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

Unified Diff: third_party/WebKit/Source/core/paint/PaintLayerClipperTest.cpp

Issue 2617903002: Convert recursion to iteration in clearClipRectsIncludingDescendants (Closed)
Patch Set: none Created 3 years, 11 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
index 8cacaeb8a22e35606d0ceb6dbbf43f4b67da5ffa..b7733458624dec05a8fd0b54d4b70b392ef370bd 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerClipperTest.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerClipperTest.cpp
@@ -144,4 +144,92 @@ TEST_F(PaintLayerClipperTest, LocalClipRectFixedUnderTransform) {
fixed->clipper().localClipRect(transformed));
}
+TEST_F(PaintLayerClipperTest, ClearClipRectsRecursive) {
+ setBodyInnerHTML(
+ "<style>"
+ "div { "
+ " width: 5px; height: 5px; background: blue;"
+ " position: relative;"
+ "}"
+ "</style>"
+ "<div id='parent'>"
+ " <div id='child'>"
+ " <div id='grandchild'></div>"
+ " </div>"
+ "</div>");
+
+ PaintLayer* parent =
+ toLayoutBoxModelObject(getLayoutObjectByElementId("parent"))->layer();
+ PaintLayer* child =
+ toLayoutBoxModelObject(getLayoutObjectByElementId("child"))->layer();
+
+ EXPECT_TRUE(parent->clipRectsCache());
+ EXPECT_TRUE(child->clipRectsCache());
+
+ parent->clipper().clearClipRectsIncludingDescendants();
+
+ EXPECT_FALSE(parent->clipRectsCache());
+ EXPECT_FALSE(child->clipRectsCache());
+}
+
+TEST_F(PaintLayerClipperTest, ClearClipRectsRecursiveChild) {
+ setBodyInnerHTML(
+ "<style>"
+ "div { "
+ " width: 5px; height: 5px; background: blue;"
+ " position: relative;"
+ "}"
+ "</style>"
+ "<div id='parent'>"
+ " <div id='child'>"
+ " <div id='grandchild'></div>"
+ " </div>"
+ "</div>");
+
+ PaintLayer* parent =
+ toLayoutBoxModelObject(getLayoutObjectByElementId("parent"))->layer();
+ PaintLayer* child =
+ toLayoutBoxModelObject(getLayoutObjectByElementId("child"))->layer();
+
+ EXPECT_TRUE(parent->clipRectsCache());
+ EXPECT_TRUE(child->clipRectsCache());
+
+ child->clipper().clearClipRectsIncludingDescendants();
+
+ EXPECT_TRUE(parent->clipRectsCache());
+ EXPECT_FALSE(child->clipRectsCache());
+}
+
+TEST_F(PaintLayerClipperTest, ClearClipRectsRecursiveOneType) {
+ setBodyInnerHTML(
+ "<style>"
+ "div { "
+ " width: 5px; height: 5px; background: blue;"
+ " position: relative;"
+ "}"
+ "</style>"
+ "<div id='parent'>"
+ " <div id='child'>"
+ " <div id='grandchild'></div>"
+ " </div>"
+ "</div>");
+
+ PaintLayer* parent =
+ toLayoutBoxModelObject(getLayoutObjectByElementId("parent"))->layer();
+ PaintLayer* child =
+ toLayoutBoxModelObject(getLayoutObjectByElementId("child"))->layer();
+
+ EXPECT_TRUE(parent->clipRectsCache());
+ EXPECT_TRUE(child->clipRectsCache());
+ EXPECT_TRUE(parent->clipRectsCache()->get(AbsoluteClipRects).root);
+ EXPECT_TRUE(child->clipRectsCache()->get(AbsoluteClipRects).root);
+
+ parent->clipper().clearClipRectsIncludingDescendants(AbsoluteClipRects);
+
+ EXPECT_TRUE(parent->clipRectsCache());
+ EXPECT_TRUE(child->clipRectsCache());
+ EXPECT_FALSE(parent->clipRectsCache()->get(AbsoluteClipRects).root);
+ EXPECT_FALSE(parent->clipRectsCache()->get(AbsoluteClipRects).root);
+}
+
} // 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