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

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

Issue 2729683002: Handle resize in PaintPropertyTreeBuilder::updateForObjectSizeAndLocation() (Closed)
Patch Set: Fix a typo (ScrollbarWithChange -> ScrollbarWidthChange) Created 3 years, 9 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
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 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 auto* clip = getLayoutObjectByElementId("clip"); 672 auto* clip = getLayoutObjectByElementId("clip");
673 EXPECT_EQ(FloatRect(45, 50, 105, 100), 673 EXPECT_EQ(FloatRect(45, 50, 105, 100),
674 clip->paintProperties()->cssClip()->clipRect().rect()); 674 clip->paintProperties()->cssClip()->clipRect().rect());
675 675
676 outer->setAttribute(HTMLNames::styleAttr, "height: 200px"); 676 outer->setAttribute(HTMLNames::styleAttr, "height: 200px");
677 document().view()->updateAllLifecyclePhases(); 677 document().view()->updateAllLifecyclePhases();
678 EXPECT_EQ(FloatRect(45, 50, 105, 200), 678 EXPECT_EQ(FloatRect(45, 50, 105, 200),
679 clip->paintProperties()->cssClip()->clipRect().rect()); 679 clip->paintProperties()->cssClip()->clipRect().rect());
680 } 680 }
681 681
682 TEST_P(PaintPropertyTreeUpdateTest, ScrollBoundsChange) {
683 setBodyInnerHTML(
684 "<div id='container'"
685 " style='width: 100px; height: 100px; overflow: scroll'>"
686 " <div id='content' style='width: 200px; height: 200px'></div>"
687 "</div>");
688
689 auto* container = getLayoutObjectByElementId("container");
690 auto* scrollNode =
691 container->paintProperties()->scrollTranslation()->scrollNode();
692 EXPECT_EQ(IntSize(100, 100), scrollNode->clip());
693 EXPECT_EQ(IntSize(200, 200), scrollNode->bounds());
694
695 document().getElementById("content")->setAttribute(
696 HTMLNames::styleAttr, "width: 200px; height: 300px");
697 document().view()->updateAllLifecyclePhases();
698 EXPECT_EQ(scrollNode,
699 container->paintProperties()->scrollTranslation()->scrollNode());
700 EXPECT_EQ(IntSize(100, 100), scrollNode->clip());
701 EXPECT_EQ(IntSize(200, 300), scrollNode->bounds());
702 }
703
704 TEST_P(PaintPropertyTreeUpdateTest, ScrollbarWidthChange) {
705 setBodyInnerHTML(
706 "<style>::-webkit-scrollbar {width: 20px; height: 20px}</style>"
707 "<div id='container'"
708 " style='width: 100px; height: 100px; overflow: scroll'>"
709 " <div id='content' style='width: 200px; height: 200px'></div>"
710 "</div>");
711
712 auto* container = getLayoutObjectByElementId("container");
713 auto* overflowClip = container->paintProperties()->overflowClip();
714 EXPECT_EQ(FloatSize(80, 80), overflowClip->clipRect().rect().size());
715
716 auto* newStyle = document().createElement("style");
717 newStyle->setTextContent("::-webkit-scrollbar {width: 40px; height: 40px}");
718 document().body()->appendChild(newStyle);
719
720 document().view()->updateAllLifecyclePhases();
721 EXPECT_EQ(overflowClip, container->paintProperties()->overflowClip());
722 EXPECT_EQ(FloatSize(60, 60), overflowClip->clipRect().rect().size());
723 }
724
682 } // namespace blink 725 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698