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

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

Issue 2596623002: Create compositor animations for effect animations in SPv2. (Closed)
Patch Set: Add 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/paint/PaintPropertyTreeBuilderTest.h" 5 #include "core/paint/PaintPropertyTreeBuilderTest.h"
6 6
7 #include "core/html/HTMLIFrameElement.h" 7 #include "core/html/HTMLIFrameElement.h"
8 #include "core/layout/LayoutTreeAsText.h" 8 #include "core/layout/LayoutTreeAsText.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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 "<div id='transform' " 396 "<div id='transform' "
397 " style='animation-name: test; animation-duration: 1s'>" 397 " style='animation-name: test; animation-duration: 1s'>"
398 "</div>"); 398 "</div>");
399 399
400 Element* transform = document().getElementById("transform"); 400 Element* transform = document().getElementById("transform");
401 const ObjectPaintProperties* transformProperties = 401 const ObjectPaintProperties* transformProperties =
402 transform->layoutObject()->paintProperties(); 402 transform->layoutObject()->paintProperties();
403 EXPECT_TRUE(transformProperties->transform()->hasDirectCompositingReasons()); 403 EXPECT_TRUE(transformProperties->transform()->hasDirectCompositingReasons());
404 } 404 }
405 405
406 namespace {
407
408 const char* kSimpleOpacityExampleHTML =
409 "<style>"
410 "div {"
411 " width: 100px;"
412 " height: 100px;"
413 " background-color: red;"
414 " animation-name: example;"
415 " animation-duration: 4s;"
416 "}"
417 "@keyframes example {"
418 " from { opacity: 0.0;}"
419 " to { opacity: 1.0;}"
420 "}"
421 "</style>"
422 "<div id='target'></div>";
423
424 } // namespace
425
406 TEST_P(PaintPropertyTreeBuilderTest, 426 TEST_P(PaintPropertyTreeBuilderTest,
407 OpacityAnimationDoesNotCreateTransformNode) { 427 OpacityAnimationDoesNotCreateTransformNode) {
408 setBodyInnerHTML( 428 setBodyInnerHTML(kSimpleOpacityExampleHTML);
409 "<style>"
410 "div {"
411 " width: 100px;"
412 " height: 100px;"
413 " background-color: red;"
414 " animation-name: example;"
415 " animation-duration: 4s;"
416 "}"
417 "@keyframes example {"
418 " from { opacity: 0.0;}"
419 " to { opacity: 1.0;}"
420 "}"
421 "</style>"
422 "<div id='target'></div>");
423
424 Element* target = document().getElementById("target"); 429 Element* target = document().getElementById("target");
425 const ObjectPaintProperties* properties = 430 const ObjectPaintProperties* properties =
426 target->layoutObject()->paintProperties(); 431 target->layoutObject()->paintProperties();
427 EXPECT_EQ(nullptr, properties->transform()); 432 EXPECT_EQ(nullptr, properties->transform());
428 } 433 }
429 434
435 TEST_P(PaintPropertyTreeBuilderTest,
436 EffectNodeWithActiveAnimationHasDirectCompositingReason) {
437 setBodyInnerHTML(kSimpleOpacityExampleHTML);
438 Element* target = document().getElementById("target");
439 const ObjectPaintProperties* properties =
440 target->layoutObject()->paintProperties();
441 EXPECT_TRUE(properties->effect()->hasDirectCompositingReasons());
442 }
443
430 TEST_P(PaintPropertyTreeBuilderTest, WillChangeTransform) { 444 TEST_P(PaintPropertyTreeBuilderTest, WillChangeTransform) {
431 setBodyInnerHTML( 445 setBodyInnerHTML(
432 "<style> body { margin: 0 } </style>" 446 "<style> body { margin: 0 } </style>"
433 "<div id='transform' style='margin-left: 50px; margin-top: 100px;" 447 "<div id='transform' style='margin-left: 50px; margin-top: 100px;"
434 " width: 400px; height: 300px;" 448 " width: 400px; height: 300px;"
435 " will-change: transform'>" 449 " will-change: transform'>"
436 "</div>"); 450 "</div>");
437 451
438 Element* transform = document().getElementById("transform"); 452 Element* transform = document().getElementById("transform");
439 const ObjectPaintProperties* transformProperties = 453 const ObjectPaintProperties* transformProperties =
(...skipping 2428 matching lines...) Expand 10 before | Expand all | Expand 10 after
2868 EXPECT_EQ(framePreTranslation(), 2882 EXPECT_EQ(framePreTranslation(),
2869 childProperties->paintOffsetTranslation()->parent()); 2883 childProperties->paintOffsetTranslation()->parent());
2870 EXPECT_EQ(childProperties->paintOffsetTranslation(), 2884 EXPECT_EQ(childProperties->paintOffsetTranslation(),
2871 childPaintState.transform()); 2885 childPaintState.transform());
2872 // This will change once we added clip expansion node. 2886 // This will change once we added clip expansion node.
2873 EXPECT_EQ(filterProperties->effect()->outputClip(), childPaintState.clip()); 2887 EXPECT_EQ(filterProperties->effect()->outputClip(), childPaintState.clip());
2874 EXPECT_EQ(filterProperties->effect(), childPaintState.effect()); 2888 EXPECT_EQ(filterProperties->effect(), childPaintState.effect());
2875 } 2889 }
2876 2890
2877 } // namespace blink 2891 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698