Title: [161964] trunk
Revision
161964
Author
[email protected]
Date
2014-01-14 07:38:26 -0800 (Tue, 14 Jan 2014)

Log Message

Source/WebCore: Background-blend-mode doesn't work for an element with an
SVG image as background and border-style or padding set.
The problem consisted in the drawing path using the default
blending parameter at all times.
https://bugs.webkit.org/show_bug.cgi?id=118894

Patch by Mihai Tica <[email protected]> on 2014-01-14
Reviewed by Dirk Schulze.

Test: css3/compositing/background-blend-mode-data-uri-svg-image.html

* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::drawPatternForContainer): Pass blendMode to Image::drawPattern.
* svg/graphics/SVGImage.h: Add a blendMode parameter to drawPatternForContainer.
* svg/graphics/SVGImageForContainer.cpp:
(WebCore::SVGImageForContainer::drawPattern): Pass blendMode to drawPatternForContainer call.

LayoutTests: Background-blend-mode doesn't work for an element with an
SVG image as background and border-style or padding set.
https://bugs.webkit.org/show_bug.cgi?id=118894

Patch by Mihai Tica <[email protected]> on 2014-01-14
Reviewed by Dirk Schulze.

* css3/compositing/background-blend-mode-data-uri-svg-image-expected.html: Added.
* css3/compositing/background-blend-mode-data-uri-svg-image.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (161963 => 161964)


--- trunk/LayoutTests/ChangeLog	2014-01-14 15:35:49 UTC (rev 161963)
+++ trunk/LayoutTests/ChangeLog	2014-01-14 15:38:26 UTC (rev 161964)
@@ -1,3 +1,14 @@
+2014-01-14  Mihai Tica  <[email protected]>
+
+        Background-blend-mode doesn't work for an element with an
+        SVG image as background and border-style or padding set.
+        https://bugs.webkit.org/show_bug.cgi?id=118894
+
+        Reviewed by Dirk Schulze.
+
+        * css3/compositing/background-blend-mode-data-uri-svg-image-expected.html: Added.
+        * css3/compositing/background-blend-mode-data-uri-svg-image.html: Added.
+
 2014-01-14  Mihnea Ovidenie  <[email protected]>
 
         [CSSRegions] Test dynamic change of position for fixed element in named flow

Added: trunk/LayoutTests/css3/compositing/background-blend-mode-data-uri-svg-image-expected.html (0 => 161964)


--- trunk/LayoutTests/css3/compositing/background-blend-mode-data-uri-svg-image-expected.html	                        (rev 0)
+++ trunk/LayoutTests/css3/compositing/background-blend-mode-data-uri-svg-image-expected.html	2014-01-14 15:38:26 UTC (rev 161964)
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML>
+
+<style>
+    div {
+        border: 5px navy;
+        border-style: dotted double;
+        background: url('data:image/svg+xml;utf8, \
+            <svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 100 100"> \
+                <circle cx="50" cy="50" r="40" fill="#0F0"/> \
+            </svg>'
+            ), #FF0;
+        width: 130px;
+        height: 130px;
+    }
+</style>
+
+<!-- This file should contain a green svg circle on top of a solid color yellow background. The container should have a visible border. -->
+
+<div></div>

Added: trunk/LayoutTests/css3/compositing/background-blend-mode-data-uri-svg-image.html (0 => 161964)


--- trunk/LayoutTests/css3/compositing/background-blend-mode-data-uri-svg-image.html	                        (rev 0)
+++ trunk/LayoutTests/css3/compositing/background-blend-mode-data-uri-svg-image.html	2014-01-14 15:38:26 UTC (rev 161964)
@@ -0,0 +1,20 @@
+<!DOCTYPE HTML>
+
+<style>
+    div {
+        border: 5px navy;
+        border-style: dotted double;
+        background: url('data:image/svg+xml;utf8, \
+            <svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 100 100"> \
+                <circle cx="50" cy="50" r="40" fill="#F00"/> \
+            </svg>'
+            ), #FF0;
+        width: 130px;
+        height: 130px;
+        -webkit-background-blend-mode: difference, normal
+    }
+</style>
+
+<!-- This file should contain a green svg circle on top of a solid color yellow background. The container should have a visible border. -->
+
+<div></div>

Modified: trunk/Source/WebCore/ChangeLog (161963 => 161964)


