Add platform support for -webkit-background-blend-mode to CG context
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Feb 2013 21:43:50 +0000 (21:43 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Feb 2013 21:43:50 +0000 (21:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=108549

Patch by Rik Cabanier <cabanier@adobe.com> on 2013-02-15
Reviewed by Dean Jackson.

Source/WebCore:

Tests: css3/compositing/effect-background-blend-mode-stacking.html
       css3/compositing/effect-background-blend-mode.html

This patch adds support for blending on background images to the Core Graphics port of WebKit.

* platform/graphics/CrossfadeGeneratedImage.cpp: Added interface change for blending.
(WebCore::CrossfadeGeneratedImage::drawPattern):
* platform/graphics/CrossfadeGeneratedImage.h: Added interface change for blending.
(CrossfadeGeneratedImage):
* platform/graphics/GeneratedImage.h: Added interface change for blending.
(GeneratedImage):
* platform/graphics/GeneratorGeneratedImage.cpp: Added interface change for blending.
(WebCore::GeneratorGeneratedImage::drawPattern):
* platform/graphics/GeneratorGeneratedImage.h: Added interface change for blending.
(GeneratorGeneratedImage):
* platform/graphics/GraphicsContext.cpp: Added interface change for blending and passes blend mode to image object.
(WebCore::GraphicsContext::drawTiledImage):
(WebCore::GraphicsContext::blendModeOperation):
(WebCore):
* platform/graphics/GraphicsContext.h: Added interface change for blending.
(GraphicsContext):
* platform/graphics/Image.cpp: Added interface change for blending and passed it to graphics layer.
(WebCore::Image::drawTiled):
* platform/graphics/Image.h: Added interface change for blending.
(Image):
* platform/graphics/cg/ImageCG.cpp: Added interface change for blending and passed it to OS.
(WebCore::Image::drawPattern):
* rendering/RenderBoxModelObject.cpp: Passed blend mode when drawing background images.
(WebCore::RenderBoxModelObject::paintFillLayerExtended):
* platform/graphics/cairo/ImageCairo.cpp: Added interface change for blending.
(WebCore::Image::drawPattern):
* platform/graphics/qt/ImageQt.cpp: Added interface change for blending.
(WebCore::Image::drawPattern):
* platform/graphics/skia/ImageSkia.cpp: Added interface change for blending.
(WebCore::Image::drawPattern):
* rendering/RenderBoxModelObject.cpp: Added interface change for blending.
(WebCore::RenderBoxModelObject::paintFillLayerExtended):
* svg/graphics/SVGImageForContainer.cpp: Added interface change for blending.
(WebCore::SVGImageForContainer::drawPattern):
* svg/graphics/SVGImageForContainer.h: Added interface change for blending.

Source/WebKit:

Fixed build issue.

* WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in:

Source/WebKit/win:

Fixed build issue.

* WebKit.vcproj/WebKitExports.def.in:

LayoutTests:

Added tests for background images.

* css3/compositing/effect-background-blend-mode-expected.png: Added.
* css3/compositing/effect-background-blend-mode-expected.txt: Added.
* css3/compositing/effect-background-blend-mode-stacking-expected.png: Added.
* css3/compositing/effect-background-blend-mode-stacking-expected.txt: Added.
* css3/compositing/effect-background-blend-mode-stacking.html: Added.
* css3/compositing/effect-background-blend-mode.html: Added.
* css3/compositing/resources/ducky.png: Added.
* platform/chromium/TestExpectations:
* platform/mac/css3/compositing: Added.
* platform/mac/css3/compositing/effect-background-blend-mode-expected.png: Added.
* platform/mac/css3/compositing/effect-background-blend-mode-stacking-expected.png: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@143046 268f45cc-cd09-0410-ab3c-d52691b4dbfc

32 files changed:
LayoutTests/ChangeLog
LayoutTests/css3/compositing/effect-background-blend-mode-expected.png [new file with mode: 0644]
LayoutTests/css3/compositing/effect-background-blend-mode-expected.txt [new file with mode: 0644]
LayoutTests/css3/compositing/effect-background-blend-mode-stacking-expected.png [new file with mode: 0644]
LayoutTests/css3/compositing/effect-background-blend-mode-stacking-expected.txt [new file with mode: 0644]
LayoutTests/css3/compositing/effect-background-blend-mode-stacking.html [new file with mode: 0644]
LayoutTests/css3/compositing/effect-background-blend-mode.html [new file with mode: 0644]
LayoutTests/css3/compositing/resources/ducky.png [new file with mode: 0644]
LayoutTests/platform/chromium/TestExpectations
LayoutTests/platform/mac/css3/compositing/effect-background-blend-mode-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/css3/compositing/effect-background-blend-mode-stacking-expected.png [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/CrossfadeGeneratedImage.cpp
Source/WebCore/platform/graphics/CrossfadeGeneratedImage.h
Source/WebCore/platform/graphics/GeneratedImage.h
Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp
Source/WebCore/platform/graphics/GeneratorGeneratedImage.h
Source/WebCore/platform/graphics/GraphicsContext.cpp
Source/WebCore/platform/graphics/GraphicsContext.h
Source/WebCore/platform/graphics/Image.cpp
Source/WebCore/platform/graphics/Image.h
Source/WebCore/platform/graphics/cairo/ImageCairo.cpp
Source/WebCore/platform/graphics/cg/ImageCG.cpp
Source/WebCore/platform/graphics/qt/ImageQt.cpp
Source/WebCore/platform/graphics/skia/ImageSkia.cpp
Source/WebCore/rendering/RenderBoxModelObject.cpp
Source/WebCore/svg/graphics/SVGImageForContainer.cpp
Source/WebCore/svg/graphics/SVGImageForContainer.h
Source/WebKit/ChangeLog
Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebKit.vcproj/WebKitExports.def.in

index d09938e..9f3c11a 100644 (file)
@@ -1,3 +1,24 @@
+2013-02-15  Rik Cabanier  <cabanier@adobe.com>
+
+        Add platform support for -webkit-background-blend-mode to CG context
+        https://bugs.webkit.org/show_bug.cgi?id=108549
+
+        Reviewed by Dean Jackson.
+
+        Added tests for background images.
+
+        * css3/compositing/effect-background-blend-mode-expected.png: Added.
+        * css3/compositing/effect-background-blend-mode-expected.txt: Added.
+        * css3/compositing/effect-background-blend-mode-stacking-expected.png: Added.
+        * css3/compositing/effect-background-blend-mode-stacking-expected.txt: Added.
+        * css3/compositing/effect-background-blend-mode-stacking.html: Added.
+        * css3/compositing/effect-background-blend-mode.html: Added.
+        * css3/compositing/resources/ducky.png: Added.
+        * platform/chromium/TestExpectations:
+        * platform/mac/css3/compositing: Added.
+        * platform/mac/css3/compositing/effect-background-blend-mode-expected.png: Added.
+        * platform/mac/css3/compositing/effect-background-blend-mode-stacking-expected.png: Added.
+
 2013-02-14  Emil A Eklund  <eae@chromium.org>
 
         Clamp span value in RenderTableCell::parse[Col|Row]SpanFromDOM
diff --git a/LayoutTests/css3/compositing/effect-background-blend-mode-expected.png b/LayoutTests/css3/compositing/effect-background-blend-mode-expected.png
new file mode 100644 (file)
index 0000000..d79a5be
Binary files /dev/null and b/LayoutTests/css3/compositing/effect-background-blend-mode-expected.png differ
diff --git a/LayoutTests/css3/compositing/effect-background-blend-mode-expected.txt b/LayoutTests/css3/compositing/effect-background-blend-mode-expected.txt
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
diff --git a/LayoutTests/css3/compositing/effect-background-blend-mode-stacking-expected.png b/LayoutTests/css3/compositing/effect-background-blend-mode-stacking-expected.png
new file mode 100644 (file)
index 0000000..8a4a473
Binary files /dev/null and b/LayoutTests/css3/compositing/effect-background-blend-mode-stacking-expected.png differ
diff --git a/LayoutTests/css3/compositing/effect-background-blend-mode-stacking-expected.txt b/LayoutTests/css3/compositing/effect-background-blend-mode-stacking-expected.txt
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
diff --git a/LayoutTests/css3/compositing/effect-background-blend-mode-stacking.html b/LayoutTests/css3/compositing/effect-background-blend-mode-stacking.html
new file mode 100644 (file)
index 0000000..e8fe136
--- /dev/null
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML>
+<script>
+    if (window.testRunner) {
+        window.testRunner.overridePreference("WebKitAcceleratedCompositingEnabled", "1");
+    }
+    if (window.testRunner)
+      window.testRunner.dumpAsText(true);
+</script>
+<style>
+
+li
+{
+       margin: 5px;
+       width: 130px;
+       height: 130px;
+       background:  url("resources/ducky.png") no-repeat 0 0 /100% 100%, linear-gradient(to right, #00ffff 0%, rgba(0,0,255,0) 24%, rgba(1,0,0,0) 50%, #ffff00 75%, #00ff00 100%);
+       -webkit-background-blend-mode: exclusion, normal;
+       display: block;
+       float: left;
+}
+</style>
+<!-- this file should contain a duck on top of a gradient with every type of blending -->
+<body style="background-color: red">
+<ul>
+<li style=""></li>
+<li style="opacity: .9"></li>
+<li style="-webkit-transform: scale(1.01, 1.01)"></li>
+<li style="-webkit-transform: translate3d(.01px,.01px, 01px)"></li>
+<li style="-webkit-box-reflect:below 5px linear-gradient(to bottom, transparent 0%, transparent 50%, white 100%);"></li>
+<li style="position: fixed; top: 160px;"></li>
+</ul>
+</body>
+
diff --git a/LayoutTests/css3/compositing/effect-background-blend-mode.html b/LayoutTests/css3/compositing/effect-background-blend-mode.html
new file mode 100644 (file)
index 0000000..6fec774
--- /dev/null
@@ -0,0 +1,42 @@
+<!DOCTYPE HTML>
+<script>
+    if (window.testRunner) {
+        window.testRunner.overridePreference("WebKitAcceleratedCompositingEnabled", "1");
+    }
+    if (window.testRunner)
+      window.testRunner.dumpAsText(true);
+</script>
+<style>
+
+li
+{
+       margin: 5px;
+       width: 130px;
+       height: 130px;
+       background:  url("resources/ducky.png") no-repeat 0 0 /100% 100%, linear-gradient(to right, #00ffff 0%, rgba(0,0,255,0) 24%, #ff0000 50%, #ffff00 75%, #00ff00 100%);
+       display: block;
+       float: left;
+}
+</style>
+<!-- this file should contain a duck on top of a gradient with every type of blending -->
+<body style="background-color: green">
+<ul>
+<li style="-webkit-background-blend-mode: normal, normal"></li>
+<li style="-webkit-background-blend-mode: multiply, normal"></li>
+<li style="-webkit-background-blend-mode: screen, normal"></li>
+<li style="-webkit-background-blend-mode: overlay, normal; opacity:.9"></li>
+<li style="-webkit-background-blend-mode: darken, normal"></li>
+<li style="-webkit-background-blend-mode: lighten, normal"></li>
+<li style="-webkit-background-blend-mode: color-dodge, normal"></li>
+<li style="-webkit-background-blend-mode: color-burn, normal"></li>
+<li style="-webkit-background-blend-mode: hard-ligh, normalt"></li>
+<li style="-webkit-background-blend-mode: soft-light, normal"></li>
+<li style="-webkit-background-blend-mode: difference, normal"></li>
+<li style="-webkit-background-blend-mode: exclusion, normal"></li>
+<li style="-webkit-background-blend-mode: hue, normal;"></li>
+<li style="-webkit-background-blend-mode: saturation, normal"></li>
+<li style="-webkit-background-blend-mode: color, normal"></li>
+<li style="-webkit-background-blend-mode: luminosity, normal"></li>
+</ul>
+</body>
+
diff --git a/LayoutTests/css3/compositing/resources/ducky.png b/LayoutTests/css3/compositing/resources/ducky.png
new file mode 100644 (file)
index 0000000..f1cbd35
Binary files /dev/null and b/LayoutTests/css3/compositing/resources/ducky.png differ
index 72014bb..dc3cc50 100644 (file)
@@ -140,6 +140,8 @@ webkit.org/b/100071 fast/canvas/canvas-blend-image.html [ Skip ]
 webkit.org/b/100071 fast/canvas/canvas-blend-solid.html [ Skip ]
 webkit.org/b/100071 platform/chromium/virtual/gpu/fast/canvas/canvas-blend-image.html [ Skip ]
 webkit.org/b/100071 platform/chromium/virtual/gpu/fast/canvas/canvas-blend-solid.html [ Skip ]
+webkit.org/b/108550 css3/compositing/effect-background-blend-mode-stacking.html [ Skip ]
+webkit.org/b/108550 css3/compositing/effect-background-blend-mode.html [ Skip ]
 
 # Implement java testing harness.
 crbug.com/36681 java [ Skip ]
diff --git a/LayoutTests/platform/mac/css3/compositing/effect-background-blend-mode-expected.png b/LayoutTests/platform/mac/css3/compositing/effect-background-blend-mode-expected.png
new file mode 100644 (file)
index 0000000..36261e2
Binary files /dev/null and b/LayoutTests/platform/mac/css3/compositing/effect-background-blend-mode-expected.png differ
diff --git a/LayoutTests/platform/mac/css3/compositing/effect-background-blend-mode-stacking-expected.png b/LayoutTests/platform/mac/css3/compositing/effect-background-blend-mode-stacking-expected.png
new file mode 100644 (file)
index 0000000..9ade04d
Binary files /dev/null and b/LayoutTests/platform/mac/css3/compositing/effect-background-blend-mode-stacking-expected.png differ
index 790de20..a49faa1 100644 (file)
@@ -1,3 +1,51 @@
+2013-02-15  Rik Cabanier  <cabanier@adobe.com>
+
+        Add platform support for -webkit-background-blend-mode to CG context
+        https://bugs.webkit.org/show_bug.cgi?id=108549
+
+        Reviewed by Dean Jackson.
+
+        Tests: css3/compositing/effect-background-blend-mode-stacking.html
+               css3/compositing/effect-background-blend-mode.html
+
+        This patch adds support for blending on background images to the Core Graphics port of WebKit.
+
+        * platform/graphics/CrossfadeGeneratedImage.cpp: Added interface change for blending.
+        (WebCore::CrossfadeGeneratedImage::drawPattern):
+        * platform/graphics/CrossfadeGeneratedImage.h: Added interface change for blending.
+        (CrossfadeGeneratedImage):
+        * platform/graphics/GeneratedImage.h: Added interface change for blending.
+        (GeneratedImage):
+        * platform/graphics/GeneratorGeneratedImage.cpp: Added interface change for blending.
+        (WebCore::GeneratorGeneratedImage::drawPattern):
+        * platform/graphics/GeneratorGeneratedImage.h: Added interface change for blending.
+        (GeneratorGeneratedImage):
+        * platform/graphics/GraphicsContext.cpp: Added interface change for blending and passes blend mode to image object.
+        (WebCore::GraphicsContext::drawTiledImage):
+        (WebCore::GraphicsContext::blendModeOperation):
+        (WebCore):
+        * platform/graphics/GraphicsContext.h: Added interface change for blending.
+        (GraphicsContext):
+        * platform/graphics/Image.cpp: Added interface change for blending and passed it to graphics layer.
+        (WebCore::Image::drawTiled):
+        * platform/graphics/Image.h: Added interface change for blending.
+        (Image):
+        * platform/graphics/cg/ImageCG.cpp: Added interface change for blending and passed it to OS.
+        (WebCore::Image::drawPattern):
+        * rendering/RenderBoxModelObject.cpp: Passed blend mode when drawing background images.
+        (WebCore::RenderBoxModelObject::paintFillLayerExtended):
+        * platform/graphics/cairo/ImageCairo.cpp: Added interface change for blending.
+        (WebCore::Image::drawPattern):
+        * platform/graphics/qt/ImageQt.cpp: Added interface change for blending.
+        (WebCore::Image::drawPattern):
+        * platform/graphics/skia/ImageSkia.cpp: Added interface change for blending.
+        (WebCore::Image::drawPattern):
+        * rendering/RenderBoxModelObject.cpp: Added interface change for blending.
+        (WebCore::RenderBoxModelObject::paintFillLayerExtended):
+        * svg/graphics/SVGImageForContainer.cpp: Added interface change for blending.
+        (WebCore::SVGImageForContainer::drawPattern):
+        * svg/graphics/SVGImageForContainer.h: Added interface change for blending.
+
 2013-02-14  Emil A Eklund  <eae@chromium.org>
 
         Clamp span value in RenderTableCell::parse[Col|Row]SpanFromDOM
index 5d3631b..7562b7e 100644 (file)
@@ -94,7 +94,7 @@ void CrossfadeGeneratedImage::draw(GraphicsContext* context, const FloatRect& ds
     drawCrossfade(context);
 }
 
-void CrossfadeGeneratedImage::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator compositeOp, const FloatRect& dstRect)
+void CrossfadeGeneratedImage::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator compositeOp, const FloatRect& dstRect, BlendMode)
 {
     OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(m_size, 1, ColorSpaceDeviceRGB, context->isAcceleratedContext() ? Accelerated : Unaccelerated);
     if (!imageBuffer)
index bd67d1d..6f83b6e 100644 (file)
@@ -54,7 +54,7 @@ public:
 
 protected:
     virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator, BlendMode);
-    virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& dstRect);
+    virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& dstRect, BlendMode);
 
     CrossfadeGeneratedImage(Image* fromImage, Image* toImage, float percentage, IntSize crossfadeSize, const IntSize&);
 
index e134608..da3ca12 100644 (file)
@@ -55,7 +55,7 @@ public:
 protected:
     virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator, BlendMode) = 0;
     virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform,
