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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 | 296 |
297 CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMappi
ng(); | 297 CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMappi
ng(); |
298 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); | 298 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); |
299 ASSERT(compositedLayerMapping->scrollingContentsLayer()); | 299 ASSERT(compositedLayerMapping->scrollingContentsLayer()); |
300 | 300 |
301 GraphicsLayer* graphicsLayer = compositedLayerMapping->scrollingContentsLaye
r(); | 301 GraphicsLayer* graphicsLayer = compositedLayerMapping->scrollingContentsLaye
r(); |
302 ASSERT_EQ(layer->scrollableArea(), graphicsLayer->scrollableArea()); | 302 ASSERT_EQ(layer->scrollableArea(), graphicsLayer->scrollableArea()); |
303 | 303 |
304 WebLayer* webScrollLayer = compositedLayerMapping->scrollingContentsLayer()-
>platformLayer(); | 304 WebLayer* webScrollLayer = compositedLayerMapping->scrollingContentsLayer()-
>platformLayer(); |
305 ASSERT_TRUE(webScrollLayer->scrollable()); | 305 ASSERT_TRUE(webScrollLayer->scrollable()); |
| 306 ASSERT_TRUE(webScrollLayer->userScrollableHorizontal()); |
| 307 ASSERT_TRUE(webScrollLayer->userScrollableVertical()); |
306 | 308 |
307 #if OS(ANDROID) | 309 #if OS(ANDROID) |
308 // Now verify we've attached impl-side scrollbars onto the scrollbar layers | 310 // Now verify we've attached impl-side scrollbars onto the scrollbar layers |
309 ASSERT_TRUE(compositedLayerMapping->layerForHorizontalScrollbar()); | 311 ASSERT_TRUE(compositedLayerMapping->layerForHorizontalScrollbar()); |
310 ASSERT_TRUE(compositedLayerMapping->layerForHorizontalScrollbar()->hasConten
tsLayer()); | 312 ASSERT_TRUE(compositedLayerMapping->layerForHorizontalScrollbar()->hasConten
tsLayer()); |
311 ASSERT_TRUE(compositedLayerMapping->layerForVerticalScrollbar()); | 313 ASSERT_TRUE(compositedLayerMapping->layerForVerticalScrollbar()); |
312 ASSERT_TRUE(compositedLayerMapping->layerForVerticalScrollbar()->hasContents
Layer()); | 314 ASSERT_TRUE(compositedLayerMapping->layerForVerticalScrollbar()->hasContents
Layer()); |
313 #endif | 315 #endif |
314 } | 316 } |
315 | 317 |
| 318 TEST_F(ScrollingCoordinatorChromiumTest, overflowHidden) |
| 319 { |
| 320 registerMockedHttpURLLoad("overflow-hidden.html"); |
| 321 navigateTo(m_baseURL + "overflow-hidden.html"); |
| 322 |
| 323 // Verify the properties of the accelerated scrolling element starting from
the RenderObject |
| 324 // all the way to the WebLayer. |
| 325 Element* overflowElement = m_webViewImpl->mainFrameImpl()->frame()->document
()->getElementById("unscrollable-y"); |
| 326 ASSERT(overflowElement); |
| 327 |
| 328 RenderObject* renderer = overflowElement->renderer(); |
| 329 ASSERT_TRUE(renderer->isBoxModelObject()); |
| 330 ASSERT_TRUE(renderer->hasLayer()); |
| 331 |
| 332 RenderLayer* layer = toRenderBoxModelObject(renderer)->layer(); |
| 333 ASSERT_TRUE(layer->usesCompositedScrolling()); |
| 334 ASSERT_EQ(PaintsIntoOwnBacking, layer->compositingState()); |
| 335 |
| 336 CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMappi
ng(); |
| 337 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); |
| 338 ASSERT(compositedLayerMapping->scrollingContentsLayer()); |
| 339 |
| 340 GraphicsLayer* graphicsLayer = compositedLayerMapping->scrollingContentsLaye
r(); |
| 341 ASSERT_EQ(layer->scrollableArea(), graphicsLayer->scrollableArea()); |
| 342 |
| 343 WebLayer* webScrollLayer = compositedLayerMapping->scrollingContentsLayer()-
>platformLayer(); |
| 344 ASSERT_TRUE(webScrollLayer->scrollable()); |
| 345 ASSERT_TRUE(webScrollLayer->userScrollableHorizontal()); |
| 346 ASSERT_FALSE(webScrollLayer->userScrollableVertical()); |
| 347 |
| 348 overflowElement = m_webViewImpl->mainFrameImpl()->frame()->document()->getEl
ementById("unscrollable-x"); |
| 349 ASSERT(overflowElement); |
| 350 |
| 351 renderer = overflowElement->renderer(); |
| 352 ASSERT_TRUE(renderer->isBoxModelObject()); |
| 353 ASSERT_TRUE(renderer->hasLayer()); |
| 354 |
| 355 layer = toRenderBoxModelObject(renderer)->layer(); |
| 356 ASSERT_TRUE(layer->usesCompositedScrolling()); |
| 357 ASSERT_EQ(PaintsIntoOwnBacking, layer->compositingState()); |
| 358 |
| 359 compositedLayerMapping = layer->compositedLayerMapping(); |
| 360 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); |
| 361 ASSERT(compositedLayerMapping->scrollingContentsLayer()); |
| 362 |
| 363 graphicsLayer = compositedLayerMapping->scrollingContentsLayer(); |
| 364 ASSERT_EQ(layer->scrollableArea(), graphicsLayer->scrollableArea()); |
| 365 |
| 366 webScrollLayer = compositedLayerMapping->scrollingContentsLayer()->platformL
ayer(); |
| 367 ASSERT_TRUE(webScrollLayer->scrollable()); |
| 368 ASSERT_FALSE(webScrollLayer->userScrollableHorizontal()); |
| 369 ASSERT_TRUE(webScrollLayer->userScrollableVertical()); |
| 370 } |
| 371 |
316 TEST_F(ScrollingCoordinatorChromiumTest, iframeScrolling) | 372 TEST_F(ScrollingCoordinatorChromiumTest, iframeScrolling) |
317 { | 373 { |
318 registerMockedHttpURLLoad("iframe-scrolling.html"); | 374 registerMockedHttpURLLoad("iframe-scrolling.html"); |
319 registerMockedHttpURLLoad("iframe-scrolling-inner.html"); | 375 registerMockedHttpURLLoad("iframe-scrolling-inner.html"); |
320 navigateTo(m_baseURL + "iframe-scrolling.html"); | 376 navigateTo(m_baseURL + "iframe-scrolling.html"); |
321 | 377 |
322 // Verify the properties of the accelerated scrolling element starting from
the RenderObject | 378 // Verify the properties of the accelerated scrolling element starting from
the RenderObject |
323 // all the way to the WebLayer. | 379 // all the way to the WebLayer. |
324 Element* scrollableFrame = m_webViewImpl->mainFrameImpl()->frame()->document
()->getElementById("scrollable"); | 380 Element* scrollableFrame = m_webViewImpl->mainFrameImpl()->frame()->document
()->getElementById("scrollable"); |
325 ASSERT_TRUE(scrollableFrame); | 381 ASSERT_TRUE(scrollableFrame); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 | 453 |
398 TEST_F(ScrollingCoordinatorChromiumTest, setupScrollbarLayerShouldNotCrash) | 454 TEST_F(ScrollingCoordinatorChromiumTest, setupScrollbarLayerShouldNotCrash) |
399 { | 455 { |
400 registerMockedHttpURLLoad("setup_scrollbar_layer_crash.html"); | 456 registerMockedHttpURLLoad("setup_scrollbar_layer_crash.html"); |
401 navigateTo(m_baseURL + "setup_scrollbar_layer_crash.html"); | 457 navigateTo(m_baseURL + "setup_scrollbar_layer_crash.html"); |
402 // This test document setup an iframe with scrollbars, then switch to | 458 // This test document setup an iframe with scrollbars, then switch to |
403 // an empty document by javascript. | 459 // an empty document by javascript. |
404 } | 460 } |
405 | 461 |
406 } // namespace | 462 } // namespace |
OLD | NEW |