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 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 ASSERT(compositor); | 87 ASSERT(compositor); |
88 ASSERT(compositor->scrollLayer()); | 88 ASSERT(compositor->scrollLayer()); |
89 | 89 |
90 WebLayer* webScrollLayer = compositor->scrollLayer()->platformLayer(); | 90 WebLayer* webScrollLayer = compositor->scrollLayer()->platformLayer(); |
91 return webScrollLayer; | 91 return webScrollLayer; |
92 } | 92 } |
93 | 93 |
94 WebViewImpl* webViewImpl() const { return m_helper.webViewImpl(); } | 94 WebViewImpl* webViewImpl() const { return m_helper.webViewImpl(); } |
95 LocalFrame* frame() const { return m_helper.webViewImpl()->mainFrameImpl()->
frame(); } | 95 LocalFrame* frame() const { return m_helper.webViewImpl()->mainFrameImpl()->
frame(); } |
96 | 96 |
| 97 WebLayerTreeView* webLayerTreeView() const { return webViewImpl()->layerTree
View(); } |
| 98 |
97 protected: | 99 protected: |
98 std::string m_baseURL; | 100 std::string m_baseURL; |
99 FrameTestHelpers::TestWebViewClient m_mockWebViewClient; | 101 FrameTestHelpers::TestWebViewClient m_mockWebViewClient; |
100 | 102 |
101 private: | 103 private: |
102 static void configureSettings(WebSettings* settings) | 104 static void configureSettings(WebSettings* settings) |
103 { | 105 { |
104 settings->setJavaScriptEnabled(true); | 106 settings->setJavaScriptEnabled(true); |
105 settings->setAcceleratedCompositingEnabled(true); | 107 settings->setAcceleratedCompositingEnabled(true); |
106 settings->setPreferCompositingToLCDTextEnabled(true); | 108 settings->setPreferCompositingToLCDTextEnabled(true); |
(...skipping 10 matching lines...) Expand all Loading... |
117 // Make sure the scrolling coordinator is active. | 119 // Make sure the scrolling coordinator is active. |
118 FrameView* frameView = frame()->view(); | 120 FrameView* frameView = frame()->view(); |
119 Page* page = frame()->page(); | 121 Page* page = frame()->page(); |
120 ASSERT_TRUE(page->scrollingCoordinator()); | 122 ASSERT_TRUE(page->scrollingCoordinator()); |
121 ASSERT_TRUE(page->scrollingCoordinator()->coordinatesScrollingForFrameView(f
rameView)); | 123 ASSERT_TRUE(page->scrollingCoordinator()->coordinatesScrollingForFrameView(f
rameView)); |
122 | 124 |
123 // Fast scrolling should be enabled by default. | 125 // Fast scrolling should be enabled by default. |
124 WebLayer* rootScrollLayer = getRootScrollLayer(); | 126 WebLayer* rootScrollLayer = getRootScrollLayer(); |
125 ASSERT_TRUE(rootScrollLayer->scrollable()); | 127 ASSERT_TRUE(rootScrollLayer->scrollable()); |
126 ASSERT_FALSE(rootScrollLayer->shouldScrollOnMainThread()); | 128 ASSERT_FALSE(rootScrollLayer->shouldScrollOnMainThread()); |
127 ASSERT_FALSE(rootScrollLayer->haveWheelEventHandlers()); | 129 ASSERT_FALSE(webLayerTreeView()->haveWheelEventHandlers()); |
128 } | 130 } |
129 | 131 |
130 TEST_F(ScrollingCoordinatorTest, fastScrollingCanBeDisabledWithSetting) | 132 TEST_F(ScrollingCoordinatorTest, fastScrollingCanBeDisabledWithSetting) |
131 { | 133 { |
132 navigateTo("about:blank"); | 134 navigateTo("about:blank"); |
133 webViewImpl()->settings()->setThreadedScrollingEnabled(false); | 135 webViewImpl()->settings()->setThreadedScrollingEnabled(false); |
134 forceFullCompositingUpdate(); | 136 forceFullCompositingUpdate(); |
135 | 137 |
136 // Make sure the scrolling coordinator is active. | 138 // Make sure the scrolling coordinator is active. |
137 FrameView* frameView = frame()->view(); | 139 FrameView* frameView = frame()->view(); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 ASSERT_TRUE(constraint.isFixedToRightEdge && constraint.isFixedToBottomE
dge); | 305 ASSERT_TRUE(constraint.isFixedToRightEdge && constraint.isFixedToBottomE
dge); |
304 } | 306 } |
305 } | 307 } |
306 | 308 |
307 TEST_F(ScrollingCoordinatorTest, wheelEventHandler) | 309 TEST_F(ScrollingCoordinatorTest, wheelEventHandler) |
308 { | 310 { |
309 registerMockedHttpURLLoad("wheel-event-handler.html"); | 311 registerMockedHttpURLLoad("wheel-event-handler.html"); |
310 navigateTo(m_baseURL + "wheel-event-handler.html"); | 312 navigateTo(m_baseURL + "wheel-event-handler.html"); |
311 forceFullCompositingUpdate(); | 313 forceFullCompositingUpdate(); |
312 | 314 |
313 WebLayer* rootScrollLayer = getRootScrollLayer(); | 315 ASSERT_TRUE(webLayerTreeView()->haveWheelEventHandlers()); |
314 ASSERT_TRUE(rootScrollLayer->haveWheelEventHandlers()); | |
315 } | 316 } |
316 | 317 |
317 TEST_F(ScrollingCoordinatorTest, scrollEventHandler) | 318 TEST_F(ScrollingCoordinatorTest, scrollEventHandler) |
318 { | 319 { |
319 registerMockedHttpURLLoad("scroll-event-handler.html"); | 320 registerMockedHttpURLLoad("scroll-event-handler.html"); |
320 navigateTo(m_baseURL + "scroll-event-handler.html"); | 321 navigateTo(m_baseURL + "scroll-event-handler.html"); |
321 forceFullCompositingUpdate(); | 322 forceFullCompositingUpdate(); |
322 | 323 |
323 WebLayer* rootScrollLayer = getRootScrollLayer(); | 324 WebLayer* rootScrollLayer = getRootScrollLayer(); |
324 ASSERT_TRUE(rootScrollLayer->haveScrollEventHandlers()); | 325 ASSERT_TRUE(rootScrollLayer->haveScrollEventHandlers()); |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 EXPECT_FALSE(scrollLayer->shouldScrollOnMainThread()); | 598 EXPECT_FALSE(scrollLayer->shouldScrollOnMainThread()); |
598 | 599 |
599 fixedPos->setInlineStyleProperty(CSSPropertyTransform, CSSValueNone); | 600 fixedPos->setInlineStyleProperty(CSSPropertyTransform, CSSValueNone); |
600 forceFullCompositingUpdate(); | 601 forceFullCompositingUpdate(); |
601 | 602 |
602 EXPECT_FALSE(static_cast<LayoutBoxModelObject*>(fixedPos->layoutObject())->l
ayer()->hasCompositedLayerMapping()); | 603 EXPECT_FALSE(static_cast<LayoutBoxModelObject*>(fixedPos->layoutObject())->l
ayer()->hasCompositedLayerMapping()); |
603 EXPECT_TRUE(scrollLayer->shouldScrollOnMainThread()); | 604 EXPECT_TRUE(scrollLayer->shouldScrollOnMainThread()); |
604 } | 605 } |
605 | 606 |
606 } // namespace blink | 607 } // namespace blink |
OLD | NEW |