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

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

Issue 2625133003: Handle geometry effects of filters in GeometryMapper (Closed)
Patch Set: Rebaseline tests Created 3 years, 11 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 f1152386d922c205c134e28a2a6205bf1992d839..b01fd531d43f2bb1e262a5efbed45009b748a598 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp
+++ b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp
@@ -92,6 +92,11 @@ FloatRect 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)
@@ -117,6 +122,37 @@ FloatRect GeometryMapper::localToAncestorVisualRectInternal(
return mappedRect;
}
+FloatRect GeometryMapper::slowLocalToAncestorVisualRectWithEffects(
+ const FloatRect& rect,
+ const PropertyTreeState& localState,
+ const PropertyTreeState& ancestorState,
+ bool& success) {
+ PropertyTreeState lastTransformAndClipState(
+ localState.transform(), localState.clip(), nullptr, nullptr);
+ FloatRect result = rect;
+
+ for (const auto* effect = localState.effect();
+ effect && effect != ancestorState.effect(); effect = effect->parent()) {
+ if (!effect->hasFilterThanMovesPixels())
+ continue;
+
+ PropertyTreeState transformAndClipState(
+ effect->localTransformSpace(), effect->outputClip(), nullptr, nullptr);
+ result = sourceToDestinationVisualRectInternal(
+ result, lastTransformAndClipState, transformAndClipState, success);
+ if (!success)
+ return result;
+
+ result = effect->mapRect(result);
+ lastTransformAndClipState = transformAndClipState;
+ }
+
+ PropertyTreeState finalTransformAndClipState(
+ ancestorState.transform(), ancestorState.clip(), nullptr, nullptr);
+ return sourceToDestinationVisualRectInternal(
+ result, lastTransformAndClipState, finalTransformAndClipState, success);
+}
+
FloatRect GeometryMapper::localToAncestorRect(
const FloatRect& rect,
const TransformPaintPropertyNode* localTransformNode,

Powered by Google App Engine
This is Rietveld 408576698