Diff
Modified: trunk/Source/WebCore/ChangeLog (174853 => 174854)
--- trunk/Source/WebCore/ChangeLog 2014-10-17 23:59:11 UTC (rev 174853)
+++ trunk/Source/WebCore/ChangeLog 2014-10-18 00:21:40 UTC (rev 174854)
@@ -1,5 +1,78 @@
2014-10-17 Chris Dumez <[email protected]>
+ Use is<>() / downcast<>() for all SVG RenderObjects
+ https://bugs.webkit.org/show_bug.cgi?id=137840
+
+ Reviewed by Benjamin Poulain.
+
+ Use is<>() / downcast<>() for all SVG RenderObjects and clean up the
+ surrounding code.
+
+ No new tests, no behaviro change.
+
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::supportsPath):
+ (WebCore::AccessibilityRenderObject::elementPath):
+ * page/FrameView.cpp:
+ (WebCore::FrameView::applyOverflowToViewport):
+ (WebCore::FrameView::forceLayoutParentViewIfNeeded):
+ * rendering/RenderLayerFilterInfo.cpp:
+ (WebCore::RenderLayer::FilterInfo::removeReferenceFilterClients):
+ * rendering/svg/RenderSVGGradientStop.cpp:
+ (WebCore::RenderSVGGradientStop::styleDidChange):
+ * rendering/svg/RenderSVGImage.h:
+ * rendering/svg/RenderSVGInlineText.h:
+ * rendering/svg/RenderSVGResourceContainer.cpp:
+ (WebCore::RenderSVGResourceContainer::markAllClientsForInvalidation):
+ * rendering/svg/RenderSVGResourceContainer.h:
+ * rendering/svg/RenderSVGRoot.cpp:
+ (WebCore::RenderSVGRoot::addResourceForClientInvalidation):
+ * rendering/svg/RenderSVGRoot.h:
+ * rendering/svg/RenderSVGShape.h:
+ * rendering/svg/RenderSVGText.cpp:
+ (WebCore::collectLayoutAttributes):
+ (WebCore::RenderSVGText::subtreeChildWillBeRemoved):
+ (WebCore::RenderSVGText::subtreeTextDidChange):
+ (WebCore::updateFontInAllDescendants):
+ * rendering/svg/RenderSVGText.h:
+ * rendering/svg/SVGInlineTextBox.h:
+ * rendering/svg/SVGRenderSupport.cpp:
+ (WebCore::SVGRenderSupport::mapLocalToContainer):
+ (WebCore::SVGRenderSupport::pushMappingToContainer):
+ (WebCore::SVGRenderSupport::computeContainerBoundingBoxes):
+ * rendering/svg/SVGRenderTreeAsText.cpp:
+ (WebCore::writeStyle):
+ * rendering/svg/SVGRenderingContext.cpp:
+ (WebCore::SVGRenderingContext::bufferForeground):
+ * rendering/svg/SVGResourcesCycleSolver.cpp:
+ (WebCore::SVGResourcesCycleSolver::resolveCycles):
+ * rendering/svg/SVGRootInlineBox.cpp:
+ (WebCore::SVGRootInlineBox::renderSVGText):
+ (WebCore::SVGRootInlineBox::computePerCharacterLayoutInformation):
+ * svg/SVGCircleElement.cpp:
+ (WebCore::SVGCircleElement::svgAttributeChanged):
+ * svg/SVGElement.cpp:
+ (WebCore::SVGElement::svgAttributeChanged):
+ * svg/SVGEllipseElement.cpp:
+ (WebCore::SVGEllipseElement::svgAttributeChanged):
+ * svg/SVGImageElement.cpp:
+ (WebCore::SVGImageElement::svgAttributeChanged):
+ (WebCore::SVGImageElement::didAttachRenderers):
+ * svg/SVGLineElement.cpp:
+ (WebCore::SVGLineElement::svgAttributeChanged):
+ * svg/SVGPolyElement.cpp:
+ (WebCore::SVGPolyElement::svgAttributeChanged):
+ * svg/SVGRectElement.cpp:
+ (WebCore::SVGRectElement::svgAttributeChanged):
+ * svg/SVGSVGElement.cpp:
+ (WebCore::SVGSVGElement::localCoordinateSpaceTransform):
+ (WebCore::SVGSVGElement::currentViewBoxRect):
+ * svg/graphics/SVGImage.cpp:
+ (WebCore::SVGImage::setContainerSize):
+ (WebCore::SVGImage::containerSize):
+
+2014-10-17 Chris Dumez <[email protected]>
+
Avoid unnecessary isSVGFont() check in SimpleFontData::applyTransforms()
https://bugs.webkit.org/show_bug.cgi?id=137836
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (174853 => 174854)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2014-10-17 23:59:11 UTC (rev 174853)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2014-10-18 00:21:40 UTC (rev 174854)
@@ -852,16 +852,13 @@
bool AccessibilityRenderObject::supportsPath() const
{
- if (m_renderer && m_renderer->isSVGShape())
- return true;
-
- return false;
+ return is<RenderSVGShape>(m_renderer);
}
Path AccessibilityRenderObject::elementPath() const
{
- if (m_renderer && m_renderer->isSVGShape() && toRenderSVGShape(m_renderer)->hasPath()) {
- Path path = toRenderSVGShape(m_renderer)->path();
+ if (is<RenderSVGShape>(m_renderer) && downcast<RenderSVGShape>(*m_renderer).hasPath()) {
+ Path path = downcast<RenderSVGShape>(*m_renderer).path();
// The SVG path is in terms of the parent's bounding box. The path needs to be offset to frame coordinates.
if (auto svgRoot = ancestorsOfType<RenderSVGRoot>(*m_renderer).first()) {
Modified: trunk/Source/WebCore/page/FrameView.cpp (174853 => 174854)
--- trunk/Source/WebCore/page/FrameView.cpp 2014-10-17 23:59:11 UTC (rev 174853)
+++ trunk/Source/WebCore/page/FrameView.cpp 2014-10-18 00:21:40 UTC (rev 174854)
@@ -590,7 +590,7 @@
setContentsSize(size);
}
-void FrameView::applyOverflowToViewport(RenderElement* o, ScrollbarMode& hMode, ScrollbarMode& vMode)
+void FrameView::applyOverflowToViewport(RenderElement* renderer, ScrollbarMode& hMode, ScrollbarMode& vMode)
{
// Handle the overflow:hidden/scroll case for the body/html elements. WinIE treats
// overflow:hidden and overflow:scroll on <body> as applying to the document's
@@ -603,13 +603,13 @@
bool overrideHidden = frame().isMainFrame() && ((frame().frameScaleFactor() > 1) || headerHeight() || footerHeight());
- EOverflow overflowX = o->style().overflowX();
- EOverflow overflowY = o->style().overflowY();
+ EOverflow overflowX = renderer->style().overflowX();
+ EOverflow overflowY = renderer->style().overflowY();
- if (o->isSVGRoot()) {
+ if (is<RenderSVGRoot>(*renderer)) {
// FIXME: evaluate if we can allow overflow for these cases too.
// Overflow is always hidden when stand-alone SVG documents are embedded.
- if (toRenderSVGRoot(o)->isEmbeddedThroughFrameContainingSVGDocument()) {
+ if (downcast<RenderSVGRoot>(*renderer).isEmbeddedThroughFrameContainingSVGDocument()) {
overflowX = OHIDDEN;
overflowY = OHIDDEN;
}
@@ -651,7 +651,7 @@
;
}
- m_viewportRenderer = o;
+ m_viewportRenderer = renderer;
}
void FrameView::applyPaginationToViewport()
@@ -1088,8 +1088,8 @@
if (!contentBox)
return;
- RenderSVGRoot* svgRoot = toRenderSVGRoot(contentBox);
- if (svgRoot->everHadLayout() && !svgRoot->needsLayout())
+ auto& svgRoot = downcast<RenderSVGRoot>(*contentBox);
+ if (svgRoot.everHadLayout() && !svgRoot.needsLayout())
return;
// If the embedded SVG document appears the first time, the ownerRenderer has already finished
Modified: trunk/Source/WebCore/rendering/RenderLayerFilterInfo.cpp (174853 => 174854)
--- trunk/Source/WebCore/rendering/RenderLayerFilterInfo.cpp 2014-10-17 23:59:11 UTC (rev 174853)
+++ trunk/Source/WebCore/rendering/RenderLayerFilterInfo.cpp 2014-10-18 00:21:40 UTC (rev 174854)
@@ -125,14 +125,13 @@
void RenderLayer::FilterInfo::removeReferenceFilterClients()
{
- for (size_t i = 0, size = m_externalSVGReferences.size(); i < size; ++i)
- m_externalSVGReferences[i]->removeClient(this);
+ for (auto& resourceHandle : m_externalSVGReferences)
+ resourceHandle->removeClient(this);
m_externalSVGReferences.clear();
- for (size_t i = 0, size = m_internalSVGReferences.size(); i < size; ++i) {
- Element* filter = m_internalSVGReferences[i].get();
+ for (const auto& filter : m_internalSVGReferences) {
if (!filter->renderer())
continue;
- toRenderSVGResourceContainer(*filter->renderer()).removeClientRenderLayer(&m_layer);
+ downcast<RenderSVGResourceContainer>(*filter->renderer()).removeClientRenderLayer(&m_layer);
}
m_internalSVGReferences.clear();
}
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGGradientStop.cpp (174853 => 174854)
--- trunk/Source/WebCore/rendering/svg/RenderSVGGradientStop.cpp 2014-10-17 23:59:11 UTC (rev 174853)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGGradientStop.cpp 2014-10-18 00:21:40 UTC (rev 174854)
@@ -52,11 +52,11 @@
if (!gradient)
return;
- RenderObject* renderer = gradient->renderer();
+ RenderElement* renderer = gradient->renderer();
if (!renderer)
return;
- toRenderSVGResourceContainer(*renderer).removeAllClientsFromCache();
+ downcast<RenderSVGResourceContainer>(*renderer).removeAllClientsFromCache();
}
void RenderSVGGradientStop::layout()
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGImage.h (174853 => 174854)
--- trunk/Source/WebCore/rendering/svg/RenderSVGImage.h 2014-10-17 23:59:11 UTC (rev 174853)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGImage.h 2014-10-18 00:21:40 UTC (rev 174854)
@@ -90,8 +90,6 @@
std::unique_ptr<ImageBuffer> m_bufferedForeground;
};
-RENDER_OBJECT_TYPE_CASTS(RenderSVGImage, isSVGImage())
-
} // namespace WebCore
SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderSVGImage, isSVGImage())
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.h (174853 => 174854)
--- trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.h 2014-10-17 23:59:11 UTC (rev 174853)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.h 2014-10-18 00:21:40 UTC (rev 174854)
@@ -69,8 +69,6 @@
SVGTextLayoutAttributes m_layoutAttributes;
};
-RENDER_OBJECT_TYPE_CASTS(RenderSVGInlineText, isSVGInlineText())
-
} // namespace WebCore
SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderSVGInlineText, isSVGInlineText())
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp (174853 => 174854)
--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp 2014-10-17 23:59:11 UTC (rev 174853)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp 2014-10-18 00:21:40 UTC (rev 174854)
@@ -96,8 +96,8 @@
bool markForInvalidation = mode != ParentOnlyInvalidation;
for (auto* client : m_clients) {
- if (client->isSVGResourceContainer()) {
- toRenderSVGResourceContainer(*client).removeAllClientsFromCache(markForInvalidation);
+ if (is<RenderSVGResourceContainer>(*client)) {
+ downcast<RenderSVGResourceContainer>(*client).removeAllClientsFromCache(markForInvalidation);
continue;
}
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceContainer.h (174853 => 174854)
--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceContainer.h 2014-10-17 23:59:11 UTC (rev 174853)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceContainer.h 2014-10-18 00:21:40 UTC (rev 174854)
@@ -75,8 +75,6 @@
HashSet<RenderLayer*> m_clientLayers;
};
-RENDER_OBJECT_TYPE_CASTS(RenderSVGResourceContainer, isSVGResourceContainer())
-
inline RenderSVGResourceContainer* getRenderSVGResourceContainerById(Document& document, const AtomicString& id)
{
if (id.isEmpty())
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp (174853 => 174854)
--- trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp 2014-10-17 23:59:11 UTC (rev 174853)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp 2014-10-18 00:21:40 UTC (rev 174854)
@@ -441,12 +441,12 @@
void RenderSVGRoot::addResourceForClientInvalidation(RenderSVGResourceContainer* resource)
{
- RenderObject* svgRoot = resource->parent();
- while (svgRoot && !svgRoot->isSVGRoot())
+ RenderElement* svgRoot = resource->parent();
+ while (svgRoot && !is<RenderSVGRoot>(*svgRoot))
svgRoot = svgRoot->parent();
if (!svgRoot)
return;
- toRenderSVGRoot(svgRoot)->m_resourcesNeedingToInvalidateClients.add(resource);
+ downcast<RenderSVGRoot>(*svgRoot).m_resourcesNeedingToInvalidateClients.add(resource);
}
}
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGRoot.h (174853 => 174854)
--- trunk/Source/WebCore/rendering/svg/RenderSVGRoot.h 2014-10-17 23:59:11 UTC (rev 174853)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGRoot.h 2014-10-18 00:21:40 UTC (rev 174854)
@@ -122,8 +122,6 @@
bool m_hasBoxDecorations : 1;
};
-RENDER_OBJECT_TYPE_CASTS(RenderSVGRoot, isSVGRoot())
-
} // namespace WebCore
SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderSVGRoot, isSVGRoot())
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGShape.h (174853 => 174854)
--- trunk/Source/WebCore/rendering/svg/RenderSVGShape.h 2014-10-17 23:59:11 UTC (rev 174853)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGShape.h 2014-10-18 00:21:40 UTC (rev 174854)
@@ -133,8 +133,6 @@
bool m_needsTransformUpdate : 1;
};
-RENDER_OBJECT_TYPE_CASTS(RenderSVGShape, isSVGShape())
-
} // namespace WebCore
SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderSVGShape, isSVGShape())
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp (174853 => 174854)
--- trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp 2014-10-17 23:59:11 UTC (rev 174853)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp 2014-10-18 00:21:40 UTC (rev 174854)
@@ -117,8 +117,8 @@
static inline void collectLayoutAttributes(RenderObject* text, Vector<SVGTextLayoutAttributes*>& attributes)
{
for (RenderObject* descendant = text; descendant; descendant = descendant->nextInPreOrder(text)) {
- if (descendant->isSVGInlineText())
- attributes.append(toRenderSVGInlineText(descendant)->layoutAttributes());
+ if (is<RenderSVGInlineText>(*descendant))
+ attributes.append(downcast<RenderSVGInlineText>(*descendant).layoutAttributes());
}
}
@@ -254,19 +254,19 @@
return;
// This logic requires that the 'text' child is still inserted in the tree.
- RenderSVGInlineText* text = toRenderSVGInlineText(child);
+ auto& text = downcast<RenderSVGInlineText>(*child);
bool stopAfterNext = false;
- SVGTextLayoutAttributes* previous = 0;
- SVGTextLayoutAttributes* next = 0;
+ SVGTextLayoutAttributes* previous = nullptr;
+ SVGTextLayoutAttributes* next = nullptr;
if (!documentBeingDestroyed())
- findPreviousAndNextAttributes(this, text, stopAfterNext, previous, next);
+ findPreviousAndNextAttributes(this, &text, stopAfterNext, previous, next);
if (previous)
affectedAttributes.append(previous);
if (next)
affectedAttributes.append(next);
- size_t position = m_layoutAttributes.find(text->layoutAttributes());
+ size_t position = m_layoutAttributes.find(text.layoutAttributes());
ASSERT(position != notFound);
m_layoutAttributes.remove(position);
}
@@ -326,17 +326,17 @@
checkLayoutAttributesConsistency(this, m_layoutAttributes);
for (RenderObject* descendant = text; descendant; descendant = descendant->nextInPreOrder(text)) {
- if (descendant->isSVGInlineText())
- m_layoutAttributesBuilder.buildLayoutAttributesForTextRenderer(toRenderSVGInlineText(*descendant));
+ if (is<RenderSVGInlineText>(*descendant))
+ m_layoutAttributesBuilder.buildLayoutAttributesForTextRenderer(downcast<RenderSVGInlineText>(*descendant));
}
}
-static inline void updateFontInAllDescendants(RenderObject* start, SVGTextLayoutAttributesBuilder* builder = 0)
+static inline void updateFontInAllDescendants(RenderObject* start, SVGTextLayoutAttributesBuilder* builder = nullptr)
{
for (RenderObject* descendant = start; descendant; descendant = descendant->nextInPreOrder(start)) {
- if (!descendant->isSVGInlineText())
+ if (!is<RenderSVGInlineText>(*descendant))
continue;
- RenderSVGInlineText& text = toRenderSVGInlineText(*descendant);
+ auto& text = downcast<RenderSVGInlineText>(*descendant);
text.updateScaledFont();
if (builder)
builder->rebuildMetricsForTextRenderer(text);
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGText.h (174853 => 174854)
--- trunk/Source/WebCore/rendering/svg/RenderSVGText.h 2014-10-17 23:59:11 UTC (rev 174853)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGText.h 2014-10-18 00:21:40 UTC (rev 174854)
@@ -105,8 +105,6 @@
Vector<SVGTextLayoutAttributes*> m_layoutAttributes;
};
-RENDER_OBJECT_TYPE_CASTS(RenderSVGText, isSVGText())
-
} // namespace WebCore
SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderSVGText, isSVGText())
Modified: trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.h (174853 => 174854)
--- trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.h 2014-10-17 23:59:11 UTC (rev 174853)
+++ trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.h 2014-10-18 00:21:40 UTC (rev 174854)
@@ -35,7 +35,7 @@
public:
explicit SVGInlineTextBox(RenderSVGInlineText&);
- RenderSVGInlineText& renderer() const { return toRenderSVGInlineText(InlineTextBox::renderer()); }
+ RenderSVGInlineText& renderer() const { return downcast<RenderSVGInlineText>(InlineTextBox::renderer()); }
virtual float virtualLogicalHeight() const { return m_logicalHeight; }
void setLogicalHeight(float height) { m_logicalHeight = height; }
Modified: trunk/Source/WebCore/rendering/svg/SVGRenderSupport.cpp (174853 => 174854)
--- trunk/Source/WebCore/rendering/svg/SVGRenderSupport.cpp 2014-10-17 23:59:11 UTC (rev 174853)
+++ trunk/Source/WebCore/rendering/svg/SVGRenderSupport.cpp 2014-10-18 00:21:40 UTC (rev 174854)
@@ -91,8 +91,8 @@
// At the SVG/HTML boundary (aka RenderSVGRoot), we apply the localToBorderBoxTransform
// to map an element from SVG viewport coordinates to CSS box coordinates.
// RenderSVGRoot's mapLocalToContainer method expects CSS box coordinates.
- if (parent.isSVGRoot())
- transformState.applyTransform(toRenderSVGRoot(parent).localToBorderBoxTransform());
+ if (is<RenderSVGRoot>(parent))
+ transformState.applyTransform(downcast<RenderSVGRoot>(parent).localToBorderBoxTransform());
transformState.applyTransform(renderer.localToParentTransform());
@@ -110,9 +110,9 @@
// At the SVG/HTML boundary (aka RenderSVGRoot), we apply the localToBorderBoxTransform
// to map an element from SVG viewport coordinates to CSS box coordinates.
// RenderSVGRoot's mapLocalToContainer method expects CSS box coordinates.
- if (parent.isSVGRoot()) {
+ if (is<RenderSVGRoot>(parent)) {
TransformationMatrix matrix(renderer.localToParentTransform());
- matrix.multiply(toRenderSVGRoot(parent).localToBorderBoxTransform());
+ matrix.multiply(downcast<RenderSVGRoot>(parent).localToBorderBoxTransform());
geometryMap.push(&renderer, matrix);
} else
geometryMap.push(&renderer, renderer.localToParentTransform());
@@ -160,7 +160,7 @@
continue;
// Don't include elements in the union that do not render.
- if (current->isSVGShape() && toRenderSVGShape(current)->isRenderingDisabled())
+ if (is<RenderSVGShape>(*current) && downcast<RenderSVGShape>(*current).isRenderingDisabled())
continue;
const AffineTransform& transform = current->localToParentTransform();
Modified: trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp (174853 => 174854)
--- trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp 2014-10-17 23:59:11 UTC (rev 174853)
+++ trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp 2014-10-18 00:21:40 UTC (rev 174854)
@@ -258,8 +258,8 @@
writeNameValuePair(ts, "transform", renderer.localTransform());
writeIfNotDefault(ts, "image rendering", style.imageRendering(), RenderStyle::initialImageRendering());
writeIfNotDefault(ts, "opacity", style.opacity(), RenderStyle::initialOpacity());
- if (renderer.isSVGShape()) {
- const auto& shape = toRenderSVGShape(renderer);
+ if (is<RenderSVGShape>(renderer)) {
+ const auto& shape = downcast<RenderSVGShape>(renderer);
Color fallbackColor;
if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(const_cast<RenderSVGShape&>(shape), shape.style(), fallbackColor)) {
Modified: trunk/Source/WebCore/rendering/svg/SVGRenderingContext.cpp (174853 => 174854)
--- trunk/Source/WebCore/rendering/svg/SVGRenderingContext.cpp 2014-10-17 23:59:11 UTC (rev 174853)
+++ trunk/Source/WebCore/rendering/svg/SVGRenderingContext.cpp 2014-10-18 00:21:40 UTC (rev 174854)
@@ -345,7 +345,7 @@
bool SVGRenderingContext::bufferForeground(std::unique_ptr<ImageBuffer>& imageBuffer)
{
ASSERT(m_paintInfo);
- ASSERT(m_renderer->isSVGImage());
+ ASSERT(is<RenderSVGImage>(*m_renderer));
FloatRect boundingBox = m_renderer->objectBoundingBox();
// Invalidate an existing buffer if the scale is not correct.
@@ -364,7 +364,7 @@
bufferedRenderingContext->translate(-boundingBox.x(), -boundingBox.y());
PaintInfo bufferedInfo(*m_paintInfo);
bufferedInfo.context = bufferedRenderingContext;
- toRenderSVGImage(m_renderer)->paintForeground(bufferedInfo);
+ downcast<RenderSVGImage>(*m_renderer).paintForeground(bufferedInfo);
} else
return false;
}
Modified: trunk/Source/WebCore/rendering/svg/SVGResourcesCycleSolver.cpp (174853 => 174854)
--- trunk/Source/WebCore/rendering/svg/SVGResourcesCycleSolver.cpp 2014-10-17 23:59:11 UTC (rev 174853)
+++ trunk/Source/WebCore/rendering/svg/SVGResourcesCycleSolver.cpp 2014-10-18 00:21:40 UTC (rev 174854)
@@ -125,8 +125,8 @@
m_allResources.add(resource);
// If we're a resource, add ourselves to the HashSet.
- if (m_renderer.isSVGResourceContainer())
- m_allResources.add(&toRenderSVGResourceContainer(m_renderer));
+ if (is<RenderSVGResourceContainer>(m_renderer))
+ m_allResources.add(&downcast<RenderSVGResourceContainer>(m_renderer));
ASSERT(!m_allResources.isEmpty());
Modified: trunk/Source/WebCore/rendering/svg/SVGRootInlineBox.cpp (174853 => 174854)
--- trunk/Source/WebCore/rendering/svg/SVGRootInlineBox.cpp 2014-10-17 23:59:11 UTC (rev 174853)
+++ trunk/Source/WebCore/rendering/svg/SVGRootInlineBox.cpp 2014-10-18 00:21:40 UTC (rev 174854)
@@ -42,7 +42,7 @@
RenderSVGText& SVGRootInlineBox::renderSVGText()
{
- return toRenderSVGText(blockFlow());
+ return downcast<RenderSVGText>(blockFlow());
}
void SVGRootInlineBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit, LayoutUnit)
@@ -76,14 +76,13 @@
void SVGRootInlineBox::computePerCharacterLayoutInformation()
{
- RenderSVGText* textRoot = toRenderSVGText(&blockFlow());
- ASSERT(textRoot);
+ auto& textRoot = downcast<RenderSVGText>(blockFlow());
- Vector<SVGTextLayoutAttributes*>& layoutAttributes = textRoot->layoutAttributes();
+ Vector<SVGTextLayoutAttributes*>& layoutAttributes = textRoot.layoutAttributes();
if (layoutAttributes.isEmpty())
return;
- if (textRoot->needsReordering())
+ if (textRoot.needsReordering())
reorderValueLists(layoutAttributes);
// Perform SVG text layout phase two (see SVGTextLayoutEngine for details).
Modified: trunk/Source/WebCore/svg/SVGCircleElement.cpp (174853 => 174854)
--- trunk/Source/WebCore/svg/SVGCircleElement.cpp 2014-10-17 23:59:11 UTC (rev 174853)
+++ trunk/Source/WebCore/svg/SVGCircleElement.cpp 2014-10-18 00:21:40 UTC (rev 174854)
@@ -113,7 +113,7 @@
return;
}
- RenderSVGShape* renderer = toRenderSVGShape(this->renderer());
+ auto* renderer = downcast<RenderSVGShape>(this->renderer());
if (!renderer)
return;
Modified: trunk/Source/WebCore/svg/SVGElement.cpp (174853 => 174854)
--- trunk/Source/WebCore/svg/SVGElement.cpp 2014-10-17 23:59:11 UTC (rev 174853)
+++ trunk/Source/WebCore/svg/SVGElement.cpp 2014-10-18 00:21:40 UTC (rev 174854)
@@ -1052,8 +1052,8 @@
if (attrName == HTMLNames::idAttr) {
auto renderer = this->renderer();
// Notify resources about id changes, this is important as we cache resources by id in SVGDocumentExtensions
- if (renderer && renderer->isSVGResourceContainer())
- toRenderSVGResourceContainer(*renderer).idChanged();
+ if (is<RenderSVGResourceContainer>(renderer))
+ downcast<RenderSVGResourceContainer>(*renderer).idChanged();
if (inDocument())
buildPendingResourcesIfNeeded();
SVGElementInstance::invalidateAllInstancesOfElement(this);
Modified: trunk/Source/WebCore/svg/SVGEllipseElement.cpp (174853 => 174854)
--- trunk/Source/WebCore/svg/SVGEllipseElement.cpp 2014-10-17 23:59:11 UTC (rev 174853)
+++ trunk/Source/WebCore/svg/SVGEllipseElement.cpp 2014-10-18 00:21:40 UTC (rev 174854)
@@ -118,7 +118,7 @@
return;
}
- RenderSVGShape* renderer = toRenderSVGShape(this->renderer());
+ auto* renderer = downcast<RenderSVGShape>(this->renderer());
if (!renderer)
return;
Modified: trunk/Source/WebCore/svg/SVGImageElement.cpp (174853 => 174854)
--- trunk/Source/WebCore/svg/SVGImageElement.cpp 2014-10-17 23:59:11 UTC (rev 174853)
+++ trunk/Source/WebCore/svg/SVGImageElement.cpp 2014-10-18 00:21:40 UTC (rev 174854)
@@ -143,12 +143,12 @@
return;
}
- auto renderer = this->renderer();
+ auto* renderer = this->renderer();
if (!renderer)
return;
if (isLengthAttribute) {
- if (toRenderSVGImage(renderer)->updateImageViewport())
+ if (downcast<RenderSVGImage>(*renderer).updateImageViewport())
RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
return;
}
@@ -175,7 +175,7 @@
void SVGImageElement::didAttachRenderers()
{
- if (RenderSVGImage* imageObj = toRenderSVGImage(renderer())) {
+ if (auto* imageObj = downcast<RenderSVGImage>(renderer())) {
if (imageObj->imageResource().hasImage())
return;
Modified: trunk/Source/WebCore/svg/SVGLineElement.cpp (174853 => 174854)
--- trunk/Source/WebCore/svg/SVGLineElement.cpp 2014-10-17 23:59:11 UTC (rev 174853)
+++ trunk/Source/WebCore/svg/SVGLineElement.cpp 2014-10-18 00:21:40 UTC (rev 174854)
@@ -117,7 +117,7 @@
if (isLengthAttribute)
updateRelativeLengthsInformation();
- RenderSVGShape* renderer = toRenderSVGShape(this->renderer());
+ auto* renderer = downcast<RenderSVGShape>(this->renderer());
if (!renderer)
return;
Modified: trunk/Source/WebCore/svg/SVGPolyElement.cpp (174853 => 174854)
--- trunk/Source/WebCore/svg/SVGPolyElement.cpp 2014-10-17 23:59:11 UTC (rev 174853)
+++ trunk/Source/WebCore/svg/SVGPolyElement.cpp 2014-10-18 00:21:40 UTC (rev 174854)
@@ -111,7 +111,7 @@
SVGElementInstance::InvalidationGuard invalidationGuard(this);
- RenderSVGShape* renderer = toRenderSVGShape(this->renderer());
+ auto* renderer = downcast<RenderSVGShape>(this->renderer());
if (!renderer)
return;
Modified: trunk/Source/WebCore/svg/SVGRectElement.cpp (174853 => 174854)
--- trunk/Source/WebCore/svg/SVGRectElement.cpp 2014-10-17 23:59:11 UTC (rev 174853)
+++ trunk/Source/WebCore/svg/SVGRectElement.cpp 2014-10-18 00:21:40 UTC (rev 174854)
@@ -132,7 +132,7 @@
return;
}
- RenderSVGShape* renderer = toRenderSVGShape(this->renderer());
+ auto* renderer = downcast<RenderSVGShape>(this->renderer());
if (!renderer)
return;
Modified: trunk/Source/WebCore/svg/SVGSVGElement.cpp (174853 => 174854)
--- trunk/Source/WebCore/svg/SVGSVGElement.cpp 2014-10-17 23:59:11 UTC (rev 174853)
+++ trunk/Source/WebCore/svg/SVGSVGElement.cpp 2014-10-18 00:21:40 UTC (rev 174854)
@@ -423,7 +423,7 @@
SVGLengthContext lengthContext(this);
transform.translate(x().value(lengthContext), y().value(lengthContext));
} else if (mode == SVGLocatable::ScreenScope) {
- if (RenderObject* renderer = this->renderer()) {
+ if (RenderElement* renderer = this->renderer()) {
FloatPoint location;
float zoomFactor = 1;
@@ -431,8 +431,8 @@
// to map an element from SVG viewport coordinates to CSS box coordinates.
// RenderSVGRoot's localToAbsolute method expects CSS box coordinates.
// We also need to adjust for the zoom level factored into CSS coordinates (bug #96361).
- if (renderer->isSVGRoot()) {
- location = toRenderSVGRoot(renderer)->localToBorderBoxTransform().mapPoint(location);
+ if (is<RenderSVGRoot>(*renderer)) {
+ location = downcast<RenderSVGRoot>(*renderer).localToBorderBoxTransform().mapPoint(location);
zoomFactor = 1 / renderer->style().effectiveZoom();
}
@@ -546,9 +546,9 @@
FloatRect useViewBox = viewBox();
if (!useViewBox.isEmpty())
return useViewBox;
- if (!renderer() || !renderer()->isSVGRoot())
+ if (!is<RenderSVGRoot>(renderer()))
return FloatRect();
- if (!toRenderSVGRoot(renderer())->isEmbeddedThroughSVGImage())
+ if (!downcast<RenderSVGRoot>(*renderer()).isEmbeddedThroughSVGImage())
return FloatRect();
Length intrinsicWidth = this->intrinsicWidth();
Modified: trunk/Source/WebCore/svg/graphics/SVGImage.cpp (174853 => 174854)
--- trunk/Source/WebCore/svg/graphics/SVGImage.cpp 2014-10-17 23:59:11 UTC (rev 174853)
+++ trunk/Source/WebCore/svg/graphics/SVGImage.cpp 2014-10-18 00:21:40 UTC (rev 174854)
@@ -93,7 +93,7 @@
SVGSVGElement* rootElement = this->rootElement();
if (!rootElement)
return;
- RenderSVGRoot* renderer = toRenderSVGRoot(rootElement->renderer());
+ auto* renderer = downcast<RenderSVGRoot>(rootElement->renderer());
if (!renderer)
return;
@@ -109,7 +109,7 @@
if (!rootElement)
return IntSize();
- RenderSVGRoot* renderer = toRenderSVGRoot(rootElement->renderer());
+ auto* renderer = downcast<RenderSVGRoot>(rootElement->renderer());
if (!renderer)
return IntSize();