Title: [108490] trunk
Revision
108490
Author
[email protected]
Date
2012-02-22 05:38:15 -0800 (Wed, 22 Feb 2012)

Log Message

REGRESSION: unbalanced transparency layers for clipPath
https://bugs.webkit.org/show_bug.cgi?id=78074

Reviewed by Zoltan Herczeg.

Source/WebCore:

If we're rendering to a mask image buffer, all children are rendered with opacity=1, regardless what their RenderStyles specify.
SVGRenderSupport::finishRenderSVGContent() did not take this into account and always called endTransparencyLayer(). Fix that
by checking if we're rendering to a mask image buffer, if so don't call endTransparencyLayer().

Add new reftest covering both the visual & logical correctness (no assertion).

Tests: svg/clip-path/opacity-assertion-expected.svg
       svg/clip-path/opacity-assertion.svg

* rendering/svg/SVGRenderSupport.cpp:
(WebCore::isRenderingMaskImage): Extraced as sharable helper function.
(WebCore::SVGRenderSupport::prepareToRenderSVGContent): Factor out isRenderingMaskImage() function.
(WebCore::SVGRenderSupport::finishRenderSVGContent): Only call endTransparencyLayer(), if we actually called beginTL() first.

LayoutTests:

* svg/clip-path/opacity-assertion-expected.svg: Added.
* svg/clip-path/opacity-assertion.svg: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (108489 => 108490)


--- trunk/LayoutTests/ChangeLog	2012-02-22 13:36:12 UTC (rev 108489)
+++ trunk/LayoutTests/ChangeLog	2012-02-22 13:38:15 UTC (rev 108490)
@@ -1,3 +1,13 @@
+2012-02-17  Nikolas Zimmermann  <[email protected]>
+
+        REGRESSION: unbalanced transparency layers for clipPath
+        https://bugs.webkit.org/show_bug.cgi?id=78074
+
+        Reviewed by Zoltan Herczeg.
+
+        * svg/clip-path/opacity-assertion-expected.svg: Added.
+        * svg/clip-path/opacity-assertion.svg: Added.
+
 2012-02-21  Pavel Feldman  <[email protected]>
 
         Web Inspector: do not filter out requestAnimationFrame from timeline, implement stop on animation events.

Added: trunk/LayoutTests/svg/clip-path/opacity-assertion-expected.svg (0 => 108490)


--- trunk/LayoutTests/svg/clip-path/opacity-assertion-expected.svg	                        (rev 0)
+++ trunk/LayoutTests/svg/clip-path/opacity-assertion-expected.svg	2012-02-22 13:38:15 UTC (rev 108490)
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg">
+<rect width="100" height="100" fill="green"/>
+</svg>

Added: trunk/LayoutTests/svg/clip-path/opacity-assertion.svg (0 => 108490)


--- trunk/LayoutTests/svg/clip-path/opacity-assertion.svg	                        (rev 0)
+++ trunk/LayoutTests/svg/clip-path/opacity-assertion.svg	2012-02-22 13:38:15 UTC (rev 108490)
@@ -0,0 +1,13 @@
+<svg xmlns="http://www.w3.org/2000/svg">
+<defs>
+    <clipPath id="clip">
+        <rect width="100" height="100" opacity=".4"/>
+        <rect/> <!-- trigger render-to-image-buffer mode -->
+    </clipPath>
+</defs>
+
+<!-- Should result in a 100x100 green square -->
+<rect width="200" height="200" fill="red" clip-path="url(#clip)"/>
+<rect width="100" height="100" fill="green"/>
+
+</svg>

Modified: trunk/Source/WebCore/ChangeLog (108489 => 108490)


--- trunk/Source/WebCore/ChangeLog	2012-02-22 13:36:12 UTC (rev 108489)
+++ trunk/Source/WebCore/ChangeLog	2012-02-22 13:38:15 UTC (rev 108490)
@@ -1,3 +1,24 @@
+2012-02-17  Nikolas Zimmermann  <[email protected]>
+
+        REGRESSION: unbalanced transparency layers for clipPath
+        https://bugs.webkit.org/show_bug.cgi?id=78074
+
+        Reviewed by Zoltan Herczeg.
+
+        If we're rendering to a mask image buffer, all children are rendered with opacity=1, regardless what their RenderStyles specify.
+        SVGRenderSupport::finishRenderSVGContent() did not take this into account and always called endTransparencyLayer(). Fix that
+        by checking if we're rendering to a mask image buffer, if so don't call endTransparencyLayer().
+
+        Add new reftest covering both the visual & logical correctness (no assertion).
+
+        Tests: svg/clip-path/opacity-assertion-expected.svg
+               svg/clip-path/opacity-assertion.svg
+
+        * rendering/svg/SVGRenderSupport.cpp:
+        (WebCore::isRenderingMaskImage): Extraced as sharable helper function.
+        (WebCore::SVGRenderSupport::prepareToRenderSVGContent): Factor out isRenderingMaskImage() function.
+        (WebCore::SVGRenderSupport::finishRenderSVGContent): Only call endTransparencyLayer(), if we actually called beginTL() first. 
+
 2012-02-22  Kenneth Rohde Christiansen  <[email protected]>
 
         Improve comments in tiling code.

Modified: trunk/Source/WebCore/rendering/svg/SVGRenderSupport.cpp (108489 => 108490)


--- trunk/Source/WebCore/rendering/svg/SVGRenderSupport.cpp	2012-02-22 13:36:12 UTC (rev 108489)
+++ trunk/Source/WebCore/rendering/svg/SVGRenderSupport.cpp	2012-02-22 13:38:15 UTC (rev 108490)
@@ -79,6 +79,13 @@
     object->parent()->mapLocalToContainer(repaintContainer, false, true, transformState, wasFixed);
 }
 
+static inline bool isRenderingMaskImage(RenderObject* object)
+{
+    if (object->frame() && object->frame()->view())
+        return object->frame()->view()->paintBehavior() & PaintBehaviorRenderingSVGMask;
+    return false;
+}
+
 bool SVGRenderSupport::prepareToRenderSVGContent(RenderObject* object, PaintInfo& paintInfo)
 {
     ASSERT(object);
@@ -89,11 +96,8 @@
     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!
+    bool isRenderingMask = isRenderingMaskImage(object);
     float opacity = isRenderingMask ? 1 : style->opacity();
     const ShadowData* shadow = svgStyle->shadow();
     if (opacity < 1 || shadow) {
@@ -168,7 +172,7 @@
     }
 #endif
 
-    if (style->opacity() < 1)
+    if (style->opacity() < 1 && !isRenderingMaskImage(object))
         paintInfo.context->endTransparencyLayer();
 
     if (svgStyle->shadow())
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to