Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(645)

Unified Diff: third_party/WebKit/Source/core/paint/PaintLayer.cpp

Issue 2276283002: Include filter-generated content bounds in visual rects (Closed)
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/paint/PaintLayer.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayer.cpp b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
index f93d85f709d718c91fd9709c95732111197a0b20..c2d92f6dd3ee80333735cbba8640fb2c889c2395 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayer.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
@@ -1106,7 +1106,7 @@ LayoutRect PaintLayer::transparencyClipBox(const PaintLayer* layer, const PaintL
// paints unfragmented.
LayoutRect clipRect = layer->physicalBoundingBox(LayoutPoint());
expandClipRectForDescendantsAndReflection(clipRect, layer, layer, transparencyBehavior, subPixelAccumulation, globalPaintFlags);
- LayoutRect result = enclosingLayoutRect(transform.mapRect(layer->mapRectForFilter(FloatRect(clipRect))));
+ LayoutRect result = enclosingLayoutRect(transform.mapRect(layer->mapRectToAffectedFilterRegion(FloatRect(clipRect))));
if (!paginationLayer)
return result;
@@ -1124,7 +1124,7 @@ LayoutRect PaintLayer::transparencyClipBox(const PaintLayer* layer, const PaintL
LayoutRect clipRect = layer->shouldFragmentCompositedBounds(rootLayer) ? layer->fragmentsBoundingBox(rootLayer) : layer->physicalBoundingBox(rootLayer);
expandClipRectForDescendantsAndReflection(clipRect, layer, rootLayer, transparencyBehavior, subPixelAccumulation, globalPaintFlags);
- clipRect = layer->mapLayoutRectForFilter(clipRect);
+ clipRect = layer->mapLayoutRectToAffectedFilterRegion(clipRect);
clipRect.move(subPixelAccumulation);
return clipRect;
}
@@ -2250,7 +2250,7 @@ LayoutRect PaintLayer::boundingBoxForCompositing(const PaintLayer* ancestorLayer
// Only enlarge by the filter outsets if we know the filter is going to be rendered in software.
// Accelerated filters will handle their own outsets.
if (paintsWithFilters())
- result = mapLayoutRectForFilter(result);
+ result = mapLayoutRectToAffectedFilterRegion(result);
}
if (transform() && (options == IncludeTransformsAndCompositedChildLayers || ((paintsWithTransform(GlobalPaintNormalPhase) && (this != ancestorLayer || options == MaybeIncludeTransformForAncestorLayer)))))
@@ -2741,7 +2741,7 @@ FilterEffect* PaintLayer::lastFilterEffect() const
return builder->lastEffect();
}
-FloatRect PaintLayer::mapRectForFilter(const FloatRect& rect) const
+FloatRect PaintLayer::mapRectToAffectedFilterRegion(const FloatRect& rect) const
{
if (!hasFilterThatMovesPixels())
return rect;
@@ -2749,14 +2749,23 @@ FloatRect PaintLayer::mapRectForFilter(const FloatRect& rect) const
updateFilterEffectBuilder();
FilterOperations filterOperations = computeFilterOperations(layoutObject()->styleRef());
- return filterOperations.mapRect(rect);
+ FloatRect filteredRect = filterOperations.mapRect(rect);
+
+ // Some reference filters (e.g., FETurbulence, FETile) have effect bounds
+ // determined by the filter itself instead of the source rect.
+ if (filterOperations.hasReferenceFilter()) {
+ if (FilterEffect* lastEffect = lastFilterEffect())
+ filteredRect.unite(lastEffect->determineFilterPrimitiveSubregion(MapRectForward));
Stephen White 2016/08/25 15:03:14 I think this is papering over the problem. I think
pdr. 2016/08/29 17:51:12 I've filed https://crbug.com/642035 as a brain-dum
+ }
+
+ return filteredRect;
}
-LayoutRect PaintLayer::mapLayoutRectForFilter(const LayoutRect& rect) const
+LayoutRect PaintLayer::mapLayoutRectToAffectedFilterRegion(const LayoutRect& rect) const
{
if (!hasFilterThatMovesPixels())
return rect;
- return enclosingLayoutRect(mapRectForFilter(FloatRect(rect)));
+ return enclosingLayoutRect(mapRectToAffectedFilterRegion(FloatRect(rect)));
}
bool PaintLayer::hasFilterThatMovesPixels() const
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698