-                             const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect) = 0;
+        const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect, BlendMode) = 0;
 
     // FIXME: Implement this to be less conservative.
     virtual bool currentFrameKnownToBeOpaque() OVERRIDE { return false; }
index 6702245..58f6373 100644 (file)
@@ -46,7 +46,7 @@ void GeneratorGeneratedImage::draw(GraphicsContext* destContext, const FloatRect
 }
 
 void GeneratorGeneratedImage::drawPattern(GraphicsContext* destContext, const FloatRect& srcRect, const AffineTransform& patternTransform,
-                                 const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator compositeOp, const FloatRect& destRect)
+    const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator compositeOp, const FloatRect& destRect, BlendMode)
 {
     // Allow the generator to provide visually-equivalent tiling parameters for better performance.
     IntSize adjustedSize = m_size;
index 5b32df8..b60bb60 100644 (file)
@@ -55,7 +55,7 @@ public:
 protected:
     virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator, BlendMode);
     virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform,
-                             const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect);
+        const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect, BlendMode);
 
     void invalidateCacheTimerFired(DeferrableOneShotTimer<GeneratorGeneratedImage>*);
 
index d1724cd..5a13ff8 100644 (file)
@@ -499,7 +499,7 @@ void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const
         setImageInterpolationQuality(previousInterpolationQuality);
 }
 
