Closed Bug 1417701 Opened 7 years ago Closed 7 years ago

MotionMark Focus20 spends a bunch of time in nsIFrame::DoUpdateStyleOfOwnedAnonBoxes

Categories

(Core :: CSS Parsing and Computation, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox59 --- fixed

People

(Reporter: jrmuizel, Assigned: emilio)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Blocks: 1417616
Flags: needinfo?(emilio)
Summary: MotionMark Focus20 is spends a bunch of time in nsIFrame::DoUpdateStyleOfOwnedAnonBoxes → MotionMark Focus20 spends a bunch of time in nsIFrame::DoUpdateStyleOfOwnedAnonBoxes
Just for reference, I took a quick look and these are all :-moz-scrolled-content anon boxes...
And there's one for each of the #scene > div elements, which have position: absolute and overflow: hidden...

It's not clear to me why we need scrollframes for overflow: hidden elements... I guess you can technically scroll them with JS setting scrollTop or what not? If so, that's very unfortunate.

In any case, there's no clear general optimization that we can do off-hand to optimize out style resolution for the scroll-frame, it'd need to be kind of a hack, in the sense that the scrollframe definitely inherits (and even inherits reset style) from the parent element, so we don't know off-hand whether the scrollframe style may or may not change...

We could hardcode the properties it touches and compare them with the old and new style of the element, or something like that... But that's kind of annoying, and looks fragile too.

Ideally we wouldn't construct scrollframes for this stuff to begin with...
I need to look at what does WebKit do for this. Meanwhile, I'll remove a couple of useless rules in there that should speed this up a bit.

Daniel, do you know if we could do something to not have the overhead of scrollcontent with overflow: hidden? I mean, I expect we need the scrollframe for all sorts of DOM APIs... But it'd be nice if we could do better.

Also, Markus and I were wondering why was reframing on overflow changes necessary? I guess to handle the IsScrollableOverflow() to !IsScrollableOverflow() change? If so, couldn't we do better at least for changes from auto to none and such?
Flags: needinfo?(emilio) → needinfo?(dholbert)
(In reply to Emilio Cobos Álvarez [:emilio] from comment #2)
> 
> It's not clear to me why we need scrollframes for overflow: hidden
> elements... I guess you can technically scroll them with JS setting
> scrollTop or what not? If so, that's very unfortunate.

Yes, I think that's the reason.  (overflow:-moz-overflow-clip avoids that.)  I wonder if we could avoid creating the scroll frame initially, then just reframe if someone touches scrollTop etc.
Comment on attachment 8929140 [details]
Bug 1417701: Remove some useless rules and importance declarations in ua.css.

https://reviewboard.mozilla.org/r/200430/#review205780

r=me with the -moz-box-ordinal-group declaration left unless there's a good reason to remove it.

::: commit-message-0f8c5:3
(Diff revision 1)
> +Bug 1417701: Remove some useless rules and importance declarations in ua.css. r?heycam
> +
> +There's no need to set inheriting anon boxes reset properties to their defaults.

You're also updating some non-inheriting anonymous box rules (like ::-moz-table-col-group), but that's also the right thing to do, so s/inheriting //.

::: layout/style/res/ua.css
(Diff revision 1)
>  
>  *|*::-moz-xul-anonymous-block {
> -  display: block ! important;
> -  position: static ! important;
> +  display: block;
> +  -moz-box-ordinal-group: inherit;
> -  float: none ! important;
> -  -moz-box-ordinal-group: inherit !important;

Should this one really be removed?  ::-moz-xul-anonymous-block is an inheriting anonymous box so this declaration could have an effect.
Attachment #8929140 - Flags: review?(cam) → review+
Comment on attachment 8929140 [details]
Bug 1417701: Remove some useless rules and importance declarations in ua.css.

https://reviewboard.mozilla.org/r/200430/#review205780

> Should this one really be removed?  ::-moz-xul-anonymous-block is an inheriting anonymous box so this declaration could have an effect.

It's not removed, only `!important` is removed.
Pushed by ecoal95@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/9a45f9d4bb6a
Remove some useless rules and importance declarations in ua.css. r=heycam
Priority: -- → P3
https://hg.mozilla.org/mozilla-central/rev/9a45f9d4bb6a
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
(In reply to Emilio Cobos Álvarez [:emilio] from comment #3)
> Daniel, do you know if we could do something to not have the overhead of
> scrollcontent with overflow: hidden? I mean, I expect we need the
> scrollframe for all sorts of DOM APIs... But it'd be nice if we could do
> better.

(Not sure, sorry.  Looks like you found a solution here, though. Hooray!)
Flags: needinfo?(dholbert)
Assignee: nobody → emilio
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: