RESOLVED FIXED 91688
[chromium] Add CCScrollbarAnimationController class for compositor scrollbar animation
https://bugs.webkit.org/show_bug.cgi?id=91688
Summary [chromium] Add CCScrollbarAnimationController class for compositor scrollbar ...
Tien-Ren Chen
Reported 2012-07-18 16:06:15 PDT
[chromium] Add CCScrollbarAnimationController class for compositor scrollbar animation
Attachments
Patch (36.60 KB, patch)
2012-07-18 16:15 PDT, Tien-Ren Chen
no flags
Patch (41.91 KB, patch)
2012-07-26 17:25 PDT, Tien-Ren Chen
no flags
Patch (41.97 KB, patch)
2012-07-26 18:09 PDT, Tien-Ren Chen
no flags
Archive of layout-test-results from gce-cr-linux-05 (363.78 KB, application/zip)
2012-07-27 01:40 PDT, WebKit Review Bot
no flags
Patch (48.86 KB, patch)
2012-07-30 15:08 PDT, Tien-Ren Chen
no flags
Patch (45.44 KB, patch)
2012-07-30 16:15 PDT, Tien-Ren Chen
no flags
Patch (53.58 KB, patch)
2012-08-01 20:54 PDT, Tien-Ren Chen
no flags
Tien-Ren Chen
Comment 1 2012-07-18 16:15:11 PDT
WebKit Review Bot
Comment 2 2012-07-18 16:53:41 PDT
Comment on attachment 153127 [details] Patch Attachment 153127 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/13276702
Adrienne Walker
Comment 3 2012-07-18 18:51:05 PDT
Comment on attachment 153127 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=153127&action=review This patch is great. I really like the switch from pulling information from layers to pushing it there. > Source/WebCore/page/FrameView.cpp:652 > +#if OS(ANDROID) > + if (m_frame->page()->mainFrame() == m_frame) { > + if (hMode == ScrollbarAuto) > + hMode = ScrollbarAlwaysOn; > + if (vMode == ScrollbarAuto) > + vMode = ScrollbarAlwaysOn; > + } > +#endif Is there a better place for this? How do other ports set the kind of scrollbars they want? > Source/WebCore/platform/graphics/chromium/cc/CCScrollbarAnimationControllerAndroid.h:34 > + CCScrollbarAnimationControllerAndroid(CCLayerImpl* scrollLayer); 1-arg ctor needs the explicit keyword. Can you also make a create function that returns a PassOwnPtr? > Source/WebCore/platform/graphics/chromium/cc/CCScrollbarAnimationControllerAndroid.h:40 > + virtual bool animate(double monotonicTime); > + virtual void didPinchGestureUpdate(); > + virtual void didPinchGestureEnd(); > + virtual void updateScrollOffset(CCLayerImpl* scrollLayer); OVERRIDE
Tien-Ren Chen
Comment 4 2012-07-26 17:25:55 PDT
Tien-Ren Chen
Comment 5 2012-07-26 17:28:30 PDT
Also added a new test to verify scroll offsets are propagated properly. (In reply to comment #3) > (From update of attachment 153127 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=153127&action=review > > This patch is great. I really like the switch from pulling information from layers to pushing it there. > > > Source/WebCore/page/FrameView.cpp:652 > > +#if OS(ANDROID) > > + if (m_frame->page()->mainFrame() == m_frame) { > > + if (hMode == ScrollbarAuto) > > + hMode = ScrollbarAlwaysOn; > > + if (vMode == ScrollbarAuto) > > + vMode = ScrollbarAlwaysOn; > > + } > > +#endif > > Is there a better place for this? How do other ports set the kind of scrollbars they want? I also feel this might be too deep into WebCore... but seems like this is the only place we can override scrollbar visibility. :( > > Source/WebCore/platform/graphics/chromium/cc/CCScrollbarAnimationControllerAndroid.h:34 > > + CCScrollbarAnimationControllerAndroid(CCLayerImpl* scrollLayer); > > 1-arg ctor needs the explicit keyword. Can you also make a create function that returns a PassOwnPtr? done > > Source/WebCore/platform/graphics/chromium/cc/CCScrollbarAnimationControllerAndroid.h:40 > > + virtual bool animate(double monotonicTime); > > + virtual void didPinchGestureUpdate(); > > + virtual void didPinchGestureEnd(); > > + virtual void updateScrollOffset(CCLayerImpl* scrollLayer); > > OVERRIDE done
Tien-Ren Chen
Comment 6 2012-07-26 18:09:05 PDT
WebKit Review Bot
Comment 7 2012-07-27 01:40:44 PDT
Comment on attachment 154800 [details] Patch Attachment 154800 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/13376259 New failing tests: CCLayerImplTest.verifyLayerChangesAreTrackedProperly
WebKit Review Bot
Comment 8 2012-07-27 01:40:48 PDT
Created attachment 154878 [details] Archive of layout-test-results from gce-cr-linux-05 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: gce-cr-linux-05 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-2.6.39-gcg-201203291735-x86_64-with-Ubuntu-10.04-lucid
James Robinson
Comment 9 2012-07-27 12:34:06 PDT
Comment on attachment 154796 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=154796&action=review I like, but please split the FrameView.cpp changes into a different bug and rebase this patch (it seems to not apply and may have bitrotted a bit). > Source/WebCore/page/FrameView.cpp:647 > +// On Android (and potentially other platform that supports pinch zoom) > +// the main frame should always create scrollbars unless hidden explicitly, > +// as the viewport size can change in the compositor can you split this change into a separate patch where we can discuss the right way to do this?
James Robinson
Comment 10 2012-07-27 12:34:37 PDT
Ah, I see you've rebased it. Any idea what's up with the test?
Tien-Ren Chen
Comment 11 2012-07-27 12:43:25 PDT
(In reply to comment #9) > (From update of attachment 154796 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=154796&action=review > > I like, but please split the FrameView.cpp changes into a different bug and rebase this patch (it seems to not apply and may have bitrotted a bit). > > Source/WebCore/page/FrameView.cpp:647 > > +// On Android (and potentially other platform that supports pinch zoom) > > +// the main frame should always create scrollbars unless hidden explicitly, > > +// as the viewport size can change in the compositor > > can you split this change into a separate patch where we can discuss the right way to do this? Roger that, will split the patch. (In reply to comment #10) > Ah, I see you've rebased it. Any idea what's up with the test? For the unit tests I probably forgot to update some of the tests. As for layout test it seems to be some RenderText is off by one pixel, probably irrelevant. let's see if the error persists.
Adrienne Walker
Comment 12 2012-07-27 12:46:51 PDT
Comment on attachment 154800 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=154800&action=review I would really like a unit test for CCScrollbarAnimationControllerAndroid. If somebody refactors something and it breaks, then we won't know. Could you refactor CCScrollbarAnimationControllerAndroid into a CCScrollbarAnimationControllerLinearFade(float hideDelay, float fadeoutLen) and then have Android just instantiate that with the values that it needs? This would let you test that this class has reasonable opacity values and handles pinches correctly on all platforms. > Source/WebKit/chromium/tests/ScrollbarLayerChromiumTest.cpp:163 > + scrollbarController->updateScrollOffset(ccLayerTreeRoot.get()); Why do you need to call this explicitly in this test?
Tien-Ren Chen
Comment 13 2012-07-27 15:29:53 PDT
(In reply to comment #10) > Ah, I see you've rebased it. Any idea what's up with the test? Ah, the CCLayerImplTest.verifyLayerChangesAreTrackedProperly failure is an interesting one. I added early exit for CCLayerImpl::scrollBy so it becomes a no-op if newDelta == m_scrollDelta. We never set scrollMaximum on the layer in the test, thus scrollBy exits early and none of the layers are marked as changed. Does it break any assumption to do an early exit in scrollBy? (In reply to comment #12) > (From update of attachment 154800 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=154800&action=review > > I would really like a unit test for CCScrollbarAnimationControllerAndroid. If somebody refactors something and it breaks, then we won't know. > > Could you refactor CCScrollbarAnimationControllerAndroid into a CCScrollbarAnimationControllerLinearFade(float hideDelay, float fadeoutLen) and then have Android just instantiate that with the values that it needs? This would let you test that this class has reasonable opacity values and handles pinches correctly on all platforms. Sounds like a great way to reuse the code! I think we want to verify that the scrollbar will show in responding to the user gesture, and will eventually fade out as time goes. Is there a good way to simulate monotonicallyIncreasingTime()? > > Source/WebKit/chromium/tests/ScrollbarLayerChromiumTest.cpp:163 > > + scrollbarController->updateScrollOffset(ccLayerTreeRoot.get()); > > Why do you need to call this explicitly in this test? No we don't, and I agree it's probably wrong to require so. Fixed.
Tien-Ren Chen
Comment 14 2012-07-30 15:08:03 PDT
Tien-Ren Chen
Comment 15 2012-07-30 15:11:16 PDT
(In reply to comment #14) > Created an attachment (id=155376) [details] > Patch This new patch fixes CCLayerImplTest.verifyLayerChangesAreTrackedProperly test by rearranging the order of property changes (move setMaxScrollPosition before scrollBy) Also renamed the android animator to linear fade animator. Tests for the linear fade animator hasn't been added yet. Need some way to mock monotonicallyIncreasingTime.
Adrienne Walker
Comment 16 2012-07-30 15:14:01 PDT
Comment on attachment 155376 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=155376&action=review > Source/WebCore/page/FrameView.cpp:655 > +// On Android (and potentially other platform that supports pinch zoom) > +// the main frame should always create scrollbars unless hidden explicitly, > +// as the viewport size can change in the compositor > +#if OS(ANDROID) > + if (m_frame->page()->mainFrame() == m_frame) { > + if (hMode == ScrollbarAuto) > + hMode = ScrollbarAlwaysOn; > + if (vMode == ScrollbarAuto) > + vMode = ScrollbarAlwaysOn; > + } > +#endif I thought this was going into a separate patch? > Source/WebCore/rendering/RenderLayer.cpp:2961 > - if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) > + if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant() && !(paintFlags & PaintLayerPaintingOverlayScrollbars)) Where did all these RenderLayer changes come from in this latest patch?
Adrienne Walker
Comment 17 2012-07-30 15:18:38 PDT
(In reply to comment #13) > I added early exit for CCLayerImpl::scrollBy so it becomes a no-op if newDelta == m_scrollDelta. We never set scrollMaximum on the layer in the test, thus scrollBy exits early and none of the layers are marked as changed. > > Does it break any assumption to do an early exit in scrollBy? That seems totally reasonable. > I think we want to verify that the scrollbar will show in responding to the user gesture, and will eventually fade out as time goes. Is there a good way to simulate monotonicallyIncreasingTime()? I'm not sure I understand what the problem is. You should just be able to pass arbitrary monotonically increasing time values to functions that need them.
Tien-Ren Chen
Comment 18 2012-07-30 15:25:35 PDT
(In reply to comment #17) > (In reply to comment #13) > > I think we want to verify that the scrollbar will show in responding to the user gesture, and will eventually fade out as time goes. Is there a good way to simulate monotonicallyIncreasingTime()? > > I'm not sure I understand what the problem is. You should just be able to pass arbitrary monotonically increasing time values to functions that need them. That's a reasonable way to do it, but will make the client code very awkward. For example, CCLayerImpl doesn't have any dependency to monotonicallyIncreasingTime, however CCLayerImpl::scrollBy needs the timestamp to pass it to CCScrollbarAnimator::updateScrollOffset. If we let CCLayerImpl to generate the timestamp, now it's the CCLayerImpl becomes un-testable. Or again we can require the client of CCLayerImpl to pass in the current timestamp... There is just no end to this. I think it is not a bad assumption to have only one global monotonic clock singleton, and who ever needs it just generate it instead of requiring the client to pass it in. Just that we need a way to mock the monotonic clock in unit tests. (In reply to comment #16) > (From update of attachment 155376 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=155376&action=review > > > Source/WebCore/page/FrameView.cpp:655 > > +// On Android (and potentially other platform that supports pinch zoom) > > +// the main frame should always create scrollbars unless hidden explicitly, > > +// as the viewport size can change in the compositor > > +#if OS(ANDROID) > > + if (m_frame->page()->mainFrame() == m_frame) { > > + if (hMode == ScrollbarAuto) > > + hMode = ScrollbarAlwaysOn; > > + if (vMode == ScrollbarAuto) > > + vMode = ScrollbarAlwaysOn; > > + } > > +#endif > > I thought this was going into a separate patch? Ah I forgot to add -g option when preparing the patch. Let me re-upload it. > > Source/WebCore/rendering/RenderLayer.cpp:2961 > > - if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) > > + if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant() && !(paintFlags & PaintLayerPaintingOverlayScrollbars)) > > Where did all these RenderLayer changes come from in this latest patch? Same as above. It is another patch to solve an issue with main thread side overlay scrollbar rendering.
Tien-Ren Chen
Comment 19 2012-07-30 16:15:01 PDT
Tien-Ren Chen
Comment 20 2012-07-30 16:15:59 PDT
(In reply to comment #19) > Created an attachment (id=155392) [details] > Patch Rebased and re-uploaded with relevant changes omitted.
Tien-Ren Chen
Comment 21 2012-08-01 20:54:44 PDT
Adrienne Walker
Comment 22 2012-08-02 09:39:56 PDT
Comment on attachment 155963 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=155963&action=review R=me. > Source/WebKit/chromium/tests/CCScrollbarAnimationControllerLinearFadeTest.cpp:38 > +class CCScrollbarAnimationControllerLinearFadeTest : public testing::Test { Thank you. This is exactly the sort of test I was expecting to see. :)
WebKit Review Bot
Comment 23 2012-08-02 15:39:17 PDT
Comment on attachment 155963 [details] Patch Clearing flags on attachment: 155963 Committed r124513: <http://trac.webkit.org/changeset/124513>
WebKit Review Bot
Comment 24 2012-08-02 15:39:23 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.