OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
12 * | 12 * |
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN
Y | 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN
Y |
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN
Y | 16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN
Y |
17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O
N | 19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O
N |
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 */ | 23 */ |
24 | 24 |
25 #include "core/page/scrolling/ScrollingCoordinator.h" | 25 #include "core/page/scrolling/ScrollingCoordinator.h" |
26 | 26 |
27 #include "core/css/CSSStyleSheet.h" | 27 #include "core/css/CSSStyleSheet.h" |
28 #include "core/css/StyleSheetList.h" | 28 #include "core/css/StyleSheetList.h" |
| 29 #include "core/frame/FrameHost.h" |
29 #include "core/frame/FrameView.h" | 30 #include "core/frame/FrameView.h" |
| 31 #include "core/frame/VisualViewport.h" |
30 #include "core/layout/LayoutPart.h" | 32 #include "core/layout/LayoutPart.h" |
31 #include "core/layout/api/LayoutViewItem.h" | 33 #include "core/layout/api/LayoutViewItem.h" |
32 #include "core/layout/compositing/CompositedLayerMapping.h" | 34 #include "core/layout/compositing/CompositedLayerMapping.h" |
33 #include "core/layout/compositing/PaintLayerCompositor.h" | 35 #include "core/layout/compositing/PaintLayerCompositor.h" |
34 #include "core/page/Page.h" | 36 #include "core/page/Page.h" |
35 #include "platform/graphics/GraphicsLayer.h" | 37 #include "platform/graphics/GraphicsLayer.h" |
36 #include "platform/testing/URLTestHelpers.h" | 38 #include "platform/testing/URLTestHelpers.h" |
37 #include "public/platform/Platform.h" | 39 #include "public/platform/Platform.h" |
38 #include "public/platform/WebLayer.h" | 40 #include "public/platform/WebLayer.h" |
39 #include "public/platform/WebLayerPositionConstraint.h" | 41 #include "public/platform/WebLayerPositionConstraint.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 Page* page = frame()->page(); | 127 Page* page = frame()->page(); |
126 ASSERT_TRUE(page->scrollingCoordinator()); | 128 ASSERT_TRUE(page->scrollingCoordinator()); |
127 ASSERT_TRUE(page->scrollingCoordinator()->coordinatesScrollingForFrameView(f
rameView)); | 129 ASSERT_TRUE(page->scrollingCoordinator()->coordinatesScrollingForFrameView(f
rameView)); |
128 | 130 |
129 // Fast scrolling should be enabled by default. | 131 // Fast scrolling should be enabled by default. |
130 WebLayer* rootScrollLayer = getRootScrollLayer(); | 132 WebLayer* rootScrollLayer = getRootScrollLayer(); |
131 ASSERT_TRUE(rootScrollLayer->scrollable()); | 133 ASSERT_TRUE(rootScrollLayer->scrollable()); |
132 ASSERT_FALSE(rootScrollLayer->shouldScrollOnMainThread()); | 134 ASSERT_FALSE(rootScrollLayer->shouldScrollOnMainThread()); |
133 ASSERT_EQ(WebEventListenerProperties::Nothing, webLayerTreeView()->eventList
enerProperties(WebEventListenerClass::TouchStartOrMove)); | 135 ASSERT_EQ(WebEventListenerProperties::Nothing, webLayerTreeView()->eventList
enerProperties(WebEventListenerClass::TouchStartOrMove)); |
134 ASSERT_EQ(WebEventListenerProperties::Nothing, webLayerTreeView()->eventList
enerProperties(WebEventListenerClass::MouseWheel)); | 136 ASSERT_EQ(WebEventListenerProperties::Nothing, webLayerTreeView()->eventList
enerProperties(WebEventListenerClass::MouseWheel)); |
| 137 |
| 138 WebLayer* innerViewportScrollLayer = page->frameHost().visualViewport().scro
llLayer()->platformLayer(); |
| 139 ASSERT_TRUE(innerViewportScrollLayer->scrollable()); |
| 140 ASSERT_FALSE(innerViewportScrollLayer->shouldScrollOnMainThread()); |
135 } | 141 } |
136 | 142 |
137 TEST_F(ScrollingCoordinatorTest, fastScrollingCanBeDisabledWithSetting) | 143 TEST_F(ScrollingCoordinatorTest, fastScrollingCanBeDisabledWithSetting) |
138 { | 144 { |
139 navigateTo("about:blank"); | 145 navigateTo("about:blank"); |
140 webViewImpl()->settings()->setThreadedScrollingEnabled(false); | 146 webViewImpl()->settings()->setThreadedScrollingEnabled(false); |
141 forceFullCompositingUpdate(); | 147 forceFullCompositingUpdate(); |
142 | 148 |
143 // Make sure the scrolling coordinator is active. | 149 // Make sure the scrolling coordinator is active. |
144 FrameView* frameView = frame()->view(); | 150 FrameView* frameView = frame()->view(); |
145 Page* page = frame()->page(); | 151 Page* page = frame()->page(); |
146 ASSERT_TRUE(page->scrollingCoordinator()); | 152 ASSERT_TRUE(page->scrollingCoordinator()); |
147 ASSERT_TRUE(page->scrollingCoordinator()->coordinatesScrollingForFrameView(f
rameView)); | 153 ASSERT_TRUE(page->scrollingCoordinator()->coordinatesScrollingForFrameView(f
rameView)); |
148 | 154 |
149 // Main scrolling should be enabled with the setting override. | 155 // Main scrolling should be enabled with the setting override. |
150 WebLayer* rootScrollLayer = getRootScrollLayer(); | 156 WebLayer* rootScrollLayer = getRootScrollLayer(); |
151 ASSERT_TRUE(rootScrollLayer->scrollable()); | 157 ASSERT_TRUE(rootScrollLayer->scrollable()); |
152 ASSERT_TRUE(rootScrollLayer->shouldScrollOnMainThread()); | 158 ASSERT_TRUE(rootScrollLayer->shouldScrollOnMainThread()); |
| 159 |
| 160 // Main scrolling should also propagate to inner viewport layer. |
| 161 WebLayer* innerViewportScrollLayer = page->frameHost().visualViewport().scro
llLayer()->platformLayer(); |
| 162 ASSERT_TRUE(innerViewportScrollLayer->scrollable()); |
| 163 ASSERT_TRUE(innerViewportScrollLayer->shouldScrollOnMainThread()); |
153 } | 164 } |
154 | 165 |
155 | 166 |
156 TEST_F(ScrollingCoordinatorTest, fastFractionalScrollingDiv) | 167 TEST_F(ScrollingCoordinatorTest, fastFractionalScrollingDiv) |
157 { | 168 { |
158 bool origFractionalOffsetsEnabled = RuntimeEnabledFeatures::fractionalScroll
OffsetsEnabled(); | 169 bool origFractionalOffsetsEnabled = RuntimeEnabledFeatures::fractionalScroll
OffsetsEnabled(); |
159 RuntimeEnabledFeatures::setFractionalScrollOffsetsEnabled(true); | 170 RuntimeEnabledFeatures::setFractionalScrollOffsetsEnabled(true); |
160 | 171 |
161 registerMockedHttpURLLoad("fractional-scroll-div.html"); | 172 registerMockedHttpURLLoad("fractional-scroll-div.html"); |
162 navigateTo(m_baseURL + "fractional-scroll-div.html"); | 173 navigateTo(m_baseURL + "fractional-scroll-div.html"); |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 // remove custom scrollbar class, the scrollbar is expected to scroll on | 676 // remove custom scrollbar class, the scrollbar is expected to scroll on |
666 // impl thread as it is an overlay scrollbar. | 677 // impl thread as it is an overlay scrollbar. |
667 container->removeAttribute("class"); | 678 container->removeAttribute("class"); |
668 forceFullCompositingUpdate(); | 679 forceFullCompositingUpdate(); |
669 scrollbarGraphicsLayer = compositedLayerMapping->layerForVerticalScrollbar()
; | 680 scrollbarGraphicsLayer = compositedLayerMapping->layerForVerticalScrollbar()
; |
670 ASSERT_FALSE(scrollbarGraphicsLayer->platformLayer()->shouldScrollOnMainThre
ad()); | 681 ASSERT_FALSE(scrollbarGraphicsLayer->platformLayer()->shouldScrollOnMainThre
ad()); |
671 ASSERT_FALSE(scrollbarGraphicsLayer->platformLayer()->mainThreadScrollingRea
sons() & MainThreadScrollingReason::kCustomScrollbarScrolling); | 682 ASSERT_FALSE(scrollbarGraphicsLayer->platformLayer()->mainThreadScrollingRea
sons() & MainThreadScrollingReason::kCustomScrollbarScrolling); |
672 } | 683 } |
673 | 684 |
674 } // namespace blink | 685 } // namespace blink |
OLD | NEW |