-void GraphicsContext::drawTiledImage(Image* image, ColorSpace styleColorSpace, const IntRect& destRect, const IntPoint& srcPoint, const IntSize& tileSize, CompositeOperator op, bool useLowQualityScale)
+void GraphicsContext::drawTiledImage(Image* image, ColorSpace styleColorSpace, const IntRect& destRect, const IntPoint& srcPoint, const IntSize& tileSize, CompositeOperator op, bool useLowQualityScale, BlendMode blendMode)
 {
     if (paintingDisabled() || !image)
         return;
@@ -507,10 +507,10 @@ void GraphicsContext::drawTiledImage(Image* image, ColorSpace styleColorSpace, c
     if (useLowQualityScale) {
         InterpolationQuality previousInterpolationQuality = imageInterpolationQuality();
         setImageInterpolationQuality(InterpolationLow);
-        image->drawTiled(this, destRect, srcPoint, tileSize, styleColorSpace, op);
+        image->drawTiled(this, destRect, srcPoint, tileSize, styleColorSpace, op, blendMode);
         setImageInterpolationQuality(previousInterpolationQuality);
     } else
-        image->drawTiled(this, destRect, srcPoint, tileSize, styleColorSpace, op);
+        image->drawTiled(this, destRect, srcPoint, tileSize, styleColorSpace, op, blendMode);
 }
 
 void GraphicsContext::drawTiledImage(Image* image, ColorSpace styleColorSpace, const IntRect& dest, const IntRect& srcRect,
@@ -717,6 +717,11 @@ CompositeOperator GraphicsContext::compositeOperation() const
     return m_state.compositeOperator;
 }
 
+BlendMode GraphicsContext::blendModeOperation() const
+{
+    return m_state.blendMode;
+}
+
 #if !USE(CG) && !USE(SKIA)
 // Implement this if you want to go ahead and push the drawing mode into your native context
 // immediately.
index 6fddf0e..5bc8881 100644 (file)
@@ -326,7 +326,7 @@ namespace WebCore {
         void drawImage(Image*, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator, BlendMode, RespectImageOrientationEnum = DoNotRespectImageOrientation, bool useLowQualityScale = false);
         
         void drawTiledImage(Image*, ColorSpace styleColorSpace, const IntRect& destRect, const IntPoint& srcPoint, const IntSize& tileSize,
-                       CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false);
+            CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false, BlendMode = BlendModeNormal);
         void drawTiledImage(Image*, ColorSpace styleColorSpace, const IntRect& destRect, const IntRect& srcRect,
                             const FloatSize& tileScaleFactor, Image::TileRule hRule = Image::StretchTile, Image::TileRule vRule = Image::StretchTile,
                             CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false);
@@ -406,6 +406,7 @@ namespace WebCore {
 
         void setCompositeOperation(CompositeOperator, BlendMode = BlendModeNormal);
         CompositeOperator compositeOperation() const;
+        BlendMode blendModeOperation() const;
 
         void clip(const Path&, WindRule = RULE_EVENODD);
 
index 1718884..2d269e6 100644 (file)
@@ -97,7 +97,7 @@ void Image::draw(GraphicsContext* ctx, const FloatRect& dstRect, const FloatRect
     draw(ctx, dstRect, srcRect, styleColorSpace, op, blendMode);
 }
 
-void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& destRect, const FloatPoint& srcPoint, const FloatSize& scaledTileSize, ColorSpace styleColorSpace, CompositeOperator op)
+void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& destRect, const FloatPoint& srcPoint, const FloatSize& scaledTileSize, ColorSpace styleColorSpace, CompositeOperator op, BlendMode blendMode)
 {    
     if (mayFillWithSolidColor()) {
         fillWithSolidColor(ctxt, destRect, solidColor(), styleColorSpace, op);
@@ -130,13 +130,13 @@ void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& destRect, const Fl
         visibleSrcRect.setY((destRect.y() - oneTileRect.y()) / scale.height());
         visibleSrcRect.setWidth(destRect.width() / scale.width());
         visibleSrcRect.setHeight(destRect.height() / scale.height());
-        draw(ctxt, destRect, visibleSrcRect, styleColorSpace, op, BlendModeNormal);
+        draw(ctxt, destRect, visibleSrcRect, styleColorSpace, op, blendMode);
         return;
     }
 
     AffineTransform patternTransform = AffineTransform().scaleNonUniform(scale.width(), scale.height());
     FloatRect tileRect(FloatPoint(), intrinsicTileSize);    
-    drawPattern(ctxt, tileRect, patternTransform, oneTileRect.location(), styleColorSpace, op, destRect);
+    drawPattern(ctxt, tileRect, patternTransform, oneTileRect.location(), styleColorSpace, op, destRect, blendMode);
     
     startAnimation();
 }
