Commit f006ecb3 authored by Koji Ishii's avatar Koji Ishii Committed by Commit Bot

[FragmentItem] Fix NGInkOverflow not to include empty rects

Legacy and NGPaintFragment ignores empty rects (i.e., width
and height are zero) even when their offsets are outside of
the frame rects.

This patch changes |NGInkOverflow| to match the behavior.

Note, the behavior of `backdrop-filter` using the visual
rect for inline boxes look questionable and weird, probably
needs a separate fix, but it helped to find the change of
the ink overflow in r784976 <crrev.com/c/2269389>. Filed
crbug.com/1123089 for the `backdrop-filter` issue.

The 3 rebaselines for paint/invalidation were incorrectly
rebaselined by r789685 crrev.com/c/2300667 due to this
issue.

Bug: 1122021
Change-Id: Ida5fc770963efedd219eecf602c2f33dfec51b73
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2379444
Commit-Queue: Koji Ishii <kojii@chromium.org>
Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: default avatarXianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#802760}
parent 2d74ea6a
......@@ -24,6 +24,8 @@ struct SameSizeAsNGInkOverflow {
ASSERT_SIZE(NGInkOverflow, SameSizeAsNGInkOverflow);
inline bool HasOverflow(const PhysicalRect& rect, const PhysicalSize& size) {
if (rect.IsEmpty())
return false;
return rect.X() < 0 || rect.Y() < 0 || rect.Right() > size.width ||
rect.Bottom() > size.height;
}
......
......@@ -26,6 +26,16 @@ class NGInkOverflowTest : public testing::Test, private ScopedLayoutNGForTest {
NGInkOverflowTest() : ScopedLayoutNGForTest(true) {}
};
TEST_F(NGInkOverflowTest, Empty) {
NGInkOverflow overflow;
NGInkOverflow::Type type =
overflow.Set(NGInkOverflow::Type::kNotSet, {0, 0, 100, 117},
// This does not affect the visual rect even if the offset is
// outside, because the size is empty.
{-24, 50, 0, 0}, {100, 117});
EXPECT_EQ(type, NGInkOverflow::Type::kNone);
}
#define MIN_LARGE32 4
#define MIN_LARGE64 1024
#if UINTPTR_MAX == 0xFFFFFFFF
......
......@@ -7,7 +7,7 @@
"backgroundColor": "#FFFFFF"
},
{
"name": "LayoutInline (relative positioned) SPAN",
"name": "LayoutNGBlockFlow (relative positioned) (floating) DIV id='float'",
"position": [158, 158],
"bounds": [100, 100],
"contentsOpaque": true,
......
......@@ -9,7 +9,7 @@
{
"name": "LayoutInline (relative positioned) SPAN",
"position": [8, 8],
"bounds": [200, 100]
"drawsContent": false
},
{
"name": "LayoutNGBlockFlow (relative positioned) (floating) DIV id='float'",
......
......@@ -9,7 +9,7 @@
{
"name": "LayoutInline (relative positioned) SPAN",
"position": [8, 8],
"bounds": [200, 100]
"drawsContent": false
},
{
"name": "LayoutNGBlockFlow (relative positioned) (floating) DIV id='float'",
......
......@@ -8,10 +8,12 @@
},
{
"name": "LayoutInline (relative positioned) SPAN",
"position": [8, 8],
"bounds": [250, 250],
"position": [158, 158],
"bounds": [100, 100],
"contentsOpaque": true,
"backgroundColor": "#008000",
"invalidations": [
[150, 150, 100, 100]
[0, 0, 100, 100]
]
}
]
......
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