--- trunk/Source/WebCore/ChangeLog	2014-01-14 15:35:49 UTC (rev 161963)
+++ trunk/Source/WebCore/ChangeLog	2014-01-14 15:38:26 UTC (rev 161964)
@@ -1,3 +1,21 @@
+2014-01-14  Mihai Tica  <[email protected]>
+
+        Background-blend-mode doesn't work for an element with an
+        SVG image as background and border-style or padding set.
+        The problem consisted in the drawing path using the default
+        blending parameter at all times.
+        https://bugs.webkit.org/show_bug.cgi?id=118894
+
+        Reviewed by Dirk Schulze.
+
+        Test: css3/compositing/background-blend-mode-data-uri-svg-image.html
+
+        * svg/graphics/SVGImage.cpp:
+        (WebCore::SVGImage::drawPatternForContainer): Pass blendMode to Image::drawPattern.
+        * svg/graphics/SVGImage.h: Add a blendMode parameter to drawPatternForContainer.
+        * svg/graphics/SVGImageForContainer.cpp:
+        (WebCore::SVGImageForContainer::drawPattern): Pass blendMode to drawPatternForContainer call.
+
 2014-01-14  Peter Molnar  <[email protected]>
 
         Remove accidentally added PLATFORM(QT) from Source/WebCore/editing/EditorCommand.cpp after r161638

Modified: trunk/Source/WebCore/svg/graphics/SVGImage.cpp (161963 => 161964)


--- trunk/Source/WebCore/svg/graphics/SVGImage.cpp	2014-01-14 15:35:49 UTC (rev 161963)
+++ trunk/Source/WebCore/svg/graphics/SVGImage.cpp	2014-01-14 15:38:26 UTC (rev 161964)
@@ -182,7 +182,7 @@
 #endif
 
 void SVGImage::drawPatternForContainer(GraphicsContext* context, const FloatSize containerSize, float zoom, const FloatRect& srcRect,
-    const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace colorSpace, CompositeOperator compositeOp, const FloatRect& dstRect)
+    const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace colorSpace, CompositeOperator compositeOp, BlendMode blendMode, const FloatRect& dstRect)
 {
     FloatRect zoomedContainerRect = FloatRect(FloatPoint(), containerSize);
     zoomedContainerRect.scale(zoom);
@@ -213,7 +213,7 @@
     unscaledPatternTransform.scale(1 / imageBufferScale.width(), 1 / imageBufferScale.height());
 
     context->setDrawLuminanceMask(false);
-    image->drawPattern(context, scaledSrcRect, unscaledPatternTransform, phase, colorSpace, compositeOp, dstRect);
+    image->drawPattern(context, scaledSrcRect, unscaledPatternTransform, phase, colorSpace, compositeOp, dstRect, blendMode);
 }
 
 void SVGImage::draw(GraphicsContext* context, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace, CompositeOperator compositeOp, BlendMode blendMode, ImageOrientationDescription)

Modified: trunk/Source/WebCore/svg/graphics/SVGImage.h (161963 => 161964)


--- trunk/Source/WebCore/svg/graphics/SVGImage.h	2014-01-14 15:35:49 UTC (rev 161963)
+++ trunk/Source/WebCore/svg/graphics/SVGImage.h	2014-01-14 15:38:26 UTC (rev 161964)
@@ -92,7 +92,7 @@
     virtual void draw(GraphicsContext*, const FloatRect& fromRect, const FloatRect& toRect, ColorSpace styleColorSpace, CompositeOperator, BlendMode, ImageOrientationDescription) OVERRIDE;
     void drawForContainer(GraphicsContext*, const FloatSize, float, const FloatRect&, const FloatRect&, ColorSpace, CompositeOperator, BlendMode);
     void drawPatternForContainer(GraphicsContext*, const FloatSize, float, const FloatRect&, const AffineTransform&, const FloatPoint&, ColorSpace,
-        CompositeOperator, const FloatRect&);
+        CompositeOperator, BlendMode, const FloatRect&);
 
     std::unique_ptr<SVGImageChromeClient> m_chromeClient;
     std::unique_ptr<Page> m_page;

Modified: trunk/Source/WebCore/svg/graphics/SVGImageForContainer.cpp (161963 => 161964)


--- trunk/Source/WebCore/svg/graphics/SVGImageForContainer.cpp	2014-01-14 15:35:49 UTC (rev 161963)
+++ trunk/Source/WebCore/svg/graphics/SVGImageForContainer.cpp	2014-01-14 15:38:26 UTC (rev 161964)
@@ -43,10 +43,10 @@
 }
 
 void SVGImageForContainer::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const AffineTransform& patternTransform,
-    const FloatPoint& phase, ColorSpace colorSpace, CompositeOperator compositeOp, const FloatRect& dstRect, BlendMode)
+    const FloatPoint& phase, ColorSpace colorSpace, CompositeOperator compositeOp, const FloatRect& dstRect, BlendMode blendMode)
 {
     m_image->setSpaceSize(spaceSize());
-    m_image->drawPatternForContainer(context, m_containerSize, m_zoom, srcRect, patternTransform, phase, colorSpace, compositeOp, dstRect);
+    m_image->drawPatternForContainer(context, m_containerSize, m_zoom, srcRect, patternTransform, phase, colorSpace, compositeOp, blendMode, dstRect);
 }
 
 PassNativeImagePtr SVGImageForContainer::nativeImageForCurrentFrame()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to