Closed
Bug 1365830
Opened 8 years ago
Closed 8 years ago
Make nsGlobalWindow::ScrollTo avoid flushing layout for (0, 0)
Categories
(Core :: DOM: Core & HTML, enhancement)
Core
DOM: Core & HTML
Tracking
()
Tracking | Status | |
---|---|---|
firefox55 | --- | fixed |
People
(Reporter: ehsan.akhgari, Assigned: ehsan.akhgari)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
(deleted),
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
See this profile from playing a video on youtube: https://perfht.ml/2pYJWzA
A synchronous layout flush coming from script calling window.scroll(0, 0) for 29ms.
I checked and Chromium has added a fast path for (0, 0), because scrolling to that position is always a valid thing to do:
<https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp?l=1272>
<https://codereview.chromium.org/1071983002>
I think we should add a similar fast path.
Assignee | ||
Comment 1•8 years ago
|
||
Olli, Mats, what do you think?
Flags: needinfo?(mats)
Flags: needinfo?(bugs)
Assignee | ||
Comment 2•8 years ago
|
||
(Note that this bug is part of the Quantum Release Criteria.)
Assignee | ||
Updated•8 years ago
|
Blocks: FirstVideoPlay_YouTube
Assignee | ||
Comment 3•8 years ago
|
||
Here is the patch, in case you agree this is a good idea.
Attachment #8868883 -
Flags: review?(bugs)
Comment 4•8 years ago
|
||
hmm, is there some edge case where flushing is needed.
Comment 5•8 years ago
|
||
Comment on attachment 8868883 [details] [diff] [review]
Don't flush layout for (0, 0) in nsGlobalWindow::ScrollTo()
Given that this has something in common with bug 1364360, perhaps bz could review.
Flags: needinfo?(bugs)
Attachment #8868883 -
Flags: review?(bugs) → review?(bzbarsky)
Comment 6•8 years ago
|
||
Comment on attachment 8868883 [details] [diff] [review]
Don't flush layout for (0, 0) in nsGlobalWindow::ScrollTo()
Please add a code comment about scrolling to some nonzero position needs a layout flush because we need to determine whether that position is actually in our scroll range or not, which depends on sizes of things, but (0,0) is always in the scroll range.
Attachment #8868883 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 7•8 years ago
|
||
Will do. I noticed that <https://searchfox.org/mozilla-central/rev/f55349994fdac101d121b11dac769f3f17fbec4b/dom/base/nsGlobalWindow.cpp#8436> also has the same issue, I'll fix that as well.
Assignee | ||
Updated•8 years ago
|
Flags: needinfo?(mats)
Pushed by eakhgari@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/93cbe9914d05
Don't flush layout for (0, 0) in nsGlobalWindow::ScrollTo(); r=bzbarsky
Assignee | ||
Comment 9•8 years ago
|
||
(In reply to Pulsebot from comment #8)
> Pushed by eakhgari@mozilla.com:
> https://hg.mozilla.org/integration/mozilla-inbound/rev/93cbe9914d05
> Don't flush layout for (0, 0) in nsGlobalWindow::ScrollTo(); r=bzbarsky
Oops, this landed before I meant it to...
Comment 10•8 years ago
|
||
Pushed by eakhgari@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/91f27a7b5130
Don't flush layout for (0, 0) in nsGlobalWindow::ScrollTo(); r=bzbarsky
Comment 11•8 years ago
|
||
Backout by eakhgari@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/802ae55b7c03
Backout for build bustage
Updated•8 years ago
|
Assignee: nobody → ehsan
Comment 12•8 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox55:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Comment 13•7 years ago
|
||
Just a note for the record: Gecko has 0,0 as the origin also for RTL, but there is
a CSSOM issue open on that: https://github.com/w3c/csswg-drafts/issues/1354
so this might change I suppose, which might break the RTL case.
(I wonder if Chrome already have that bug, since they don't have 0,0 as the origin for RTL.)
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
Updated•3 years ago
|
Performance Impact: --- → P1
Whiteboard: [qf:p1]
You need to log in
before you can comment on or make changes to this bug.
Description
•