Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(887)

Unified Diff: Source/core/rendering/svg/SVGRenderingContext.cpp

Issue 17115010: Add support for element blending to SVG (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Added test files for webkit-svg-shadow Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/css3/compositing/svg-blend-soft-light-expected.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/svg/SVGRenderingContext.cpp
diff --git a/Source/core/rendering/svg/SVGRenderingContext.cpp b/Source/core/rendering/svg/SVGRenderingContext.cpp
index e4d7be5cbb3403a3a07902bec0ceb7dfd09266fb..6b9968b006394922f685b63662bd8ed24a003523 100644
--- a/Source/core/rendering/svg/SVGRenderingContext.cpp
+++ b/Source/core/rendering/svg/SVGRenderingContext.cpp
@@ -102,12 +102,20 @@ void SVGRenderingContext::prepareToRenderSVGContent(RenderObject* object, PaintI
// Setup transparency layers before setting up SVG resources!
bool isRenderingMask = isRenderingMaskImage(m_object);
float opacity = isRenderingMask ? 1 : style->opacity();
+ BlendMode blendMode = isRenderingMask ? BlendModeNormal : style->blendMode();
const ShadowData* shadow = svgStyle->shadow();
- if (opacity < 1 || shadow) {
+ if (opacity < 1 || shadow || blendMode != BlendModeNormal) {
FloatRect repaintRect = m_object->repaintRectInLocalCoordinates();
- if (opacity < 1) {
+ if (opacity < 1 || blendMode != BlendModeNormal) {
m_paintInfo->context->clip(repaintRect);
+ if (blendMode != BlendModeNormal) {
+ if (!(m_renderingFlags & RestoreGraphicsContext)) {
+ m_paintInfo->context->save();
+ m_renderingFlags |= RestoreGraphicsContext;
+ }
+ m_paintInfo->context->setCompositeOperation(CompositeSourceOver, blendMode);
+ }
m_paintInfo->context->beginTransparencyLayer(opacity);
m_renderingFlags |= EndOpacityLayer;
}
« no previous file with comments | « LayoutTests/css3/compositing/svg-blend-soft-light-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698