| 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/PaintLayerClipper.h" | 5 #include "core/paint/PaintLayerClipper.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 #include "core/paint/PaintLayer.h" | 10 #include "core/paint/PaintLayer.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 EXPECT_EQ(LayoutRect(0, 0, 200, 400), layerBounds); | 110 EXPECT_EQ(LayoutRect(0, 0, 200, 400), layerBounds); |
| 111 | 111 |
| 112 ClipRectsContext contextClip(layer->parent(), PaintingClipRects); | 112 ClipRectsContext contextClip(layer->parent(), PaintingClipRects); |
| 113 layer->clipper().calculateRects(contextClip, infiniteRect, layerBounds, | 113 layer->clipper().calculateRects(contextClip, infiniteRect, layerBounds, |
| 114 backgroundRect, foregroundRect); | 114 backgroundRect, foregroundRect); |
| 115 EXPECT_EQ(LayoutRect(0, 0, 200, 200), backgroundRect.rect()); | 115 EXPECT_EQ(LayoutRect(0, 0, 200, 200), backgroundRect.rect()); |
| 116 EXPECT_EQ(LayoutRect(0, 0, 200, 200), foregroundRect.rect()); | 116 EXPECT_EQ(LayoutRect(0, 0, 200, 200), foregroundRect.rect()); |
| 117 EXPECT_EQ(LayoutRect(0, 0, 200, 400), layerBounds); | 117 EXPECT_EQ(LayoutRect(0, 0, 200, 400), layerBounds); |
| 118 } | 118 } |
| 119 | 119 |
| 120 TEST_F(PaintLayerClipperTest, LocalClipRectFixedUnderTransform) { | |
| 121 setBodyInnerHTML( | |
| 122 "<div id='transformed'" | |
| 123 " style='will-change: transform; width: 100px; height: 100px;" | |
| 124 " overflow: hidden'>" | |
| 125 " <div id='fixed' " | |
| 126 " style='position: fixed; width: 100px; height: 100px;" | |
| 127 " top: -50px'>" | |
| 128 " </div>" | |
| 129 "</div>"); | |
| 130 | |
| 131 LayoutRect infiniteRect(LayoutRect::infiniteIntRect()); | |
| 132 PaintLayer* transformed = | |
| 133 toLayoutBoxModelObject(getLayoutObjectByElementId("transformed")) | |
| 134 ->layer(); | |
| 135 PaintLayer* fixed = | |
| 136 toLayoutBoxModelObject(getLayoutObjectByElementId("fixed"))->layer(); | |
| 137 | |
| 138 EXPECT_EQ(LayoutRect(0, 0, 100, 100), | |
| 139 transformed->clipper().localClipRect(transformed)); | |
| 140 EXPECT_EQ(LayoutRect(0, 50, 100, 100), | |
| 141 fixed->clipper().localClipRect(transformed)); | |
| 142 } | |
| 143 | |
| 144 } // namespace blink | 120 } // namespace blink |
| OLD | NEW |