index 8be967a..637643d 100644 (file)
@@ -176,7 +176,7 @@ public:
 #endif
 
     virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform,
-                             const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect);
+        const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect, BlendMode = BlendModeNormal);
 
 #if ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
     FloatRect adjustSourceRectForDownSampling(const FloatRect& srcRect, const IntSize& scaledSize) const;
@@ -199,7 +199,8 @@ protected:
 #endif
     virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator, BlendMode) = 0;
     virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator, BlendMode, RespectImageOrientationEnum);
-    void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatPoint& srcPoint, const FloatSize& tileSize, ColorSpace styleColorSpace, CompositeOperator);
+    void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatPoint& srcPoint, const FloatSize& tileSize, ColorSpace styleColorSpace,
+        CompositeOperator , BlendMode);
     void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, const FloatSize& tileScaleFactor, TileRule hRule, TileRule vRule, ColorSpace styleColorSpace, CompositeOperator);
 
     // Supporting tiled drawing
index f1af13c..e858547 100644 (file)
@@ -43,7 +43,7 @@
 namespace WebCore {
 
 void Image::drawPattern(GraphicsContext* context, const FloatRect& tileRect, const AffineTransform& patternTransform,
-                        const FloatPoint& phase, ColorSpace, CompositeOperator op, const FloatRect& destRect)
+    const FloatPoint& phase, ColorSpace, CompositeOperator op, const FloatRect& destRect, BlendMode)
 {
     NativeImageCairo* image = nativeImageForCurrentFrame();
     if (!image) // If it's too early we won't have an image yet.
index a54a867..2db26ac 100644 (file)
@@ -74,7 +74,7 @@ static void drawPatternCallback(void* info, CGContextRef context)
 }
 
 void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, const AffineTransform& patternTransform,
