Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(528)

Issue 1913843004: Implementing document.setRootScroller API for main thread scrolling. (Closed)

Created:
4 years, 7 months ago by bokan
Modified:
4 years, 7 months ago
Reviewers:
esprehn, jbroman, tdresser
CC:
blink-reviews, blink-reviews-dom_chromium.org, chromium-reviews, dglazkov+blink, dtapuska+blinkwatch_chromium.org, eae+blinkwatch, kenneth.christiansen, kinuko+watch, rwlbuis, sof
Base URL:
https://chromium.googlesource.com/chromium/src.git@overscrollController
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Implementing document.setRootScroller API for main thread scrolling. This patch implements the setRootScroller API, also know as the non-document root scroller proposal. See this expaliner for details: https://github.com/bokand/NonDocumentRootScroller This patch implements most of the initial functionality but only for scrolling on the main thread. All new API surfaces are behind a RuntimeEnabledFeature. BUG=505516 Committed: https://crrev.com/861d774435b04448856e99462d4f4e3d734f72f4 Cr-Commit-Position: refs/heads/master@{#390200}

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : #

Total comments: 30

Patch Set 4 : Addressed Tim's feedback #

Patch Set 5 : Rebase #

Total comments: 12

Patch Set 6 : Rebase #

Patch Set 7 : Tim's feedback round #2 #

Patch Set 8 : Fixing bad rebase #

Total comments: 3

Patch Set 9 : Restore RuntimeEnabledFeatures #

Patch Set 10 : Rebase and remove whitespace in Document.idl #

Total comments: 17
Unified diffs Side-by-side diffs Delta from patch set Stats (+1068 lines, -86 lines) Patch
A third_party/WebKit/LayoutTests/fast/scrolling/set-root-scroller.html View 1 2 3 1 chunk +113 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt View 1 2 3 4 5 2 chunks +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/core.gypi View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/Document.h View 1 2 3 4 1 chunk +3 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/Document.cpp View 1 2 3 4 5 6 7 4 chunks +54 lines, -32 lines 1 comment Download
M third_party/WebKit/Source/core/dom/Document.idl View 1 2 3 4 5 6 7 8 9 1 chunk +4 lines, -0 lines 2 comments Download
M third_party/WebKit/Source/core/frame/FrameHost.h View 1 2 3 chunks +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/frame/FrameHost.cpp View 1 2 4 chunks +23 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/input/EventHandler.cpp View 1 2 3 4 1 chunk +1 line, -4 lines 0 comments Download
A third_party/WebKit/Source/core/page/scrolling/RootScroller.h View 1 2 3 1 chunk +65 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/core/page/scrolling/RootScroller.cpp View 1 2 3 1 chunk +159 lines, -0 lines 14 comments Download
M third_party/WebKit/Source/core/page/scrolling/ViewportScrollCallback.h View 1 chunk +8 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/page/scrolling/ViewportScrollCallback.cpp View 1 2 3 4 5 6 5 chunks +31 lines, -46 lines 0 comments Download
M third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
A third_party/WebKit/Source/web/tests/RootScrollerTest.cpp View 1 2 3 4 5 6 7 8 1 chunk +489 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/web/tests/data/root-scroller.html View 1 chunk +46 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/web/tests/data/root-scroller-child.html View 1 chunk +37 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/web/tests/data/root-scroller-iframe.html View 1 chunk +24 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/web/web.gypi View 1 chunk +1 line, -0 lines 0 comments Download

Depends on Patchset:

Messages

