Diff
Modified: trunk/Source/WebCore/ChangeLog (157944 => 157945)
--- trunk/Source/WebCore/ChangeLog 2013-10-24 19:18:30 UTC (rev 157944)
+++ trunk/Source/WebCore/ChangeLog 2013-10-24 19:36:55 UTC (rev 157945)
@@ -1,3 +1,15 @@
+2013-10-24 Andreas Kling <[email protected]>
+
+ SVGRenderingContext should wrap a RenderElement.
+ <https://webkit.org/b/123283>
+
+ The SVG rendering context class is never used with text renderers
+ so we can have it wrap a RenderElement for tighter code.
+
+ Also renamed SVGRenderingContext::m_object to m_renderer.
+
+ Reviewed by Antti Koivisto.
+
2013-10-24 Santosh Mahto <[email protected]>
[contenteditable] Content after non-editable element disappears when merging lines using backspace
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGContainer.cpp (157944 => 157945)
--- trunk/Source/WebCore/rendering/svg/RenderSVGContainer.cpp 2013-10-24 19:18:30 UTC (rev 157944)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGContainer.cpp 2013-10-24 19:36:55 UTC (rev 157945)
@@ -133,7 +133,7 @@
SVGRenderingContext renderingContext;
bool continueRendering = true;
if (childPaintInfo.phase == PaintPhaseForeground) {
- renderingContext.prepareToRenderSVGContent(this, childPaintInfo);
+ renderingContext.prepareToRenderSVGContent(*this, childPaintInfo);
continueRendering = renderingContext.isRenderingPrepared();
}
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp (157944 => 157945)
--- trunk/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp 2013-10-24 19:18:30 UTC (rev 157944)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp 2013-10-24 19:36:55 UTC (rev 157945)
@@ -70,7 +70,7 @@
SVGRenderingContext renderingContext;
bool continueRendering = true;
if (paintInfo.phase == PaintPhaseForeground) {
- renderingContext.prepareToRenderSVGContent(this, childPaintInfo);
+ renderingContext.prepareToRenderSVGContent(*this, childPaintInfo);
continueRendering = renderingContext.isRenderingPrepared();
}
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGImage.cpp (157944 => 157945)
--- trunk/Source/WebCore/rendering/svg/RenderSVGImage.cpp 2013-10-24 19:18:30 UTC (rev 157944)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGImage.cpp 2013-10-24 19:36:55 UTC (rev 157945)
@@ -134,7 +134,7 @@
childPaintInfo.applyTransform(m_localTransform);
if (childPaintInfo.phase == PaintPhaseForeground) {
- SVGRenderingContext renderingContext(this, childPaintInfo);
+ SVGRenderingContext renderingContext(*this, childPaintInfo);
if (renderingContext.isRenderingPrepared()) {
if (style()->svgStyle()->bufferedRendering() == BR_STATIC && renderingContext.bufferForeground(m_bufferedForeground))
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp (157944 => 157945)
--- trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp 2013-10-24 19:18:30 UTC (rev 157944)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp 2013-10-24 19:36:55 UTC (rev 157945)
@@ -287,7 +287,7 @@
SVGRenderingContext renderingContext;
bool continueRendering = true;
if (childPaintInfo.phase == PaintPhaseForeground) {
- renderingContext.prepareToRenderSVGContent(this, childPaintInfo);
+ renderingContext.prepareToRenderSVGContent(*this, childPaintInfo);
continueRendering = renderingContext.isRenderingPrepared();
}
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp (157944 => 157945)
--- trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp 2013-10-24 19:18:30 UTC (rev 157944)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp 2013-10-24 19:36:55 UTC (rev 157945)
@@ -280,7 +280,7 @@
childPaintInfo.applyTransform(m_localTransform);
if (childPaintInfo.phase == PaintPhaseForeground) {
- SVGRenderingContext renderingContext(this, childPaintInfo);
+ SVGRenderingContext renderingContext(*this, childPaintInfo);
if (renderingContext.isRenderingPrepared()) {
const SVGRenderStyle* svgStyle = style()->svgStyle();
Modified: trunk/Source/WebCore/rendering/svg/SVGInlineFlowBox.cpp (157944 => 157945)
--- trunk/Source/WebCore/rendering/svg/SVGInlineFlowBox.cpp 2013-10-24 19:18:30 UTC (rev 157944)
+++ trunk/Source/WebCore/rendering/svg/SVGInlineFlowBox.cpp 2013-10-24 19:36:55 UTC (rev 157945)
@@ -54,7 +54,7 @@
ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection);
ASSERT(!paintInfo.context->paintingDisabled());
- SVGRenderingContext renderingContext(&renderer(), paintInfo, SVGRenderingContext::SaveGraphicsContext);
+ SVGRenderingContext renderingContext(renderer(), paintInfo, SVGRenderingContext::SaveGraphicsContext);
if (renderingContext.isRenderingPrepared()) {
for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
if (child->isSVGInlineTextBox())
Modified: trunk/Source/WebCore/rendering/svg/SVGRenderingContext.cpp (157944 => 157945)
--- trunk/Source/WebCore/rendering/svg/SVGRenderingContext.cpp 2013-10-24 19:18:30 UTC (rev 157944)
+++ trunk/Source/WebCore/rendering/svg/SVGRenderingContext.cpp 2013-10-24 19:36:55 UTC (rev 157945)
@@ -56,12 +56,12 @@
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;
}
@@ -77,17 +77,15 @@
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;
@@ -99,18 +97,18 @@
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);
@@ -129,10 +127,10 @@
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())
@@ -144,14 +142,14 @@
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;
}
@@ -164,14 +162,14 @@
// 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
@@ -333,8 +331,8 @@
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) {
@@ -352,7 +350,7 @@
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;
}
Modified: trunk/Source/WebCore/rendering/svg/SVGRenderingContext.h (157944 => 157945)
--- trunk/Source/WebCore/rendering/svg/SVGRenderingContext.h 2013-10-24 19:18:30 UTC (rev 157944)
+++ trunk/Source/WebCore/rendering/svg/SVGRenderingContext.h 2013-10-24 19:36:55 UTC (rev 157945)
@@ -48,22 +48,22 @@
// 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);
@@ -73,7 +73,7 @@
~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);
@@ -112,7 +112,7 @@
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;
Modified: trunk/Source/WebCore/rendering/svg/SVGRootInlineBox.cpp (157944 => 157945)
--- trunk/Source/WebCore/rendering/svg/SVGRootInlineBox.cpp 2013-10-24 19:18:30 UTC (rev 157944)
+++ trunk/Source/WebCore/rendering/svg/SVGRootInlineBox.cpp 2013-10-24 19:36:55 UTC (rev 157945)
@@ -65,7 +65,7 @@
}
}
- SVGRenderingContext renderingContext(&renderSVGText(), paintInfo, SVGRenderingContext::SaveGraphicsContext);
+ SVGRenderingContext renderingContext(renderSVGText(), paintInfo, SVGRenderingContext::SaveGraphicsContext);
if (renderingContext.isRenderingPrepared()) {
for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
if (child->isSVGInlineTextBox())