| 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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 | 408 |
| 409 LayoutBox* box = toLayoutBox(layoutObject); | 409 LayoutBox* box = toLayoutBox(layoutObject); |
| 410 ASSERT_TRUE(box->usesCompositedScrolling()); | 410 ASSERT_TRUE(box->usesCompositedScrolling()); |
| 411 ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState()); | 411 ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState()); |
| 412 | 412 |
| 413 CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLay
erMapping(); | 413 CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLay
erMapping(); |
| 414 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); | 414 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); |
| 415 ASSERT(compositedLayerMapping->scrollingContentsLayer()); | 415 ASSERT(compositedLayerMapping->scrollingContentsLayer()); |
| 416 | 416 |
| 417 GraphicsLayer* graphicsLayer = compositedLayerMapping->scrollingContentsLaye
r(); | 417 GraphicsLayer* graphicsLayer = compositedLayerMapping->scrollingContentsLaye
r(); |
| 418 ASSERT_EQ(box->layer()->scrollableArea(), graphicsLayer->scrollableArea()); | 418 ASSERT_EQ(box->layer()->getScrollableArea(), graphicsLayer->getScrollableAre
a()); |
| 419 | 419 |
| 420 WebLayer* webScrollLayer = compositedLayerMapping->scrollingContentsLayer()-
>platformLayer(); | 420 WebLayer* webScrollLayer = compositedLayerMapping->scrollingContentsLayer()-
>platformLayer(); |
| 421 ASSERT_TRUE(webScrollLayer->scrollable()); | 421 ASSERT_TRUE(webScrollLayer->scrollable()); |
| 422 ASSERT_TRUE(webScrollLayer->userScrollableHorizontal()); | 422 ASSERT_TRUE(webScrollLayer->userScrollableHorizontal()); |
| 423 ASSERT_TRUE(webScrollLayer->userScrollableVertical()); | 423 ASSERT_TRUE(webScrollLayer->userScrollableVertical()); |
| 424 | 424 |
| 425 #if OS(ANDROID) | 425 #if OS(ANDROID) |
| 426 // Now verify we've attached impl-side scrollbars onto the scrollbar layers | 426 // Now verify we've attached impl-side scrollbars onto the scrollbar layers |
| 427 ASSERT_TRUE(compositedLayerMapping->layerForHorizontalScrollbar()); | 427 ASSERT_TRUE(compositedLayerMapping->layerForHorizontalScrollbar()); |
| 428 ASSERT_TRUE(compositedLayerMapping->layerForHorizontalScrollbar()->hasConten
tsLayer()); | 428 ASSERT_TRUE(compositedLayerMapping->layerForHorizontalScrollbar()->hasConten
tsLayer()); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 448 | 448 |
| 449 LayoutBox* box = toLayoutBox(layoutObject); | 449 LayoutBox* box = toLayoutBox(layoutObject); |
| 450 ASSERT_TRUE(box->usesCompositedScrolling()); | 450 ASSERT_TRUE(box->usesCompositedScrolling()); |
| 451 ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState()); | 451 ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState()); |
| 452 | 452 |
| 453 CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLay
erMapping(); | 453 CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLay
erMapping(); |
| 454 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); | 454 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); |
| 455 ASSERT(compositedLayerMapping->scrollingContentsLayer()); | 455 ASSERT(compositedLayerMapping->scrollingContentsLayer()); |
| 456 | 456 |
| 457 GraphicsLayer* graphicsLayer = compositedLayerMapping->scrollingContentsLaye
r(); | 457 GraphicsLayer* graphicsLayer = compositedLayerMapping->scrollingContentsLaye
r(); |
| 458 ASSERT_EQ(box->layer()->scrollableArea(), graphicsLayer->scrollableArea()); | 458 ASSERT_EQ(box->layer()->getScrollableArea(), graphicsLayer->getScrollableAre
a()); |
| 459 | 459 |
| 460 WebLayer* webScrollLayer = compositedLayerMapping->scrollingContentsLayer()-
>platformLayer(); | 460 WebLayer* webScrollLayer = compositedLayerMapping->scrollingContentsLayer()-
>platformLayer(); |
| 461 ASSERT_TRUE(webScrollLayer->scrollable()); | 461 ASSERT_TRUE(webScrollLayer->scrollable()); |
| 462 ASSERT_TRUE(webScrollLayer->userScrollableHorizontal()); | 462 ASSERT_TRUE(webScrollLayer->userScrollableHorizontal()); |
| 463 ASSERT_FALSE(webScrollLayer->userScrollableVertical()); | 463 ASSERT_FALSE(webScrollLayer->userScrollableVertical()); |
| 464 | 464 |
| 465 overflowElement = frame()->document()->getElementById("unscrollable-x"); | 465 overflowElement = frame()->document()->getElementById("unscrollable-x"); |
| 466 ASSERT(overflowElement); | 466 ASSERT(overflowElement); |
| 467 | 467 |
| 468 layoutObject = overflowElement->layoutObject(); | 468 layoutObject = overflowElement->layoutObject(); |
| 469 ASSERT_TRUE(layoutObject->isBox()); | 469 ASSERT_TRUE(layoutObject->isBox()); |
| 470 ASSERT_TRUE(layoutObject->hasLayer()); | 470 ASSERT_TRUE(layoutObject->hasLayer()); |
| 471 | 471 |
| 472 box = toLayoutBox(layoutObject); | 472 box = toLayoutBox(layoutObject); |
| 473 ASSERT_TRUE(box->scrollableArea()->usesCompositedScrolling()); | 473 ASSERT_TRUE(box->getScrollableArea()->usesCompositedScrolling()); |
| 474 ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState()); | 474 ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState()); |
| 475 | 475 |
| 476 compositedLayerMapping = box->layer()->compositedLayerMapping(); | 476 compositedLayerMapping = box->layer()->compositedLayerMapping(); |
| 477 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); | 477 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); |
| 478 ASSERT(compositedLayerMapping->scrollingContentsLayer()); | 478 ASSERT(compositedLayerMapping->scrollingContentsLayer()); |
| 479 | 479 |
| 480 graphicsLayer = compositedLayerMapping->scrollingContentsLayer(); | 480 graphicsLayer = compositedLayerMapping->scrollingContentsLayer(); |
| 481 ASSERT_EQ(box->layer()->scrollableArea(), graphicsLayer->scrollableArea()); | 481 ASSERT_EQ(box->layer()->getScrollableArea(), graphicsLayer->getScrollableAre
a()); |
| 482 | 482 |
| 483 webScrollLayer = compositedLayerMapping->scrollingContentsLayer()->platformL
ayer(); | 483 webScrollLayer = compositedLayerMapping->scrollingContentsLayer()->platformL
ayer(); |
| 484 ASSERT_TRUE(webScrollLayer->scrollable()); | 484 ASSERT_TRUE(webScrollLayer->scrollable()); |
| 485 ASSERT_FALSE(webScrollLayer->userScrollableHorizontal()); | 485 ASSERT_FALSE(webScrollLayer->userScrollableHorizontal()); |
| 486 ASSERT_TRUE(webScrollLayer->userScrollableVertical()); | 486 ASSERT_TRUE(webScrollLayer->userScrollableVertical()); |
| 487 } | 487 } |
| 488 | 488 |
| 489 TEST_F(ScrollingCoordinatorTest, iframeScrolling) | 489 TEST_F(ScrollingCoordinatorTest, iframeScrolling) |
| 490 { | 490 { |
| 491 registerMockedHttpURLLoad("iframe-scrolling.html"); | 491 registerMockedHttpURLLoad("iframe-scrolling.html"); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 509 | 509 |
| 510 FrameView* innerFrameView = toFrameView(layoutPart->widget()); | 510 FrameView* innerFrameView = toFrameView(layoutPart->widget()); |
| 511 LayoutView* innerLayoutView = innerFrameView->layoutView(); | 511 LayoutView* innerLayoutView = innerFrameView->layoutView(); |
| 512 ASSERT_TRUE(innerLayoutView); | 512 ASSERT_TRUE(innerLayoutView); |
| 513 | 513 |
| 514 PaintLayerCompositor* innerCompositor = innerLayoutView->compositor(); | 514 PaintLayerCompositor* innerCompositor = innerLayoutView->compositor(); |
| 515 ASSERT_TRUE(innerCompositor->inCompositingMode()); | 515 ASSERT_TRUE(innerCompositor->inCompositingMode()); |
| 516 ASSERT_TRUE(innerCompositor->scrollLayer()); | 516 ASSERT_TRUE(innerCompositor->scrollLayer()); |
| 517 | 517 |
| 518 GraphicsLayer* scrollLayer = innerCompositor->scrollLayer(); | 518 GraphicsLayer* scrollLayer = innerCompositor->scrollLayer(); |
| 519 ASSERT_EQ(innerFrameView, scrollLayer->scrollableArea()); | 519 ASSERT_EQ(innerFrameView, scrollLayer->getScrollableArea()); |
| 520 | 520 |
| 521 WebLayer* webScrollLayer = scrollLayer->platformLayer(); | 521 WebLayer* webScrollLayer = scrollLayer->platformLayer(); |
| 522 ASSERT_TRUE(webScrollLayer->scrollable()); | 522 ASSERT_TRUE(webScrollLayer->scrollable()); |
| 523 | 523 |
| 524 #if OS(ANDROID) | 524 #if OS(ANDROID) |
| 525 // Now verify we've attached impl-side scrollbars onto the scrollbar layers | 525 // Now verify we've attached impl-side scrollbars onto the scrollbar layers |
| 526 ASSERT_TRUE(innerCompositor->layerForHorizontalScrollbar()); | 526 ASSERT_TRUE(innerCompositor->layerForHorizontalScrollbar()); |
| 527 ASSERT_TRUE(innerCompositor->layerForHorizontalScrollbar()->hasContentsLayer
()); | 527 ASSERT_TRUE(innerCompositor->layerForHorizontalScrollbar()->hasContentsLayer
()); |
| 528 ASSERT_TRUE(innerCompositor->layerForVerticalScrollbar()); | 528 ASSERT_TRUE(innerCompositor->layerForVerticalScrollbar()); |
| 529 ASSERT_TRUE(innerCompositor->layerForVerticalScrollbar()->hasContentsLayer()
); | 529 ASSERT_TRUE(innerCompositor->layerForVerticalScrollbar()->hasContentsLayer()
); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 553 | 553 |
| 554 FrameView* innerFrameView = toFrameView(layoutPart->widget()); | 554 FrameView* innerFrameView = toFrameView(layoutPart->widget()); |
| 555 LayoutView* innerLayoutView = innerFrameView->layoutView(); | 555 LayoutView* innerLayoutView = innerFrameView->layoutView(); |
| 556 ASSERT_TRUE(innerLayoutView); | 556 ASSERT_TRUE(innerLayoutView); |
| 557 | 557 |
| 558 PaintLayerCompositor* innerCompositor = innerLayoutView->compositor(); | 558 PaintLayerCompositor* innerCompositor = innerLayoutView->compositor(); |
| 559 ASSERT_TRUE(innerCompositor->inCompositingMode()); | 559 ASSERT_TRUE(innerCompositor->inCompositingMode()); |
| 560 ASSERT_TRUE(innerCompositor->scrollLayer()); | 560 ASSERT_TRUE(innerCompositor->scrollLayer()); |
| 561 | 561 |
| 562 GraphicsLayer* scrollLayer = innerCompositor->scrollLayer(); | 562 GraphicsLayer* scrollLayer = innerCompositor->scrollLayer(); |
| 563 ASSERT_EQ(innerFrameView, scrollLayer->scrollableArea()); | 563 ASSERT_EQ(innerFrameView, scrollLayer->getScrollableArea()); |
| 564 | 564 |
| 565 WebLayer* webScrollLayer = scrollLayer->platformLayer(); | 565 WebLayer* webScrollLayer = scrollLayer->platformLayer(); |
| 566 ASSERT_TRUE(webScrollLayer->scrollable()); | 566 ASSERT_TRUE(webScrollLayer->scrollable()); |
| 567 | 567 |
| 568 int expectedScrollPosition = 958 + (innerFrameView->verticalScrollbar()->isO
verlayScrollbar() ? 0 : 15); | 568 int expectedScrollPosition = 958 + (innerFrameView->verticalScrollbar()->isO
verlayScrollbar() ? 0 : 15); |
| 569 ASSERT_EQ(expectedScrollPosition, webScrollLayer->scrollPositionDouble().x); | 569 ASSERT_EQ(expectedScrollPosition, webScrollLayer->scrollPositionDouble().x); |
| 570 } | 570 } |
| 571 | 571 |
| 572 TEST_F(ScrollingCoordinatorTest, setupScrollbarLayerShouldNotCrash) | 572 TEST_F(ScrollingCoordinatorTest, setupScrollbarLayerShouldNotCrash) |
| 573 { | 573 { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 EXPECT_FALSE(scrollLayer->shouldScrollOnMainThread()); | 643 EXPECT_FALSE(scrollLayer->shouldScrollOnMainThread()); |
| 644 | 644 |
| 645 fixedPos->setInlineStyleProperty(CSSPropertyTransform, CSSValueNone); | 645 fixedPos->setInlineStyleProperty(CSSPropertyTransform, CSSValueNone); |
| 646 forceFullCompositingUpdate(); | 646 forceFullCompositingUpdate(); |
| 647 | 647 |
| 648 EXPECT_FALSE(static_cast<LayoutBoxModelObject*>(fixedPos->layoutObject())->l
ayer()->hasCompositedLayerMapping()); | 648 EXPECT_FALSE(static_cast<LayoutBoxModelObject*>(fixedPos->layoutObject())->l
ayer()->hasCompositedLayerMapping()); |
| 649 EXPECT_TRUE(scrollLayer->shouldScrollOnMainThread()); | 649 EXPECT_TRUE(scrollLayer->shouldScrollOnMainThread()); |
| 650 } | 650 } |
| 651 | 651 |
| 652 } // namespace blink | 652 } // namespace blink |
| OLD | NEW |