-                        const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect)
+    const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect, BlendMode blendMode)
 {
     if (!nativeImageForCurrentFrame())
         return;
@@ -85,7 +85,7 @@ void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, const
     CGContextRef context = ctxt->platformContext();
     GraphicsContextStateSaver stateSaver(*ctxt);
     CGContextClipToRect(context, destRect);
-    ctxt->setCompositeOperation(op);
+    ctxt->setCompositeOperation(op, blendMode);
     CGContextTranslateCTM(context, destRect.x(), destRect.y() + destRect.height());
     CGContextScaleCTM(context, 1, -1);
     
index bbe06c8..eb9235c 100644 (file)
@@ -132,7 +132,7 @@ void Image::setPlatformResource(const char* name, const QPixmap& pixmap)
 }
 
 void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, const AffineTransform& patternTransform,
-                        const FloatPoint& phase, ColorSpace, CompositeOperator op, const FloatRect& destRect)
+    const FloatPoint& phase, ColorSpace, CompositeOperator op, const FloatRect& destRect, BlendMode)
 {
     QPixmap* framePixmap = nativeImageForCurrentFrame();
     if (!framePixmap) // If it's too early we won't have an image yet.
index b1e6061..1dec1ee 100644 (file)
@@ -465,7 +465,8 @@ void Image::drawPattern(GraphicsContext* context,
                         const FloatPoint& phase,
                         ColorSpace styleColorSpace,
                         CompositeOperator compositeOp,
-                        const FloatRect& destRect)
+                        const FloatRect& destRect,
+                        BlendMode)
 {
 #if PLATFORM(CHROMIUM)
     TRACE_EVENT0("skia", "Image::drawPattern");
index 58ba294..3ddacfa 100644 (file)
@@ -882,7 +882,7 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co
             RefPtr<Image> image = bgImage->image(clientForBackgroundImage, geometry.tileSize());
             bool useLowQualityScaling = shouldPaintAtLowQuality(context, image.get(), bgLayer, geometry.tileSize());
             context->drawTiledImage(image.get(), style()->colorSpace(), geometry.destRect(), geometry.relativePhase(), geometry.tileSize(), 
-                compositeOp, useLowQualityScaling);
+                compositeOp, useLowQualityScaling, bgLayer->blendMode());
         }
     }
 
