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

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

Issue 2578343002: Support compositing for active animations in SPv2. (Closed)
Patch Set: Added unit tests. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/html/HTMLIFrameElement.h" 5 #include "core/html/HTMLIFrameElement.h"
6 #include "core/layout/LayoutTestHelper.h" 6 #include "core/layout/LayoutTestHelper.h"
7 #include "core/layout/LayoutTreeAsText.h" 7 #include "core/layout/LayoutTreeAsText.h"
8 #include "core/layout/api/LayoutViewItem.h" 8 #include "core/layout/api/LayoutViewItem.h"
9 #include "core/paint/ObjectPaintProperties.h" 9 #include "core/paint/ObjectPaintProperties.h"
10 #include "core/paint/PaintPropertyTreePrinter.h" 10 #include "core/paint/PaintPropertyTreePrinter.h"
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 transform->setAttribute( 371 transform->setAttribute(
372 HTMLNames::styleAttr, 372 HTMLNames::styleAttr,
373 "margin-left: 50px; margin-top: 100px; width: 400px; height: 300px; " 373 "margin-left: 50px; margin-top: 100px; width: 400px; height: 300px; "
374 "transform: translate3D(123px, 456px, 789px)"); 374 "transform: translate3D(123px, 456px, 789px)");
375 document().view()->updateAllLifecyclePhases(); 375 document().view()->updateAllLifecyclePhases();
376 EXPECT_EQ( 376 EXPECT_EQ(
377 TransformationMatrix().translate3d(123, 456, 789), 377 TransformationMatrix().translate3d(123, 456, 789),
378 transform->layoutObject()->paintProperties()->transform()->matrix()); 378 transform->layoutObject()->paintProperties()->transform()->matrix());
379 } 379 }
380 380
381 TEST_P(PaintPropertyTreeBuilderTest,
382 TransformNodeWithActiveAnimationHasDirectCompositingReason) {
383 setBodyInnerHTML(
384 "<style>"
385 "@keyframes test {"
386 " 0% { transform: translate(1em, 1em) } "
387 " 100% { transform: translate(2em, 2em) } "
388 "} "
389 "</style>"
390 "<div id='transform' "
391 " style='animation-name: test; animation-duration: 1s'>"
392 "</div>");
393
394 Element* transform = document().getElementById("transform");
395 const ObjectPaintProperties* transformProperties =
396 transform->layoutObject()->paintProperties();
397 EXPECT_TRUE(transformProperties->transform()->hasDirectCompositingReasons());
398 }
399
381 TEST_P(PaintPropertyTreeBuilderTest, WillChangeTransform) { 400 TEST_P(PaintPropertyTreeBuilderTest, WillChangeTransform) {
382 setBodyInnerHTML( 401 setBodyInnerHTML(
383 "<style> body { margin: 0 } </style>" 402 "<style> body { margin: 0 } </style>"
384 "<div id='transform' style='margin-left: 50px; margin-top: 100px;" 403 "<div id='transform' style='margin-left: 50px; margin-top: 100px;"
385 " width: 400px; height: 300px;" 404 " width: 400px; height: 300px;"
386 " will-change: transform'>" 405 " will-change: transform'>"
387 "</div>"); 406 "</div>");
388 407
389 Element* transform = document().getElementById("transform"); 408 Element* transform = document().getElementById("transform");
390 const ObjectPaintProperties* transformProperties = 409 const ObjectPaintProperties* transformProperties =
(...skipping 2834 matching lines...) Expand 10 before | Expand all | Expand 10 after
3225 setBodyInnerHTML("<div id='div' style='background-color: blue'>DIV</div>"); 3244 setBodyInnerHTML("<div id='div' style='background-color: blue'>DIV</div>");
3226 auto* div = document().getElementById("div"); 3245 auto* div = document().getElementById("div");
3227 3246
3228 document().view()->updateAllLifecyclePhases(); 3247 document().view()->updateAllLifecyclePhases();
3229 div->setAttribute(HTMLNames::styleAttr, "background-color: green"); 3248 div->setAttribute(HTMLNames::styleAttr, "background-color: green");
3230 document().view()->updateLifecycleToLayoutClean(); 3249 document().view()->updateLifecycleToLayoutClean();
3231 EXPECT_FALSE(div->layoutObject()->needsPaintPropertyUpdate()); 3250 EXPECT_FALSE(div->layoutObject()->needsPaintPropertyUpdate());
3232 } 3251 }
3233 3252
3234 } // namespace blink 3253 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698