Commit c60ca25c authored by Chris Harrelson's avatar Chris Harrelson Committed by Commit Bot

Simplify compositing bounds for overlap test.

Instead of calling into BoundingBoxForCompositingInternal when
filters are present, just account for them directly. The code
was previously also wrong because it would recurse into children
and stop the recursion at composited children, which means it
depended on the previous compositing state. The code was added
in 2013 (*)

(*) https://source.chromium.org/chromium/chromium/src/+/ae7c13ecb7f34a7e31cab0ce9167d9c9744fabfa

Change-Id: Id90d62adb7c0626135976110334805f76650f292
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2343507
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Reviewed-by: default avatarXianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#796249}
parent 84a145e0
......@@ -2607,12 +2607,12 @@ PhysicalRect PaintLayer::BoundingBoxForCompositingOverlapTest() const {
// TODO(trchen): Layer fragmentation is inhibited across compositing boundary.
// Should we return the unfragmented bounds for overlap testing? Or perhaps
// assume fragmented layers always overlap?
PhysicalRect bounding_box =
OverlapBoundsIncludeChildren()
? BoundingBoxForCompositingInternal(
*this, nullptr, kNeverIncludeTransformForAncestorLayer)
: FragmentsBoundingBox(this);
PhysicalRect bounding_box = FragmentsBoundingBox(this);
const ComputedStyle& style = GetLayoutObject().StyleRef();
if (PaintsWithFilters())
bounding_box = MapRectForFilter(bounding_box);
if (style.HasBackdropFilter() &&
style.BackdropFilter().HasFilterThatMovesPixels()) {
bounding_box = PhysicalRect::EnclosingRect(
......@@ -2649,10 +2649,6 @@ PhysicalRect PaintLayer::BoundingBoxForCompositingOverlapTest() const {
return bounding_box;
}
bool PaintLayer::OverlapBoundsIncludeChildren() const {
return HasFilterThatMovesPixels();
}
void PaintLayer::ExpandRectForStackingChildren(
const PaintLayer& composited_layer,
PhysicalRect& result,
......
......@@ -478,10 +478,6 @@ class CORE_EXPORT PaintLayer : public DisplayItemClient {
PhysicalRect BoundingBoxForCompositingOverlapTest() const;
PhysicalRect BoundingBoxForCompositing() const;
// If true, this layer's children are included in its bounds for overlap
// testing. We can't rely on the children's positions if this layer has a
// filter that could have moved the children's pixels around.
bool OverlapBoundsIncludeChildren() const;
// Static position is set in parent's coordinate space.
LayoutUnit StaticInlinePosition() const { return static_inline_position_; }
......
......@@ -12,11 +12,6 @@
"bounds": [200, 200],
"backgroundColor": "#000000",
"transform": 1
},
{
"name": "LayoutNGBlockFlow (positioned) DIV id='software-parent'",
"bounds": [200, 200],
"backgroundColor": "#008000"
}
],
"transforms": [
......
......@@ -12,11 +12,6 @@
"bounds": [200, 200],
"backgroundColor": "#000000",
"transform": 1
},
{
"name": "LayoutBlockFlow (positioned) DIV id='software-parent'",
"bounds": [200, 200],
"backgroundColor": "#008000"
}
],
"transforms": [
......
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