| Index: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
|
| diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
|
| index 2af3d7fe368e997a67167a2c3fa49b863856bfd2..1ad7921f6a9e95710d4c818aa43476955b71983c 100644
|
| --- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
|
| +++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
|
| @@ -3029,4 +3029,53 @@ TEST_P(PaintPropertyTreeBuilderTest, BuildingStopsAtThrottledFrames) {
|
| EXPECT_FALSE(iframeTransform->descendantNeedsPaintPropertyUpdate());
|
| }
|
|
|
| +TEST_P(PaintPropertyTreeBuilderTest, OverflowClipRecomputedOnChange) {
|
| + setBodyInnerHTML(
|
| + "<style>"
|
| + "body { margin:0 }"
|
| + "#div { overflow:hidden; height:0px; }"
|
| + "</style>"
|
| + "<div id='div'></div>");
|
| + auto* div = document().getElementById("div");
|
| + div->setAttribute(HTMLNames::styleAttr, "display:inline-block; width:7px;");
|
| + document().view()->updateAllLifecyclePhases();
|
| + auto* properties = div->layoutObject()->paintProperties()->overflowClip();
|
| + EXPECT_EQ(FloatRect(0, 0, 7, 0), properties->clipRect().rect());
|
| +
|
| + // Width changes should update the overflow clip.
|
| + div->setAttribute(HTMLNames::styleAttr, "display:inline-block; width:7px;");
|
| + document().view()->updateAllLifecyclePhases();
|
| + properties = div->layoutObject()->paintProperties()->overflowClip();
|
| + EXPECT_EQ(FloatRect(0, 0, 7, 0), properties->clipRect().rect());
|
| + div->setAttribute(HTMLNames::styleAttr, "display:inline-block; width:9px;");
|
| + document().view()->updateAllLifecyclePhases();
|
| + EXPECT_EQ(FloatRect(0, 0, 9, 0), properties->clipRect().rect());
|
| +
|
| + // An inline block's overflow clip should be updated when padding changes,
|
| + // even if the border box remains unchanged.
|
| + div->setAttribute(HTMLNames::styleAttr,
|
| + "display:inline-block; width:7px; padding-right:3px;");
|
| + document().view()->updateAllLifecyclePhases();
|
| + properties = div->layoutObject()->paintProperties()->overflowClip();
|
| + EXPECT_EQ(FloatRect(0, 0, 10, 0), properties->clipRect().rect());
|
| + div->setAttribute(HTMLNames::styleAttr,
|
| + "display:inline-block; width:8px; padding-right:2px;");
|
| + document().view()->updateAllLifecyclePhases();
|
| + EXPECT_EQ(FloatRect(0, 0, 10, 0), properties->clipRect().rect());
|
| + div->setAttribute(HTMLNames::styleAttr,
|
| + "display:inline-block; width:8px;"
|
| + "padding-right:1px; padding-left:1px;");
|
| + document().view()->updateAllLifecyclePhases();
|
| + EXPECT_EQ(FloatRect(0, 0, 10, 0), properties->clipRect().rect());
|
| +
|
| + // An block's overflow clip should be updated when borders change.
|
| + div->setAttribute(HTMLNames::styleAttr, "border-right:3px solid red;");
|
| + document().view()->updateAllLifecyclePhases();
|
| + properties = div->layoutObject()->paintProperties()->overflowClip();
|
| + EXPECT_EQ(FloatRect(0, 0, 797, 0), properties->clipRect().rect());
|
| + div->setAttribute(HTMLNames::styleAttr, "border-right:5px solid red;");
|
| + document().view()->updateAllLifecyclePhases();
|
| + EXPECT_EQ(FloatRect(0, 0, 795, 0), properties->clipRect().rect());
|
| +}
|
| +
|
| } // namespace blink
|
|
|