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

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

Issue 2078343005: Fix positioning of CSS reference clips in composited layers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add virtual expectation Created 4 years, 6 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/core/paint/SVGClipPainter.cpp
diff --git a/third_party/WebKit/Source/core/paint/SVGClipPainter.cpp b/third_party/WebKit/Source/core/paint/SVGClipPainter.cpp
index 806cad631f9bcec3e41a5356a486cf659604acad..6bf0c5897b34518f1e4d8e44f160a8734359e89a 100644
--- a/third_party/WebKit/Source/core/paint/SVGClipPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/SVGClipPainter.cpp
@@ -33,7 +33,7 @@ private:
} // namespace
bool SVGClipPainter::prepareEffect(const LayoutObject& target, const FloatRect& targetBoundingBox,
- const FloatRect& paintInvalidationRect, GraphicsContext& context, ClipperState& clipperState)
+ const FloatRect& paintInvalidationRect, const FloatPoint& layerPositionOffset, GraphicsContext& context, ClipperState& clipperState)
{
ASSERT(clipperState == ClipperNotApplied);
ASSERT_WITH_SECURITY_IMPLICATION(!m_clip.needsLayout());
@@ -57,6 +57,9 @@ bool SVGClipPainter::prepareEffect(const LayoutObject& target, const FloatRect&
// First, try to apply the clip as a clipPath.
Path clipPath;
if (m_clip.asPath(animatedLocalTransform, targetBoundingBox, clipPath)) {
+ AffineTransform positionTransform;
+ positionTransform.translate(layerPositionOffset.x(), layerPositionOffset.y());
+ clipPath.transform(positionTransform);
clipperState = ClipperAppliedPath;
context.getPaintController().createAndAppend<BeginClipPathDisplayItem>(target, clipPath);
return true;
@@ -68,7 +71,7 @@ bool SVGClipPainter::prepareEffect(const LayoutObject& target, const FloatRect&
// Begin compositing the clip mask.
CompositingRecorder::beginCompositing(context, target, SkXfermode::kSrcOver_Mode, 1, &paintInvalidationRect);
{
- if (!drawClipAsMask(context, target, targetBoundingBox, paintInvalidationRect, animatedLocalTransform)) {
+ if (!drawClipAsMask(context, target, targetBoundingBox, paintInvalidationRect, animatedLocalTransform, layerPositionOffset)) {
// End the clip mask's compositor.
CompositingRecorder::endCompositing(context, target);
return false;
@@ -100,7 +103,8 @@ void SVGClipPainter::finishEffect(const LayoutObject& target, GraphicsContext& c
}
}
-bool SVGClipPainter::drawClipAsMask(GraphicsContext& context, const LayoutObject& layoutObject, const FloatRect& targetBoundingBox, const FloatRect& targetPaintInvalidationRect, const AffineTransform& localTransform)
+bool SVGClipPainter::drawClipAsMask(GraphicsContext& context, const LayoutObject& layoutObject, const FloatRect& targetBoundingBox,
+ const FloatRect& targetPaintInvalidationRect, const AffineTransform& localTransform, const FloatPoint& layerPositionOffset)
{
if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, layoutObject, DisplayItem::SVGClip))
return true;
@@ -114,7 +118,7 @@ bool SVGClipPainter::drawClipAsMask(GraphicsContext& context, const LayoutObject
SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObject(&m_clip);
LayoutSVGResourceClipper* clipPathClipper = resources ? resources->clipper() : nullptr;
ClipperState clipPathClipperState = ClipperNotApplied;
- if (clipPathClipper && !SVGClipPainter(*clipPathClipper).prepareEffect(m_clip, targetBoundingBox, targetPaintInvalidationRect, maskContext, clipPathClipperState))
+ if (clipPathClipper && !SVGClipPainter(*clipPathClipper).prepareEffect(m_clip, targetBoundingBox, targetPaintInvalidationRect, layerPositionOffset, maskContext, clipPathClipperState))
return false;
{
« no previous file with comments | « third_party/WebKit/Source/core/paint/SVGClipPainter.h ('k') | third_party/WebKit/Source/core/paint/SVGPaintContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698