| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 ClipRectsContext context(document().layoutView()->layer(), UncachedClipRects); | 43 ClipRectsContext context(document().layoutView()->layer(), UncachedClipRects); |
| 44 // When RLS is enabled, the LayoutView will have a composited scrolling layer, | 44 // When RLS is enabled, the LayoutView will have a composited scrolling layer, |
| 45 // so don't apply an overflow clip. | 45 // so don't apply an overflow clip. |
| 46 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) | 46 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
| 47 context.setIgnoreOverflowClip(); | 47 context.setIgnoreOverflowClip(); |
| 48 LayoutRect layerBounds; | 48 LayoutRect layerBounds; |
| 49 ClipRect backgroundRect, foregroundRect; | 49 ClipRect backgroundRect, foregroundRect; |
| 50 targetPaintLayer->clipper().calculateRects( | 50 targetPaintLayer->clipper().calculateRects( |
| 51 context, LayoutRect(LayoutRect::infiniteIntRect()), layerBounds, | 51 context, LayoutRect(LayoutRect::infiniteIntRect()), layerBounds, |
| 52 backgroundRect, foregroundRect); | 52 backgroundRect, foregroundRect); |
| 53 EXPECT_EQ(LayoutRect(LayoutRect::infiniteIntRect()), backgroundRect.rect()); | 53 EXPECT_EQ(LayoutRect(8, 8, 200, 300), backgroundRect.rect()); |
| 54 // TODO(chrishtr): the behavior for SPv2 is actually correct, since the | 54 EXPECT_EQ(LayoutRect(8, 8, 200, 300), foregroundRect.rect()); |
| 55 // svg root clip should be applied to the foreground rect. See | |
| 56 // crbug.com/680325. | |
| 57 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | |
| 58 EXPECT_EQ(LayoutRect(LayoutRect::infiniteIntRect()), foregroundRect.rect()); | |
| 59 EXPECT_EQ(LayoutRect(8, 8, 200, 300), layerBounds); | 55 EXPECT_EQ(LayoutRect(8, 8, 200, 300), layerBounds); |
| 60 } | 56 } |
| 61 | 57 |
| 62 TEST_P(PaintLayerClipperTest, LayoutSVGRootChild) { | 58 TEST_P(PaintLayerClipperTest, LayoutSVGRootChild) { |
| 63 setBodyInnerHTML( | 59 setBodyInnerHTML( |
| 64 "<svg width=200 height=300 style='position: relative'>" | 60 "<svg width=200 height=300 style='position: relative'>" |
| 65 " <foreignObject width=400 height=500>" | 61 " <foreignObject width=400 height=500>" |
| 66 " <div id=target xmlns='http://www.w3.org/1999/xhtml' " | 62 " <div id=target xmlns='http://www.w3.org/1999/xhtml' " |
| 67 "style='position: relative'></div>" | 63 "style='position: relative'></div>" |
| 68 " </foreignObject>" | 64 " </foreignObject>" |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 | 256 |
| 261 parent->clipper().clearClipRectsIncludingDescendants(AbsoluteClipRects); | 257 parent->clipper().clearClipRectsIncludingDescendants(AbsoluteClipRects); |
| 262 | 258 |
| 263 EXPECT_TRUE(parent->clipRectsCache()); | 259 EXPECT_TRUE(parent->clipRectsCache()); |
| 264 EXPECT_TRUE(child->clipRectsCache()); | 260 EXPECT_TRUE(child->clipRectsCache()); |
| 265 EXPECT_FALSE(parent->clipRectsCache()->get(AbsoluteClipRects).root); | 261 EXPECT_FALSE(parent->clipRectsCache()->get(AbsoluteClipRects).root); |
| 266 EXPECT_FALSE(parent->clipRectsCache()->get(AbsoluteClipRects).root); | 262 EXPECT_FALSE(parent->clipRectsCache()->get(AbsoluteClipRects).root); |
| 267 } | 263 } |
| 268 | 264 |
| 269 } // namespace blink | 265 } // namespace blink |
| OLD | NEW |