Title: [106009] branches/chromium/963
Revision
106009
Author
[email protected]
Date
2012-01-26 10:41:54 -0800 (Thu, 26 Jan 2012)

Log Message

Merge 105978 - crash in WebCore::RenderSVGContainer::paint
BUG=99615
Review URL: https://chromiumcodereview.appspot.com/9235065

Modified Paths

Added Paths

Diff

Modified: branches/chromium/963/LayoutTests/platform/chromium/test_expectations.txt (106008 => 106009)


--- branches/chromium/963/LayoutTests/platform/chromium/test_expectations.txt	2012-01-26 17:54:08 UTC (rev 106008)
+++ branches/chromium/963/LayoutTests/platform/chromium/test_expectations.txt	2012-01-26 18:41:54 UTC (rev 106009)
@@ -4073,6 +4073,9 @@
 BUGWK76800 : svg/filters/feImage-reference-invalidation.svg = IMAGE
 BUGWK76800 : svg/filters/feImage-reference-svg-primitive.svg = IMAGE
 
+// Just needs a rebaseline.
+BUGWK69714 : svg/clip-path/clip-path-tspan-and-stroke.svg = IMAGE+TEXT
+
 // Change error (misspelling) underlines from Windows look to Mac look.
 BUG_CARYCLARK MAC : editing/deleting/delete-3928305-fix.html = IMAGE
 BUG_CARYCLARK MAC : editing/deleting/delete-3959464-fix.html = IMAGE

Copied: branches/chromium/963/LayoutTests/platform/mac/svg/clip-path/clip-path-tspan-and-stroke-expected.png (from rev 105978, trunk/LayoutTests/platform/mac/svg/clip-path/clip-path-tspan-and-stroke-expected.png)


(Binary files differ)

Copied: branches/chromium/963/LayoutTests/platform/mac/svg/clip-path/clip-path-tspan-and-stroke-expected.txt (from rev 105978, trunk/LayoutTests/platform/mac/svg/clip-path/clip-path-tspan-and-stroke-expected.txt) (0 => 106009)


