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

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

Issue 2604973002: Move computation of 3D descendants to the descendant-dependent flags walk. (Closed)
Patch Set: none 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/paint/PaintLayerTest.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerTest.cpp b/third_party/WebKit/Source/core/paint/PaintLayerTest.cpp
index aa3d293a52bb1e73c5251e9081c6f6abcf280cb4..0c5802f72c28f8444b45d3c4fa4bf3a196e4f29c 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerTest.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerTest.cpp
@@ -290,6 +290,84 @@ TEST_P(PaintLayerTest, HasVisibleDescendant) {
EXPECT_FALSE(invisible->hasDescendantWithClipPath());
}
+TEST_P(PaintLayerTest, Has3DTransformedDescendant) {
+ enableCompositing();
+ setBodyInnerHTML(
+ "<div id='parent' style='position:relative; z-index: 0'>"
+ " <div id='child' style='transform: translateZ(1px)'>"
+ " </div>"
+ "</div>");
+ PaintLayer* parent =
+ toLayoutBoxModelObject(getLayoutObjectByElementId("parent"))->layer();
+ PaintLayer* child =
+ toLayoutBoxModelObject(getLayoutObjectByElementId("child"))->layer();
+
+ EXPECT_TRUE(parent->has3DTransformedDescendant());
+ EXPECT_FALSE(child->has3DTransformedDescendant());
+}
+
+TEST_P(PaintLayerTest, Has3DTransformedDescendantChangeStyle) {
+ enableCompositing();
+ setBodyInnerHTML(
+ "<div id='parent' style='position:relative; z-index: 0'>"
+ " <div id='child' style='position:relative '>"
+ " </div>"
+ "</div>");
+ PaintLayer* parent =
+ toLayoutBoxModelObject(getLayoutObjectByElementId("parent"))->layer();
+ PaintLayer* child =
+ toLayoutBoxModelObject(getLayoutObjectByElementId("child"))->layer();
+
+ EXPECT_FALSE(parent->has3DTransformedDescendant());
+ EXPECT_FALSE(child->has3DTransformedDescendant());
+
+ document().getElementById("child")->setAttribute(
+ HTMLNames::styleAttr, "transform: translateZ(1px)");
+ document().view()->updateAllLifecyclePhases();
+
+ EXPECT_TRUE(parent->has3DTransformedDescendant());
+ EXPECT_FALSE(child->has3DTransformedDescendant());
+}
+
+TEST_P(PaintLayerTest, Has3DTransformedDescendantNotStacking) {
+ enableCompositing();
+ setBodyInnerHTML(
+ "<div id='parent' style='position:relative;'>"
+ " <div id='child' style='transform: translateZ(1px)'>"
+ " </div>"
+ "</div>");
+ PaintLayer* parent =
+ toLayoutBoxModelObject(getLayoutObjectByElementId("parent"))->layer();
+ PaintLayer* child =
+ toLayoutBoxModelObject(getLayoutObjectByElementId("child"))->layer();
+
+ // |child| is not a stacking child of |parent|, so it has no 3D transformed
+ // descendant.
+ EXPECT_FALSE(parent->has3DTransformedDescendant());
+ EXPECT_FALSE(child->has3DTransformedDescendant());
+}
+
+TEST_P(PaintLayerTest, Has3DTransformedGrandchildWithPreserve3d) {
+ enableCompositing();
+ setBodyInnerHTML(
+ "<div id='parent' style='position:relative; z-index: 0'>"
+ " <div id='child' style='transform-style: preserve-3d'>"
+ " <div id='grandchild' style='transform: translateZ(1px)'>"
+ " </div>"
+ " </div>"
+ "</div>");
+ PaintLayer* parent =
+ toLayoutBoxModelObject(getLayoutObjectByElementId("parent"))->layer();
+ PaintLayer* child =
+ toLayoutBoxModelObject(getLayoutObjectByElementId("child"))->layer();
+ PaintLayer* grandchild =
+ toLayoutBoxModelObject(getLayoutObjectByElementId("grandchild"))->layer();
+
+ EXPECT_TRUE(parent->has3DTransformedDescendant());
+ EXPECT_TRUE(child->has3DTransformedDescendant());
+ EXPECT_FALSE(grandchild->has3DTransformedDescendant());
+}
+
TEST_P(PaintLayerTest, DescendantDependentFlagsStopsAtThrottledFrames) {
enableCompositing();
setBodyInnerHTML(

Powered by Google App Engine
This is Rietveld 408576698