index 0aeaf13..485c49f 100644 (file)
@@ -43,7 +43,7 @@ void SVGImageForContainer::draw(GraphicsContext* context, const FloatRect& dstRe
 }
 
 void SVGImageForContainer::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const AffineTransform& patternTransform,
-    const FloatPoint& phase, ColorSpace colorSpace, CompositeOperator compositeOp, const FloatRect& dstRect)
+    const FloatPoint& phase, ColorSpace colorSpace, CompositeOperator compositeOp, const FloatRect& dstRect, BlendMode)
 {
     m_image->drawPatternForContainer(context, m_containerSize, m_pageScale, m_zoom, srcRect, patternTransform, phase, colorSpace, compositeOp, dstRect);
 }
index 8d04b06..fed96da 100644 (file)
@@ -57,7 +57,7 @@ public:
 
     virtual void draw(GraphicsContext*, const FloatRect&, const FloatRect&, ColorSpace, CompositeOperator, BlendMode) OVERRIDE;
 
-    virtual void drawPattern(GraphicsContext*, const FloatRect&, const AffineTransform&, const FloatPoint&, ColorSpace, CompositeOperator, const FloatRect&) OVERRIDE;
+    virtual void drawPattern(GraphicsContext*, const FloatRect&, const AffineTransform&, const FloatPoint&, ColorSpace, CompositeOperator, const FloatRect&, BlendMode) OVERRIDE;
 
     // FIXME: Implement this to be less conservative.
     virtual bool currentFrameKnownToBeOpaque() OVERRIDE { return false; }