--- branches/chromium/963/LayoutTests/platform/mac/svg/clip-path/clip-path-tspan-and-stroke-expected.txt	                        (rev 0)
+++ branches/chromium/963/LayoutTests/platform/mac/svg/clip-path/clip-path-tspan-and-stroke-expected.txt	2012-01-26 18:41:54 UTC (rev 106009)
@@ -0,0 +1,12 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderSVGRoot {svg} at (40,88) size 191x92
+    RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+      RenderSVGResourceClipper {clipPath} [id="clip"] [clipPathUnits=userSpaceOnUse]
+        RenderSVGText {text} at (40,88) size 191x92 contains 1 chunk(s)
+          RenderSVGTSpan {tspan} at (0,0) size 191x92
+            RenderSVGInlineText {#text} at (0,0) size 191x92
+              chunk 1 text run 1 at (40.00,160.00) startOffset 0 endOffset 4 width 191.00: "CLIP"
+    RenderSVGRect {rect} at (40,88) size 191x92 [fill={[type=SOLID] [color=#008000]}] [x=40.00] [y=40.00] [width=300.00] [height=300.00]
+      [clipPath="clip"] RenderSVGResourceClipper {clipPath} at (40,88) size 191x92

Copied: branches/chromium/963/LayoutTests/svg/clip-path/clip-path-tspan-and-stroke.svg (from rev 105978, trunk/LayoutTests/svg/clip-path/clip-path-tspan-and-stroke.svg) (0 => 106009)


--- branches/chromium/963/LayoutTests/svg/clip-path/clip-path-tspan-and-stroke.svg	                        (rev 0)
+++ branches/chromium/963/LayoutTests/svg/clip-path/clip-path-tspan-and-stroke.svg	2012-01-26 18:41:54 UTC (rev 106009)
@@ -0,0 +1,9 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<defs>
+    <clipPath id="clip">
+        <!-- fill and stroke properties should be ignored -->
+        <text x="40" y="160" font-size="80" font-weight="bold"><tspan stroke="red" fill="none">CLIP</tspan></text>
+    </clipPath>
+</defs>
+<rect x="40" y="40" height="300" width="300" style="fill:green;clip-path:url(#clip);"/>
+</svg>

Copied: branches/chromium/963/LayoutTests/svg/custom/layout-loop-expected.txt (from rev 105978, trunk/LayoutTests/svg/custom/layout-loop-expected.txt) (0 => 106009)


--- branches/chromium/963/LayoutTests/svg/custom/layout-loop-expected.txt	                        (rev 0)
+++ branches/chromium/963/LayoutTests/svg/custom/layout-loop-expected.txt	2012-01-26 18:41:54 UTC (rev 106009)
@@ -0,0 +1,2 @@
+CONSOLE MESSAGE: line 15: Error: Problem parsing d="M147.231,26.23c70.188,0,127.086,57.77,127.086,129.032c0"
+PASS, if it doesn't crash.

Copied: branches/chromium/963/LayoutTests/svg/custom/layout-loop.svg (from rev 105978, trunk/LayoutTests/svg/custom/layout-loop.svg) (0 => 106009)


--- branches/chromium/963/LayoutTests/svg/custom/layout-loop.svg	                        (rev 0)
+++ branches/chromium/963/LayoutTests/svg/custom/layout-loop.svg	2012-01-26 18:41:54 UTC (rev 106009)
@@ -0,0 +1,53 @@
+<svg xmlns="http://www.w3.org/2000/svg">
+<g>
+    <linearGradient>
+        <stop id="stop"/>
+    </linearGradient>
+</g>
+<g>
+    <defs>
+        <filter id="filter"/>
+    </defs>
+
+    <mask id="mask">
+        <g filter="url(#filter)">
+            <linearGradient id="gradient"/>
+            <path fill="url(#gradient)" d="M147.231,26.23c70.188,0,127.086,57.77,127.086,129.032c0"/>
+        </g>
+    </mask>
+
+    <path mask="url(#mask)" d="M147.231,26.23c70.188,0,127.086,57.77,127.086,129.032"/>
+</g>
+
+<text>PASS, if it doesn't crash.</text>
+<script><![CDATA[
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+document.execCommand("SelectAll");
+range = document.createRange();
+range.setStartBefore(document.getElementById("stop"));
+range.insertNode(document.getElementById("mask"));
+
+/* What does this do? It moves the whole <mask> element as child of the <linearGradient>.
+The final DOM looks like:
+
+<g>
+    <linearGradient>
+        <mask id="mask">
+            <g filter="url(#filter)">
+                <linearGradient id="gradient"/>
+                <path fill="url(#gradient)" d="..."/>
+            </g>
+        </mask>
+        <stop id="stop"/>
+    </linearGradient>
+</g>
+<g>
+    <defs>
+        <filter id="filter"/>
+    </defs>
+    <path mask="url(#mask)" d="...."/>
+</g>
+*/
+]]></script>
+</svg>

Modified: branches/chromium/963/Source/WebCore/rendering/PaintPhase.h (106008 => 106009)


--- branches/chromium/963/Source/WebCore/rendering/PaintPhase.h	2012-01-26 17:54:08 UTC (rev 106008)
+++ branches/chromium/963/Source/WebCore/rendering/PaintPhase.h	2012-01-26 18:41:54 UTC (rev 106009)
@@ -56,7 +56,8 @@
     PaintBehaviorNormal = 0,
     PaintBehaviorSelectionOnly = 1 << 0,
     PaintBehaviorForceBlackText = 1 << 1,
-    PaintBehaviorFlattenCompositingLayers = 1 << 2
+    PaintBehaviorFlattenCompositingLayers = 1 << 2,
+    PaintBehaviorRenderingSVGMask = 1 << 3
 };
 
 typedef unsigned PaintBehavior;

Modified: branches/chromium/963/Source/WebCore/rendering/svg/RenderSVGResource.cpp (106008 => 106009)


--- branches/chromium/963/Source/WebCore/rendering/svg/RenderSVGResource.cpp	2012-01-26 17:54:08 UTC (rev 106008)
+++ branches/chromium/963/Source/WebCore/rendering/svg/RenderSVGResource.cpp	2012-01-26 18:41:54 UTC (rev 106009)
@@ -54,12 +54,23 @@
     if (!svgStyle)
         return 0;
 
+    bool isRenderingMask = false;
+    if (object->frame() && object->frame()->view())
+        isRenderingMask = object->frame()->view()->paintBehavior() & PaintBehaviorRenderingSVGMask;
+
     // If we have no fill/stroke, return 0.
     if (mode == ApplyToFillMode) {
+        // When rendering the mask for a RenderSVGResourceClipper, always use the initial fill paint server, and ignore stroke.
+        if (isRenderingMask) {
+            RenderSVGResourceSolidColor* colorResource = RenderSVGResource::sharedSolidPaintingResource();
+            colorResource->setColor(SVGRenderStyle::initialFillPaintColor());
+            return colorResource;
+        }
+
         if (!svgStyle->hasFill())
             return 0;
     } else {
-        if (!svgStyle->hasStroke())
+        if (!svgStyle->hasStroke() || isRenderingMask)
             return 0;
     }
 

Modified: branches/chromium/963/Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp (106008 => 106009)


--- branches/chromium/963/Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp	2012-01-26 17:54:08 UTC (rev 106008)
+++ branches/chromium/963/Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp	2012-01-26 18:41:54 UTC (rev 106009)
@@ -54,7 +54,6 @@
 
 RenderSVGResourceClipper::RenderSVGResourceClipper(SVGClipPathElement* node)
     : RenderSVGResourceContainer(node)
-    , m_invalidationBlocked(false)
 {
 }
 
@@ -69,9 +68,6 @@
 
 void RenderSVGResourceClipper::removeAllClientsFromCache(bool markForInvalidation)
 {
-    if (m_invalidationBlocked)
-        return;
-
     m_clipBoundaries = FloatRect();
     if (!m_clipper.isEmpty()) {
         deleteAllValues(m_clipper);
@@ -84,9 +80,6 @@
 void RenderSVGResourceClipper::removeClientFromCache(RenderObject* client, bool markForInvalidation)
 {
     ASSERT(client);
-    if (m_invalidationBlocked)
-        return;
-
     if (m_clipper.contains(client))
         delete m_clipper.take(client);
 
@@ -199,7 +192,10 @@
             }
         }
 
-        drawContentIntoMaskImage(clipperData, objectBoundingBox);
+        if (!drawContentIntoMaskImage(clipperData, objectBoundingBox)) {
+            stateSaver.restore();
+            clipperData->clipMaskImage.clear();
+        }
     }
 
     if (!clipperData->clipMaskImage)
@@ -211,6 +207,7 @@
 
 bool RenderSVGResourceClipper::drawContentIntoMaskImage(ClipperData* clipperData, const FloatRect& objectBoundingBox)
 {
+    ASSERT(frame());
     ASSERT(clipperData);
     ASSERT(clipperData->clipMaskImage);
 
@@ -225,11 +222,23 @@
         maskContext->concatCTM(maskContentTransformation);
     }
 
+    // Switch to a paint behavior where all children of this <clipPath> will be rendered using special constraints:
+    // - fill-opacity/stroke-opacity/opacity set to 1
+    // - masker/filter not applied when rendering the children
+    // - fill is set to the initial fill paint server (solid, black)
+    // - stroke is set to the initial stroke paint server (none)
+    PaintBehavior oldBehavior = frame()->view()->paintBehavior();
+    frame()->view()->setPaintBehavior(oldBehavior | PaintBehaviorRenderingSVGMask);
+
     // Draw all clipPath children into a global mask.
     for (Node* childNode = node()->firstChild(); childNode; childNode = childNode->nextSibling()) {
         RenderObject* renderer = childNode->renderer();
         if (!childNode->isSVGElement() || !static_cast<SVGElement*>(childNode)->isStyled() || !renderer)
             continue;
+        if (renderer->needsLayout()) {
+            frame()->view()->setPaintBehavior(oldBehavior);
+            return false;
+        }
         RenderStyle* style = renderer->style();
         if (!style || style->display() == NONE || style->visibility() != VISIBLE)
             continue;
@@ -249,35 +258,15 @@
         if (!renderer->isSVGShape() && !renderer->isSVGText())
             continue;
 
-        // Save the old RenderStyle of the current object for restoring after drawing
-        // it to the MaskImage. The new intermediate RenderStyle needs to inherit from
-        // the old one.
-        RefPtr<RenderStyle> oldRenderStyle = renderer->style();
-        RefPtr<RenderStyle> newRenderStyle = RenderStyle::clone(oldRenderStyle.get());
-        SVGRenderStyle* svgStyle = newRenderStyle.get()->accessSVGStyle();
-        svgStyle->setFillPaint(SVGRenderStyle::initialFillPaintType(), SVGRenderStyle::initialFillPaintColor(), SVGRenderStyle::initialFillPaintUri());
-        svgStyle->setStrokePaint(SVGRenderStyle::initialStrokePaintType(), SVGRenderStyle::initialStrokePaintColor(), SVGRenderStyle::initialStrokePaintUri());
-        svgStyle->setFillRule(newClipRule);
-        newRenderStyle.get()->setOpacity(1);
-        svgStyle->setFillOpacity(1);
-        svgStyle->setStrokeOpacity(1);
-        svgStyle->setFilterResource(String());
-        svgStyle->setMaskerResource(String());
+        maskContext->setFillRule(newClipRule);
 
-        // The setStyle() call results in a styleDidChange() call, which in turn invalidations the resources.
-        // As we're mutating the resource on purpose, block updates until we've resetted the style again.
-        m_invalidationBlocked = true;
-        renderer->setStyle(newRenderStyle.release());
-
         // In the case of a <use> element, we obtained its renderere above, to retrieve its clipRule.
         // We have to pass the <use> renderer itself to renderSubtreeToImageBuffer() to apply it's x/y/transform/etc. values when rendering.
         // So if isUseElement is true, refetch the childNode->renderer(), as renderer got overriden above.
         SVGImageBufferTools::renderSubtreeToImageBuffer(clipperData->clipMaskImage.get(), isUseElement ? childNode->renderer() : renderer, maskContentTransformation);
-
-        renderer->setStyle(oldRenderStyle.release());
-        m_invalidationBlocked = false;
     }
 
+    frame()->view()->setPaintBehavior(oldBehavior);
     return true;
 }
 

Modified: branches/chromium/963/Source/WebCore/rendering/svg/RenderSVGResourceClipper.h (106008 => 106009)


--- branches/chromium/963/Source/WebCore/rendering/svg/RenderSVGResourceClipper.h	2012-01-26 17:54:08 UTC (rev 106008)
+++ branches/chromium/963/Source/WebCore/rendering/svg/RenderSVGResourceClipper.h	2012-01-26 18:41:54 UTC (rev 106009)
@@ -69,7 +69,6 @@
     bool drawContentIntoMaskImage(ClipperData*, const FloatRect& objectBoundingBox);
     void calculateClipContentRepaintRect();
 
-    bool m_invalidationBlocked;
     FloatRect m_clipBoundaries;
     HashMap<RenderObject*, ClipperData*> m_clipper;
 };

Modified: branches/chromium/963/Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp (106008 => 106009)


--- branches/chromium/963/Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp	2012-01-26 17:54:08 UTC (rev 106008)
+++ branches/chromium/963/Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp	2012-01-26 18:41:54 UTC (rev 106009)
@@ -117,7 +117,10 @@
         maskImageContext->translate(-clampedAbsoluteTargetRect.x(), -clampedAbsoluteTargetRect.y());
         maskImageContext->concatCTM(absoluteTransform);
 
-        drawContentIntoMaskImage(maskerData, colorSpace, maskElement, object);
+        if (!drawContentIntoMaskImage(maskerData, colorSpace, maskElement, object)) {
+            maskImageContext->restore();
+            maskerData->maskImage.clear();
+        }
     }
 
     if (!maskerData->maskImage)