Total messages: 35 (14 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1913843004/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1913843004/20001
4 years, 7 months ago (2016-04-26 15:20:57 UTC) #2
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: linux_chromium_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/218904)
4 years, 7 months ago (2016-04-26 16:36:53 UTC) #4
bokan
PTAL, thanks.
4 years, 7 months ago (2016-04-26 17:49:14 UTC) #7
tdresser
Basically just nits. I need to take a more thorough look at the tests still. ...
4 years, 7 months ago (2016-04-26 20:43:50 UTC) #8
bokan
https://codereview.chromium.org/1913843004/diff/40001/third_party/WebKit/LayoutTests/fast/scrolling/set-root-scroller.html File third_party/WebKit/LayoutTests/fast/scrolling/set-root-scroller.html (right): https://codereview.chromium.org/1913843004/diff/40001/third_party/WebKit/LayoutTests/fast/scrolling/set-root-scroller.html#newcode67 third_party/WebKit/LayoutTests/fast/scrolling/set-root-scroller.html:67: eventSender.gestureScrollEnd(0, 0); On 2016/04/26 20:43:49, tdresser wrote: > This ...
4 years, 7 months ago (2016-04-26 23:06:24 UTC) #9
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1913843004/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1913843004/60001
4 years, 7 months ago (2016-04-26 23:06:51 UTC) #11
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: ios_rel_device_ninja on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios_rel_device_ninja/builds/207426) mac_chromium_rel_ng on ...
4 years, 7 months ago (2016-04-26 23:09:09 UTC) #13
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1913843004/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1913843004/80001
4 years, 7 months ago (2016-04-27 00:56:40 UTC) #15
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: linux_chromium_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/219351)
4 years, 7 months ago (2016-04-27 02:10:50 UTC) #17
tdresser
LGTM. https://codereview.chromium.org/1913843004/diff/80001/third_party/WebKit/Source/core/page/scrolling/ViewportScrollCallback.cpp File third_party/WebKit/Source/core/page/scrolling/ViewportScrollCallback.cpp (right): https://codereview.chromium.org/1913843004/diff/80001/third_party/WebKit/Source/core/page/scrolling/ViewportScrollCallback.cpp#newcode92 third_party/WebKit/Source/core/page/scrolling/ViewportScrollCallback.cpp:92: // TODO: This isn't consuming everything Should this ...
4 years, 7 months ago (2016-04-27 15:37:08 UTC) #18
bokan
Found two failing tests that looked unrelated but are in fact caused by this patch. ...
4 years, 7 months ago (2016-04-27 17:53:56 UTC) #19
bokan
:/ Test failures were cause of a bad rebase conflict resolve in PatchSet 5. I've ...
4 years, 7 months ago (2016-04-27 19:02:03 UTC) #20
bokan
+jbroman for RuntimeEnabledFeatures
4 years, 7 months ago (2016-04-27 19:03:01 UTC) #22
jbroman
RuntimeEnabledFeatures.in lgtm one comment elsewhere https://codereview.chromium.org/1913843004/diff/140001/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp File third_party/WebKit/Source/web/tests/RootScrollerTest.cpp (right): https://codereview.chromium.org/1913843004/diff/140001/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp#newcode56 third_party/WebKit/Source/web/tests/RootScrollerTest.cpp:56: RuntimeEnabledFeatures::setSetRootScrollerEnabled(true); I don't think ...
4 years, 7 months ago (2016-04-27 19:21:29 UTC) #23
bokan
https://codereview.chromium.org/1913843004/diff/140001/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp File third_party/WebKit/Source/web/tests/RootScrollerTest.cpp (right): https://codereview.chromium.org/1913843004/diff/140001/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp#newcode56 third_party/WebKit/Source/web/tests/RootScrollerTest.cpp:56: RuntimeEnabledFeatures::setSetRootScrollerEnabled(true); On 2016/04/27 19:21:29, jbroman wrote: > I don't ...
4 years, 7 months ago (2016-04-27 20:26:39 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1913843004/180001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1913843004/180001
4 years, 7 months ago (2016-04-27 20:27:14 UTC) #27
commit-bot: I haz the power
Committed patchset #10 (id:180001)
4 years, 7 months ago (2016-04-27 21:44:44 UTC) #29
commit-bot: I haz the power
Patchset 10 (id:??) landed as https://crrev.com/861d774435b04448856e99462d4f4e3d734f72f4 Cr-Commit-Position: refs/heads/master@{#390200}
4 years, 7 months ago (2016-04-30 17:13:32 UTC) #30
esprehn
https://codereview.chromium.org/1913843004/diff/180001/third_party/WebKit/Source/core/dom/Document.idl File third_party/WebKit/Source/core/dom/Document.idl (right): https://codereview.chromium.org/1913843004/diff/180001/third_party/WebKit/Source/core/dom/Document.idl#newcode77 third_party/WebKit/Source/core/dom/Document.idl:77: [RuntimeEnabled=SetRootScroller, RaisesException] void setRootScroller (Element element); This doesn't match ...
4 years, 7 months ago (2016-05-05 17:20:19 UTC) #33
esprehn
https://codereview.chromium.org/1913843004/diff/180001/third_party/WebKit/Source/core/dom/Document.cpp File third_party/WebKit/Source/core/dom/Document.cpp (right): https://codereview.chromium.org/1913843004/diff/180001/third_party/WebKit/Source/core/dom/Document.cpp#newcode611 third_party/WebKit/Source/core/dom/Document.cpp:611: "Element isn't in this document."); This doesn't really make ...
4 years, 7 months ago (2016-05-05 17:29:47 UTC) #34
bokan
4 years, 7 months ago (2016-05-05 21:19:49 UTC) #35
Message was sent while issue was closed.
Thanks for the help Elliott, I'll put up a new patch soon that fixes your
concerns.

https://codereview.chromium.org/1913843004/diff/180001/third_party/WebKit/Sou...
File third_party/WebKit/Source/core/dom/Document.idl (right):

https://codereview.chromium.org/1913843004/diff/180001/third_party/WebKit/Sou...
third_party/WebKit/Source/core/dom/Document.idl:77:
[RuntimeEnabled=SetRootScroller, RaisesException] void setRootScroller (Element
element);
On 2016/05/05 17:20:19, esprehn wrote:
> This doesn't match web platform conventions. The web doesn't use setFoo
methods,
> it uses setter properties. This API needs a review.

Acknowledged.

https://codereview.chromium.org/1913843004/diff/180001/third_party/WebKit/Sou...
File third_party/WebKit/Source/core/page/scrolling/RootScroller.cpp (right):

https://codereview.chromium.org/1913843004/diff/180001/third_party/WebKit/Sou...
third_party/WebKit/Source/core/page/scrolling/RootScroller.cpp:26:
DCHECK(frameHost->page().mainFrame()->isLocalFrame());
On 2016/05/05 17:29:46, esprehn wrote:
> There's no reason to go through the FrameHost like this all the time, just use
> the localRoot()

Acknowledged.

https://codereview.chromium.org/1913843004/diff/180001/third_party/WebKit/Sou...
third_party/WebKit/Source/core/page/scrolling/RootScroller.cpp:37: if
(box->isDocumentElement() && element.document().view())
On 2016/05/05 17:29:46, esprehn wrote:
> it's impossible for view() to be null here if the LayoutObject is not null

Acknowledged.

https://codereview.chromium.org/1913843004/diff/180001/third_party/WebKit/Sou...
third_party/WebKit/Source/core/page/scrolling/RootScroller.cpp:40: return
static_cast<PaintInvalidationCapableScrollableArea*>(
On 2016/05/05 17:29:46, esprehn wrote:
> this needs a toPaintInvalidationCapableScrollableArea() casting function and a
> virtual check.

This is an upcast though. LayoutBoxModelObject::getScrollableArea()
(confusingly) returns a PaintLayerScrollableArea which derives from
PaintInvalidationCapableScrollableArea.

https://codereview.chromium.org/1913843004/diff/180001/third_party/WebKit/Sou...
third_party/WebKit/Source/core/page/scrolling/RootScroller.cpp:47: :
m_frameHost(&frameHost)
On 2016/05/05 17:29:46, esprehn wrote:
> use a Frame, not the FrameHost.

Yah, I hadn't thought this through and had a 1 RootScroller per Page. I think
having 1:1 RootScroller:Frame is a better idea, with only the main frame's
RootScroller applying viewport actions.

https://codereview.chromium.org/1913843004/diff/180001/third_party/WebKit/Sou...
third_party/WebKit/Source/core/page/scrolling/RootScroller.cpp:132: if
(element.document() != topDocument(m_frameHost))
On 2016/05/05 17:29:46, esprehn wrote:
> you want to hook Element::removedFrom not layout for this

There's other cases that make an Element invalid to be the root scroller. I.e.
if it's not a box.

I didn't add it in this patch, but our initial version of this proposal also has
that only viewport-filling elements (i.e. width:100%, height:100%) can be the
root scroller. This is to prevent strange effects as we increase/decrease the
clip height dynamically on the root scroller as we move the top controls and to
make overscroll glow simpler to implement. For those cases, I think we need to
be hooked into layout, right?

The way this is implemented right now, if the currently set root scroller
becomes invalid after being set, the root scroller will reset to the document
element. It sounds like maybe making it "sticky" would be more natural. i.e.
While its invalid, use the document element, but if it becomes valid again it
will be used. Does that sound better?

https://codereview.chromium.org/1913843004/diff/180001/third_party/WebKit/Sou...
third_party/WebKit/Source/core/page/scrolling/RootScroller.cpp:135: if
(!element.isInTreeScope())
On 2016/05/05 17:29:46, esprehn wrote:
> the layoutObject check below is a proxy for this, there's no reason to check
> both

Acknowledged.

https://codereview.chromium.org/1913843004/diff/180001/third_party/WebKit/Sou...
third_party/WebKit/Source/core/page/scrolling/RootScroller.cpp:138: if
(!element.layoutObject())
On 2016/05/05 17:29:46, esprehn wrote:
> this check doesn't make sense, it means if you display: none the root
scroller,
> force a layout, and then display: block it again the scroller is reset. I
don't
> think this feature should work that way.

Yah, that was the intention, though I can see that it might be surprising. I'll
do what I mentioned above.

Powered by Google App Engine
This is Rietveld 408576698