index 4259a6c..fb7548e 100644 (file)
@@ -1,3 +1,14 @@
+2013-02-15  Rik Cabanier  <cabanier@adobe.com>
+
+        Add platform support for -webkit-background-blend-mode to CG context
+        https://bugs.webkit.org/show_bug.cgi?id=108549
+
+        Reviewed by Dean Jackson.
+
+        Fixed build issue.
+
+        * WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in:
+
 2013-02-14  Roger Fong  <roger_fong@apple.com>
 
         Unreviewed. Touch-ups to the VS2010 WebKit solution.
index b4e92d3..92c2ad8 100644 (file)
@@ -365,7 +365,7 @@ EXPORTS
 #endif
         ?getHBITMAP@BitmapImage@WebCore@@UAE_NPAUHBITMAP__@@@Z
         ?getHBITMAPOfSize@BitmapImage@WebCore@@UAE_NPAUHBITMAP__@@PAUtagSIZE@@@Z
-        ?drawPattern@Image@WebCore@@UAEXPAVGraphicsContext@2@ABVFloatRect@2@ABVAffineTransform@2@ABVFloatPoint@2@W4ColorSpace@2@W4CompositeOperator@2@1@Z
+        ?drawPattern@Image@WebCore@@UAEXPAVGraphicsContext@2@ABVFloatRect@2@ABVAffineTransform@2@ABVFloatPoint@2@W4ColorSpace@2@W4CompositeOperator@2@1W4BlendMode@2@@Z
         ?reportMemoryUsage@BitmapImage@WebCore@@UBEXPAVMemoryObjectInfo@WTF@@@Z
         ?drawFrameMatchingSourceSize@BitmapImage@WebCore@@MAEXPAVGraphicsContext@2@ABVFloatRect@2@ABVIntSize@2@W4ColorSpace@2@W4CompositeOperator@2@@Z
         ?draw@Image@WebCore@@MAEXPAVGraphicsContext@2@ABVFloatRect@2@1W4ColorSpace@2@W4CompositeOperator@2@W4BlendMode@2@W4RespectImageOrientationEnum@2@@Z
