Commit 98d5af2a authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

Update reference box for all pixel moving filters

Pixel moving filters [1] can expand bounds of visual effect from the
bounds of all descendants. We need reference box for all of them.

[1] https://cs.chromium.org/chromium/src/cc/paint/filter_operations.cc?rcl=0b6c41a840ed2a011a989c5d2130b93cc038fc4d&l=82

Change-Id: I1a1fcce6b1db2d876820d263c1456fe6c482ba33
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2095958Reviewed-by: default avatarStefan Zager <szager@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748774}
parent 476db166
...@@ -2534,7 +2534,7 @@ PaintLayer* PaintLayer::HitTestChildren( ...@@ -2534,7 +2534,7 @@ PaintLayer* PaintLayer::HitTestChildren(
} }
void PaintLayer::UpdateFilterReferenceBox() { void PaintLayer::UpdateFilterReferenceBox() {
if (!NeedsFilterReferenceBox()) if (!HasFilterThatMovesPixels())
return; return;
FloatRect reference_box = FloatRect reference_box =
FloatRect(PhysicalBoundingBoxIncludingStackingChildren( FloatRect(PhysicalBoundingBoxIncludingStackingChildren(
...@@ -2548,16 +2548,6 @@ void PaintLayer::UpdateFilterReferenceBox() { ...@@ -2548,16 +2548,6 @@ void PaintLayer::UpdateFilterReferenceBox() {
EnsureResourceInfo().SetFilterReferenceBox(reference_box); EnsureResourceInfo().SetFilterReferenceBox(reference_box);
} }
bool PaintLayer::NeedsFilterReferenceBox() const {
if (GetLayoutObject().HasReflection() && GetLayoutObject().IsBox())
return true;
FilterOperations operations = GetLayoutObject().StyleRef().Filter();
if (operations.HasBlurOrReferenceFilter())
return true;
operations = GetLayoutObject().StyleRef().BackdropFilter();
return !operations.IsEmpty();
}
FloatRect PaintLayer::FilterReferenceBox() const { FloatRect PaintLayer::FilterReferenceBox() const {
DCHECK(IsAllowedToQueryCompositingState()); DCHECK(IsAllowedToQueryCompositingState());
if (ResourceInfo()) if (ResourceInfo())
...@@ -3485,7 +3475,7 @@ bool PaintLayer::HasFilterThatMovesPixels() const { ...@@ -3485,7 +3475,7 @@ bool PaintLayer::HasFilterThatMovesPixels() const {
const ComputedStyle& style = GetLayoutObject().StyleRef(); const ComputedStyle& style = GetLayoutObject().StyleRef();
if (style.HasFilter() && style.Filter().HasFilterThatMovesPixels()) if (style.HasFilter() && style.Filter().HasFilterThatMovesPixels())
return true; return true;
if (style.HasBoxReflect()) if (GetLayoutObject().HasReflection())
return true; return true;
return false; return false;
} }
......
...@@ -1270,8 +1270,6 @@ class CORE_EXPORT PaintLayer : public DisplayItemClient { ...@@ -1270,8 +1270,6 @@ class CORE_EXPORT PaintLayer : public DisplayItemClient {
bool ShouldApplyTransformToBoundingBox(const PaintLayer& composited_layer, bool ShouldApplyTransformToBoundingBox(const PaintLayer& composited_layer,
CalculateBoundsOptions) const; CalculateBoundsOptions) const;
bool NeedsFilterReferenceBox() const;
AncestorDependentCompositingInputs& EnsureAncestorDependentCompositingInputs() AncestorDependentCompositingInputs& EnsureAncestorDependentCompositingInputs()
const { const {
if (!ancestor_dependent_compositing_inputs_) { if (!ancestor_dependent_compositing_inputs_) {
......
...@@ -70,16 +70,6 @@ bool FilterOperations::CanInterpolateWith(const FilterOperations& other) const { ...@@ -70,16 +70,6 @@ bool FilterOperations::CanInterpolateWith(const FilterOperations& other) const {
return true; return true;
} }
bool FilterOperations::HasBlurOrReferenceFilter() const {
for (const auto& operation : operations_) {
FilterOperation::OperationType type = operation->GetType();
if (type == FilterOperation::BLUR || type == FilterOperation::REFERENCE) {
return true;
}
}
return false;
}
FloatRect FilterOperations::MapRect(const FloatRect& rect) const { FloatRect FilterOperations::MapRect(const FloatRect& rect) const {
auto accumulate_mapped_rect = [](const FloatRect& rect, auto accumulate_mapped_rect = [](const FloatRect& rect,
const Member<FilterOperation>& op) { const Member<FilterOperation>& op) {
......
...@@ -70,8 +70,6 @@ class CORE_EXPORT FilterOperations { ...@@ -70,8 +70,6 @@ class CORE_EXPORT FilterOperations {
bool HasFilterThatAffectsOpacity() const; bool HasFilterThatAffectsOpacity() const;
bool HasFilterThatMovesPixels() const; bool HasFilterThatMovesPixels() const;
bool HasBlurOrReferenceFilter() const;
void AddClient(SVGResourceClient&) const; void AddClient(SVGResourceClient&) const;
void RemoveClient(SVGResourceClient&) const; void RemoveClient(SVGResourceClient&) const;
......
...@@ -21,7 +21,12 @@ ...@@ -21,7 +21,12 @@
{ {
"object": "LayoutNGBlockFlow DIV id='resize' class='drop-shadow'", "object": "LayoutNGBlockFlow DIV id='resize' class='drop-shadow'",
"rect": [0, 0, 214, 260], "rect": [0, 0, 214, 260],
"reason": "geometry" "reason": "paint property change"
},
{
"object": "LayoutNGBlockFlow DIV id='resize' class='drop-shadow'",
"rect": [0, 0, 160, 260],
"reason": "paint property change"
} }
], ],
"transform": 1 "transform": 1
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
{ {
"object": "LayoutNGBlockFlow DIV id='resize' class='drop-shadow accelerated'", "object": "LayoutNGBlockFlow DIV id='resize' class='drop-shadow accelerated'",
"rect": [0, 0, 160, 260], "rect": [0, 0, 160, 260],
"reason": "geometry" "reason": "paint property change"
} }
], ],
"transform": 1 "transform": 1
......
...@@ -19,7 +19,12 @@ ...@@ -19,7 +19,12 @@
{ {
"object": "LayoutBlockFlow DIV id='resize' class='drop-shadow'", "object": "LayoutBlockFlow DIV id='resize' class='drop-shadow'",
"rect": [0, 0, 212, 257], "rect": [0, 0, 212, 257],
"reason": "geometry" "reason": "paint property change"
},
{
"object": "LayoutBlockFlow DIV id='resize' class='drop-shadow'",
"rect": [0, 0, 158, 257],
"reason": "paint property change"
} }
], ],
"transform": 1 "transform": 1
......
...@@ -19,7 +19,12 @@ ...@@ -19,7 +19,12 @@
{ {
"object": "LayoutNGBlockFlow DIV id='resize' class='drop-shadow'", "object": "LayoutNGBlockFlow DIV id='resize' class='drop-shadow'",
"rect": [0, 0, 212, 257], "rect": [0, 0, 212, 257],
"reason": "geometry" "reason": "paint property change"
},
{
"object": "LayoutNGBlockFlow DIV id='resize' class='drop-shadow'",
"rect": [0, 0, 158, 257],
"reason": "paint property change"
} }
], ],
"transform": 1 "transform": 1
......
...@@ -19,7 +19,12 @@ ...@@ -19,7 +19,12 @@
{ {
"object": "LayoutNGBlockFlow DIV id='resize' class='drop-shadow'", "object": "LayoutNGBlockFlow DIV id='resize' class='drop-shadow'",
"rect": [0, 0, 212, 257], "rect": [0, 0, 212, 257],
"reason": "geometry" "reason": "paint property change"
},
{
"object": "LayoutNGBlockFlow DIV id='resize' class='drop-shadow'",
"rect": [0, 0, 158, 257],
"reason": "paint property change"
} }
], ],
"transform": 1 "transform": 1
......
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