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

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

Issue 2608543002: Store compositor element id in paint properties for animated objects. (Closed)
Patch Set: Hide create-dom-node method. Created 3 years, 12 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
Index: third_party/WebKit/Source/core/paint/PaintPropertyTreeUpdateTests.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeUpdateTests.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeUpdateTests.cpp
index 4401e5f140a3b696ed9423e4241b498eb3b09ed6..a2a0a834421fcee4b33d383cb1d3fe7f7ac19dda 100644
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeUpdateTests.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeUpdateTests.cpp
@@ -445,18 +445,7 @@ TEST_P(PaintPropertyTreeUpdateTest,
TEST_P(PaintPropertyTreeUpdateTest,
TransformNodeWithAnimationLosesNodeWhenAnimationRemoved) {
- setBodyInnerHTML(
- "<style>"
- "@keyframes test {"
- " 0% { transform: translate(1em, 1em) } "
- " 100% { transform: translate(2em, 2em) } "
- "} "
- ".animate { "
- " animation-name: test; "
- " animation-duration: 1s "
- "}"
- "</style>"
- "<div id='target' class='animate'></div>");
+ loadTestData("transform-animation.html");
Element* target = document().getElementById("target");
const ObjectPaintProperties* properties =
target->layoutObject()->paintProperties();
@@ -470,23 +459,7 @@ TEST_P(PaintPropertyTreeUpdateTest,
TEST_P(PaintPropertyTreeUpdateTest,
EffectNodeWithAnimationLosesNodeWhenAnimationRemoved) {
- setBodyInnerHTML(
- "<style>"
- "div {"
- " width: 100px;"
- " height: 100px;"
- " background-color: red;"
- "} "
- ".animate {"
- " animation-name: test;"
- " animation-duration: 4s;"
- "}"
- "@keyframes test {"
- " from { opacity: 0.0;}"
- " to { opacity: 1.0;}"
- "}"
- "</style>"
- "<div id='target' class='animate'></div>");
+ loadTestData("opacity-animation.html");
Element* target = document().getElementById("target");
const ObjectPaintProperties* properties =
target->layoutObject()->paintProperties();
@@ -498,6 +471,43 @@ TEST_P(PaintPropertyTreeUpdateTest,
EXPECT_EQ(nullptr, properties->effect());
}
+TEST_P(PaintPropertyTreeUpdateTest,
+ TransformNodeLosesCompositorElementIdWhenAnimationRemoved) {
+ loadTestData("transform-animation.html");
+
+ Element* target = document().getElementById("target");
+ target->setAttribute(HTMLNames::styleAttr, "transform: translateX(2em)");
+ document().view()->updateAllLifecyclePhases();
+
+ const ObjectPaintProperties* properties =
+ target->layoutObject()->paintProperties();
+ EXPECT_NE(CompositorElementId(),
+ properties->transform()->compositorElementId());
+
+ // Remove the animation but keep the transform on the element.
+ target->removeAttribute(HTMLNames::classAttr);
+ document().view()->updateAllLifecyclePhases();
+ EXPECT_EQ(CompositorElementId(),
+ properties->transform()->compositorElementId());
+}
+
+TEST_P(PaintPropertyTreeUpdateTest,
+ EffectNodeLosesCompositorElementIdWhenAnimationRemoved) {
+ loadTestData("opacity-animation.html");
+
+ Element* target = document().getElementById("target");
+ target->setAttribute(HTMLNames::styleAttr, "opacity: 0.2");
+ document().view()->updateAllLifecyclePhases();
+
+ const ObjectPaintProperties* properties =
+ target->layoutObject()->paintProperties();
+ EXPECT_NE(CompositorElementId(), properties->effect()->compositorElementId());
+
+ target->removeAttribute(HTMLNames::classAttr);
+ document().view()->updateAllLifecyclePhases();
+ EXPECT_EQ(CompositorElementId(), properties->effect()->compositorElementId());
+}
+
TEST_P(PaintPropertyTreeUpdateTest, PerspectiveOriginUpdatesOnSizeChanges) {
setBodyInnerHTML(
"<style>"

Powered by Google App Engine
This is Rietveld 408576698