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

Issue 1057603002: Expose scroll customization for touch to JS (behind REF). (Closed)

Created:
5 years, 8 months ago by tdresser
Modified:
5 years, 5 months ago
Reviewers:
haraken, Yuki, blink-reviews-bindings, Rick Byers, bashi
CC:
blink-reviews, kenneth.christiansen, arv+blink, vivekg, sof, eae+blinkwatch, blink-reviews-dom_chromium.org, dglazkov+blink, blink-reviews-events_chromium.org, vivekg_samsung, Inactive, rwlbuis
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

Expose scroll customization for touch to JS (behind REF). This enables scroll customization of touch scrolls for JS. See http://goo.gl/xCBm7L for details. This is a followup to https://codereview.chromium.org/988823003, and completes landing https://codereview.chromium.org/850443002/. BUG=410974

Patch Set 1 #

Patch Set 2 : Fix case where documentElement was added to scroll chain twice. #

Total comments: 18

Patch Set 3 : Use attributes, address rbyers' feedback. #

Patch Set 4 : Rebase. #

Patch Set 5 : Fix test expectations, and fix issue with quirks mode. #

Patch Set 6 : Switch back to prototype chain. #

Patch Set 7 : Undo Accidental RuntimeEnabledFeature change. #

Patch Set 8 : Add test for calling any subset of the native scrolling methods. #

Total comments: 1

Patch Set 9 : Rebase. #

Total comments: 8

Patch Set 10 : Address haraken's comments. #

Total comments: 2

Patch Set 11 : Use callback interface and callback function. Broken. #

Total comments: 19

Patch Set 12 : Address haraken's comments. #

