Commit b21c50dc authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

Fix PaintLayer::HasNonEmptyChildLayoutObjects() with overflow:visible child

Bug: 1128440
Change-Id: I9f64c6d8bbe0228dae3ecf6f49caaed2a785f970
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2451849Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814332}
parent 10119600
...@@ -3071,14 +3071,14 @@ bool PaintLayer::HasNonEmptyChildLayoutObjects() const { ...@@ -3071,14 +3071,14 @@ bool PaintLayer::HasNonEmptyChildLayoutObjects() const {
// <img src=...> // <img src=...>
// </div> // </div>
// so test for 0x0 LayoutTexts here // so test for 0x0 LayoutTexts here
for (LayoutObject* child = GetLayoutObject().SlowFirstChild(); child; for (const auto* child = GetLayoutObject().SlowFirstChild(); child;
child = child->NextSibling()) { child = child->NextSibling()) {
if (!child->HasLayer()) { if (!child->HasLayer()) {
if (child->IsLayoutInline() || !child->IsBox()) if (child->IsLayoutInline() || !child->IsBox())
return true; return true;
if (ToLayoutBox(child)->Size().Width() > 0 || const auto* box = ToLayoutBox(child);
ToLayoutBox(child)->Size().Height() > 0) if (!box->Size().IsZero() || box->HasVisualOverflow())
return true; return true;
} }
} }
......
...@@ -2932,4 +2932,17 @@ TEST_P(PaintLayerTest, GlobalRootScrollerHitTest) { ...@@ -2932,4 +2932,17 @@ TEST_P(PaintLayerTest, GlobalRootScrollerHitTest) {
} }
} }
TEST_P(PaintLayerTest, HasNonEmptyChildLayoutObjectsZeroSizeOverflowVisible) {
SetBodyInnerHTML(R"HTML(
<div id="layer" style="position: relative">
<div style="overflow: visible; height: 0; width: 0">text</div>
</div>
)HTML");
auto* layer = ToLayoutBox(GetLayoutObjectByElementId("layer"))->Layer();
EXPECT_TRUE(layer->HasVisibleContent());
EXPECT_FALSE(layer->HasVisibleDescendant());
EXPECT_TRUE(layer->HasNonEmptyChildLayoutObjects());
}
} // namespace blink } // namespace blink
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-will-change/#will-change">
<link rel="match" href="will-change-transform-zero-size-child-overflow-visible-ref.html">
<div style="will-change: transform">
<div style="width: 0; height: 0; overflow: visible; white-space: nowrap">This should be visible</div>
</div>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment