Index: third_party/WebKit/Source/platform/graphics/filters/FilterEffect.cpp |
diff --git a/third_party/WebKit/Source/platform/graphics/filters/FilterEffect.cpp b/third_party/WebKit/Source/platform/graphics/filters/FilterEffect.cpp |
index 1b5f60c7b2725cb7b309c48a587378a669e0b253..4d8dbdf5802d6b662cad33a2489f881d0ede8658 100644 |
--- a/third_party/WebKit/Source/platform/graphics/filters/FilterEffect.cpp |
+++ b/third_party/WebKit/Source/platform/graphics/filters/FilterEffect.cpp |
@@ -56,40 +56,40 @@ FloatRect FilterEffect::absoluteBounds() const |
return getFilter()->mapLocalRectToAbsoluteRect(computedBounds); |
} |
-FloatRect FilterEffect::determineAbsolutePaintRect(const FloatRect& originalRequestedRect) const |
+FloatRect FilterEffect::mapInputs(const FloatRect& rect) const |
{ |
- FloatRect requestedRect = originalRequestedRect; |
- // Filters in SVG clip to primitive subregion, while CSS doesn't. |
- if (clipsToBounds()) |
- requestedRect.intersect(absoluteBounds()); |
- |
- FloatRect inputRect = mapPaintRect(requestedRect, false); |
+ if (!m_inputEffects.size()) { |
+ if (clipsToBounds()) |
+ return absoluteBounds(); |
+ return rect; |
+ } |
FloatRect inputUnion; |
- unsigned size = m_inputEffects.size(); |
+ for (const auto& effect : m_inputEffects) |
+ inputUnion.unite(effect->mapRect(rect)); |
+ return inputUnion; |
+} |
- for (unsigned i = 0; i < size; ++i) |
- inputUnion.unite(m_inputEffects.at(i)->determineAbsolutePaintRect(inputRect)); |
- inputUnion = mapPaintRect(inputUnion, true); |
+FloatRect FilterEffect::mapEffect(const FloatRect& rect) const |
+{ |
+ return rect; |
+} |
- if (affectsTransparentPixels() || !size) { |
- inputUnion = requestedRect; |
- } else { |
- // Rect may have inflated. Re-intersect with request. |
- inputUnion.intersect(requestedRect); |
- } |
- return inputUnion; |
+FloatRect FilterEffect::applyBounds(const FloatRect& rect) const |
+{ |
+ // Filters in SVG clip to primitive subregion, while CSS doesn't. |
+ if (!clipsToBounds()) |
+ return rect; |
+ FloatRect bounds = absoluteBounds(); |
+ if (affectsTransparentPixels()) |
+ return bounds; |
+ return intersection(rect, bounds); |
} |
-FloatRect FilterEffect::mapRectRecursive(const FloatRect& rect) const |
+FloatRect FilterEffect::mapRect(const FloatRect& rect) const |
{ |
- FloatRect result; |
- if (m_inputEffects.size() > 0) { |
- result = m_inputEffects.at(0)->mapRectRecursive(rect); |
- for (unsigned i = 1; i < m_inputEffects.size(); ++i) |
- result.unite(m_inputEffects.at(i)->mapRectRecursive(rect)); |
- } else |
- result = rect; |
- return mapRect(result); |
+ FloatRect result = mapInputs(rect); |
+ result = mapEffect(result); |
+ return applyBounds(result); |
} |
FilterEffect* FilterEffect::inputEffect(unsigned number) const |