| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 forceFullCompositingUpdate(); | 158 forceFullCompositingUpdate(); |
| 159 | 159 |
| 160 // Make sure the fractional scroll offset change 1.0 -> 1.2 gets propagated | 160 // Make sure the fractional scroll offset change 1.0 -> 1.2 gets propagated |
| 161 // to compositor. | 161 // to compositor. |
| 162 scrollableElement->setScrollTop(1.2); | 162 scrollableElement->setScrollTop(1.2); |
| 163 scrollableElement->setScrollLeft(1.2); | 163 scrollableElement->setScrollLeft(1.2); |
| 164 forceFullCompositingUpdate(); | 164 forceFullCompositingUpdate(); |
| 165 | 165 |
| 166 LayoutObject* renderer = scrollableElement->renderer(); | 166 LayoutObject* renderer = scrollableElement->renderer(); |
| 167 ASSERT_TRUE(renderer->isBox()); | 167 ASSERT_TRUE(renderer->isBox()); |
| 168 RenderBox* box = toRenderBox(renderer); | 168 LayoutBox* box = toLayoutBox(renderer); |
| 169 ASSERT_TRUE(box->usesCompositedScrolling()); | 169 ASSERT_TRUE(box->usesCompositedScrolling()); |
| 170 CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLay
erMapping(); | 170 CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLay
erMapping(); |
| 171 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); | 171 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); |
| 172 ASSERT(compositedLayerMapping->scrollingContentsLayer()); | 172 ASSERT(compositedLayerMapping->scrollingContentsLayer()); |
| 173 WebLayer* webScrollLayer = compositedLayerMapping->scrollingContentsLayer()-
>platformLayer(); | 173 WebLayer* webScrollLayer = compositedLayerMapping->scrollingContentsLayer()-
>platformLayer(); |
| 174 ASSERT_TRUE(webScrollLayer); | 174 ASSERT_TRUE(webScrollLayer); |
| 175 ASSERT_NEAR(1.2, webScrollLayer->scrollPositionDouble().x, 0.01); | 175 ASSERT_NEAR(1.2, webScrollLayer->scrollPositionDouble().x, 0.01); |
| 176 ASSERT_NEAR(1.2, webScrollLayer->scrollPositionDouble().y, 0.01); | 176 ASSERT_NEAR(1.2, webScrollLayer->scrollPositionDouble().y, 0.01); |
| 177 } | 177 } |
| 178 | 178 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 | 350 |
| 351 // Verify the properties of the accelerated scrolling element starting from
the LayoutObject | 351 // Verify the properties of the accelerated scrolling element starting from
the LayoutObject |
| 352 // all the way to the WebLayer. | 352 // all the way to the WebLayer. |
| 353 Element* scrollableElement = frame()->document()->getElementById("scrollable
"); | 353 Element* scrollableElement = frame()->document()->getElementById("scrollable
"); |
| 354 ASSERT(scrollableElement); | 354 ASSERT(scrollableElement); |
| 355 | 355 |
| 356 LayoutObject* renderer = scrollableElement->renderer(); | 356 LayoutObject* renderer = scrollableElement->renderer(); |
| 357 ASSERT_TRUE(renderer->isBox()); | 357 ASSERT_TRUE(renderer->isBox()); |
| 358 ASSERT_TRUE(renderer->hasLayer()); | 358 ASSERT_TRUE(renderer->hasLayer()); |
| 359 | 359 |
| 360 RenderBox* box = toRenderBox(renderer); | 360 LayoutBox* box = toLayoutBox(renderer); |
| 361 ASSERT_TRUE(box->usesCompositedScrolling()); | 361 ASSERT_TRUE(box->usesCompositedScrolling()); |
| 362 ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState()); | 362 ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState()); |
| 363 | 363 |
| 364 CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLay
erMapping(); | 364 CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLay
erMapping(); |
| 365 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); | 365 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); |
| 366 ASSERT(compositedLayerMapping->scrollingContentsLayer()); | 366 ASSERT(compositedLayerMapping->scrollingContentsLayer()); |
| 367 | 367 |
| 368 GraphicsLayer* graphicsLayer = compositedLayerMapping->scrollingContentsLaye
r(); | 368 GraphicsLayer* graphicsLayer = compositedLayerMapping->scrollingContentsLaye
r(); |
| 369 ASSERT_EQ(box->layer()->scrollableArea(), graphicsLayer->scrollableArea()); | 369 ASSERT_EQ(box->layer()->scrollableArea(), graphicsLayer->scrollableArea()); |
| 370 | 370 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 390 | 390 |
| 391 // Verify the properties of the accelerated scrolling element starting from
the LayoutObject | 391 // Verify the properties of the accelerated scrolling element starting from
the LayoutObject |
| 392 // all the way to the WebLayer. | 392 // all the way to the WebLayer. |
| 393 Element* overflowElement = frame()->document()->getElementById("unscrollable
-y"); | 393 Element* overflowElement = frame()->document()->getElementById("unscrollable
-y"); |
| 394 ASSERT(overflowElement); | 394 ASSERT(overflowElement); |
| 395 | 395 |
| 396 LayoutObject* renderer = overflowElement->renderer(); | 396 LayoutObject* renderer = overflowElement->renderer(); |
| 397 ASSERT_TRUE(renderer->isBox()); | 397 ASSERT_TRUE(renderer->isBox()); |
| 398 ASSERT_TRUE(renderer->hasLayer()); | 398 ASSERT_TRUE(renderer->hasLayer()); |
| 399 | 399 |
| 400 RenderBox* box = toRenderBox(renderer); | 400 LayoutBox* box = toLayoutBox(renderer); |
| 401 ASSERT_TRUE(box->usesCompositedScrolling()); | 401 ASSERT_TRUE(box->usesCompositedScrolling()); |
| 402 ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState()); | 402 ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState()); |
| 403 | 403 |
| 404 CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLay
erMapping(); | 404 CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLay
erMapping(); |
| 405 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); | 405 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); |
| 406 ASSERT(compositedLayerMapping->scrollingContentsLayer()); | 406 ASSERT(compositedLayerMapping->scrollingContentsLayer()); |
| 407 | 407 |
| 408 GraphicsLayer* graphicsLayer = compositedLayerMapping->scrollingContentsLaye
r(); | 408 GraphicsLayer* graphicsLayer = compositedLayerMapping->scrollingContentsLaye
r(); |
| 409 ASSERT_EQ(box->layer()->scrollableArea(), graphicsLayer->scrollableArea()); | 409 ASSERT_EQ(box->layer()->scrollableArea(), graphicsLayer->scrollableArea()); |
| 410 | 410 |
| 411 WebLayer* webScrollLayer = compositedLayerMapping->scrollingContentsLayer()-
>platformLayer(); | 411 WebLayer* webScrollLayer = compositedLayerMapping->scrollingContentsLayer()-
>platformLayer(); |
| 412 ASSERT_TRUE(webScrollLayer->scrollable()); | 412 ASSERT_TRUE(webScrollLayer->scrollable()); |
| 413 ASSERT_TRUE(webScrollLayer->userScrollableHorizontal()); | 413 ASSERT_TRUE(webScrollLayer->userScrollableHorizontal()); |
| 414 ASSERT_FALSE(webScrollLayer->userScrollableVertical()); | 414 ASSERT_FALSE(webScrollLayer->userScrollableVertical()); |
| 415 | 415 |
| 416 overflowElement = frame()->document()->getElementById("unscrollable-x"); | 416 overflowElement = frame()->document()->getElementById("unscrollable-x"); |
| 417 ASSERT(overflowElement); | 417 ASSERT(overflowElement); |
| 418 | 418 |
| 419 renderer = overflowElement->renderer(); | 419 renderer = overflowElement->renderer(); |
| 420 ASSERT_TRUE(renderer->isBox()); | 420 ASSERT_TRUE(renderer->isBox()); |
| 421 ASSERT_TRUE(renderer->hasLayer()); | 421 ASSERT_TRUE(renderer->hasLayer()); |
| 422 | 422 |
| 423 box = toRenderBox(renderer); | 423 box = toLayoutBox(renderer); |
| 424 ASSERT_TRUE(box->scrollableArea()->usesCompositedScrolling()); | 424 ASSERT_TRUE(box->scrollableArea()->usesCompositedScrolling()); |
| 425 ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState()); | 425 ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState()); |
| 426 | 426 |
| 427 compositedLayerMapping = box->layer()->compositedLayerMapping(); | 427 compositedLayerMapping = box->layer()->compositedLayerMapping(); |
| 428 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); | 428 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); |
| 429 ASSERT(compositedLayerMapping->scrollingContentsLayer()); | 429 ASSERT(compositedLayerMapping->scrollingContentsLayer()); |
| 430 | 430 |
| 431 graphicsLayer = compositedLayerMapping->scrollingContentsLayer(); | 431 graphicsLayer = compositedLayerMapping->scrollingContentsLayer(); |
| 432 ASSERT_EQ(box->layer()->scrollableArea(), graphicsLayer->scrollableArea()); | 432 ASSERT_EQ(box->layer()->scrollableArea(), graphicsLayer->scrollableArea()); |
| 433 | 433 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 registerMockedHttpURLLoad("trivial-scroller.html"); | 536 registerMockedHttpURLLoad("trivial-scroller.html"); |
| 537 navigateTo(m_baseURL + "trivial-scroller.html"); | 537 navigateTo(m_baseURL + "trivial-scroller.html"); |
| 538 forceFullCompositingUpdate(); | 538 forceFullCompositingUpdate(); |
| 539 | 539 |
| 540 Document* document = frame()->document(); | 540 Document* document = frame()->document(); |
| 541 Element* scrollableElement = document->getElementById("scroller"); | 541 Element* scrollableElement = document->getElementById("scroller"); |
| 542 ASSERT(scrollableElement); | 542 ASSERT(scrollableElement); |
| 543 | 543 |
| 544 LayoutObject* renderer = scrollableElement->renderer(); | 544 LayoutObject* renderer = scrollableElement->renderer(); |
| 545 ASSERT_TRUE(renderer->isBox()); | 545 ASSERT_TRUE(renderer->isBox()); |
| 546 RenderBox* box = toRenderBox(renderer); | 546 LayoutBox* box = toLayoutBox(renderer); |
| 547 ASSERT_TRUE(box->usesCompositedScrolling()); | 547 ASSERT_TRUE(box->usesCompositedScrolling()); |
| 548 CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLay
erMapping(); | 548 CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLay
erMapping(); |
| 549 GraphicsLayer* scrollbarGraphicsLayer = compositedLayerMapping->layerForVert
icalScrollbar(); | 549 GraphicsLayer* scrollbarGraphicsLayer = compositedLayerMapping->layerForVert
icalScrollbar(); |
| 550 ASSERT_TRUE(scrollbarGraphicsLayer); | 550 ASSERT_TRUE(scrollbarGraphicsLayer); |
| 551 | 551 |
| 552 bool hasWebScrollbarLayer = !scrollbarGraphicsLayer->drawsContent(); | 552 bool hasWebScrollbarLayer = !scrollbarGraphicsLayer->drawsContent(); |
| 553 ASSERT_TRUE(hasWebScrollbarLayer || scrollbarGraphicsLayer->platformLayer()-
>shouldScrollOnMainThread()); | 553 ASSERT_TRUE(hasWebScrollbarLayer || scrollbarGraphicsLayer->platformLayer()-
>shouldScrollOnMainThread()); |
| 554 } | 554 } |
| 555 | 555 |
| 556 #if OS(MACOSX) | 556 #if OS(MACOSX) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 575 WebLayer* contentsLayer = scrollbarGraphicsLayer->contentsLayer(); | 575 WebLayer* contentsLayer = scrollbarGraphicsLayer->contentsLayer(); |
| 576 ASSERT_TRUE(contentsLayer); | 576 ASSERT_TRUE(contentsLayer); |
| 577 | 577 |
| 578 // After scrollableAreaScrollbarLayerDidChange, | 578 // After scrollableAreaScrollbarLayerDidChange, |
| 579 // if the main frame's scrollbarLayer is opaque, | 579 // if the main frame's scrollbarLayer is opaque, |
| 580 // contentsLayer should be opaque too. | 580 // contentsLayer should be opaque too. |
| 581 ASSERT_EQ(platformLayer->opaque(), contentsLayer->opaque()); | 581 ASSERT_EQ(platformLayer->opaque(), contentsLayer->opaque()); |
| 582 } | 582 } |
| 583 | 583 |
| 584 } // namespace | 584 } // namespace |
| OLD | NEW |