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