Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / rendering / svg / SVGRenderingContext.cpp
index 23766e3..97dc1d0 100644 (file)
@@ -40,7 +40,7 @@
 
 static int kMaxImageBufferSize = 4096;
 
-namespace WebCore {
+namespace blink {
 
 static inline bool isRenderingMaskImage(RenderObject* object)
 {
@@ -90,7 +90,7 @@ void SVGRenderingContext::prepareToRenderSVGContent(RenderObject* object, PaintI
 {
     ASSERT(object);
 
-#ifndef NDEBUG
+#if ENABLE(ASSERT)
     // This function must not be called twice!
     ASSERT(!(m_renderingFlags & PrepareToRenderSVGContentWasCalled));
     m_renderingFlags |= PrepareToRenderSVGContentWasCalled;
@@ -109,8 +109,7 @@ void SVGRenderingContext::prepareToRenderSVGContent(RenderObject* object, PaintI
     RenderStyle* style = m_object->style();
     ASSERT(style);
 
-    const SVGRenderStyle* svgStyle = style->svgStyle();
-    ASSERT(svgStyle);
+    const SVGRenderStyle& svgStyle = style->svgStyle();
 
     // Setup transparency layers before setting up SVG resources!
     bool isRenderingMask = isRenderingMaskImage(m_object);
@@ -119,8 +118,8 @@ void SVGRenderingContext::prepareToRenderSVGContent(RenderObject* object, PaintI
     bool hasBlendMode = style->hasBlendMode() && !isRenderingMask;
 
     if (opacity < 1 || hasBlendMode || style->hasIsolation()) {
-        FloatRect repaintRect = m_object->paintInvalidationRectInLocalCoordinates();
-        m_paintInfo->context->clip(repaintRect);
+        FloatRect paintInvalidationRect = m_object->paintInvalidationRectInLocalCoordinates();
+        m_paintInfo->context->clip(paintInvalidationRect);
 
         if (hasBlendMode) {
             if (!(m_renderingFlags & RestoreGraphicsContext)) {
@@ -133,7 +132,7 @@ void SVGRenderingContext::prepareToRenderSVGContent(RenderObject* object, PaintI
         m_paintInfo->context->beginTransparencyLayer(opacity);
 
         if (hasBlendMode)
-            m_paintInfo->context->setCompositeOperation(CompositeSourceOver, blink::WebBlendModeNormal);
+            m_paintInfo->context->setCompositeOperation(CompositeSourceOver, WebBlendModeNormal);
 
         m_renderingFlags |= EndOpacityLayer;
     }
@@ -146,7 +145,7 @@ void SVGRenderingContext::prepareToRenderSVGContent(RenderObject* object, PaintI
 
     SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(m_object);
     if (!resources) {
-        if (svgStyle->hasFilter())
+        if (svgStyle.hasFilter())
             return;
 
         m_renderingFlags |= RenderingPrepared;
@@ -181,7 +180,7 @@ void SVGRenderingContext::prepareToRenderSVGContent(RenderObject* object, PaintI
             if (!m_filter->applyResource(m_object, style, m_paintInfo->context, ApplyToDefaultMode))
                 return;
 
-            // Since we're caching the resulting bitmap and do not invalidate it on repaint rect
+            // Since we're caching the resulting bitmap and do not invalidate it on paint invalidation rect
             // changes, we need to paint the whole filter region. Otherwise, elements not visible
             // at the time of the initial paint (due to scrolling, window size, etc.) will never
             // be drawn.
@@ -295,7 +294,7 @@ bool SVGRenderingContext::bufferForeground(OwnPtr<ImageBuffer>& imageBuffer)
 
     // Create a new buffer and paint the foreground into it.
     if (!imageBuffer) {
-        if ((imageBuffer = m_paintInfo->context->createCompatibleBuffer(expandedIntSize(boundingBox.size())))) {
+        if ((imageBuffer = m_paintInfo->context->createRasterBuffer(expandedIntSize(boundingBox.size())))) {
             GraphicsContext* bufferedRenderingContext = imageBuffer->context();
             bufferedRenderingContext->translate(-boundingBox.x(), -boundingBox.y());
             PaintInfo bufferedInfo(*m_paintInfo);
@@ -309,4 +308,4 @@ bool SVGRenderingContext::bufferForeground(OwnPtr<ImageBuffer>& imageBuffer)
     return true;
 }
 
-}
+} // namespace blink