if (!(m_renderingFlags & ActionsNeeded))
return;
- ASSERT(m_object && m_paintInfo);
+ ASSERT(m_renderer && m_paintInfo);
#if ENABLE(FILTERS)
if (m_renderingFlags & EndFilterLayer) {
ASSERT(m_filter);
- m_filter->postApplyResource(m_object, m_paintInfo->context, ApplyToDefaultMode, 0, 0);
+ m_filter->postApplyResource(m_renderer, m_paintInfo->context, ApplyToDefaultMode, 0, 0);
m_paintInfo->context = m_savedContext;
m_paintInfo->rect = m_savedPaintRect;
}
m_paintInfo->context->restore();
}
-void SVGRenderingContext::prepareToRenderSVGContent(RenderObject* object, PaintInfo& paintInfo, NeedsGraphicsContextSave needsGraphicsContextSave)
+void SVGRenderingContext::prepareToRenderSVGContent(RenderElement& renderer, PaintInfo& paintInfo, NeedsGraphicsContextSave needsGraphicsContextSave)
{
- ASSERT(object);
-
#ifndef NDEBUG
// This function must not be called twice!
ASSERT(!(m_renderingFlags & PrepareToRenderSVGContentWasCalled));
m_renderingFlags |= PrepareToRenderSVGContentWasCalled;
#endif
- m_object = object;
+ m_renderer = &renderer;
m_paintInfo = &paintInfo;
#if ENABLE(FILTERS)
m_filter = 0;
m_renderingFlags |= RestoreGraphicsContext;
}
- RenderStyle* style = m_object->style();
+ RenderStyle* style = m_renderer->style();
ASSERT(style);
const SVGRenderStyle* svgStyle = style->svgStyle();
ASSERT(svgStyle);
// Setup transparency layers before setting up SVG resources!
- bool isRenderingMask = isRenderingMaskImage(*m_object);
+ bool isRenderingMask = isRenderingMaskImage(*m_renderer);
float opacity = isRenderingMask ? 1 : style->opacity();
const ShadowData* shadow = svgStyle->shadow();
if (opacity < 1 || shadow) {
- FloatRect repaintRect = m_object->repaintRectInLocalCoordinates();
+ FloatRect repaintRect = m_renderer->repaintRectInLocalCoordinates();
if (opacity < 1) {
m_paintInfo->context->clip(repaintRect);
ClipPathOperation* clipPathOperation = style->clipPath();
if (clipPathOperation && clipPathOperation->type() == ClipPathOperation::SHAPE) {
ShapeClipPathOperation* clipPath = static_cast<ShapeClipPathOperation*>(clipPathOperation);
- m_paintInfo->context->clipPath(clipPath->path(object->objectBoundingBox()), clipPath->windRule());
+ m_paintInfo->context->clipPath(clipPath->path(renderer.objectBoundingBox()), clipPath->windRule());
}
- SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(m_object);
+ SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(m_renderer);
if (!resources) {
#if ENABLE(FILTERS)
if (svgStyle->hasFilter())
if (!isRenderingMask) {
if (RenderSVGResourceMasker* masker = resources->masker()) {
- if (!masker->applyResource(m_object, style, m_paintInfo->context, ApplyToDefaultMode))
+ if (!masker->applyResource(m_renderer, style, m_paintInfo->context, ApplyToDefaultMode))
return;
}
}
RenderSVGResourceClipper* clipper = resources->clipper();
if (!clipPathOperation && clipper) {
- if (!clipper->applyResource(m_object, style, m_paintInfo->context, ApplyToDefaultMode))
+ if (!clipper->applyResource(m_renderer, style, m_paintInfo->context, ApplyToDefaultMode))
return;
}
// Return with false here may mean that we don't need to draw the content
// (because it was either drawn before or empty) but we still need to apply the filter.
m_renderingFlags |= EndFilterLayer;
- if (!m_filter->applyResource(m_object, style, m_paintInfo->context, ApplyToDefaultMode))
+ if (!m_filter->applyResource(m_renderer, style, m_paintInfo->context, ApplyToDefaultMode))
return;
// Since we're caching the resulting bitmap and do not invalidate it on repaint 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.
- m_paintInfo->rect = IntRect(m_filter->drawingRegion(m_object));
+ m_paintInfo->rect = IntRect(m_filter->drawingRegion(m_renderer));
}
}
#endif
bool SVGRenderingContext::bufferForeground(OwnPtr<ImageBuffer>& imageBuffer)
{
ASSERT(m_paintInfo);
- ASSERT(m_object->isSVGImage());
- FloatRect boundingBox = m_object->objectBoundingBox();
+ ASSERT(m_renderer->isSVGImage());
+ FloatRect boundingBox = m_renderer->objectBoundingBox();
// Invalidate an existing buffer if the scale is not correct.
if (imageBuffer) {
bufferedRenderingContext->translate(-boundingBox.x(), -boundingBox.y());
PaintInfo bufferedInfo(*m_paintInfo);
bufferedInfo.context = bufferedRenderingContext;
- toRenderSVGImage(m_object)->paintForeground(bufferedInfo);
+ toRenderSVGImage(m_renderer)->paintForeground(bufferedInfo);
} else
return false;
}
// Does not start rendering.
SVGRenderingContext()
: m_renderingFlags(0)
- , m_object(0)
- , m_paintInfo(0)
- , m_savedContext(0)
+ , m_renderer(nullptr)
+ , m_paintInfo(nullptr)
+ , m_savedContext(nullptr)
#if ENABLE(FILTERS)
- , m_filter(0)
+ , m_filter(nullptr)
#endif
{
}
- SVGRenderingContext(RenderObject* object, PaintInfo& paintinfo, NeedsGraphicsContextSave needsGraphicsContextSave = DontSaveGraphicsContext)
+ SVGRenderingContext(RenderElement& object, PaintInfo& paintinfo, NeedsGraphicsContextSave needsGraphicsContextSave = DontSaveGraphicsContext)
: m_renderingFlags(0)
- , m_object(0)
- , m_paintInfo(0)
- , m_savedContext(0)
+ , m_renderer(nullptr)
+ , m_paintInfo(nullptr)
+ , m_savedContext(nullptr)
#if ENABLE(FILTERS)
- , m_filter(0)
+ , m_filter(nullptr)
#endif
{
prepareToRenderSVGContent(object, paintinfo, needsGraphicsContextSave);
~SVGRenderingContext();
// Used by all SVG renderers who apply clip/filter/etc. resources to the renderer content.
- void prepareToRenderSVGContent(RenderObject*, PaintInfo&, NeedsGraphicsContextSave = DontSaveGraphicsContext);
+ void prepareToRenderSVGContent(RenderElement&, PaintInfo&, NeedsGraphicsContextSave = DontSaveGraphicsContext);
bool isRenderingPrepared() const { return m_renderingFlags & RenderingPrepared; }
static bool createImageBuffer(const FloatRect& paintRect, const AffineTransform& absoluteTransform, OwnPtr<ImageBuffer>&, ColorSpace, RenderingMode);
const static int ActionsNeeded = RestoreGraphicsContext | EndOpacityLayer | EndShadowLayer | EndFilterLayer;
int m_renderingFlags;
- RenderObject* m_object;
+ RenderElement* m_renderer;
PaintInfo* m_paintInfo;
GraphicsContext* m_savedContext;
IntRect m_savedPaintRect;