Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/paint/PaintLayer.h" | 5 #include "core/paint/PaintLayer.h" |
| 6 | 6 |
| 7 #include "core/html/HTMLIFrameElement.h" | 7 #include "core/html/HTMLIFrameElement.h" |
| 8 #include "core/layout/LayoutBoxModelObject.h" | 8 #include "core/layout/LayoutBoxModelObject.h" |
| 9 #include "core/layout/LayoutTestHelper.h" | 9 #include "core/layout/LayoutTestHelper.h" |
| 10 #include "core/layout/LayoutView.h" | 10 #include "core/layout/LayoutView.h" |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 509 EXPECT_EQ(LayoutRect(0, 30, 50, 10), contentLayer->visualRect()); | 509 EXPECT_EQ(LayoutRect(0, 30, 50, 10), contentLayer->visualRect()); |
| 510 EXPECT_EQ(LayoutRect(0, 30, 50, 5), content->visualRect()); | 510 EXPECT_EQ(LayoutRect(0, 30, 50, 5), content->visualRect()); |
| 511 | 511 |
| 512 scroller->getScrollableArea()->setScrollOffset(ScrollOffset(0, 20), | 512 scroller->getScrollableArea()->setScrollOffset(ScrollOffset(0, 20), |
| 513 ProgrammaticScroll); | 513 ProgrammaticScroll); |
| 514 document().view()->updateAllLifecyclePhases(); | 514 document().view()->updateAllLifecyclePhases(); |
| 515 EXPECT_EQ(LayoutRect(0, 30, 50, 10), contentLayer->visualRect()); | 515 EXPECT_EQ(LayoutRect(0, 30, 50, 10), contentLayer->visualRect()); |
| 516 EXPECT_EQ(LayoutRect(0, 30, 50, 5), content->visualRect()); | 516 EXPECT_EQ(LayoutRect(0, 30, 50, 5), content->visualRect()); |
| 517 } | 517 } |
| 518 | 518 |
| 519 TEST_P(PaintLayerTest, CompositingContainerFloat) { | 519 TEST_P(PaintLayerTest, CompositingContainerFloatUnderInline) { |
| 520 enableCompositing(); | 520 enableCompositing(); |
| 521 setBodyInnerHTML( | 521 setBodyInnerHTML( |
| 522 "<div id='compositedContainer' style='position: relative;" | 522 "<div id='compositedContainer' style='position: relative;" |
| 523 " will-change: transform'>" | 523 " will-change: transform'>" |
| 524 " <div id='containingBlock' style='position: relative; z-index: 0'>" | 524 " <div id='containingBlock' style='position: relative; z-index: 0'>" |
| 525 " <div style='backface-visibility: hidden'></div>" | 525 " <div style='backface-visibility: hidden'></div>" |
| 526 " <span id='span'" | 526 " <span id='span'" |
| 527 " style='clip-path: polygon(0px 15px, 0px 54px, 100px 0px)'>" | 527 " style='clip-path: polygon(0px 15px, 0px 54px, 100px 0px)'>" |
| 528 " <div id='target' style='float: right; position: relative'></div>" | 528 " <div id='target' style='float: right; position: relative'></div>" |
| 529 " </span>" | 529 " </span>" |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 540 ->layer(); | 540 ->layer(); |
| 541 | 541 |
| 542 // enclosingLayerWithCompositedLayerMapping is not needed or applicable to | 542 // enclosingLayerWithCompositedLayerMapping is not needed or applicable to |
| 543 // SPv2. | 543 // SPv2. |
| 544 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 544 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 545 EXPECT_EQ(compositedContainer, | 545 EXPECT_EQ(compositedContainer, |
| 546 target->enclosingLayerWithCompositedLayerMapping(ExcludeSelf)); | 546 target->enclosingLayerWithCompositedLayerMapping(ExcludeSelf)); |
| 547 } | 547 } |
| 548 } | 548 } |
| 549 | 549 |
| 550 TEST_P(PaintLayerTest, CompositingContainerUnderFloatUnderInline) { | |
|
Xianzhu
2017/03/30 22:23:12
This test also passes without any real code change
| |
| 551 enableCompositing(); | |
| 552 setBodyInnerHTML( | |
| 553 "<div id='compositedContainer' style='position: relative;" | |
| 554 " will-change: transform'>" | |
| 555 " <div id='containingBlock' style='position: relative; z-index: 0'>" | |
| 556 " <div style='backface-visibility: hidden'></div>" | |
| 557 " <span id='span'" | |
| 558 " style='clip-path: polygon(0px 15px, 0px 54px, 100px 0px)'>" | |
| 559 " <div style='float: right'>" | |
| 560 " <div id='target' style='position: relative'></div>" | |
| 561 " </div>" | |
| 562 " </span>" | |
| 563 " </div>" | |
| 564 "</div>"); | |
| 565 | |
| 566 PaintLayer* target = | |
| 567 toLayoutBoxModelObject(getLayoutObjectByElementId("target"))->layer(); | |
| 568 PaintLayer* span = | |
| 569 toLayoutBoxModelObject(getLayoutObjectByElementId("span"))->layer(); | |
| 570 EXPECT_EQ(span, target->compositingContainer()); | |
| 571 PaintLayer* compositedContainer = | |
| 572 toLayoutBoxModelObject(getLayoutObjectByElementId("compositedContainer")) | |
| 573 ->layer(); | |
| 574 | |
| 575 // enclosingLayerWithCompositedLayerMapping is not needed or applicable to | |
| 576 // SPv2. | |
| 577 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | |
| 578 EXPECT_EQ(compositedContainer, | |
| 579 target->enclosingLayerWithCompositedLayerMapping(ExcludeSelf)); | |
| 580 } | |
| 581 } | |
| 582 | |
| 550 TEST_P(PaintLayerTest, FloatLayerAndAbsoluteUnderInlineLayer) { | 583 TEST_P(PaintLayerTest, FloatLayerAndAbsoluteUnderInlineLayer) { |
| 551 setBodyInnerHTML( | 584 setBodyInnerHTML( |
| 552 "<div id='container' style='position: absolute; top: 20px; left: 20px'>" | 585 "<div id='container' style='position: absolute; top: 20px; left: 20px'>" |
| 553 " <div style='margin: 33px'>" | 586 " <div style='margin: 33px'>" |
| 554 " <span id='span' style='position: relative; top: 100px; left: 100px'>" | 587 " <span id='span' style='position: relative; top: 100px; left: 100px'>" |
| 555 " <div id='floating'" | 588 " <div id='floating'" |
| 556 " style='float: left; position: relative; top: 50px; left: 50px'>" | 589 " style='float: left; position: relative; top: 50px; left: 50px'>" |
| 557 " </div>" | 590 " </div>" |
| 558 " <div id='absolute'" | 591 " <div id='absolute'" |
| 559 " style='position: absolute; top: 50px; left: 50px'>" | 592 " style='position: absolute; top: 50px; left: 50px'>" |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 842 RefPtr<ComputedStyle> oldStyle = | 875 RefPtr<ComputedStyle> oldStyle = |
| 843 ComputedStyle::clone(targetObject->styleRef()); | 876 ComputedStyle::clone(targetObject->styleRef()); |
| 844 ComputedStyle* newStyle = targetObject->mutableStyle(); | 877 ComputedStyle* newStyle = targetObject->mutableStyle(); |
| 845 newStyle->setHasCurrentTransformAnimation(); | 878 newStyle->setHasCurrentTransformAnimation(); |
| 846 targetPaintLayer->updateTransform(oldStyle.get(), *newStyle); | 879 targetPaintLayer->updateTransform(oldStyle.get(), *newStyle); |
| 847 | 880 |
| 848 EXPECT_NE(nullptr, targetPaintLayer->transform()); | 881 EXPECT_NE(nullptr, targetPaintLayer->transform()); |
| 849 } | 882 } |
| 850 | 883 |
| 851 } // namespace blink | 884 } // namespace blink |
| OLD | NEW |