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

Unified Diff: Source/core/rendering/RenderLayer.cpp

Issue 365293002: Restore GC state after painting with a "reference" [url(#foo)] clip-path (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 | « LayoutTests/css3/masking/clip-path-reference-restore-expected.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderLayer.cpp
diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp
index 7eb58ff0f355ba051f183de0734dc010f3f212db..8f262b46c2aa22f4a4dd563b5fc33473154273fd 100644
--- a/Source/core/rendering/RenderLayer.cpp
+++ b/Source/core/rendering/RenderLayer.cpp
@@ -1834,7 +1834,7 @@ void RenderLayer::paintLayerContents(GraphicsContext* context, const LayerPainti
bool rootRelativeBoundsComputed = false;
// Apply clip-path to context.
- bool hasClipPath = false;
+ GraphicsContextStateSaver clipStateSaver(*context, false);
RenderStyle* style = renderer()->style();
RenderSVGResourceClipper* resourceClipper = 0;
ClipperContext clipperContext;
@@ -1845,8 +1845,7 @@ void RenderLayer::paintLayerContents(GraphicsContext* context, const LayerPainti
if (renderer()->hasClipPath() && !context->paintingDisabled() && style && (!needsCompositedScrolling() || paintFlags & PaintLayerPaintingChildClippingMaskPhase)) {
ASSERT(style->clipPath());
if (style->clipPath()->type() == ClipPathOperation::SHAPE) {
- hasClipPath = true;
- context->save();
+ clipStateSaver.save();
ShapeClipPathOperation* clipPath = toShapeClipPathOperation(style->clipPath());
if (!rootRelativeBoundsComputed) {
@@ -1861,6 +1860,9 @@ void RenderLayer::paintLayerContents(GraphicsContext* context, const LayerPainti
// FIXME: It doesn't work with forward or external SVG references (https://bugs.webkit.org/show_bug.cgi?id=90405)
Element* element = document.getElementById(referenceClipPathOperation->fragment());
if (isSVGClipPathElement(element) && element->renderer()) {
+ // FIXME: Saving at this point is not required in the 'mask'-
+ // case, or if the clip ends up empty.
+ clipStateSaver.save();
if (!rootRelativeBoundsComputed) {
rootRelativeBounds = physicalBoundingBoxIncludingReflectionAndStackingChildren(paintingInfo.rootLayer, offsetFromRoot);
rootRelativeBoundsComputed = true;
@@ -2009,9 +2011,6 @@ void RenderLayer::paintLayerContents(GraphicsContext* context, const LayerPainti
if (resourceClipper)
resourceClipper->postApplyStatefulResource(renderer(), context, clipperContext);
-
- if (hasClipPath)
- context->restore();
}
void RenderLayer::paintLayerByApplyingTransform(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, const LayoutPoint& translationOffset)
« no previous file with comments | « LayoutTests/css3/masking/clip-path-reference-restore-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698