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

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

Issue 2602453002: Update perspective paint properties on perspective-origin changes (Closed)
Patch Set: Update comment, add a relative length update test 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/paint/PaintPropertyTreeBuilderTest.h" 6 #include "core/paint/PaintPropertyTreeBuilderTest.h"
7 #include "core/paint/PaintPropertyTreePrinter.h" 7 #include "core/paint/PaintPropertyTreePrinter.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 const ObjectPaintProperties* properties = 491 const ObjectPaintProperties* properties =
492 target->layoutObject()->paintProperties(); 492 target->layoutObject()->paintProperties();
493 EXPECT_TRUE(properties->effect()->hasDirectCompositingReasons()); 493 EXPECT_TRUE(properties->effect()->hasDirectCompositingReasons());
494 494
495 // Removing the animation should remove the effect node. 495 // Removing the animation should remove the effect node.
496 target->removeAttribute(HTMLNames::classAttr); 496 target->removeAttribute(HTMLNames::classAttr);
497 document().view()->updateAllLifecyclePhases(); 497 document().view()->updateAllLifecyclePhases();
498 EXPECT_EQ(nullptr, properties->effect()); 498 EXPECT_EQ(nullptr, properties->effect());
499 } 499 }
500 500
501 TEST_P(PaintPropertyTreeUpdateTest, PerspectiveOriginUpdatesOnSizeChanges) {
502 setBodyInnerHTML(
503 "<style>"
504 " body { margin: 0 }"
505 " #perspective {"
506 " position: absolute;"
507 " perspective: 100px;"
508 " width: 100px;"
509 " perspective-origin: 50% 50% 0;"
510 " }"
511 "</style>"
512 "<div id='perspective'>"
513 " <div id='contents'></div>"
514 "</div>");
515
516 auto* perspective = document().getElementById("perspective")->layoutObject();
517 EXPECT_EQ(TransformationMatrix().applyPerspective(100),
518 perspective->paintProperties()->perspective()->matrix());
519 EXPECT_EQ(FloatPoint3D(50, 0, 0),
520 perspective->paintProperties()->perspective()->origin());
521
522 auto* contents = document().getElementById("contents");
523 contents->setAttribute(HTMLNames::styleAttr, "height: 200px;");
524 document().view()->updateAllLifecyclePhases();
525 EXPECT_EQ(TransformationMatrix().applyPerspective(100),
526 perspective->paintProperties()->perspective()->matrix());
527 EXPECT_EQ(FloatPoint3D(50, 100, 0),
528 perspective->paintProperties()->perspective()->origin());
529 }
530
531 TEST_P(PaintPropertyTreeUpdateTest, TransformUpdatesOnRelativeLengthChanges) {
532 setBodyInnerHTML(
533 "<style>"
534 " body { margin: 0 }"
535 " #transform {"
536 " transform: translate3d(50%, 50%, 0);"
537 " width: 100px;"
538 " height: 200px;"
539 " }"
540 "</style>"
541 "<div id='transform'></div>");
542
543 auto* transform = document().getElementById("transform");
544 auto* transformObject = transform->layoutObject();
545 EXPECT_EQ(TransformationMatrix().translate3d(50, 100, 0),
546 transformObject->paintProperties()->transform()->matrix());
547
548 transform->setAttribute(HTMLNames::styleAttr, "width: 200px; height: 300px;");
549 document().view()->updateAllLifecyclePhases();
550 EXPECT_EQ(TransformationMatrix().translate3d(100, 150, 0),
551 transformObject->paintProperties()->transform()->matrix());
552 }
553
501 } // namespace blink 554 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698