0

Add outline rects for descendant with additional offset

When descendant has a layer, AddOutlineRects() and LocalToAncestorRects() has
different offset compared to legacy layout.

This CL use same offset to have same result.

Bug: 1330568
Change-Id: I535d97179c8b422d54cd8a7b18b3e26b8173411b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3686934
Reviewed-by: Koji Ishii <kojii@chromium.org>
Commit-Queue: jongdeok kim <jongdeok.kim@navercorp.com>
Reviewed-by: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1012803}
This commit is contained in:
jongdeok.kim
2022-06-10 01:09:22 +00:00
committed by Chromium LUCI CQ
parent 3a2b064284
commit 66a3db021b
3 changed files with 63 additions and 4 deletions

@ -963,14 +963,12 @@ void NGPhysicalFragment::AddOutlineRectsForDescendant(
if (descendant_box->HasLayer()) {
DCHECK(descendant_layout_object);
Vector<PhysicalRect> layer_outline_rects;
descendant_box->AddOutlineRects(additional_offset, outline_type,
descendant_box->AddOutlineRects(PhysicalOffset(), outline_type,
&layer_outline_rects);
// Don't pass additional_offset because LocalToAncestorRects will itself
// apply it.
descendant_layout_object->LocalToAncestorRects(
layer_outline_rects, containing_block, PhysicalOffset(),
PhysicalOffset());
additional_offset);
outline_rects->AppendVector(layer_outline_rects);
return;
}

@ -0,0 +1,31 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http:/html4/strict.dtd">
<html lang="en">
<head>
<style type="text/css">
.a {
background: green;
height: 30px;
width: 30px;
position: relative;
margin: 25px;
outline-color: red;
outline-style: auto;
}
.b {
background: blue;
height: 20px;
width: 20px;
top: 5px;
left: 5px;
position: relative;
}
.second {
margin-top: -5px;
}
</style>
</head>
<body>
<div class="a"><div class="b"></div></div>
<div class="a second"><div class="b"></div></div>
</body>
</html>

@ -0,0 +1,30 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http:/html4/strict.dtd">
<html lang="en">
<head>
<style type="text/css">
.a {
background: blue;
height: 20px;
width: 20px;
position: relative;
margin: 30px;
outline-color: red;
outline-style: auto;
}
.b {
background: green;
height: 100%;
width: 100%;
left: 0;
top: 0;
position: absolute;
transform: scale(1.5);
z-index: -1;
}
</style>
</head>
<body>
<div class="a"><div class="b"></div></div>
<div class="a"><div class="b"></div></div>
</body>
</html>