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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 // Make sure the scrolling coordinator is active. | 119 // Make sure the scrolling coordinator is active. |
120 FrameView* frameView = frame()->view(); | 120 FrameView* frameView = frame()->view(); |
121 Page* page = frame()->page(); | 121 Page* page = frame()->page(); |
122 ASSERT_TRUE(page->scrollingCoordinator()); | 122 ASSERT_TRUE(page->scrollingCoordinator()); |
123 ASSERT_TRUE(page->scrollingCoordinator()->coordinatesScrollingForFrameView(f
rameView)); | 123 ASSERT_TRUE(page->scrollingCoordinator()->coordinatesScrollingForFrameView(f
rameView)); |
124 | 124 |
125 // Fast scrolling should be enabled by default. | 125 // Fast scrolling should be enabled by default. |
126 WebLayer* rootScrollLayer = getRootScrollLayer(); | 126 WebLayer* rootScrollLayer = getRootScrollLayer(); |
127 ASSERT_TRUE(rootScrollLayer->scrollable()); | 127 ASSERT_TRUE(rootScrollLayer->scrollable()); |
128 ASSERT_FALSE(rootScrollLayer->shouldScrollOnMainThread()); | 128 ASSERT_FALSE(rootScrollLayer->shouldScrollOnMainThread()); |
129 ASSERT_FALSE(webLayerTreeView()->haveWheelEventHandlers()); | 129 ASSERT_EQ(WebEventListenerProperties::Nothing, webLayerTreeView()->eventList
enerProperties(WebEventListenerClass::Touch)); |
| 130 ASSERT_EQ(WebEventListenerProperties::Nothing, webLayerTreeView()->eventList
enerProperties(WebEventListenerClass::MouseWheel)); |
130 } | 131 } |
131 | 132 |
132 TEST_F(ScrollingCoordinatorTest, fastScrollingCanBeDisabledWithSetting) | 133 TEST_F(ScrollingCoordinatorTest, fastScrollingCanBeDisabledWithSetting) |
133 { | 134 { |
134 navigateTo("about:blank"); | 135 navigateTo("about:blank"); |
135 webViewImpl()->settings()->setThreadedScrollingEnabled(false); | 136 webViewImpl()->settings()->setThreadedScrollingEnabled(false); |
136 forceFullCompositingUpdate(); | 137 forceFullCompositingUpdate(); |
137 | 138 |
138 // Make sure the scrolling coordinator is active. | 139 // Make sure the scrolling coordinator is active. |
139 FrameView* frameView = frame()->view(); | 140 FrameView* frameView = frame()->view(); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 Element* element = document->getElementById("span-br"); | 300 Element* element = document->getElementById("span-br"); |
300 ASSERT_TRUE(element); | 301 ASSERT_TRUE(element); |
301 WebLayer* layer = webLayerFromElement(element); | 302 WebLayer* layer = webLayerFromElement(element); |
302 ASSERT_TRUE(layer); | 303 ASSERT_TRUE(layer); |
303 WebLayerPositionConstraint constraint = layer->positionConstraint(); | 304 WebLayerPositionConstraint constraint = layer->positionConstraint(); |
304 ASSERT_TRUE(constraint.isFixedPosition); | 305 ASSERT_TRUE(constraint.isFixedPosition); |
305 ASSERT_TRUE(constraint.isFixedToRightEdge && constraint.isFixedToBottomE
dge); | 306 ASSERT_TRUE(constraint.isFixedToRightEdge && constraint.isFixedToBottomE
dge); |
306 } | 307 } |
307 } | 308 } |
308 | 309 |
| 310 TEST_F(ScrollingCoordinatorTest, touchEventHandler) |
| 311 { |
| 312 registerMockedHttpURLLoad("touch-event-handler.html"); |
| 313 navigateTo(m_baseURL + "touch-event-handler.html"); |
| 314 forceFullCompositingUpdate(); |
| 315 |
| 316 ASSERT_EQ(WebEventListenerProperties::Blocking, webLayerTreeView()->eventLis
tenerProperties(WebEventListenerClass::Touch)); |
| 317 } |
| 318 |
| 319 TEST_F(ScrollingCoordinatorTest, touchEventHandlerPassive) |
| 320 { |
| 321 registerMockedHttpURLLoad("touch-event-handler-passive.html"); |
| 322 navigateTo(m_baseURL + "touch-event-handler-passive.html"); |
| 323 forceFullCompositingUpdate(); |
| 324 |
| 325 ASSERT_EQ(WebEventListenerProperties::Passive, webLayerTreeView()->eventList
enerProperties(WebEventListenerClass::Touch)); |
| 326 } |
| 327 |
| 328 TEST_F(ScrollingCoordinatorTest, touchEventHandlerBoth) |
| 329 { |
| 330 registerMockedHttpURLLoad("touch-event-handler-both.html"); |
| 331 navigateTo(m_baseURL + "touch-event-handler-both.html"); |
| 332 forceFullCompositingUpdate(); |
| 333 |
| 334 ASSERT_EQ(WebEventListenerProperties::Blocking, webLayerTreeView()->eventLis
tenerProperties(WebEventListenerClass::Touch)); |
| 335 } |
| 336 |
309 TEST_F(ScrollingCoordinatorTest, wheelEventHandler) | 337 TEST_F(ScrollingCoordinatorTest, wheelEventHandler) |
310 { | 338 { |
311 registerMockedHttpURLLoad("wheel-event-handler.html"); | 339 registerMockedHttpURLLoad("wheel-event-handler.html"); |
312 navigateTo(m_baseURL + "wheel-event-handler.html"); | 340 navigateTo(m_baseURL + "wheel-event-handler.html"); |
313 forceFullCompositingUpdate(); | 341 forceFullCompositingUpdate(); |
314 | 342 |
315 ASSERT_TRUE(webLayerTreeView()->haveWheelEventHandlers()); | 343 ASSERT_EQ(WebEventListenerProperties::Blocking, webLayerTreeView()->eventLis
tenerProperties(WebEventListenerClass::MouseWheel)); |
| 344 } |
| 345 |
| 346 TEST_F(ScrollingCoordinatorTest, wheelEventHandlerPassive) |
| 347 { |
| 348 registerMockedHttpURLLoad("wheel-event-handler-passive.html"); |
| 349 navigateTo(m_baseURL + "wheel-event-handler-passive.html"); |
| 350 forceFullCompositingUpdate(); |
| 351 |
| 352 ASSERT_EQ(WebEventListenerProperties::Passive, webLayerTreeView()->eventList
enerProperties(WebEventListenerClass::MouseWheel)); |
| 353 } |
| 354 |
| 355 TEST_F(ScrollingCoordinatorTest, wheelEventHandlerBoth) |
| 356 { |
| 357 registerMockedHttpURLLoad("wheel-event-handler-both.html"); |
| 358 navigateTo(m_baseURL + "wheel-event-handler-both.html"); |
| 359 forceFullCompositingUpdate(); |
| 360 |
| 361 ASSERT_EQ(WebEventListenerProperties::Blocking, webLayerTreeView()->eventLis
tenerProperties(WebEventListenerClass::MouseWheel)); |
316 } | 362 } |
317 | 363 |
318 TEST_F(ScrollingCoordinatorTest, scrollEventHandler) | 364 TEST_F(ScrollingCoordinatorTest, scrollEventHandler) |
319 { | 365 { |
320 registerMockedHttpURLLoad("scroll-event-handler.html"); | 366 registerMockedHttpURLLoad("scroll-event-handler.html"); |
321 navigateTo(m_baseURL + "scroll-event-handler.html"); | 367 navigateTo(m_baseURL + "scroll-event-handler.html"); |
322 forceFullCompositingUpdate(); | 368 forceFullCompositingUpdate(); |
323 | 369 |
324 ASSERT_TRUE(webLayerTreeView()->haveScrollEventHandlers()); | 370 ASSERT_TRUE(webLayerTreeView()->haveScrollEventHandlers()); |
325 } | 371 } |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 EXPECT_FALSE(scrollLayer->shouldScrollOnMainThread()); | 643 EXPECT_FALSE(scrollLayer->shouldScrollOnMainThread()); |
598 | 644 |
599 fixedPos->setInlineStyleProperty(CSSPropertyTransform, CSSValueNone); | 645 fixedPos->setInlineStyleProperty(CSSPropertyTransform, CSSValueNone); |
600 forceFullCompositingUpdate(); | 646 forceFullCompositingUpdate(); |
601 | 647 |
602 EXPECT_FALSE(static_cast<LayoutBoxModelObject*>(fixedPos->layoutObject())->l
ayer()->hasCompositedLayerMapping()); | 648 EXPECT_FALSE(static_cast<LayoutBoxModelObject*>(fixedPos->layoutObject())->l
ayer()->hasCompositedLayerMapping()); |
603 EXPECT_TRUE(scrollLayer->shouldScrollOnMainThread()); | 649 EXPECT_TRUE(scrollLayer->shouldScrollOnMainThread()); |
604 } | 650 } |
605 | 651 |
606 } // namespace blink | 652 } // namespace blink |
OLD | NEW |