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

Unified Diff: third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp

Issue 2625133003: Handle geometry effects of filters in GeometryMapper (Closed)
Patch Set: - Created 3 years, 10 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
Index: third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp
index e61aa3bba93e5866c730e592ece114b5d73630e1..7b394451d4246bb90fc40751b97afc62c419d205 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp
+++ b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp
@@ -94,6 +94,11 @@ FloatClipRect GeometryMapper::localToAncestorVisualRectInternal(
return rect;
}
+ if (localState.effect() != ancestorState.effect()) {
+ return slowLocalToAncestorVisualRectWithEffects(rect, localState,
+ ancestorState, success);
+ }
+
const auto& transformMatrix = localToAncestorMatrixInternal(
localState.transform(), ancestorState.transform(), success);
if (!success)
@@ -119,6 +124,47 @@ FloatClipRect GeometryMapper::localToAncestorVisualRectInternal(
return clipRect;
}
+FloatClipRect GeometryMapper::slowLocalToAncestorVisualRectWithEffects(
+ const FloatRect& rect,
+ const PropertyTreeState& localState,
+ const PropertyTreeState& ancestorState,
+ bool& success) {
+ PropertyTreeState lastTransformAndClipState(localState.transform(),
+ localState.clip(), nullptr);
+ FloatClipRect result(rect);
+
+ for (const auto* effect = localState.effect();
+ effect && effect != ancestorState.effect(); effect = effect->parent()) {
+ if (!effect->hasFilterThatMovesPixels())
+ continue;
+
+ PropertyTreeState transformAndClipState(effect->localTransformSpace(),
+ effect->outputClip(), nullptr);
+ bool hasRadius = result.hasRadius();
+ result = sourceToDestinationVisualRectInternal(
+ result.rect(), lastTransformAndClipState, transformAndClipState,
+ success);
+ hasRadius |= result.hasRadius();
+ if (!success) {
+ result.setHasRadius(hasRadius);
+ return result;
+ }
+
+ result = effect->mapRect(result.rect());
+ result.setHasRadius(hasRadius);
+ lastTransformAndClipState = transformAndClipState;
+ }
+
+ PropertyTreeState finalTransformAndClipState(ancestorState.transform(),
+ ancestorState.clip(), nullptr);
+ bool hasRadius = result.hasRadius();
+ result = sourceToDestinationVisualRectInternal(
+ result.rect(), lastTransformAndClipState, finalTransformAndClipState,
+ success);
+ result.setHasRadius(hasRadius || result.hasRadius());
+ return result;
+}
+
FloatRect GeometryMapper::localToAncestorRect(
const FloatRect& rect,
const TransformPaintPropertyNode* localTransformNode,

Powered by Google App Engine
This is Rietveld 408576698