Closed Bug 1434474 Opened 6 years ago Closed 6 years ago

nsIPresShell::RestyleForCSSRuleChanges probably doesn't need to trigger separate font flushes

Categories

(Core :: CSS Parsing and Computation, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla60
Tracking Status
firefox60 --- fixed

People

(Reporter: bholley, Assigned: emilio)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

This seems to be the cause of the first large stylist update in bug 1434145. Emilio and I discussed, and it's not obvious why we need to do this work, since we could otherwise just let it happen during the eventual style flush.

I'm going to push an experimental patch and see what breaks.
(In reply to Bobby Holley (:bholley) from comment #1)
> https://treeherder.mozilla.org/#/
> jobs?repo=try&revision=dd1973aaaf5bd176b7a5e828683c7dfb260757c3

There's some orange on that push. I'm out of time for the evening, but can look tomorrow if emilio doesn't get to it first.
(In reply to Bobby Holley (:bholley) from comment #2)
> (In reply to Bobby Holley (:bholley) from comment #1)
> > https://treeherder.mozilla.org/#/
> > jobs?repo=try&revision=dd1973aaaf5bd176b7a5e828683c7dfb260757c3
> 
> There's some orange on that push. I'm out of time for the evening, but can
> look tomorrow if emilio doesn't get to it first.

You definitely need to mark it as dirty somehow, it's just a matter of it not needing to be off a runnable. I'm running a patch through try right now.
(In reply to Emilio Cobos Álvarez [:emilio] from comment #4)
> This is my try, let's see...
> https://treeherder.mozilla.org/#/
> jobs?repo=try&revision=6f4a8992704dd0f75754973fef6e800ba1c8295f

Looks good! Will clean it up.
Here's a try run without the other patches causing the WPT passes.

https://treeherder.mozilla.org/#/jobs?repo=try&revision=8d28337ed948e24395d120dbf2b985fc7701e386
Comment on attachment 8947049 [details]
Bug 1434474: There's no need to rebuild font / counter styles / font feature values off a runnable.

Per IRC discussion, my intuition says that we want EnsureStyleFlush here. If we do that, we should make sure that the EnsureStyleFlush path will bail appropriately for !mDidInitialize presshells, or else find some other way to fix the cnn issue.

Redirecting to Boris, who's going to have a look.
Attachment #8947049 - Flags: review?(bobbyholley) → review?(bzbarsky)
Comment on attachment 8947049 [details]
Bug 1434474: There's no need to rebuild font / counter styles / font feature values off a runnable.

So, summarizing the discussion with bz:

* We need EnsureStyleFlush rather than SetNeedsStyleFlush.
* The Ensure should be in the appropriate callers, rather than in the Mark functions, since not all callers need it.
* We should add comments CreateShell/DeleteShell indicating that we need to mark the fonts as dirty because changing the shell can change which rules apply. But we don't need to do any Ensuring at those sites.

I can stamp the result.
Attachment #8947049 - Flags: review?(bzbarsky) → review-
Comment on attachment 8947049 [details]
Bug 1434474: There's no need to rebuild font / counter styles / font feature values off a runnable.

https://reviewboard.mozilla.org/r/216850/#review222892

::: layout/style/FontFaceSet.cpp:1986
(Diff revision 4)
>  FontFaceSet::UserFontSet::DoRebuildUserFontSet()
>  {
>    if (!mFontFaceSet) {
>      return;
>    }
> -  mFontFaceSet->RebuildUserFontSet();
> +  mFontFaceSet->MarkUserFontSetDirty();

I don't have time to check, but are you sure we don't need to ensure a flush here?
Attachment #8947049 - Flags: review?(bobbyholley) → review+
Comment on attachment 8947049 [details]
Bug 1434474: There's no need to rebuild font / counter styles / font feature values off a runnable.

https://reviewboard.mozilla.org/r/216850/#review222892

> I don't have time to check, but are you sure we don't need to ensure a flush here?

It goes through FontFaceSet, so it does call EnsureStyleFlush.
Pushed by ecoal95@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/6d21bdf7eab3
There's no need to rebuild font / counter styles / font feature values off a runnable. r=bholley
https://hg.mozilla.org/mozilla-central/rev/6d21bdf7eab3
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla60
Assignee: bobbyholley → emilio
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: