Diff
Modified: trunk/Source/WTF/ChangeLog (174374 => 174375)
--- trunk/Source/WTF/ChangeLog 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WTF/ChangeLog 2014-10-07 00:26:25 UTC (rev 174375)
@@ -1,3 +1,21 @@
+2014-10-06 Christophe Dumez <[email protected]>
+
+ Add is<>() / downcast<>() support for RenderObject subclasses
+ https://bugs.webkit.org/show_bug.cgi?id=137424
+
+ Reviewed by Benjamin Poulain.
+
+ Handle correctly calling TypeCastTraits<ExpectedType, ArgType>::isOfType(ArgType&)
+ with ExpectedType being a base class of ArgType (or the same as ArgType). The
+ previous template specialization was only meant to support the case where
+ ExpectedType is the same as ArgType but even that wasn't working as the compiler
+ would complain about ambiguous partial specializations. Since this is needed by
+ RenderTraversal functions, this patch adds an extra isBaseType template parameter
+ to TypeCastTraits to resolve the ambiguity and relies on std::is_base_of for the
+ detection.
+
+ * wtf/TypeCasts.h:
+
2014-10-06 Brent Fulgham <[email protected]>
[Win] Project file gardening.
Modified: trunk/Source/WTF/wtf/TypeCasts.h (174374 => 174375)
--- trunk/Source/WTF/wtf/TypeCasts.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WTF/wtf/TypeCasts.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -30,7 +30,7 @@
namespace WTF {
-template <typename ExpectedType, typename ArgType>
+template <typename ExpectedType, typename ArgType, bool isBaseType = std::is_base_of<ExpectedType, ArgType>::value>
struct TypeCastTraits {
static bool isOfType(ArgType&)
{
@@ -44,9 +44,11 @@
}
};
-template <typename ExpectedType>
-struct TypeCastTraits<ExpectedType, ExpectedType> {
- static bool isOfType(ExpectedType&) { return true; }
+// Template specialization for the case where ExpectedType is a base of ArgType,
+// so we can return return true unconditionally.
+template <typename ExpectedType, typename ArgType>
+struct TypeCastTraits<ExpectedType, ArgType, true /* isBaseType */> {
+ static bool isOfType(ArgType&) { return true; }
};
// Type checking function, to use before casting with downcast<>().
@@ -83,7 +85,7 @@
#define SPECIALIZE_TYPE_TRAITS_BEGIN(ClassName) \
namespace WTF { \
template <typename ArgType> \
-class TypeCastTraits<const ClassName, ArgType> { \
+class TypeCastTraits<const ClassName, ArgType, false /* isBaseType */> { \
public: \
static bool isOfType(ArgType& source) { return isType(source); } \
private:
@@ -94,6 +96,7 @@
} // namespace WTF
+using WTF::TypeCastTraits;
using WTF::is;
using WTF::downcast;
Modified: trunk/Source/WebCore/ChangeLog (174374 => 174375)
--- trunk/Source/WebCore/ChangeLog 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/ChangeLog 2014-10-07 00:26:25 UTC (rev 174375)
@@ -1,5 +1,153 @@
2014-10-06 Christophe Dumez <[email protected]>
+ Add is<>() / downcast<>() support for RenderObject subclasses
+ https://bugs.webkit.org/show_bug.cgi?id=137424
+
+ Reviewed by Benjamin Poulain.
+
+ Add is<>() / downcast<>() support for RenderObject subclasses, and
+ get rid of IsRendererOfType traits struct as we can now rely on the
+ TypeCastsTraits instead.
+
+ toRender*() is still supported for most render objects because I did
+ not want to remove all usages in this patch, to keep the size small.
+ For now, only the MathML render objects were ported over to using
+ is<>() / downcast<>(). Other render objects will be taken care of in
+ follow-up patches and I will drop support for toRender*()
+ incrementally.
+
+ No new tests, no behavior change.
+
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::isMathFenceOperator):
+ (WebCore::AccessibilityRenderObject::isMathSeparatorOperator):
+ (WebCore::AccessibilityRenderObject::mathLineThickness):
+ * dom/make_names.pl:
+ (printTypeHelpers):
+ * mathml/MathMLInlineContainerElement.cpp:
+ (WebCore::MathMLInlineContainerElement::childrenChanged):
+ * mathml/MathMLTextElement.cpp:
+ (WebCore::MathMLTextElement::didAttachRenderers):
+ (WebCore::MathMLTextElement::childrenChanged):
+ * rendering/RenderAncestorIterator.h:
+ (WebCore::lineageOfType):
+ * rendering/RenderBlock.h:
+ * rendering/RenderBlockFlow.h:
+ * rendering/RenderBox.h:
+ * rendering/RenderBoxModelObject.h:
+ * rendering/RenderButton.h:
+ * rendering/RenderCombineText.h:
+ * rendering/RenderCounter.h:
+ * rendering/RenderDetailsMarker.h:
+ * rendering/RenderElement.h:
+ * rendering/RenderEmbeddedObject.h:
+ * rendering/RenderFieldset.h:
+ * rendering/RenderFileUploadControl.h:
+ * rendering/RenderFlexibleBox.h:
+ * rendering/RenderFlowThread.h:
+ * rendering/RenderFrame.h:
+ * rendering/RenderFrameSet.h:
+ * rendering/RenderFullScreen.h:
+ * rendering/RenderGrid.h:
+ * rendering/RenderHTMLCanvas.h:
+ * rendering/RenderIFrame.h:
+ * rendering/RenderImage.h:
+ * rendering/RenderInline.h:
+ * rendering/RenderIterator.h:
+ (WebCore::isRendererOfType):
+ (WebCore::RenderTraversal::firstChild):
+ (WebCore::RenderTraversal::lastChild):
+ (WebCore::RenderTraversal::nextSibling):
+ (WebCore::RenderTraversal::previousSibling):
+ (WebCore::RenderTraversal::findAncestorOfType):
+ * rendering/RenderLayerModelObject.h:
+ * rendering/RenderLineBreak.h:
+ * rendering/RenderListBox.h:
+ * rendering/RenderListItem.h:
+ * rendering/RenderListMarker.h:
+ * rendering/RenderMedia.h:
+ * rendering/RenderMenuList.h:
+ * rendering/RenderMeter.h:
+ * rendering/RenderMultiColumnFlowThread.h:
+ * rendering/RenderMultiColumnSet.h:
+ * rendering/RenderMultiColumnSpannerPlaceholder.h:
+ * rendering/RenderNamedFlowFragment.h:
+ * rendering/RenderNamedFlowThread.h:
+ * rendering/RenderObject.h:
+ (WebCore::RenderObject>): Deleted.
+ * rendering/RenderProgress.h:
+ * rendering/RenderQuote.h:
+ * rendering/RenderRegion.h:
+ * rendering/RenderReplaced.h:
+ * rendering/RenderRubyRun.h:
+ * rendering/RenderScrollbarPart.h:
+ * rendering/RenderSearchField.h:
+ * rendering/RenderSlider.h:
+ * rendering/RenderSnapshottedPlugIn.h:
+ * rendering/RenderTable.h:
+ * rendering/RenderTableCaption.h:
+ * rendering/RenderTableCell.h:
+ * rendering/RenderTableCol.h:
+ * rendering/RenderTableRow.h:
+ * rendering/RenderTableSection.h:
+ * rendering/RenderText.h:
+ * rendering/RenderTextControl.h:
+ * rendering/RenderTextControlMultiLine.h:
+ * rendering/RenderTextControlSingleLine.h:
+ * rendering/RenderTextFragment.h:
+ * rendering/RenderVideo.h:
+ * rendering/RenderView.h:
+ * rendering/RenderWidget.h:
+ * rendering/mathml/RenderMathMLBlock.h:
+ * rendering/mathml/RenderMathMLFenced.cpp:
+ (WebCore::RenderMathMLFenced::updateFromElement):
+ * rendering/mathml/RenderMathMLFraction.cpp:
+ (WebCore::RenderMathMLFraction::unembellishedOperator):
+ * rendering/mathml/RenderMathMLFraction.h:
+ * rendering/mathml/RenderMathMLOperator.h:
+ * rendering/mathml/RenderMathMLRadicalOperator.h:
+ * rendering/mathml/RenderMathMLRoot.cpp:
+ (WebCore::RenderMathMLRoot::baseWrapper):
+ (WebCore::RenderMathMLRoot::radicalWrapper):
+ (WebCore::RenderMathMLRoot::indexWrapper):
+ (WebCore::RenderMathMLRoot::radicalOperator):
+ (WebCore::RenderMathMLRootWrapper::removeChild):
+ * rendering/mathml/RenderMathMLRoot.h:
+ * rendering/mathml/RenderMathMLRow.cpp:
+ (WebCore::RenderMathMLRow::updateOperatorProperties):
+ (WebCore::RenderMathMLRow::layout):
+ * rendering/mathml/RenderMathMLRow.h:
+ * rendering/mathml/RenderMathMLScripts.cpp:
+ (WebCore::RenderMathMLScripts::addChildInternal):
+ (WebCore::RenderMathMLScripts::removeChildInternal):
+ (WebCore::RenderMathMLScripts::unembellishedOperator):
+ (WebCore::RenderMathMLScripts::layout):
+ (WebCore::RenderMathMLScriptsWrapper::addChildInternal):
+ (WebCore::RenderMathMLScriptsWrapper::addChild):
+ (WebCore::RenderMathMLScriptsWrapper::removeChildInternal):
+ (WebCore::RenderMathMLScriptsWrapper::removeChild):
+ * rendering/mathml/RenderMathMLScripts.h:
+ * rendering/mathml/RenderMathMLSpace.h:
+ * rendering/mathml/RenderMathMLSquareRoot.h:
+ * rendering/mathml/RenderMathMLToken.h:
+ * rendering/mathml/RenderMathMLUnderOver.cpp:
+ (WebCore::RenderMathMLUnderOver::unembellishedOperator):
+ * rendering/svg/RenderSVGContainer.h:
+ * rendering/svg/RenderSVGGradientStop.h:
+ * rendering/svg/RenderSVGImage.h:
+ * rendering/svg/RenderSVGInlineText.h:
+ * rendering/svg/RenderSVGModelObject.h:
+ * rendering/svg/RenderSVGPath.h:
+ * rendering/svg/RenderSVGResourceContainer.h:
+ * rendering/svg/RenderSVGResourceFilter.h:
+ * rendering/svg/RenderSVGRoot.h:
+ * rendering/svg/RenderSVGShape.h:
+ * rendering/svg/RenderSVGText.h:
+ * rendering/svg/RenderSVGTextPath.h:
+ * rendering/svg/RenderSVGViewportContainer.h:
+
+2014-10-06 Christophe Dumez <[email protected]>
+
Use is<>() / downcast<>() for ScrollingTreeNode subclasses
https://bugs.webkit.org/show_bug.cgi?id=137451
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (174374 => 174375)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2014-10-07 00:26:25 UTC (rev 174375)
@@ -3536,18 +3536,18 @@
bool AccessibilityRenderObject::isMathFenceOperator() const
{
- if (!m_renderer || !m_renderer->isRenderMathMLOperator())
+ if (!is<RenderMathMLOperator>(m_renderer))
return false;
- return toRenderMathMLOperator(*m_renderer).hasOperatorFlag(MathMLOperatorDictionary::Fence);
+ return downcast<RenderMathMLOperator>(*m_renderer).hasOperatorFlag(MathMLOperatorDictionary::Fence);
}
bool AccessibilityRenderObject::isMathSeparatorOperator() const
{
- if (!m_renderer || !m_renderer->isRenderMathMLOperator())
+ if (!is<RenderMathMLOperator>(m_renderer))
return false;
- return toRenderMathMLOperator(*m_renderer).hasOperatorFlag(MathMLOperatorDictionary::Separator);
+ return downcast<RenderMathMLOperator>(*m_renderer).hasOperatorFlag(MathMLOperatorDictionary::Separator);
}
bool AccessibilityRenderObject::isMathText() const
@@ -3823,10 +3823,10 @@
int AccessibilityRenderObject::mathLineThickness() const
{
- if (!isMathFraction())
+ if (!is<RenderMathMLFraction>(m_renderer))
return -1;
- return toRenderMathMLFraction(m_renderer)->lineThickness();
+ return downcast<RenderMathMLFraction>(*m_renderer).lineThickness();
}
#endif
Modified: trunk/Source/WebCore/dom/make_names.pl (174374 => 174375)
--- trunk/Source/WebCore/dom/make_names.pl 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/dom/make_names.pl 2014-10-07 00:26:25 UTC (rev 174375)
@@ -644,7 +644,7 @@
}
namespace WTF {
template <typename ArgType>
-class TypeCastTraits<const WebCore::$class, ArgType> {
+class TypeCastTraits<const WebCore::$class, ArgType, false /* isBaseType */> {
public:
static bool isOfType(ArgType& node) { return checkTagName(node); }
private:
Modified: trunk/Source/WebCore/mathml/MathMLInlineContainerElement.cpp (174374 => 174375)
--- trunk/Source/WebCore/mathml/MathMLInlineContainerElement.cpp 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/mathml/MathMLInlineContainerElement.cpp 2014-10-07 00:26:25 UTC (rev 174375)
@@ -58,12 +58,12 @@
void MathMLInlineContainerElement::childrenChanged(const ChildChange& change)
{
if (renderer()) {
- if (renderer()->isRenderMathMLRow())
- toRenderMathMLRow(renderer())->updateOperatorProperties();
+ if (is<RenderMathMLRow>(*renderer()))
+ downcast<RenderMathMLRow>(*renderer()).updateOperatorProperties();
else if (hasTagName(mathTag) || hasTagName(msqrtTag)) {
- auto childRenderer = renderer()->firstChild();
- if (childRenderer && childRenderer->isRenderMathMLRow())
- toRenderMathMLRow(childRenderer)->updateOperatorProperties();
+ auto* childRenderer = renderer()->firstChild();
+ if (is<RenderMathMLRow>(childRenderer))
+ downcast<RenderMathMLRow>(*childRenderer).updateOperatorProperties();
}
}
MathMLElement::childrenChanged(change);
Modified: trunk/Source/WebCore/mathml/MathMLTextElement.cpp (174374 => 174375)
--- trunk/Source/WebCore/mathml/MathMLTextElement.cpp 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/mathml/MathMLTextElement.cpp 2014-10-07 00:26:25 UTC (rev 174375)
@@ -53,15 +53,15 @@
void MathMLTextElement::didAttachRenderers()
{
MathMLElement::didAttachRenderers();
- if (renderer() && renderer()->isRenderMathMLToken())
- toRenderMathMLToken(renderer())->updateTokenContent();
+ if (is<RenderMathMLToken>(renderer()))
+ downcast<RenderMathMLToken>(*renderer()).updateTokenContent();
}
void MathMLTextElement::childrenChanged(const ChildChange& change)
{
MathMLElement::childrenChanged(change);
- if (renderer() && renderer()->isRenderMathMLToken())
- toRenderMathMLToken(renderer())->updateTokenContent();
+ if (is<RenderMathMLToken>(renderer()))
+ downcast<RenderMathMLToken>(*renderer()).updateTokenContent();
}
RenderPtr<RenderElement> MathMLTextElement::createElementRenderer(PassRef<RenderStyle> style)
Modified: trunk/Source/WebCore/rendering/RenderAncestorIterator.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderAncestorIterator.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderAncestorIterator.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -186,7 +186,7 @@
template <typename T>
inline RenderAncestorIteratorAdapter<T> lineageOfType(RenderObject& first)
{
- if (isRendererOfType<const T>(first))
+ if (isRendererOfType<T>(first))
return RenderAncestorIteratorAdapter<T>(static_cast<T*>(&first));
return ancestorsOfType<T>(first);
}
@@ -194,7 +194,7 @@
template <typename T>
inline RenderAncestorConstIteratorAdapter<T> lineageOfType(const RenderObject& first)
{
- if (isRendererOfType<const T>(first))
+ if (isRendererOfType<T>(first))
return RenderAncestorConstIteratorAdapter<T>(static_cast<const T*>(&first));
return ancestorsOfType<T>(first);
}
Modified: trunk/Source/WebCore/rendering/RenderBlock.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderBlock.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderBlock.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -538,4 +538,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderBlock, isRenderBlock())
+
#endif // RenderBlock_h
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -636,4 +636,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderBlockFlow, isRenderBlockFlow())
+
#endif // RenderBlockFlow_h
Modified: trunk/Source/WebCore/rendering/RenderBox.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderBox.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderBox.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -767,4 +767,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderBox, isBox())
+
#endif // RenderBox_h
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -343,4 +343,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderBoxModelObject, isBoxModelObject())
+
#endif // RenderBoxModelObject_h
Modified: trunk/Source/WebCore/rendering/RenderButton.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderButton.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderButton.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -87,4 +87,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderButton, isRenderButton())
+
#endif // RenderButton_h
Modified: trunk/Source/WebCore/rendering/RenderCombineText.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderCombineText.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderCombineText.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -61,4 +61,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderCombineText, isCombineText())
+
#endif // RenderCombineText_h
Modified: trunk/Source/WebCore/rendering/RenderCounter.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderCounter.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderCounter.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -66,6 +66,8 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderCounter, isCounter())
+
#ifndef NDEBUG
// Outside the WebCore namespace for ease of invocation from gdb.
void showCounterRendererTree(const WebCore::RenderObject*, const char* counterName = 0);
Modified: trunk/Source/WebCore/rendering/RenderDetailsMarker.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderDetailsMarker.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderDetailsMarker.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -47,9 +47,11 @@
RENDER_OBJECT_TYPE_CASTS(RenderDetailsMarker, isDetailsMarker())
-}
+} // namespace WebCore
-#endif
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderDetailsMarker, isDetailsMarker())
+#endif // ENABLE(DETAILS_ELEMENT)
+
#endif // RenderDetailsMarker_h
Modified: trunk/Source/WebCore/rendering/RenderElement.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderElement.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderElement.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -380,4 +380,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderElement, isRenderElement())
+
#endif // RenderElement_h
Modified: trunk/Source/WebCore/rendering/RenderEmbeddedObject.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderEmbeddedObject.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderEmbeddedObject.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -105,4 +105,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderEmbeddedObject, isEmbeddedObject())
+
#endif // RenderEmbeddedObject_h
Modified: trunk/Source/WebCore/rendering/RenderFieldset.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderFieldset.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderFieldset.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -59,4 +59,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderFieldset, isFieldset())
+
#endif // RenderFieldset_h
Modified: trunk/Source/WebCore/rendering/RenderFileUploadControl.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderFileUploadControl.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderFileUploadControl.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -68,4 +68,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderFileUploadControl, isFileUploadControl())
+
#endif // RenderFileUploadControl_h
Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderFlexibleBox.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -165,4 +165,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderFlexibleBox, isFlexibleBox())
+
#endif // RenderFlexibleBox_h
Modified: trunk/Source/WebCore/rendering/RenderFlowThread.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderFlowThread.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderFlowThread.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -410,4 +410,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderFlowThread, isRenderFlowThread())
+
#endif // RenderFlowThread_h
Modified: trunk/Source/WebCore/rendering/RenderFrame.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderFrame.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderFrame.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -50,4 +50,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderFrame, isFrame())
+
#endif // RenderFrame_h
Modified: trunk/Source/WebCore/rendering/RenderFrameSet.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderFrameSet.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderFrameSet.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -130,4 +130,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderFrameSet, isFrameSet())
+
#endif // RenderFrameSet_h
Modified: trunk/Source/WebCore/rendering/RenderFullScreen.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderFullScreen.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderFullScreen.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -55,8 +55,10 @@
RENDER_OBJECT_TYPE_CASTS(RenderFullScreen, isRenderFullScreen())
-}
+} // namespace WebCore
-#endif
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderFullScreen, isRenderFullScreen())
-#endif
+#endif // ENABLE(FULLSCREEN_API)
+
+#endif // RenderFullScreen_h
Modified: trunk/Source/WebCore/rendering/RenderGrid.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderGrid.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderGrid.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -135,6 +135,8 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderGrid, isRenderGrid())
+
#endif /* ENABLE(CSS_GRID_LAYOUT) */
#endif // RenderGrid_h
Modified: trunk/Source/WebCore/rendering/RenderHTMLCanvas.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderHTMLCanvas.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderHTMLCanvas.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -53,4 +53,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderHTMLCanvas, isCanvas())
+
#endif // RenderHTMLCanvas_h
Modified: trunk/Source/WebCore/rendering/RenderIFrame.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderIFrame.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderIFrame.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -66,4 +66,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderIFrame, isRenderIFrame())
+
#endif // RenderIFrame_h
Modified: trunk/Source/WebCore/rendering/RenderImage.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderImage.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderImage.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -132,4 +132,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderImage, isRenderImage())
+
#endif // RenderImage_h
Modified: trunk/Source/WebCore/rendering/RenderInline.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderInline.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderInline.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -184,4 +184,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderInline, isRenderInline())
+
#endif // RenderInline_h
Modified: trunk/Source/WebCore/rendering/RenderIterator.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderIterator.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderIterator.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -72,6 +72,10 @@
const T* m_current;
};
+// Similar to WTF::is<>() but without the static_assert() making sure the check is necessary.
+template <typename T, typename U>
+inline bool isRendererOfType(const U& renderer) { return TypeCastTraits<const T, const U>::isOfType(renderer); }
+
// Traversal helpers
namespace RenderTraversal {
@@ -80,7 +84,7 @@
inline T* firstChild(U& current)
{
RenderObject* object = current.firstChild();
- while (object && !isRendererOfType<const T>(*object))
+ while (object && !isRendererOfType<T>(*object))
object = object->nextSibling();
return static_cast<T*>(object);
}
@@ -89,7 +93,7 @@
inline T* lastChild(U& current)
{
RenderObject* object = current.lastChild();
- while (object && !isRendererOfType<const T>(*object))
+ while (object && !isRendererOfType<T>(*object))
object = object->previousSibling();
return static_cast<T*>(object);
}
@@ -98,7 +102,7 @@
inline T* nextSibling(U& current)
{
RenderObject* object = current.nextSibling();
- while (object && !isRendererOfType<const T>(*object))
+ while (object && !isRendererOfType<T>(*object))
object = object->nextSibling();
return static_cast<T*>(object);
}
@@ -107,7 +111,7 @@
inline T* previousSibling(U& current)
{
RenderObject* object = current.previousSibling();
- while (object && !isRendererOfType<const T>(*object))
+ while (object && !isRendererOfType<T>(*object))
object = object->previousSibling();
return static_cast<T*>(object);
}
@@ -115,8 +119,8 @@
template <typename T>
inline T* findAncestorOfType(const RenderObject& current)
{
- for (auto ancestor = current.parent(); ancestor; ancestor = ancestor->parent()) {
- if (isRendererOfType<const T>(*ancestor))
+ for (auto* ancestor = current.parent(); ancestor; ancestor = ancestor->parent()) {
+ if (isRendererOfType<T>(*ancestor))
return static_cast<T*>(ancestor);
}
return nullptr;
Modified: trunk/Source/WebCore/rendering/RenderLayerModelObject.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderLayerModelObject.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderLayerModelObject.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -73,4 +73,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderLayerModelObject, isRenderLayerModelObject())
+
#endif // RenderLayerModelObject_h
Modified: trunk/Source/WebCore/rendering/RenderLineBreak.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderLineBreak.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderLineBreak.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -97,4 +97,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderLineBreak, isLineBreak())
+
#endif // RenderLineBreak_h
Modified: trunk/Source/WebCore/rendering/RenderListBox.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderListBox.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderListBox.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -165,4 +165,6 @@
} // namepace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderListBox, isListBox())
+
#endif // RenderListBox_h
Modified: trunk/Source/WebCore/rendering/RenderListItem.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderListItem.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderListItem.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -97,4 +97,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderListItem, isListItem())
+
#endif // RenderListItem_h
Modified: trunk/Source/WebCore/rendering/RenderListMarker.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderListMarker.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderListMarker.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -89,4 +89,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderListMarker, isListMarker())
+
#endif // RenderListMarker_h
Modified: trunk/Source/WebCore/rendering/RenderMedia.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderMedia.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderMedia.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -60,6 +60,8 @@
} // namespace WebCore
-#endif
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMedia, isMedia())
+#endif // ENABLE(VIDEO)
+
#endif // RenderMedia_h
Modified: trunk/Source/WebCore/rendering/RenderMenuList.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderMenuList.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderMenuList.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -154,6 +154,8 @@
RENDER_OBJECT_TYPE_CASTS(RenderMenuList, isMenuList())
-}
+} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMenuList, isMenuList())
+
#endif
Modified: trunk/Source/WebCore/rendering/RenderMeter.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderMeter.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderMeter.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -51,7 +51,9 @@
} // namespace WebCore
-#endif
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMeter, isMeter())
+#endif // ENABLE(METER_ELEMENT)
+
#endif // RenderMeter_h
Modified: trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -163,5 +163,7 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMultiColumnFlowThread, isRenderMultiColumnFlowThread())
+
#endif // RenderMultiColumnFlowThread_h
Modified: trunk/Source/WebCore/rendering/RenderMultiColumnSet.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderMultiColumnSet.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnSet.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -229,5 +229,7 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMultiColumnSet, isRenderMultiColumnSet())
+
#endif // RenderMultiColumnSet_h
Modified: trunk/Source/WebCore/rendering/RenderMultiColumnSpannerPlaceholder.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderMultiColumnSpannerPlaceholder.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnSpannerPlaceholder.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -59,4 +59,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMultiColumnSpannerPlaceholder, isRenderMultiColumnSpannerPlaceholder())
+
#endif // RenderMultiColumnSpannerPlaceholder_h
Modified: trunk/Source/WebCore/rendering/RenderNamedFlowFragment.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderNamedFlowFragment.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderNamedFlowFragment.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -167,4 +167,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderNamedFlowFragment, isRenderNamedFlowFragment())
+
#endif // RenderNamedFlowFragment_h
Modified: trunk/Source/WebCore/rendering/RenderNamedFlowThread.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderNamedFlowThread.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderNamedFlowThread.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -163,4 +163,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderNamedFlowThread, isRenderNamedFlowThread())
+
#endif // RenderNamedFlowThread_h
Modified: trunk/Source/WebCore/rendering/RenderObject.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderObject.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderObject.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -38,6 +38,7 @@
#include "StyleInheritedData.h"
#include "TextAffinity.h"
#include <wtf/HashSet.h>
+#include <wtf/TypeCasts.h>
namespace WebCore {
@@ -1030,9 +1031,6 @@
void setEverHadLayout(bool b) { m_bitfields.setEverHadLayout(b); }
};
-template <typename Type> bool isRendererOfType(const RenderObject&);
-template <> inline bool isRendererOfType<const RenderObject>(const RenderObject&) { return true; }
-
inline Frame& RenderObject::frame() const
{
return *document().frame();
@@ -1128,12 +1126,17 @@
return m_bitfields.boxDecorationState() == HasBoxDecorationsAndBackgroundIsKnownToBeObscured;
}
+// FIXME: Remove this macro and use SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT() instead.
#define RENDER_OBJECT_TYPE_CASTS(ToValueTypeName, predicate) \
- template <> inline bool isRendererOfType<const ToValueTypeName>(const RenderObject& renderer) { return renderer.predicate; } \
- TYPE_CASTS_BASE(ToValueTypeName, RenderObject, renderer, isRendererOfType<const ToValueTypeName>(*renderer), isRendererOfType<const ToValueTypeName>(renderer))
+ TYPE_CASTS_BASE(ToValueTypeName, RenderObject, renderer, is<ToValueTypeName>(*renderer), is<ToValueTypeName>(renderer))
} // namespace WebCore
+#define SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(ToValueTypeName, predicate) \
+SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::ToValueTypeName) \
+ static bool isType(const WebCore::RenderObject& renderer) { return renderer.predicate; } \
+SPECIALIZE_TYPE_TRAITS_END()
+
#ifndef NDEBUG
// Outside the WebCore namespace for ease of invocation from gdb.
void showNodeTree(const WebCore::RenderObject*);
Modified: trunk/Source/WebCore/rendering/RenderProgress.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderProgress.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderProgress.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -62,5 +62,7 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderProgress, isProgress())
+
#endif // RenderProgress_h
Modified: trunk/Source/WebCore/rendering/RenderQuote.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderQuote.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderQuote.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -59,4 +59,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderQuote, isQuote())
+
#endif // RenderQuote_h
Modified: trunk/Source/WebCore/rendering/RenderRegion.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderRegion.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderRegion.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -179,8 +179,6 @@
bool m_isValid : 1;
};
-RENDER_OBJECT_TYPE_CASTS(RenderRegion, isRenderRegion())
-
class CurrentRenderRegionMaintainer {
WTF_MAKE_NONCOPYABLE(CurrentRenderRegionMaintainer);
public:
@@ -194,4 +192,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderRegion, isRenderRegion())
+
#endif // RenderRegion_h
Modified: trunk/Source/WebCore/rendering/RenderReplaced.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderReplaced.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderReplaced.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -91,6 +91,8 @@
RENDER_OBJECT_TYPE_CASTS(RenderReplaced, isRenderReplaced())
-}
+} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderReplaced, isRenderReplaced())
+
#endif
Modified: trunk/Source/WebCore/rendering/RenderRubyRun.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderRubyRun.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderRubyRun.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -81,4 +81,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderRubyRun, isRubyRun())
+
#endif // RenderRubyRun_h
Modified: trunk/Source/WebCore/rendering/RenderScrollbarPart.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderScrollbarPart.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderScrollbarPart.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -77,4 +77,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderScrollbarPart, isRenderScrollbarPart())
+
#endif // RenderScrollbarPart_h
Modified: trunk/Source/WebCore/rendering/RenderSearchField.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderSearchField.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderSearchField.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -92,6 +92,8 @@
RENDER_OBJECT_TYPE_CASTS(RenderSearchField, isTextField())
-}
+} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderSearchField, isTextField())
+
#endif
Modified: trunk/Source/WebCore/rendering/RenderSlider.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderSlider.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderSlider.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -55,4 +55,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderSlider, isSlider())
+
#endif // RenderSlider_h
Modified: trunk/Source/WebCore/rendering/RenderSnapshottedPlugIn.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderSnapshottedPlugIn.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderSnapshottedPlugIn.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -67,4 +67,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderSnapshottedPlugIn, isSnapshottedPlugIn())
+
#endif // RenderSnapshottedPlugIn_h
Modified: trunk/Source/WebCore/rendering/RenderTable.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderTable.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderTable.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -385,4 +385,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderTable, isTable())
+
#endif // RenderTable_h
Modified: trunk/Source/WebCore/rendering/RenderTableCaption.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderTableCaption.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderTableCaption.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -48,4 +48,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderTableCaption, isTableCaption())
+
#endif // RenderTableCaption_h
Modified: trunk/Source/WebCore/rendering/RenderTableCell.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderTableCell.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderTableCell.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -318,4 +318,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderTableCell, isTableCell())
+
#endif // RenderTableCell_h
Modified: trunk/Source/WebCore/rendering/RenderTableCol.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderTableCol.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderTableCol.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -102,6 +102,8 @@
RENDER_OBJECT_TYPE_CASTS(RenderTableCol, isRenderTableCol())
-}
+} // namespace WebCore
-#endif
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderTableCol, isRenderTableCol())
+
+#endif // RenderTableCol_h
Modified: trunk/Source/WebCore/rendering/RenderTableRow.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderTableRow.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderTableRow.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -143,4 +143,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderTableRow, isTableRow())
+
#endif // RenderTableRow_h
Modified: trunk/Source/WebCore/rendering/RenderTableSection.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderTableSection.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderTableSection.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -351,4 +351,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderTableSection, isTableSection())
+
#endif // RenderTableSection_h
Modified: trunk/Source/WebCore/rendering/RenderText.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderText.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderText.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -259,4 +259,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderText, isText())
+
#endif // RenderText_h
Modified: trunk/Source/WebCore/rendering/RenderTextControl.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderTextControl.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderTextControl.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -109,7 +109,8 @@
};
-
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderTextControl, isTextControl())
+
#endif // RenderTextControl_h
Modified: trunk/Source/WebCore/rendering/RenderTextControlMultiLine.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderTextControlMultiLine.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderTextControlMultiLine.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -53,6 +53,8 @@
RENDER_OBJECT_TYPE_CASTS(RenderTextControlMultiLine, isTextArea())
-}
+} // namespace WebCore
-#endif
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderTextControlMultiLine, isTextArea())
+
+#endif // RenderTextControlMultiLine_h
Modified: trunk/Source/WebCore/rendering/RenderTextControlSingleLine.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderTextControlSingleLine.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderTextControlSingleLine.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -115,6 +115,9 @@
RENDER_OBJECT_TYPE_CASTS(RenderTextControlInnerBlock, isTextControlInnerBlock())
-}
+} // namespace WebCore
-#endif
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderTextControlSingleLine, isTextField())
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderTextControlInnerBlock, isTextControlInnerBlock())
+
+#endif // RenderTextControlSingleLine_h
Modified: trunk/Source/WebCore/rendering/RenderTextFragment.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderTextFragment.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderTextFragment.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -76,4 +76,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderTextFragment, isText() && toRenderText(renderer).isTextFragment())
+
#endif // RenderTextFragment_h
Modified: trunk/Source/WebCore/rendering/RenderVideo.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderVideo.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderVideo.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -94,5 +94,7 @@
} // namespace WebCore
-#endif
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderVideo, isVideo())
+
+#endif // ENABLE(VIDEO)
#endif // RenderVideo_h
Modified: trunk/Source/WebCore/rendering/RenderView.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderView.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderView.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -456,4 +456,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderView, isRenderView())
+
#endif // RenderView_h
Modified: trunk/Source/WebCore/rendering/RenderWidget.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/RenderWidget.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/RenderWidget.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -108,4 +108,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderWidget, isWidget())
+
#endif // RenderWidget_h
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -69,8 +69,6 @@
virtual const char* renderName() const override;
};
-RENDER_OBJECT_TYPE_CASTS(RenderMathMLBlock, isRenderMathMLBlock())
-
class RenderMathMLTable final : public RenderTable {
public:
explicit RenderMathMLTable(Element& element, PassRef<RenderStyle> style)
@@ -85,12 +83,14 @@
virtual const char* renderName() const override { return "RenderMathMLTable"; }
};
-RENDER_OBJECT_TYPE_CASTS(RenderMathMLTable, isRenderMathMLTable())
-
// Parsing functions for MathML Length values
bool parseMathMLLength(const String&, LayoutUnit&, const RenderStyle*, bool allowNegative = true);
bool parseMathMLNamedSpace(const String&, LayoutUnit&, const RenderStyle*, bool allowNegative = true);
-}
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMathMLBlock, isRenderMathMLBlock())
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMathMLTable, isRenderMathMLTable())
+
#endif // ENABLE(MATHML)
#endif // RenderMathMLBlock_h
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.cpp (174374 => 174375)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.cpp 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.cpp 2014-10-07 00:26:25 UTC (rev 174375)
@@ -78,7 +78,7 @@
makeFences();
else {
// FIXME: The mfenced element fails to update dynamically when its open, close and separators attributes are changed (https://bugs.webkit.org/show_bug.cgi?id=57696).
- toRenderMathMLOperator(firstChild())->updateTokenContent(m_open);
+ downcast<RenderMathMLOperator>(*firstChild()).updateTokenContent(m_open);
m_closeFenceRenderer->updateTokenContent(m_close);
}
}
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp (174374 => 174375)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp 2014-10-07 00:26:25 UTC (rev 174375)
@@ -120,11 +120,11 @@
{
RenderObject* numeratorWrapper = firstChild();
if (!numeratorWrapper)
- return 0;
+ return nullptr;
RenderObject* numerator = numeratorWrapper->firstChildSlow();
- if (!numerator || !numerator->isRenderMathMLBlock())
- return 0;
- return toRenderMathMLBlock(numerator)->unembellishedOperator();
+ if (!is<RenderMathMLBlock>(numerator))
+ return nullptr;
+ return downcast<RenderMathMLBlock>(*numerator).unembellishedOperator();
}
void RenderMathMLFraction::layout()
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -58,9 +58,9 @@
LayoutUnit m_lineThickness;
};
-RENDER_OBJECT_TYPE_CASTS(RenderMathMLFraction, isRenderMathMLFraction())
+} // namespace WebCore
-}
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMathMLFraction, isRenderMathMLFraction())
#endif // ENABLE(MATHML)
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -189,9 +189,9 @@
virtual void SetOperatorProperties();
};
-RENDER_OBJECT_TYPE_CASTS(RenderMathMLOperator, isRenderMathMLOperator())
+} // namespace WebCore
-}
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMathMLOperator, isRenderMathMLOperator())
#endif // ENABLE(MATHML)
#endif // RenderMathMLOperator_h
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRadicalOperator.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRadicalOperator.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRadicalOperator.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -48,9 +48,9 @@
void SetOperatorProperties() override;
};
-RENDER_OBJECT_TYPE_CASTS(RenderMathMLRadicalOperator, isRenderMathMLRadicalOperator())
+} // namespace WebCore
-}
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMathMLRadicalOperator, isRenderMathMLRadicalOperator())
#endif // ENABLE(MATHML)
#endif // RenderMathMLRadicalOperator_h
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp (174374 => 174375)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp 2014-10-07 00:26:25 UTC (rev 174375)
@@ -35,6 +35,7 @@
#include "PaintInfo.h"
#include "RenderIterator.h"
#include "RenderMathMLRadicalOperator.h"
+#include "RenderMathMLSquareRoot.h"
namespace WebCore {
@@ -67,25 +68,25 @@
RenderMathMLRootWrapper* RenderMathMLRoot::baseWrapper() const
{
ASSERT(!isEmpty());
- return toRenderMathMLRootWrapper(lastChild());
+ return downcast<RenderMathMLRootWrapper>(lastChild());
}
RenderMathMLBlock* RenderMathMLRoot::radicalWrapper() const
{
ASSERT(!isEmpty());
- return toRenderMathMLBlock(lastChild()->previousSibling());
+ return downcast<RenderMathMLBlock>(lastChild()->previousSibling());
}
RenderMathMLRootWrapper* RenderMathMLRoot::indexWrapper() const
{
ASSERT(!isEmpty());
- return isRenderMathMLSquareRoot() ? nullptr : toRenderMathMLRootWrapper(firstChild());
+ return is<RenderMathMLSquareRoot>(*this) ? nullptr : downcast<RenderMathMLRootWrapper>(firstChild());
}
RenderMathMLRadicalOperator* RenderMathMLRoot::radicalOperator() const
{
ASSERT(!isEmpty());
- return toRenderMathMLRadicalOperator(radicalWrapper()->firstChild());
+ return downcast<RenderMathMLRadicalOperator>(radicalWrapper()->firstChild());
}
void RenderMathMLRoot::restructureWrappers()
@@ -358,7 +359,7 @@
RenderObject* next = RenderMathMLBlock::removeChild(child);
if (!(beingDestroyed() || documentBeingDestroyed()))
- toRenderMathMLRoot(parent())->restructureWrappers();
+ downcast<RenderMathMLRoot>(*parent()).restructureWrappers();
return next;
}
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -71,8 +71,6 @@
LayoutUnit m_extraAscender;
float m_degreeBottomRaisePercent;
};
-
-RENDER_OBJECT_TYPE_CASTS(RenderMathMLRoot, isRenderMathMLRoot())
// These are specific wrappers for the index and base, that ask the parent to restructure the renderers after child removal.
class RenderMathMLRootWrapper : public RenderMathMLRow {
@@ -91,9 +89,10 @@
virtual const char* renderName() const override { return "RenderMathMLRootWrapper"; }
};
-RENDER_OBJECT_TYPE_CASTS(RenderMathMLRootWrapper, isRenderMathMLRootWrapper())
+} // namespace WebCore
-}
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMathMLRoot, isRenderMathMLRoot())
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMathMLRootWrapper, isRenderMathMLRootWrapper())
#endif // ENABLE(MATHML)
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp (174374 => 174375)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp 2014-10-07 00:26:25 UTC (rev 174375)
@@ -58,8 +58,8 @@
void RenderMathMLRow::updateOperatorProperties()
{
for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
- if (child->isRenderMathMLBlock()) {
- if (auto renderOperator = toRenderMathMLBlock(child)->unembellishedOperator())
+ if (is<RenderMathMLBlock>(*child)) {
+ if (auto* renderOperator = downcast<RenderMathMLBlock>(*child).unembellishedOperator())
renderOperator->updateOperatorProperties();
}
}
@@ -71,26 +71,26 @@
int stretchHeightAboveBaseline = 0, stretchDepthBelowBaseline = 0;
for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
if (child->needsLayout())
- toRenderElement(child)->layout();
- if (child->isRenderMathMLBlock()) {
+ downcast<RenderElement>(*child).layout();
+ if (is<RenderMathMLBlock>(*child)) {
// We skip the stretchy operators as they must not be included in the computation of the stretch size.
- auto renderOperator = toRenderMathMLBlock(child)->unembellishedOperator();
+ auto* renderOperator = downcast<RenderMathMLBlock>(*child).unembellishedOperator();
if (renderOperator && renderOperator->hasOperatorFlag(MathMLOperatorDictionary::Stretchy))
continue;
}
LayoutUnit childHeightAboveBaseline = 0, childDepthBelowBaseline = 0;
- if (child->isRenderMathMLBlock()) {
- RenderMathMLBlock* mathmlChild = toRenderMathMLBlock(child);
- childHeightAboveBaseline = mathmlChild->firstLineBaseline();
+ if (is<RenderMathMLBlock>(*child)) {
+ RenderMathMLBlock& mathmlChild = downcast<RenderMathMLBlock>(*child);
+ childHeightAboveBaseline = mathmlChild.firstLineBaseline();
if (childHeightAboveBaseline == -1)
- childHeightAboveBaseline = mathmlChild->logicalHeight();
- childDepthBelowBaseline = mathmlChild->logicalHeight() - childHeightAboveBaseline;
- } else if (child->isRenderMathMLTable()) {
- RenderMathMLTable* tableChild = toRenderMathMLTable(child);
- childHeightAboveBaseline = tableChild->firstLineBaseline();
- childDepthBelowBaseline = tableChild->logicalHeight() - childHeightAboveBaseline;
- } else if (child->isBox()) {
- childHeightAboveBaseline = toRenderBox(child)->logicalHeight();
+ childHeightAboveBaseline = mathmlChild.logicalHeight();
+ childDepthBelowBaseline = mathmlChild.logicalHeight() - childHeightAboveBaseline;
+ } else if (is<RenderMathMLTable>(*child)) {
+ RenderMathMLTable& tableChild = downcast<RenderMathMLTable>(*child);
+ childHeightAboveBaseline = tableChild.firstLineBaseline();
+ childDepthBelowBaseline = tableChild.logicalHeight() - childHeightAboveBaseline;
+ } else if (is<RenderBox>(*child)) {
+ childHeightAboveBaseline = downcast<RenderBox>(*child).logicalHeight();
childDepthBelowBaseline = 0;
}
stretchHeightAboveBaseline = std::max<LayoutUnit>(stretchHeightAboveBaseline, childHeightAboveBaseline);
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -50,9 +50,9 @@
virtual const char* renderName() const override { return isAnonymous() ? "RenderMathMLRow (anonymous)" : "RenderMathMLRow"; }
};
-RENDER_OBJECT_TYPE_CASTS(RenderMathMLRow, isRenderMathMLRow())
+} // namespace WebCore
-}
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMathMLRow, isRenderMathMLRow())
#endif // ENABLE(MATHML)
#endif // RenderMathMLRow_h
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp (174374 => 174375)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp 2014-10-07 00:26:25 UTC (rev 174375)
@@ -153,10 +153,10 @@
// beforeChild may be a grandchild, so we call the addChild function of the corresponding wrapper instead.
RenderObject* parent = beforeChild->parent();
if (parent != this) {
- RenderMathMLBlock* parentBlock = toRenderMathMLBlock(parent);
- if (parentBlock->isRenderMathMLScriptsWrapper()) {
- RenderMathMLScriptsWrapper* wrapper = toRenderMathMLScriptsWrapper(parentBlock);
- wrapper->addChildInternal(false, child, beforeChild);
+ RenderMathMLBlock& parentBlock = downcast<RenderMathMLBlock>(*parent);
+ if (is<RenderMathMLScriptsWrapper>(parentBlock)) {
+ RenderMathMLScriptsWrapper& wrapper = downcast<RenderMathMLScriptsWrapper>(parentBlock);
+ wrapper.addChildInternal(false, child, beforeChild);
return;
}
}
@@ -176,12 +176,12 @@
if (!beforeChild || isPrescript(beforeChild)) {
// We are at the end of a sequence of subSup pairs.
- RenderMathMLBlock* previousSibling = toRenderMathMLBlock(beforeChild ? beforeChild->previousSibling() : lastChild());
- if (previousSibling && previousSibling->isRenderMathMLScriptsWrapper()) {
- RenderMathMLScriptsWrapper* wrapper = toRenderMathMLScriptsWrapper(previousSibling);
- if ((wrapper->m_kind == RenderMathMLScriptsWrapper::Base && wrapper->isEmpty()) || (wrapper->m_kind == RenderMathMLScriptsWrapper::SubSupPair && !wrapper->firstChild()->nextSibling())) {
+ RenderMathMLBlock* previousSibling = downcast<RenderMathMLBlock>(beforeChild ? beforeChild->previousSibling() : lastChild());
+ if (is<RenderMathMLScriptsWrapper>(previousSibling)) {
+ RenderMathMLScriptsWrapper& wrapper = downcast<RenderMathMLScriptsWrapper>(*previousSibling);
+ if ((wrapper.m_kind == RenderMathMLScriptsWrapper::Base && wrapper.isEmpty()) || (wrapper.m_kind == RenderMathMLScriptsWrapper::SubSupPair && !wrapper.firstChild()->nextSibling())) {
// The previous sibling is either an empty base or a SubSup pair with a single child so we can insert the new child into that wrapper.
- wrapper->addChildInternal(true, child);
+ wrapper.addChildInternal(true, child);
return;
}
}
@@ -193,10 +193,10 @@
}
// beforeChild is a subSup pair. This is like inserting the new child at the beginning of the subSup wrapper.
- RenderMathMLScriptsWrapper* wrapper = toRenderMathMLScriptsWrapper(beforeChild);
- ASSERT(wrapper->m_kind == RenderMathMLScriptsWrapper::SubSupPair);
+ RenderMathMLScriptsWrapper& wrapper = downcast<RenderMathMLScriptsWrapper>(*beforeChild);
+ ASSERT(wrapper.m_kind == RenderMathMLScriptsWrapper::SubSupPair);
ASSERT(!(m_baseWrapper->isEmpty() && m_baseWrapper->nextSibling() == beforeChild));
- wrapper->addChildInternal(false, child, wrapper->firstChild());
+ wrapper.addChildInternal(false, child, wrapper.firstChild());
}
RenderObject* RenderMathMLScripts::removeChildInternal(bool doNotRestructure, RenderObject& child)
@@ -211,13 +211,13 @@
ASSERT(previousSibling);
if (nextSibling && !isPrescript(previousSibling) && !isPrescript(nextSibling)) {
- RenderMathMLScriptsWrapper* previousWrapper = toRenderMathMLScriptsWrapper(previousSibling);
- RenderMathMLScriptsWrapper* nextWrapper = toRenderMathMLScriptsWrapper(nextSibling);
- ASSERT(nextWrapper->m_kind == RenderMathMLScriptsWrapper::SubSupPair && !nextWrapper->isEmpty());
- if ((previousWrapper->m_kind == RenderMathMLScriptsWrapper::Base && previousWrapper->isEmpty()) || (previousWrapper->m_kind == RenderMathMLScriptsWrapper::SubSupPair && !previousWrapper->firstChild()->nextSibling())) {
- RenderObject* script = nextWrapper->firstChild();
- nextWrapper->removeChildInternal(false, *script);
- previousWrapper->addChildInternal(true, script);
+ RenderMathMLScriptsWrapper& previousWrapper = downcast<RenderMathMLScriptsWrapper>(*previousSibling);
+ RenderMathMLScriptsWrapper& nextWrapper = downcast<RenderMathMLScriptsWrapper>(*nextSibling);
+ ASSERT(nextWrapper.m_kind == RenderMathMLScriptsWrapper::SubSupPair && !nextWrapper.isEmpty());
+ if ((previousWrapper.m_kind == RenderMathMLScriptsWrapper::Base && previousWrapper.isEmpty()) || (previousWrapper.m_kind == RenderMathMLScriptsWrapper::SubSupPair && !previousWrapper.firstChild()->nextSibling())) {
+ RenderObject* script = nextWrapper.firstChild();
+ nextWrapper.removeChildInternal(false, *script);
+ previousWrapper.addChildInternal(true, script);
}
}
@@ -261,9 +261,9 @@
RenderMathMLOperator* RenderMathMLScripts::unembellishedOperator()
{
RenderBoxModelObject* base = this->base();
- if (!base || !base->isRenderMathMLBlock())
- return 0;
- return toRenderMathMLBlock(base)->unembellishedOperator();
+ if (!is<RenderMathMLBlock>(base))
+ return nullptr;
+ return downcast<RenderMathMLBlock>(*base).unembellishedOperator();
}
void RenderMathMLScripts::layout()
@@ -302,8 +302,8 @@
parseMathMLLength(scriptElement->fastGetAttribute(MathMLNames::superscriptshiftAttr), superscriptShiftValue, &style(), false);
bool isPostScript = true;
- RenderMathMLBlock* subSupPair = toRenderMathMLBlock(m_baseWrapper->nextSibling());
- for (; subSupPair; subSupPair = toRenderMathMLBlock(subSupPair->nextSibling())) {
+ RenderMathMLBlock* subSupPair = downcast<RenderMathMLBlock>(m_baseWrapper->nextSibling());
+ for (; subSupPair; subSupPair = downcast<RenderMathMLBlock>(subSupPair->nextSibling())) {
// We skip the base and <mprescripts/> elements.
if (isPrescript(subSupPair)) {
@@ -381,7 +381,7 @@
return;
}
- RenderMathMLScripts* parentNode = toRenderMathMLScripts(parent());
+ RenderMathMLScripts* parentNode = downcast<RenderMathMLScripts>(parent());
if (m_kind == Base) {
RenderObject* sibling = nextSibling();
@@ -432,7 +432,7 @@
// We first move to the last subSup pair in the curent sequence of scripts.
RenderMathMLScriptsWrapper* subSupPair = this;
while (subSupPair->nextSibling() && !isPrescript(subSupPair->nextSibling()))
- subSupPair = toRenderMathMLScriptsWrapper(subSupPair->nextSibling());
+ subSupPair = downcast<RenderMathMLScriptsWrapper>(subSupPair->nextSibling());
if (subSupPair->firstChild()->nextSibling()) {
// The last pair has two children so we need to create a new pair to leave room for the new child.
RenderMathMLScriptsWrapper* newPair = createAnonymousWrapper(parentNode, RenderMathMLScriptsWrapper::SubSupPair);
@@ -442,20 +442,20 @@
// We shift the successors in the current sequence of scripts.
for (RenderObject* previousSibling = subSupPair->previousSibling(); subSupPair != this; previousSibling = previousSibling->previousSibling()) {
- RenderMathMLScriptsWrapper* previousSubSupPair = toRenderMathMLScriptsWrapper(previousSibling);
- RenderObject* script = previousSubSupPair->lastChild();
- previousSubSupPair->removeChildInternal(true, *script);
+ RenderMathMLScriptsWrapper& previousSubSupPair = downcast<RenderMathMLScriptsWrapper>(*previousSibling);
+ RenderObject* script = previousSubSupPair.lastChild();
+ previousSubSupPair.removeChildInternal(true, *script);
subSupPair->addChildInternal(true, script, subSupPair->firstChild());
- subSupPair = toRenderMathMLScriptsWrapper(previousSibling);
+ subSupPair = downcast<RenderMathMLScriptsWrapper>(previousSibling);
}
// This subSup pair now contain one element which is either beforeChild or the script that was before. Hence we can insert the new child before of after that element.
- RenderMathMLBlock::addChild(child, firstChild() == beforeChild ? beforeChild : 0);
+ RenderMathMLBlock::addChild(child, firstChild() == beforeChild ? beforeChild : nullptr);
}
void RenderMathMLScriptsWrapper::addChild(RenderObject* child, RenderObject* beforeChild)
{
- RenderMathMLScripts* parentNode = toRenderMathMLScripts(parent());
+ RenderMathMLScripts* parentNode = downcast<RenderMathMLScripts>(parent());
addChildInternal(false, child, beforeChild);
@@ -467,7 +467,7 @@
if (doNotRestructure)
return RenderMathMLBlock::removeChild(child);
- RenderMathMLScripts* parentNode = toRenderMathMLScripts(parent());
+ RenderMathMLScripts* parentNode = downcast<RenderMathMLScripts>(parent());
if (m_kind == Base) {
// We remove the child from the base wrapper.
@@ -475,9 +475,9 @@
RenderMathMLBlock::removeChild(child);
if (sibling && !isPrescript(sibling)) {
// If there are postscripts, the first one becomes the base.
- RenderMathMLScriptsWrapper* wrapper = toRenderMathMLScriptsWrapper(sibling);
- RenderObject* script = wrapper->firstChild();
- wrapper->removeChildInternal(false, *script);
+ RenderMathMLScriptsWrapper& wrapper = downcast<RenderMathMLScriptsWrapper>(*sibling);
+ RenderObject* script = wrapper.firstChild();
+ wrapper.removeChildInternal(false, *script);
RenderMathMLBlock::addChild(script);
}
return sibling;
@@ -487,11 +487,11 @@
RenderObject* next = RenderMathMLBlock::removeChild(child);
RenderMathMLScriptsWrapper* subSupPair = this;
for (RenderObject* nextSibling = subSupPair->nextSibling(); nextSibling && !isPrescript(nextSibling); nextSibling = nextSibling->nextSibling()) {
- RenderMathMLScriptsWrapper* nextSubSupPair = toRenderMathMLScriptsWrapper(nextSibling);
- RenderObject* script = nextSubSupPair->firstChild();
- nextSubSupPair->removeChildInternal(true, *script);
+ RenderMathMLScriptsWrapper& nextSubSupPair = downcast<RenderMathMLScriptsWrapper>(*nextSibling);
+ RenderObject* script = nextSubSupPair.firstChild();
+ nextSubSupPair.removeChildInternal(true, *script);
subSupPair->addChildInternal(true, script);
- subSupPair = toRenderMathMLScriptsWrapper(nextSibling);
+ subSupPair = downcast<RenderMathMLScriptsWrapper>(nextSibling);
}
// We remove the last subSup pair if it became empty.
@@ -510,7 +510,7 @@
return RenderMathMLBlock::removeChild(child);
}
- RenderMathMLScripts* parentNode = toRenderMathMLScripts(parent());
+ RenderMathMLScripts* parentNode = downcast<RenderMathMLScripts>(parent());
RenderObject* next = removeChildInternal(false, child);
parentNode->fixAnonymousStyles();
return next;
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -65,8 +65,6 @@
WrapperType m_kind;
};
-RENDER_OBJECT_TYPE_CASTS(RenderMathMLScriptsWrapper, isRenderMathMLScriptsWrapper())
-
// Render a base with scripts.
class RenderMathMLScripts : public RenderMathMLBlock {
@@ -105,9 +103,10 @@
RenderMathMLScriptsWrapper* m_baseWrapper;
};
-RENDER_OBJECT_TYPE_CASTS(RenderMathMLScripts, isRenderMathMLScripts())
+} // namespace WebCore
-}
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMathMLScriptsWrapper, isRenderMathMLScriptsWrapper())
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMathMLScripts, isRenderMathMLScripts())
#endif // ENABLE(MATHML)
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -54,9 +54,9 @@
LayoutUnit m_depth;
};
-RENDER_OBJECT_TYPE_CASTS(RenderMathMLSpace, isRenderMathMLSpace())
+} // namespace WebCore
-}
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMathMLSpace, isRenderMathMLSpace())
#endif // ENABLE(MATHML)
#endif // RenderMathMLSpace_h
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -47,8 +47,10 @@
virtual const char* renderName() const override { return "RenderMathMLSquareRoot"; }
};
-}
+} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMathMLSquareRoot, isRenderMathMLSquareRoot())
+
#endif // ENABLE(MATHML)
#endif // RenderMathMLSquareRoot_h
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -59,9 +59,9 @@
bool m_containsElement;
};
-RENDER_OBJECT_TYPE_CASTS(RenderMathMLToken, isRenderMathMLToken())
+} // namespace WebCore
-}
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMathMLToken, isRenderMathMLToken())
#endif // ENABLE(MATHML)
#endif // RenderMathMLToken_h
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp (174374 => 174375)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp 2014-10-07 00:26:25 UTC (rev 174375)
@@ -55,9 +55,9 @@
RenderMathMLOperator* RenderMathMLUnderOver::unembellishedOperator()
{
RenderObject* base = firstChild();
- if (!base || !base->isRenderMathMLBlock())
- return 0;
- return toRenderMathMLBlock(base)->unembellishedOperator();
+ if (!is<RenderMathMLBlock>(base))
+ return nullptr;
+ return downcast<RenderMathMLBlock>(*base).unembellishedOperator();
}
int RenderMathMLUnderOver::firstLineBaseline() const
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGContainer.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/svg/RenderSVGContainer.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGContainer.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -84,4 +84,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderSVGContainer, isSVGContainer())
+
#endif // RenderSVGContainer_h
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGGradientStop.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/svg/RenderSVGGradientStop.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGGradientStop.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -62,6 +62,8 @@
RENDER_OBJECT_TYPE_CASTS(RenderSVGGradientStop, isSVGGradientStop())
-}
+} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderSVGGradientStop, isSVGGradientStop())
+
#endif // RenderSVGGradientStop_h
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGImage.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/svg/RenderSVGImage.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGImage.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -94,4 +94,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderSVGImage, isSVGImage())
+
#endif // RenderSVGImage_h
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -71,6 +71,8 @@
RENDER_OBJECT_TYPE_CASTS(RenderSVGInlineText, isSVGInlineText())
-}
+} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderSVGInlineText, isSVGInlineText())
+
#endif // RenderSVGInlineText_h
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -80,8 +80,10 @@
bool m_hasSVGShadow;
};
-RENDER_OBJECT_TYPE_CASTS(RenderSVGModelObject, isRenderSVGModelObject());
+RENDER_OBJECT_TYPE_CASTS(RenderSVGModelObject, isRenderSVGModelObject())
-}
+} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderSVGModelObject, isRenderSVGModelObject())
+
#endif
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGPath.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/svg/RenderSVGPath.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGPath.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -57,6 +57,8 @@
RENDER_OBJECT_TYPE_CASTS(RenderSVGPath, isSVGPath())
-}
+} // namespace WebCore
-#endif
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderSVGPath, isSVGPath())
+
+#endif // RenderSVGPath_h
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceContainer.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceContainer.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceContainer.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -97,6 +97,8 @@
return nullptr;
}
-}
+} // namespace WebCore
-#endif
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderSVGResourceContainer, isSVGResourceContainer())
+
+#endif // RenderSVGResourceContainer_h
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -99,6 +99,8 @@
RENDER_OBJECT_TYPE_CASTS(RenderSVGResourceFilter, isSVGResourceFilter())
-}
+} // namespace WebCore
-#endif
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderSVGResourceFilter, isSVGResourceFilter())
+
+#endif // RenderSVGResourceFilter_h
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGRoot.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/svg/RenderSVGRoot.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGRoot.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -126,4 +126,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderSVGRoot, isSVGRoot())
+
#endif // RenderSVGRoot_h
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGShape.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/svg/RenderSVGShape.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGShape.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -135,6 +135,8 @@
RENDER_OBJECT_TYPE_CASTS(RenderSVGShape, isSVGShape())
-}
+} // namespace WebCore
-#endif
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderSVGShape, isSVGShape())
+
+#endif // RenderSVGShape_h
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGText.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/svg/RenderSVGText.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGText.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -107,6 +107,8 @@
RENDER_OBJECT_TYPE_CASTS(RenderSVGText, isSVGText())
-}
+} // namespace WebCore
-#endif
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderSVGText, isSVGText())
+
+#endif // RenderSVGText_h
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGTextPath.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/svg/RenderSVGTextPath.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGTextPath.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -47,6 +47,8 @@
RENDER_OBJECT_TYPE_CASTS(RenderSVGTextPath, isSVGTextPath())
-}
+} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderSVGTextPath, isSVGTextPath())
+
#endif // RenderSVGTextPath_h
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGViewportContainer.h (174374 => 174375)
--- trunk/Source/WebCore/rendering/svg/RenderSVGViewportContainer.h 2014-10-07 00:15:07 UTC (rev 174374)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGViewportContainer.h 2014-10-07 00:26:25 UTC (rev 174375)
@@ -71,4 +71,6 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderSVGViewportContainer, isSVGViewportContainer())
+
#endif // RenderSVGViewportContainer_h