| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 static WebLayer* webLayerFromElement(Element* element) | 153 static WebLayer* webLayerFromElement(Element* element) |
| 154 { | 154 { |
| 155 if (!element) | 155 if (!element) |
| 156 return 0; | 156 return 0; |
| 157 RenderObject* renderer = element->renderer(); | 157 RenderObject* renderer = element->renderer(); |
| 158 if (!renderer || !renderer->isBoxModelObject()) | 158 if (!renderer || !renderer->isBoxModelObject()) |
| 159 return 0; | 159 return 0; |
| 160 RenderLayer* layer = toRenderBoxModelObject(renderer)->layer(); | 160 RenderLayer* layer = toRenderBoxModelObject(renderer)->layer(); |
| 161 if (!layer) | 161 if (!layer) |
| 162 return 0; | 162 return 0; |
| 163 |
| 164 if (!layer->hasCompositedLayerMapping()) |
| 165 return 0; |
| 163 CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMappi
ng(); | 166 CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMappi
ng(); |
| 164 if (!compositedLayerMapping) | 167 |
| 165 return 0; | |
| 166 GraphicsLayer* graphicsLayer = compositedLayerMapping->mainGraphicsLayer(); | 168 GraphicsLayer* graphicsLayer = compositedLayerMapping->mainGraphicsLayer(); |
| 167 if (!graphicsLayer) | 169 if (!graphicsLayer) |
| 168 return 0; | 170 return 0; |
| 169 return graphicsLayer->platformLayer(); | 171 return graphicsLayer->platformLayer(); |
| 170 } | 172 } |
| 171 | 173 |
| 172 TEST_F(ScrollingCoordinatorChromiumTest, fastScrollingForFixedPosition) | 174 TEST_F(ScrollingCoordinatorChromiumTest, fastScrollingForFixedPosition) |
| 173 { | 175 { |
| 174 registerMockedHttpURLLoad("fixed-position.html"); | 176 registerMockedHttpURLLoad("fixed-position.html"); |
| 175 navigateTo(m_baseURL + "fixed-position.html"); | 177 navigateTo(m_baseURL + "fixed-position.html"); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 Element* scrollableElement = m_webViewImpl->mainFrameImpl()->frame()->docume
nt()->getElementById("scrollable"); | 300 Element* scrollableElement = m_webViewImpl->mainFrameImpl()->frame()->docume
nt()->getElementById("scrollable"); |
| 299 ASSERT(scrollableElement); | 301 ASSERT(scrollableElement); |
| 300 | 302 |
| 301 RenderObject* renderer = scrollableElement->renderer(); | 303 RenderObject* renderer = scrollableElement->renderer(); |
| 302 ASSERT_TRUE(renderer->isBox()); | 304 ASSERT_TRUE(renderer->isBox()); |
| 303 ASSERT_TRUE(renderer->hasLayer()); | 305 ASSERT_TRUE(renderer->hasLayer()); |
| 304 | 306 |
| 305 RenderBox* box = toRenderBox(renderer); | 307 RenderBox* box = toRenderBox(renderer); |
| 306 ASSERT_TRUE(box->usesCompositedScrolling()); | 308 ASSERT_TRUE(box->usesCompositedScrolling()); |
| 307 ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState()); | 309 ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState()); |
| 310 ASSERT_TRUE(box->layer()->hasCompositedLayerMapping()); |
| 308 | 311 |
| 309 CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLay
erMapping(); | 312 CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLay
erMapping(); |
| 310 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); | 313 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); |
| 311 ASSERT(compositedLayerMapping->scrollingContentsLayer()); | 314 ASSERT(compositedLayerMapping->scrollingContentsLayer()); |
| 312 | 315 |
| 313 GraphicsLayer* graphicsLayer = compositedLayerMapping->scrollingContentsLaye
r(); | 316 GraphicsLayer* graphicsLayer = compositedLayerMapping->scrollingContentsLaye
r(); |
| 314 ASSERT_EQ(box->layer()->scrollableArea(), graphicsLayer->scrollableArea()); | 317 ASSERT_EQ(box->layer()->scrollableArea(), graphicsLayer->scrollableArea()); |
| 315 | 318 |
| 316 WebLayer* webScrollLayer = compositedLayerMapping->scrollingContentsLayer()-
>platformLayer(); | 319 WebLayer* webScrollLayer = compositedLayerMapping->scrollingContentsLayer()-
>platformLayer(); |
| 317 ASSERT_TRUE(webScrollLayer->scrollable()); | 320 ASSERT_TRUE(webScrollLayer->scrollable()); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 338 Element* overflowElement = m_webViewImpl->mainFrameImpl()->frame()->document
()->getElementById("unscrollable-y"); | 341 Element* overflowElement = m_webViewImpl->mainFrameImpl()->frame()->document
()->getElementById("unscrollable-y"); |
| 339 ASSERT(overflowElement); | 342 ASSERT(overflowElement); |
| 340 | 343 |
| 341 RenderObject* renderer = overflowElement->renderer(); | 344 RenderObject* renderer = overflowElement->renderer(); |
| 342 ASSERT_TRUE(renderer->isBox()); | 345 ASSERT_TRUE(renderer->isBox()); |
| 343 ASSERT_TRUE(renderer->hasLayer()); | 346 ASSERT_TRUE(renderer->hasLayer()); |
| 344 | 347 |
| 345 RenderBox* box = toRenderBox(renderer); | 348 RenderBox* box = toRenderBox(renderer); |
| 346 ASSERT_TRUE(box->usesCompositedScrolling()); | 349 ASSERT_TRUE(box->usesCompositedScrolling()); |
| 347 ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState()); | 350 ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState()); |
| 351 ASSERT_TRUE(box->layer()->hasCompositedLayerMapping()); |
| 348 | 352 |
| 349 CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLay
erMapping(); | 353 CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLay
erMapping(); |
| 350 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); | 354 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); |
| 351 ASSERT(compositedLayerMapping->scrollingContentsLayer()); | 355 ASSERT(compositedLayerMapping->scrollingContentsLayer()); |
| 352 | 356 |
| 353 GraphicsLayer* graphicsLayer = compositedLayerMapping->scrollingContentsLaye
r(); | 357 GraphicsLayer* graphicsLayer = compositedLayerMapping->scrollingContentsLaye
r(); |
| 354 ASSERT_EQ(box->layer()->scrollableArea(), graphicsLayer->scrollableArea()); | 358 ASSERT_EQ(box->layer()->scrollableArea(), graphicsLayer->scrollableArea()); |
| 355 | 359 |
| 356 WebLayer* webScrollLayer = compositedLayerMapping->scrollingContentsLayer()-
>platformLayer(); | 360 WebLayer* webScrollLayer = compositedLayerMapping->scrollingContentsLayer()-
>platformLayer(); |
| 357 ASSERT_TRUE(webScrollLayer->scrollable()); | 361 ASSERT_TRUE(webScrollLayer->scrollable()); |
| 358 ASSERT_TRUE(webScrollLayer->userScrollableHorizontal()); | 362 ASSERT_TRUE(webScrollLayer->userScrollableHorizontal()); |
| 359 ASSERT_FALSE(webScrollLayer->userScrollableVertical()); | 363 ASSERT_FALSE(webScrollLayer->userScrollableVertical()); |
| 360 | 364 |
| 361 overflowElement = m_webViewImpl->mainFrameImpl()->frame()->document()->getEl
ementById("unscrollable-x"); | 365 overflowElement = m_webViewImpl->mainFrameImpl()->frame()->document()->getEl
ementById("unscrollable-x"); |
| 362 ASSERT(overflowElement); | 366 ASSERT(overflowElement); |
| 363 | 367 |
| 364 renderer = overflowElement->renderer(); | 368 renderer = overflowElement->renderer(); |
| 365 ASSERT_TRUE(renderer->isBox()); | 369 ASSERT_TRUE(renderer->isBox()); |
| 366 ASSERT_TRUE(renderer->hasLayer()); | 370 ASSERT_TRUE(renderer->hasLayer()); |
| 367 | 371 |
| 368 box = toRenderBox(renderer); | 372 box = toRenderBox(renderer); |
| 369 ASSERT_TRUE(box->scrollableArea()->usesCompositedScrolling()); | 373 ASSERT_TRUE(box->scrollableArea()->usesCompositedScrolling()); |
| 370 ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState()); | 374 ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState()); |
| 375 ASSERT_TRUE(box->layer()->hasCompositedLayerMapping()); |
| 371 | 376 |
| 372 compositedLayerMapping = box->layer()->compositedLayerMapping(); | 377 compositedLayerMapping = box->layer()->compositedLayerMapping(); |
| 373 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); | 378 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); |
| 374 ASSERT(compositedLayerMapping->scrollingContentsLayer()); | 379 ASSERT(compositedLayerMapping->scrollingContentsLayer()); |
| 375 | 380 |
| 376 graphicsLayer = compositedLayerMapping->scrollingContentsLayer(); | 381 graphicsLayer = compositedLayerMapping->scrollingContentsLayer(); |
| 377 ASSERT_EQ(box->layer()->scrollableArea(), graphicsLayer->scrollableArea()); | 382 ASSERT_EQ(box->layer()->scrollableArea(), graphicsLayer->scrollableArea()); |
| 378 | 383 |
| 379 webScrollLayer = compositedLayerMapping->scrollingContentsLayer()->platformL
ayer(); | 384 webScrollLayer = compositedLayerMapping->scrollingContentsLayer()->platformL
ayer(); |
| 380 ASSERT_TRUE(webScrollLayer->scrollable()); | 385 ASSERT_TRUE(webScrollLayer->scrollable()); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 TEST_F(ScrollingCoordinatorChromiumTest, setupScrollbarLayerShouldNotCrash) | 474 TEST_F(ScrollingCoordinatorChromiumTest, setupScrollbarLayerShouldNotCrash) |
| 470 { | 475 { |
| 471 registerMockedHttpURLLoad("setup_scrollbar_layer_crash.html"); | 476 registerMockedHttpURLLoad("setup_scrollbar_layer_crash.html"); |
| 472 navigateTo(m_baseURL + "setup_scrollbar_layer_crash.html"); | 477 navigateTo(m_baseURL + "setup_scrollbar_layer_crash.html"); |
| 473 forceFullCompositingUpdate(); | 478 forceFullCompositingUpdate(); |
| 474 // This test document setup an iframe with scrollbars, then switch to | 479 // This test document setup an iframe with scrollbars, then switch to |
| 475 // an empty document by javascript. | 480 // an empty document by javascript. |
| 476 } | 481 } |
| 477 | 482 |
| 478 } // namespace | 483 } // namespace |
| OLD | NEW |