@@ -127,7 +130,7 @@
     return true;
 }
 
-void RenderSVGResourceMasker::drawContentIntoMaskImage(MaskerData* maskerData, ColorSpace colorSpace, const SVGMaskElement* maskElement, RenderObject* object)
+bool RenderSVGResourceMasker::drawContentIntoMaskImage(MaskerData* maskerData, ColorSpace colorSpace, const SVGMaskElement* maskElement, RenderObject* object)
 {
     GraphicsContext* maskImageContext = maskerData->maskImage->context();
     ASSERT(maskImageContext);
@@ -146,6 +149,8 @@
         RenderObject* renderer = node->renderer();
         if (!node->isSVGElement() || !static_cast<SVGElement*>(node)->isStyled() || !renderer)
             continue;
+        if (renderer->needsLayout())
+            return false;
         RenderStyle* style = renderer->style();
         if (!style || style->display() == NONE || style->visibility() != VISIBLE)
             continue;
@@ -162,6 +167,7 @@
 
     // Create the luminance mask.
     maskerData->maskImage->convertToLuminanceMask();
+    return true;
 }
 
 void RenderSVGResourceMasker::calculateMaskContentRepaintRect()

Modified: branches/chromium/963/Source/WebCore/rendering/svg/RenderSVGResourceMasker.h (106008 => 106009)


