| 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/layout/LayoutBoxModelObject.h" | 7 #include "core/layout/LayoutBoxModelObject.h" |
| 8 #include "core/layout/LayoutTestHelper.h" | 8 #include "core/layout/LayoutTestHelper.h" |
| 9 #include "core/layout/LayoutView.h" | 9 #include "core/layout/LayoutView.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 using PaintLayerTest = RenderingTest; | 13 using PaintLayerTest = RenderingTest; |
| 14 | 14 |
| 15 TEST_F(PaintLayerTest, CompositedBoundsAbsPosGrandchild) { |
| 16 setBodyInnerHTML( |
| 17 " <div id='parent'><div id='absposparent'><div id='absposchild'>" |
| 18 " </div></div></div>" |
| 19 "<style>" |
| 20 " #parent { position: absolute; z-index: 0; overflow: hidden;" |
| 21 " background: lightgray; width: 150px; height: 150px;" |
| 22 " will-change: transform; }" |
| 23 " #absposparent { position: absolute; z-index: 0; }" |
| 24 " #absposchild { position: absolute; top: 0px; left: 0px; height: 200px;" |
| 25 " width: 200px; background: lightblue; }</style>"); |
| 26 |
| 27 PaintLayer* parentLayer = |
| 28 toLayoutBoxModelObject(getLayoutObjectByElementId("parent"))->layer(); |
| 29 // Since "absposchild" is clipped by "parent", it should not expand the |
| 30 // composited bounds for "parent" beyond its intrinsic size of 150x150. |
| 31 EXPECT_EQ(LayoutRect(0, 0, 150, 150), |
| 32 parentLayer->boundingBoxForCompositing()); |
| 33 } |
| 34 |
| 15 TEST_F(PaintLayerTest, PaintingExtentReflection) { | 35 TEST_F(PaintLayerTest, PaintingExtentReflection) { |
| 16 setBodyInnerHTML( | 36 setBodyInnerHTML( |
| 17 "<div id='target' style='background-color: blue; position: absolute;" | 37 "<div id='target' style='background-color: blue; position: absolute;" |
| 18 " width: 110px; height: 120px; top: 40px; left: 60px;" | 38 " width: 110px; height: 120px; top: 40px; left: 60px;" |
| 19 " -webkit-box-reflect: below 3px'>" | 39 " -webkit-box-reflect: below 3px'>" |
| 20 "</div>"); | 40 "</div>"); |
| 21 | 41 |
| 22 PaintLayer* layer = | 42 PaintLayer* layer = |
| 23 toLayoutBoxModelObject(getLayoutObjectByElementId("target"))->layer(); | 43 toLayoutBoxModelObject(getLayoutObjectByElementId("target"))->layer(); |
| 24 EXPECT_EQ( | 44 EXPECT_EQ( |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 scrollLayer->getScrollableArea()->setScrollOffset(ScrollOffset(1000, 1000), | 106 scrollLayer->getScrollableArea()->setScrollOffset(ScrollOffset(1000, 1000), |
| 87 ProgrammaticScroll); | 107 ProgrammaticScroll); |
| 88 document().view()->updateAllLifecyclePhasesExceptPaint(); | 108 document().view()->updateAllLifecyclePhasesExceptPaint(); |
| 89 EXPECT_EQ(LayoutPoint(-1000, -1000), contentLayer->location()); | 109 EXPECT_EQ(LayoutPoint(-1000, -1000), contentLayer->location()); |
| 90 EXPECT_TRUE(contentLayer->needsRepaint()); | 110 EXPECT_TRUE(contentLayer->needsRepaint()); |
| 91 EXPECT_TRUE(scrollLayer->needsRepaint()); | 111 EXPECT_TRUE(scrollLayer->needsRepaint()); |
| 92 document().view()->updateAllLifecyclePhases(); | 112 document().view()->updateAllLifecyclePhases(); |
| 93 } | 113 } |
| 94 | 114 |
| 95 } // namespace blink | 115 } // namespace blink |
| OLD | NEW |