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

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

Issue 2371523002: Apply SVG root viewport clips in PaintLayerClipper. (Closed)
Patch Set: none Created 4 years, 2 months 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 | « third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp ('k') | 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
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
pdr. 2016/09/26 17:04:52 Nit: 2016
chrishtr 2016/09/26 17:37:54 Done.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "core/paint/PaintLayerClipper.h"
6
7 #include "core/layout/LayoutBoxModelObject.h"
8 #include "core/layout/LayoutTestHelper.h"
9 #include "core/layout/LayoutView.h"
10 #include "core/paint/PaintLayer.h"
11
12 namespace blink {
13
14 class PaintLayerClipperTest : public RenderingTest {
15 public:
16 PaintLayerClipperTest()
17 : RenderingTest(SingleChildFrameLoaderClient::create())
18 { }
19 };
20
21
22 TEST_F(PaintLayerClipperTest, LayoutSVGRoot)
23 {
24 setBodyInnerHTML("<!DOCTYPE html>"
pdr. 2016/09/26 17:04:52 Nit: I recently learned setBodyInnerHTML literally
chrishtr 2016/09/26 17:37:54 Done.
25 "<svg id=target width=200 height=300 style='position: relative'>"
26 " <rect width=400 height=500 fill='blue'/>"
27 "</svg>");
28
29 Element* target = document().getElementById("target");
30 PaintLayer* targetPaintLayer = toLayoutBoxModelObject(target->layoutObject() )->layer();
31 ClipRectsContext context(document().layoutView()->layer(), UncachedClipRects );
32 LayoutRect layerBounds;
33 ClipRect backgroundRect, foregroundRect;
34 targetPaintLayer->clipper().calculateRects(context, LayoutRect(LayoutRect::i nfiniteIntRect()), layerBounds,
35 backgroundRect, foregroundRect);
36 EXPECT_EQ(LayoutRect(LayoutRect::infiniteIntRect()), backgroundRect.rect());
37 EXPECT_EQ(LayoutRect(LayoutRect::infiniteIntRect()), foregroundRect.rect());
38 EXPECT_EQ(LayoutRect(8, 8, 200, 300), layerBounds);
39 }
40
41 TEST_F(PaintLayerClipperTest, LayoutSVGRootChild)
42 {
43 setBodyInnerHTML("<!DOCTYPE html>"
44 "<svg width=200 height=300 style='position: relative'>"
45 " <foreignObject width=400 height=500>"
46 " <div id=target xmlns='http://www.w3.org/1999/xhtml' style='position : relative'></div>"
47 " </foreignObject>"
48 "</svg>");
49
50 Element* target = document().getElementById("target");
51 PaintLayer* targetPaintLayer = toLayoutBoxModelObject(target->layoutObject() )->layer();
52 ClipRectsContext context(document().layoutView()->layer(), UncachedClipRects );
53 LayoutRect layerBounds;
54 ClipRect backgroundRect, foregroundRect;
55 targetPaintLayer->clipper().calculateRects(context, LayoutRect(LayoutRect::i nfiniteIntRect()), layerBounds,
56 backgroundRect, foregroundRect);
57 EXPECT_EQ(LayoutRect(8, 8, 200, 300), backgroundRect.rect());
58 EXPECT_EQ(LayoutRect(8, 8, 200, 300), foregroundRect.rect());
59 EXPECT_EQ(LayoutRect(8, 8, 400, 0), layerBounds);
60 }
61
62
63 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698