--- branches/chromium/963/Source/WebCore/rendering/svg/RenderSVGResourceMasker.h	2012-01-26 17:54:08 UTC (rev 106008)
+++ branches/chromium/963/Source/WebCore/rendering/svg/RenderSVGResourceMasker.h	2012-01-26 18:41:54 UTC (rev 106009)
@@ -57,7 +57,7 @@
     static RenderSVGResourceType s_resourceType;
 
 private:
-    void drawContentIntoMaskImage(MaskerData*, ColorSpace, const SVGMaskElement*, RenderObject*);
+    bool drawContentIntoMaskImage(MaskerData*, ColorSpace, const SVGMaskElement*, RenderObject*);
     void calculateMaskContentRepaintRect();
 
     FloatRect m_maskContentBoundaries;

Modified: branches/chromium/963/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp (106008 => 106009)


--- branches/chromium/963/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp	2012-01-26 17:54:08 UTC (rev 106008)
+++ branches/chromium/963/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp	2012-01-26 18:41:54 UTC (rev 106009)
@@ -274,6 +274,8 @@
     for (Node* node = attributes.patternContentElement()->firstChild(); node; node = node->nextSibling()) {
         if (!node->isSVGElement() || !static_cast<SVGElement*>(node)->isStyled() || !node->renderer())
             continue;
+        if (node->renderer()->needsLayout())
+            return nullptr;
         SVGImageBufferTools::renderSubtreeToImageBuffer(tileImage.get(), node->renderer(), contentTransformation);
     }
 

