[CSS Background Blending] -webkit-background-blend-mode fails for certain SVG files

https://bugs.webkit.org/show_bug.cgi?id=127350

Patch by Mihai Tica <mitica@adobe.com> on 2014-01-22
Reviewed by Dirk Schulze.

Source/WebCore:

The graphics context of the SVG inherits the blend mode set
on the background layer. Fix consists in drawing the SVG
in a transparency layer.

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

* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::draw): Begin a transparency layer if a blend mode is set.

LayoutTests:

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

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162517 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b726b8b0
2014-01-22 Mihai Tica <mitica@adobe.com>
[CSS Background Blending] -webkit-background-blend-mode fails for certain SVG files
https://bugs.webkit.org/show_bug.cgi?id=127350
Reviewed by Dirk Schulze.
* css3/compositing/background-blend-mode-svg-expected.html: Added.
* css3/compositing/background-blend-mode-svg.html: Added.
2014-01-22 Antti Koivisto <antti@apple.com>
Update overlay scrollbars in single pass
<!DOCTYPE HTML>
<!-- Test background blending with SVG. Test passes if you can see a green square. -->
<style type="text/css">
div {
width: 100px;
height: 100px;
background: green;
}
</style>
<div></div>
<!DOCTYPE HTML>
<!-- Test background blending with SVG. Test passes if you can see a green square. -->
<style type="text/css">
div {
width: 100px;
height: 100px;
background: url('data:image/svg+xml;utf8, \
<svg xmlns="http://www.w3.org/2000/svg" width="100px" height="100px"> \
<rect width="100" height="100" fill="#000"/> \
<rect width="100" height="100" fill="#FFF"/> \
</svg>') 0 0 / 100% 100%, green;
-webkit-background-blend-mode: multiply, normal;
}
</style>
<div></div>
2014-01-22 Mihai Tica <mitica@adobe.com>
[CSS Background Blending] -webkit-background-blend-mode fails for certain SVG files
https://bugs.webkit.org/show_bug.cgi?id=127350
Reviewed by Dirk Schulze.
The graphics context of the SVG inherits the blend mode set
on the background layer. Fix consists in drawing the SVG
in a transparency layer.
Test: css3/compositing/background-blend-mode-svg.html
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::draw): Begin a transparency layer if a blend mode is set.
2014-01-22 Antti Koivisto <antti@apple.com>
Update overlay scrollbars in single pass
......@@ -226,8 +226,11 @@ void SVGImage::draw(GraphicsContext* context, const FloatRect& dstRect, const Fl
GraphicsContextStateSaver stateSaver(*context);
context->setCompositeOperation(compositeOp, blendMode);
context->clip(enclosingIntRect(dstRect));
if (compositeOp != CompositeSourceOver)
bool compositingRequiresTransparencyLayer = compositeOp != CompositeSourceOver || blendMode != BlendModeNormal;
if (compositingRequiresTransparencyLayer) {
context->beginTransparencyLayer(1);
context->setCompositeOperation(CompositeSourceOver, BlendModeNormal);
}
FloatSize scale(dstRect.width() / srcRect.width(), dstRect.height() / srcRect.height());
......@@ -246,7 +249,7 @@ void SVGImage::draw(GraphicsContext* context, const FloatRect& dstRect, const Fl
view->paint(context, enclosingIntRect(srcRect));
if (compositeOp != CompositeSourceOver)
if (compositingRequiresTransparencyLayer)
context->endTransparencyLayer();
stateSaver.restore();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment