Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayerClipperTest.cpp

Issue 2576883002: RootLayerScrolling: fix PaintLayerClipperTest. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 class PaintLayerClipperTest : public RenderingTest { 14 class PaintLayerClipperTest : public RenderingTest {
15 public: 15 public:
16 PaintLayerClipperTest() : RenderingTest(EmptyFrameLoaderClient::create()) {} 16 PaintLayerClipperTest() : RenderingTest(EmptyFrameLoaderClient::create()) {}
17 }; 17 };
18 18
19 TEST_F(PaintLayerClipperTest, LayoutSVGRoot) { 19 TEST_F(PaintLayerClipperTest, LayoutSVGRoot) {
20 setBodyInnerHTML( 20 setBodyInnerHTML(
21 "<!DOCTYPE html>" 21 "<!DOCTYPE html>"
22 "<svg id=target width=200 height=300 style='position: relative'>" 22 "<svg id=target width=200 height=300 style='position: relative'>"
23 " <rect width=400 height=500 fill='blue'/>" 23 " <rect width=400 height=500 fill='blue'/>"
24 "</svg>"); 24 "</svg>");
25 25
26 Element* target = document().getElementById("target"); 26 Element* target = document().getElementById("target");
27 PaintLayer* targetPaintLayer = 27 PaintLayer* targetPaintLayer =
28 toLayoutBoxModelObject(target->layoutObject())->layer(); 28 toLayoutBoxModelObject(target->layoutObject())->layer();
29 ClipRectsContext context(document().layoutView()->layer(), UncachedClipRects); 29 ClipRectsContext context(document().layoutView()->layer(), UncachedClipRects);
30 // When RLS is enabled, the LayoutView will have a composited scrolling layer,
31 // so don't apply an overflow clip.
32 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled())
33 context.setIgnoreOverflowClip();
30 LayoutRect layerBounds; 34 LayoutRect layerBounds;
31 ClipRect backgroundRect, foregroundRect; 35 ClipRect backgroundRect, foregroundRect;
32 targetPaintLayer->clipper().calculateRects( 36 targetPaintLayer->clipper().calculateRects(
33 context, LayoutRect(LayoutRect::infiniteIntRect()), layerBounds, 37 context, LayoutRect(LayoutRect::infiniteIntRect()), layerBounds,
34 backgroundRect, foregroundRect); 38 backgroundRect, foregroundRect);
35 EXPECT_EQ(LayoutRect(LayoutRect::infiniteIntRect()), backgroundRect.rect()); 39 EXPECT_EQ(LayoutRect(LayoutRect::infiniteIntRect()), backgroundRect.rect());
36 EXPECT_EQ(LayoutRect(LayoutRect::infiniteIntRect()), foregroundRect.rect()); 40 EXPECT_EQ(LayoutRect(LayoutRect::infiniteIntRect()), foregroundRect.rect());
37 EXPECT_EQ(LayoutRect(8, 8, 200, 300), layerBounds); 41 EXPECT_EQ(LayoutRect(8, 8, 200, 300), layerBounds);
38 } 42 }
39 43
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 PaintLayer* fixed = 138 PaintLayer* fixed =
135 toLayoutBoxModelObject(getLayoutObjectByElementId("fixed"))->layer(); 139 toLayoutBoxModelObject(getLayoutObjectByElementId("fixed"))->layer();
136 140
137 EXPECT_EQ(LayoutRect(0, 0, 100, 100), 141 EXPECT_EQ(LayoutRect(0, 0, 100, 100),
138 transformed->clipper().localClipRect(transformed)); 142 transformed->clipper().localClipRect(transformed));
139 EXPECT_EQ(LayoutRect(0, 50, 100, 100), 143 EXPECT_EQ(LayoutRect(0, 50, 100, 100),
140 fixed->clipper().localClipRect(transformed)); 144 fixed->clipper().localClipRect(transformed));
141 } 145 }
142 146
143 } // namespace blink 147 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698