Modified: branches/chromium/963/Source/WebCore/rendering/svg/RenderSVGResourceSolidColor.cpp (106008 => 106009)


--- branches/chromium/963/Source/WebCore/rendering/svg/RenderSVGResourceSolidColor.cpp	2012-01-26 17:54:08 UTC (rev 106008)
+++ branches/chromium/963/Source/WebCore/rendering/svg/RenderSVGResourceSolidColor.cpp	2012-01-26 18:41:54 UTC (rev 106009)
@@ -54,15 +54,25 @@
     const SVGRenderStyle* svgStyle = style ? style->svgStyle() : 0;
     ColorSpace colorSpace = style ? style->colorSpace() : ColorSpaceDeviceRGB;
 
+    bool isRenderingMask = false;
+    if (object->frame() && object->frame()->view())
+        isRenderingMask = object->frame()->view()->paintBehavior() & PaintBehaviorRenderingSVGMask;
+
     if (resourceMode & ApplyToFillMode) {
-        context->setAlpha(svgStyle ? svgStyle->fillOpacity() : 1.0f);
+        if (!isRenderingMask && svgStyle)
+            context->setAlpha(svgStyle->fillOpacity());
+        else
+            context->setAlpha(1);
         context->setFillColor(m_color, colorSpace);
-        context->setFillRule(svgStyle ? svgStyle->fillRule() : RULE_NONZERO);
+        if (!isRenderingMask)
+            context->setFillRule(svgStyle ? svgStyle->fillRule() : RULE_NONZERO);
 
         if (resourceMode & ApplyToTextMode)
             context->setTextDrawingMode(TextModeFill);
     } else if (resourceMode & ApplyToStrokeMode) {
-        context->setAlpha(svgStyle ? svgStyle->strokeOpacity() : 1.0f);
+        // When rendering the mask for a RenderSVGResourceClipper, the stroke code path is never hit.
+        ASSERT(!isRenderingMask);
+        context->setAlpha(svgStyle ? svgStyle->strokeOpacity() : 1);
         context->setStrokeColor(m_color, colorSpace);
 
         if (style)

Modified: branches/chromium/963/Source/WebCore/rendering/svg/SVGImageBufferTools.cpp (106008 => 106009)


--- branches/chromium/963/Source/WebCore/rendering/svg/SVGImageBufferTools.cpp	2012-01-26 17:54:08 UTC (rev 106008)
+++ branches/chromium/963/Source/WebCore/rendering/svg/SVGImageBufferTools.cpp	2012-01-26 18:41:54 UTC (rev 106009)
@@ -87,7 +87,7 @@
     AffineTransform savedContentTransformation = contentTransformation;
     contentTransformation = subtreeContentTransformation * contentTransformation;
 
-    item->layoutIfNeeded();
+    ASSERT(!item->needsLayout());
     item->paint(info, IntPoint());
 
     contentTransformation = savedContentTransformation;

Modified: branches/chromium/963/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp (106008 => 106009)


--- branches/chromium/963/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp	2012-01-26 17:54:08 UTC (rev 106008)
+++ branches/chromium/963/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp	2012-01-26 18:41:54 UTC (rev 106009)
@@ -198,21 +198,10 @@
     const SVGRenderStyle* svgStyle = style->svgStyle();
     ASSERT(svgStyle);
 
-    bool hasFill = svgStyle->hasFill();
-    bool hasStroke = svgStyle->hasStroke();
-
     RenderStyle* selectionStyle = style;
     if (hasSelection) {
         selectionStyle = parentRenderer->getCachedPseudoStyle(SELECTION);
-        if (selectionStyle) {
-            const SVGRenderStyle* svgSelectionStyle = selectionStyle->svgStyle();
-            ASSERT(svgSelectionStyle);
-
-            if (!hasFill)
-                hasFill = svgSelectionStyle->hasFill();
-            if (!hasStroke)
-                hasStroke = svgSelectionStyle->hasStroke();
-        } else
+        if (!selectionStyle)
             selectionStyle = style;
     }
 
@@ -295,6 +284,11 @@
             selectionStyle = style;
     }
 