Total comments: 12
Unified diffs Side-by-side diffs Delta from patch set Stats (+787 lines, -92 lines) Patch
M LayoutTests/TestExpectations View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +12 lines, -0 lines 0 comments Download
M LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-basic.html View 1 2 1 chunk +45 lines, -45 lines 0 comments Download
M LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-consume-deltas.html View 1 2 2 chunks +12 lines, -12 lines 0 comments Download
M LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-consume-deltas-throw.html View 1 2 2 chunks +15 lines, -15 lines 0 comments Download
A LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-distribute-to-scroll-chain-descendant.html View 1 2 3 4 5 6 7 8 9 10 1 chunk +55 lines, -0 lines 0 comments Download
A LayoutTests/fast/scroll-behavior/scroll-customization/touch-scroll-customization.html View 1 2 3 4 5 6 7 8 9 10 1 chunk +315 lines, -0 lines 0 comments Download
A Source/bindings/core/v8/ScrollStateCallbackToScriptValue.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +20 lines, -0 lines 1 comment Download
A Source/bindings/core/v8/ScrollStateCallbackToScriptValue.cpp View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +85 lines, -0 lines 1 comment Download
M Source/bindings/core/v8/v8.gypi View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +2 lines, -0 lines 0 comments Download
M Source/core/core.gypi View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +3 lines, -0 lines 0 comments Download
M Source/core/dom/Element.h View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +12 lines, -3 lines 2 comments Download
M Source/core/dom/Element.cpp View 1 2 3 4 5 6 7 8 9 10 11 6 chunks +77 lines, -5 lines 4 comments Download
M Source/core/dom/Element.idl View 1 2 3 4 5 6 7 8 9 10 2 chunks +10 lines, -0 lines 0 comments Download
M Source/core/dom/ElementRareData.h View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +12 lines, -0 lines 2 comments Download
M Source/core/dom/ElementRareData.cpp View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +3 lines, -0 lines 1 comment Download
M Source/core/input/EventHandler.cpp View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +14 lines, -8 lines 0 comments Download
M Source/core/page/scrolling/ScrollState.h View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/page/scrolling/ScrollState.cpp View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/page/scrolling/ScrollState.idl View 1 chunk +1 line, -1 line 0 comments Download
A Source/core/page/scrolling/ScrollStateCallback.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +42 lines, -0 lines 0 comments Download
A Source/core/page/scrolling/ScrollStateCallback.cpp View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +25 lines, -0 lines 1 comment Download
A Source/core/page/scrolling/ScrollStateCallback.idl View 1 2 3 4 5 6 7 8 9 10 1 chunk +11 lines, -0 lines 0 comments Download
M Source/core/testing/Internals.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +3 lines, -1 line 0 comments Download
M Source/core/testing/Internals.cpp View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +10 lines, -0 lines 0 comments Download
M Source/core/testing/Internals.idl View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 45 (7 generated)
tdresser
I'll likely want to get another pair of eyes on the V8 binding stuff before ...
5 years, 8 months ago (2015-04-07 21:13:16 UTC) #2
Rick Byers
Looking great! https://codereview.chromium.org/1057603002/diff/20001/LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-distribute-to-scroll-chain-descendant.html File LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-distribute-to-scroll-chain-descendant.html (right): https://codereview.chromium.org/1057603002/diff/20001/LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-distribute-to-scroll-chain-descendant.html#newcode37 LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-distribute-to-scroll-chain-descendant.html:37: window.internals.setScrollChain(scrollState, elements); To what extent do you ...
5 years, 8 months ago (2015-04-10 14:51:44 UTC) #3
tdresser
There are still a few test failures I need to look into, but this is ...
5 years, 7 months ago (2015-05-08 18:23:02 UTC) #5
tdresser
https://codereview.chromium.org/1057603002/diff/20001/LayoutTests/fast/scroll-behavior/scroll-customization/touch-scroll-customization.html File LayoutTests/fast/scroll-behavior/scroll-customization/touch-scroll-customization.html (right): https://codereview.chromium.org/1057603002/diff/20001/LayoutTests/fast/scroll-behavior/scroll-customization/touch-scroll-customization.html#newcode128 LayoutTests/fast/scroll-behavior/scroll-customization/touch-scroll-customization.html:128: assert_equals(document.body.scrollTop, bodyScrollTop[i], "For body on step " + i); ...
5 years, 7 months ago (2015-05-08 19:38:34 UTC) #6
haraken
> I suspect the bindings code will need to be rehauled though, it's a little ...
5 years, 7 months ago (2015-05-09 15:28:53 UTC) #7
tdresser
I've switched away from using an attribute for applyScroll/distributeScroll. The plan is to land this ...
5 years, 6 months ago (2015-06-08 15:37:36 UTC) #8
haraken
This looks much nicer but I want to see more clean-ups :) Ideally you won't ...
5 years, 6 months ago (2015-06-09 00:07:13 UTC) #9
tdresser
The fundamental difference between this and requestAnimationFrame is that applyScroll and distributeScroll require default values. ...
5 years, 6 months ago (2015-06-09 14:27:42 UTC) #10
haraken
+binding-reviews > The fundamental difference between this and requestAnimationFrame is that > applyScroll and distributeScroll ...
5 years, 6 months ago (2015-06-09 15:16:38 UTC) #12
tdresser
> I'm curious why something like the following doesn't work: > > distributeScroll(); // Default ...
5 years, 6 months ago (2015-06-09 15:43:11 UTC) #13
haraken
On 2015/06/09 15:43:11, tdresser wrote: > > I'm curious why something like the following doesn't ...
5 years, 6 months ago (2015-06-09 16:05:23 UTC) #14
Rick Byers
On 2015/06/09 16:05:23, haraken wrote: > On 2015/06/09 15:43:11, tdresser wrote: > > > I'm ...
5 years, 6 months ago (2015-06-09 16:21:45 UTC) #15
tdresser
On 2015/06/09 16:21:45, Rick Byers wrote: > On 2015/06/09 16:05:23, haraken wrote: > > On ...
5 years, 6 months ago (2015-06-09 16:47:36 UTC) #16
haraken
On 2015/06/09 16:47:36, tdresser wrote: > On 2015/06/09 16:21:45, Rick Byers wrote: > > On ...
5 years, 6 months ago (2015-06-10 00:44:50 UTC) #17
Rick Byers
On 2015/06/10 00:44:50, haraken wrote: > On 2015/06/09 16:47:36, tdresser wrote: > > On 2015/06/09 ...
5 years, 6 months ago (2015-06-11 03:05:26 UTC) #18
tdresser
On 2015/06/11 03:05:26, Rick Byers wrote: > On 2015/06/10 00:44:50, haraken wrote: > > On ...
5 years, 6 months ago (2015-06-12 15:53:08 UTC) #19
haraken
Just to clarify: I'm fine with adding some custom bindings if it needs some customized ...
5 years, 6 months ago (2015-06-13 04:03:33 UTC) #21
Yuki
+bashi, whether the code generator supports attributes/methods which return callback interface.
5 years, 6 months ago (2015-06-15 05:51:09 UTC) #23
Yuki
On 2015/06/15 05:51:09, Yuki wrote: > +bashi, whether the code generator supports attributes/methods which return ...
5 years, 6 months ago (2015-06-15 09:27:10 UTC) #24
bashi
On 2015/06/15 09:27:10, Yuki wrote: > On 2015/06/15 05:51:09, Yuki wrote: > > +bashi, whether ...
5 years, 6 months ago (2015-06-16 03:12:04 UTC) #25
tdresser
On 2015/06/16 03:12:04, bashi1 wrote: > On 2015/06/15 09:27:10, Yuki wrote: > > On 2015/06/15 ...
5 years, 6 months ago (2015-06-16 12:26:14 UTC) #26
bashi
On 2015/06/16 12:26:14, tdresser wrote: > On 2015/06/16 03:12:04, bashi1 wrote: > > On 2015/06/15 ...
5 years, 6 months ago (2015-06-17 02:18:18 UTC) #27
tdresser
On 2015/06/17 02:18:18, bashi1 wrote: > On 2015/06/16 12:26:14, tdresser wrote: > > On 2015/06/16 ...
5 years, 6 months ago (2015-06-17 13:20:21 UTC) #28
haraken
On 2015/06/17 13:20:21, tdresser wrote: > On 2015/06/17 02:18:18, bashi1 wrote: > > On 2015/06/16 ...
5 years, 6 months ago (2015-06-17 15:49:02 UTC) #29
tdresser
On 2015/06/17 15:49:02, haraken wrote: > On 2015/06/17 13:20:21, tdresser wrote: > > On 2015/06/17 ...
5 years, 6 months ago (2015-06-17 15:55:48 UTC) #30
haraken
On 2015/06/17 15:55:48, tdresser wrote: > On 2015/06/17 15:49:02, haraken wrote: > > On 2015/06/17 ...
5 years, 6 months ago (2015-06-17 16:09:04 UTC) #31
tdresser
On 2015/06/17 16:09:04, haraken wrote: > On 2015/06/17 15:55:48, tdresser wrote: > > On 2015/06/17 ...
5 years, 6 months ago (2015-06-17 16:51:53 UTC) #32
haraken
On 2015/06/17 16:51:53, tdresser wrote: > On 2015/06/17 16:09:04, haraken wrote: > > On 2015/06/17 ...
5 years, 6 months ago (2015-06-17 17:53:53 UTC) #33
tdresser
On 2015/06/17 17:53:53, haraken wrote: > On 2015/06/17 16:51:53, tdresser wrote: > > On 2015/06/17 ...
5 years, 6 months ago (2015-06-18 13:34:41 UTC) #34
haraken
> > Then what happens if you expose: > > > > Element.defaultDistributionScroll; > > ...
5 years, 6 months ago (2015-06-18 18:51:06 UTC) #35
tdresser
> I'm not saying that you must remove all custom bindings. What we should avoid ...
5 years, 6 months ago (2015-06-18 18:57:28 UTC) #36
haraken
On 2015/06/18 18:57:28, tdresser wrote: > > I'm not saying that you must remove all ...
5 years, 6 months ago (2015-06-18 19:08:27 UTC) #37
tdresser
On 2015/06/18 19:08:27, haraken wrote: > On 2015/06/18 18:57:28, tdresser wrote: > > > I'm ...
5 years, 6 months ago (2015-06-18 19:26:25 UTC) #38
tdresser
I think this approach minimizes the amount of custom bindings logic. I think it negatively ...
5 years, 6 months ago (2015-06-26 14:53:15 UTC) #41
haraken
https://codereview.chromium.org/1057603002/diff/240001/Source/core/dom/ElementRareData.cpp File Source/core/dom/ElementRareData.cpp (right): https://codereview.chromium.org/1057603002/diff/240001/Source/core/dom/ElementRareData.cpp#newcode42 Source/core/dom/ElementRareData.cpp:42: void* pointers[15]; It's unfortunate that we increase sizeof(ElementRareData) for ...
5 years, 5 months ago (2015-06-27 08:09:33 UTC) #42
tdresser
PTAL, thanks! I'm still working out some issues with flaky tests when oilpan is disabled. ...
5 years, 5 months ago (2015-06-29 20:59:33 UTC) #43
haraken
I'm getting a bit tired of reviewing this CL... Would it be really worth working ...
5 years, 5 months ago (2015-06-30 07:08:31 UTC) #44
tdresser
5 years, 5 months ago (2015-07-06 20:42:32 UTC) #45
On 2015/06/30 07:08:31, haraken wrote:
> I'm getting a bit tired of reviewing this CL... Would it be really worth
working
> on the complexity for such an at-the-moment API (which is just for developers
> that want to try the API at the moment)? I think we should first work on
> polishing up the API before digging into the binding complexity.
> 
> The complexity in ScrollStateCallbackToScriptValue.cpp is not acceptable. I
> guess what we need would be:
> 
> 1) Make V8ScriptStateCallback hold a v8::Function. See
V8RequestAnimationFrame.
> The V8ScriptStateCallback should be auto-generated by ScriptStateCallback.idl.
> 
>   class V8ScriptStateCallback {
>     ScopedPersistent<v8::Function> m_callback;
>   };
> 
> 2) Support toV8() functions in callback interfaces. Specifically,
> toV8(ScriptStateCallback*) just needs to return m_callback. Then the binding
> layer can just call toV8(distributeScroll()) to get a wrapper of the callback
> interface. (The wrapper is a v8::Function.)
> 
>
https://codereview.chromium.org/1057603002/diff/260001/Source/bindings/core/v...
> File Source/bindings/core/v8/ScrollStateCallbackToScriptValue.cpp (right):
> 
>
https://codereview.chromium.org/1057603002/diff/260001/Source/bindings/core/v...
> Source/bindings/core/v8/ScrollStateCallbackToScriptValue.cpp:32: if
> (!maybeLocalScrollStateCallback.ToLocal(&localScrollStateCallback))
> 
>   if (data->Get(...).ToLocal())
> 
> Nit: We want to avoid writing MaybeLocal in the binding layer as much as
> possible.
> 
>
https://codereview.chromium.org/1057603002/diff/260001/Source/bindings/core/v...
> File Source/bindings/core/v8/ScrollStateCallbackToScriptValue.h (right):
> 
>
https://codereview.chromium.org/1057603002/diff/260001/Source/bindings/core/v...
> Source/bindings/core/v8/ScrollStateCallbackToScriptValue.h:16: ScriptValue
> scrollStateCallbackToScriptValue(ScrollStateCallback&, ScriptState*);
> 
> This should go to ToV8.h. (See my comment in Element.h.)
> 
>
https://codereview.chromium.org/1057603002/diff/260001/Source/core/dom/Elemen...
> File Source/core/dom/Element.cpp (right):
> 
>
https://codereview.chromium.org/1057603002/diff/260001/Source/core/dom/Elemen...
> Source/core/dom/Element.cpp:477: class DistributeScrollCallback : public
> ScrollStateCallback {
> 
> We should define this in ScrollStateCallback.h (or a dedicated file).
> 
>
https://codereview.chromium.org/1057603002/diff/260001/Source/core/dom/Elemen...
> Source/core/dom/Element.cpp:488: class ApplyScrollCallback : public
> ScrollStateCallback {
> 
> Ditto.
> 
>
https://codereview.chromium.org/1057603002/diff/260001/Source/core/dom/Elemen...
> Source/core/dom/Element.cpp:510: setDistributeScroll(new
> DistributeScrollCallback());
> 
> In a case where we don't have a customized calback, we want to avoid storing
an
> empty callback to ElementRareData because it will create an ElementRareData.
> 
> Can we just return a native callback without storing anything in
> ElementRareData?
> 
>
https://codereview.chromium.org/1057603002/diff/260001/Source/core/dom/Elemen...
> Source/core/dom/Element.cpp:523: setApplyScroll(new ApplyScrollCallback());
> 
> Ditto.
> 
>
https://codereview.chromium.org/1057603002/diff/260001/Source/core/dom/Element.h
> File Source/core/dom/Element.h (right):
> 
>
https://codereview.chromium.org/1057603002/diff/260001/Source/core/dom/Elemen...
> Source/core/dom/Element.h:373: ScriptValue distributeScroll(ScriptState*);
> 
> Would it be possible to:
> 
> - make distributeScroll return ScriptStateCallback*
> - let the binding layer call toV8(distributeScroll()), which converts the
> ScriptStateCallback* to a V8 wrapper
> 
> This is a common way to convert a DOM object to a V8 wrapper. You can define
the
> toV8 method in ToV8.h.
> 
>
https://codereview.chromium.org/1057603002/diff/260001/Source/core/dom/Elemen...
> Source/core/dom/Element.h:376: ScriptValue applyScroll(ScriptState*);
> 
> Ditto.
> 
>
https://codereview.chromium.org/1057603002/diff/260001/Source/core/dom/Elemen...
> File Source/core/dom/ElementRareData.cpp (right):
> 
>
https://codereview.chromium.org/1057603002/diff/260001/Source/core/dom/Elemen...
> Source/core/dom/ElementRareData.cpp:43: PersistentWillBeMember<Element>
> persistentWillBeMember[2];
> 
> This looks like an unacceptable size increase. Let's revisit this issue once
we
> resolve other concerns in this CL.
> 
> FWIW, I'm tring to reduce sizeof(Persistent) here:
> https://codereview.chromium.org/1213133002/
> 
>
https://codereview.chromium.org/1057603002/diff/260001/Source/core/dom/Elemen...
> File Source/core/dom/ElementRareData.h (right):
> 
>
https://codereview.chromium.org/1057603002/diff/260001/Source/core/dom/Elemen...
> Source/core/dom/ElementRareData.h:127: ScrollStateCallback*
> getDistributeScroll() { return m_distributeScroll.get(); }
> 
> Nit: Blink normally doesn't use a "get" prefix.
> 
>
https://codereview.chromium.org/1057603002/diff/260001/Source/core/dom/Elemen...
> Source/core/dom/ElementRareData.h:131: ScrollStateCallback* getApplyScroll() {
> return m_applyScroll.get(); }
> 
> Ditto.
> 
>
https://codereview.chromium.org/1057603002/diff/260001/Source/core/page/scrol...
> File Source/core/page/scrolling/ScrollStateCallback.cpp (right):
> 
>
https://codereview.chromium.org/1057603002/diff/260001/Source/core/page/scrol...
> Source/core/page/scrolling/ScrollStateCallback.cpp:20: m_targetElement =
> &targetElement;
> 
> Instead of storing m_targetElement to ScrollStateCallback, how about just
> passing the target element to handleEvent()?

Yeah, you're right, we should be taking a less invasive approach.
I've got a new approach up here: https://codereview.chromium.org/1209183004/,
which doesn't require any custom bindings, but is significantly less flexible.

It should be adequate for now.
We still need to find a better place than ElementRareData to stash the
ScrollStateCallback objects, but that shouldn't be too bad.

Thanks,
Tim

Powered by Google App Engine
This is Rietveld 408576698