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

Unified 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, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/paint/PaintLayerClipperTest.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerClipperTest.cpp b/third_party/WebKit/Source/core/paint/PaintLayerClipperTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..e65b4a707d87ee5fcf26ebd817e6cb0553692d6d
--- /dev/null
+++ b/third_party/WebKit/Source/core/paint/PaintLayerClipperTest.cpp
@@ -0,0 +1,63 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/paint/PaintLayerClipper.h"
+
+#include "core/layout/LayoutBoxModelObject.h"
+#include "core/layout/LayoutTestHelper.h"
+#include "core/layout/LayoutView.h"
+#include "core/paint/PaintLayer.h"
+
+namespace blink {
+
+class PaintLayerClipperTest : public RenderingTest {
+public:
+ PaintLayerClipperTest()
+ : RenderingTest(SingleChildFrameLoaderClient::create())
+ { }
+};
+
+
+TEST_F(PaintLayerClipperTest, LayoutSVGRoot)
+{
+ setBodyInnerHTML("<!DOCTYPE html>"
+ "<svg id=target width=200 height=300 style='position: relative'>"
+ " <rect width=400 height=500 fill='blue'/>"
+ "</svg>");
+
+ Element* target = document().getElementById("target");
+ PaintLayer* targetPaintLayer = toLayoutBoxModelObject(target->layoutObject())->layer();
+ ClipRectsContext context(document().layoutView()->layer(), UncachedClipRects);
+ LayoutRect layerBounds;
+ ClipRect backgroundRect, foregroundRect;
+ targetPaintLayer->clipper().calculateRects(context, LayoutRect(LayoutRect::infiniteIntRect()), layerBounds,
+ backgroundRect, foregroundRect);
+ EXPECT_EQ(LayoutRect(LayoutRect::infiniteIntRect()), backgroundRect.rect());
+ EXPECT_EQ(LayoutRect(LayoutRect::infiniteIntRect()), foregroundRect.rect());
+ EXPECT_EQ(LayoutRect(8, 8, 200, 300), layerBounds);
+}
+
+TEST_F(PaintLayerClipperTest, LayoutSVGRootChild)
+{
+ setBodyInnerHTML(
+ "<svg width=200 height=300 style='position: relative'>"
+ " <foreignObject width=400 height=500>"
+ " <div id=target xmlns='http://www.w3.org/1999/xhtml' style='position: relative'></div>"
+ " </foreignObject>"
+ "</svg>");
+
+ Element* target = document().getElementById("target");
+ PaintLayer* targetPaintLayer = toLayoutBoxModelObject(target->layoutObject())->layer();
+ ClipRectsContext context(document().layoutView()->layer(), UncachedClipRects);
+ LayoutRect layerBounds;
+ ClipRect backgroundRect, foregroundRect;
+ targetPaintLayer->clipper().calculateRects(context, LayoutRect(LayoutRect::infiniteIntRect()), layerBounds,
+ backgroundRect, foregroundRect);
+ EXPECT_EQ(LayoutRect(8, 8, 200, 300), backgroundRect.rect());
+ EXPECT_EQ(LayoutRect(8, 8, 200, 300), foregroundRect.rect());
+ EXPECT_EQ(LayoutRect(8, 8, 400, 0), layerBounds);
+}
+
+
+} // namespace blink
« 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