+    if (textRenderer->frame() && textRenderer->frame()->view() && textRenderer->frame()->view()->paintBehavior() & PaintBehaviorRenderingSVGMask) {
+        hasFill = true;
+        hasStroke = false;
+    }
+
     AffineTransform fragmentTransform;
     unsigned textFragmentsSize = m_textFragments.size();
     for (unsigned i = 0; i < textFragmentsSize; ++i) {

Modified: branches/chromium/963/Source/WebCore/rendering/svg/SVGRenderSupport.cpp (106008 => 106009)


--- branches/chromium/963/Source/WebCore/rendering/svg/SVGRenderSupport.cpp	2012-01-26 17:54:08 UTC (rev 106008)
+++ branches/chromium/963/Source/WebCore/rendering/svg/SVGRenderSupport.cpp	2012-01-26 18:41:54 UTC (rev 106009)
@@ -87,8 +87,12 @@
     const SVGRenderStyle* svgStyle = style->svgStyle();
     ASSERT(svgStyle);
 
+    bool isRenderingMask = false;
+    if (object->frame() && object->frame()->view())
+        isRenderingMask = object->frame()->view()->paintBehavior() & PaintBehaviorRenderingSVGMask;
+
     // Setup transparency layers before setting up SVG resources!
-    float opacity = style->opacity();
+    float opacity = isRenderingMask ? 1 : style->opacity();
     const ShadowData* shadow = svgStyle->shadow();
     if (opacity < 1 || shadow) {
         FloatRect repaintRect = object->repaintRectInLocalCoordinates();
@@ -114,9 +118,11 @@
         return true;
     }
 
-    if (RenderSVGResourceMasker* masker = resources->masker()) {
-        if (!masker->applyResource(object, style, paintInfo.context, ApplyToDefaultMode))
-            return false;
+    if (!isRenderingMask) {
+        if (RenderSVGResourceMasker* masker = resources->masker()) {
+            if (!masker->applyResource(object, style, paintInfo.context, ApplyToDefaultMode))
+                return false;
+        }
     }
 
     if (RenderSVGResourceClipper* clipper = resources->clipper()) {
@@ -125,9 +131,11 @@
     }
 
 #if ENABLE(FILTERS)
-    if (RenderSVGResourceFilter* filter = resources->filter()) {
-        if (!filter->applyResource(object, style, paintInfo.context, ApplyToDefaultMode))
-            return false;
+    if (!isRenderingMask) {
+        if (RenderSVGResourceFilter* filter = resources->filter()) {
+            if (!filter->applyResource(object, style, paintInfo.context, ApplyToDefaultMode))
+                return false;
+        }
     }
 #endif
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to