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