index f504c7a..a7edd23 100644 (file)
@@ -1,3 +1,14 @@
+2013-02-15  Rik Cabanier  <cabanier@adobe.com>
+
+        Add platform support for -webkit-background-blend-mode to CG context
+        https://bugs.webkit.org/show_bug.cgi?id=108549
+
+        Reviewed by Dean Jackson.
+
+        Fixed build issue.
+
+        * WebKit.vcproj/WebKitExports.def.in:
+
 2013-02-15  Allan Sandfeld Jensen  <allan.jensen@digia.com>
 
         Simplify hitTestResultAtPoint and nodesFromRect APIs
index 6f54e55..47db4c5 100644 (file)
@@ -365,7 +365,7 @@ EXPORTS
 #endif
         ?getHBITMAP@BitmapImage@WebCore@@UAE_NPAUHBITMAP__@@@Z
         ?getHBITMAPOfSize@BitmapImage@WebCore@@UAE_NPAUHBITMAP__@@PAUtagSIZE@@@Z
-        ?drawPattern@Image@WebCore@@UAEXPAVGraphicsContext@2@ABVFloatRect@2@ABVAffineTransform@2@ABVFloatPoint@2@W4ColorSpace@2@W4CompositeOperator@2@1@Z
+        ?drawPattern@Image@WebCore@@UAEXPAVGraphicsContext@2@ABVFloatRect@2@ABVAffineTransform@2@ABVFloatPoint@2@W4ColorSpace@2@W4CompositeOperator@2@1W4BlendMode@2@@Z
         ?reportMemoryUsage@BitmapImage@WebCore@@UBEXPAVMemoryObjectInfo@WTF@@@Z
         ?drawFrameMatchingSourceSize@BitmapImage@WebCore@@MAEXPAVGraphicsContext@2@ABVFloatRect@2@ABVIntSize@2@W4ColorSpace@2@W4CompositeOperator@2@@Z
         ?draw@Image@WebCore@@MAEXPAVGraphicsContext@2@ABVFloatRect@2@1W4ColorSpace@2@W4CompositeOperator@2@W4BlendMode@2@W4RespectImageOrientationEnum@2@@Z