Introduce RENDER_OBJECT_TYPE_CASTS to replace manual toFoo() in child render object
authorgyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Oct 2013 01:30:20 +0000 (01:30 +0000)
committergyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Oct 2013 01:30:20 +0000 (01:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=123150

Reviewed by Andreas Kling.

As a step to let toFoo use TYPE_CASTS_BASE, toRenderFoo() can use it for child render object.
So, this patch introduces RENDER_OBJECT_TYPE_CASTS based on the TYPE_CASTS_BASE. This will
generate plenty more helper functions for render object type cast.

Some unnecessary type casts are fixed by this change.

No new tests, no behavior changes.

* rendering/RenderBlock.h:
* rendering/RenderBlockFlow.h:
* rendering/RenderBox.h:
* rendering/RenderBoxModelObject.h:
* rendering/RenderButton.h:
* rendering/RenderCounter.h:
* rendering/RenderElement.h:
(WebCore::RenderElement::generatingElement):
* 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/RenderHTMLCanvas.h:
* rendering/RenderIFrame.h:
* rendering/RenderImage.h:
* rendering/RenderInline.h:
* rendering/RenderLayerModelObject.h:
* rendering/RenderLineBreak.h:
* rendering/RenderListBox.h:
* rendering/RenderListItem.h:
* rendering/RenderMedia.h:
* rendering/RenderMenuList.h:
* rendering/RenderMeter.h:
* rendering/RenderMultiColumnBlock.h:
* rendering/RenderMultiColumnSet.h:
* rendering/RenderNamedFlowFragment.h:
* rendering/RenderNamedFlowThread.h:
* rendering/RenderObject.h:
* 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/RenderWidget.h:
* rendering/mathml/RenderMathMLBlock.h:
* rendering/svg/RenderSVGContainer.h:
* rendering/svg/RenderSVGGradientStop.h:
* rendering/svg/RenderSVGImage.h:
* rendering/svg/RenderSVGInlineText.h:
* rendering/svg/RenderSVGPath.h:
* rendering/svg/RenderSVGResourceFilter.h:
* rendering/svg/RenderSVGResourceFilterPrimitive.cpp:
(WebCore::RenderSVGResourceFilterPrimitive::styleDidChange):
* rendering/svg/RenderSVGRoot.h:
* rendering/svg/RenderSVGShape.h:
* rendering/svg/RenderSVGText.h:
* rendering/svg/RenderSVGTextPath.h:
* rendering/svg/RenderSVGViewportContainer.h:
* rendering/svg/SVGInlineFlowBox.cpp:
(WebCore::SVGInlineFlowBox::paint):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@157907 268f45cc-cd09-0410-ab3c-d52691b4dbfc

66 files changed:
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlock.h
Source/WebCore/rendering/RenderBlockFlow.h
Source/WebCore/rendering/RenderBox.h
Source/WebCore/rendering/RenderBoxModelObject.h
Source/WebCore/rendering/RenderButton.h
Source/WebCore/rendering/RenderCounter.h
Source/WebCore/rendering/RenderElement.h
Source/WebCore/rendering/RenderEmbeddedObject.h
Source/WebCore/rendering/RenderFieldset.h
Source/WebCore/rendering/RenderFileUploadControl.h
Source/WebCore/rendering/RenderFlexibleBox.h
Source/WebCore/rendering/RenderFlowThread.h
Source/WebCore/rendering/RenderFrame.h
Source/WebCore/rendering/RenderFrameSet.h
Source/WebCore/rendering/RenderFullScreen.h
Source/WebCore/rendering/RenderHTMLCanvas.h
Source/WebCore/rendering/RenderIFrame.h
Source/WebCore/rendering/RenderImage.h
Source/WebCore/rendering/RenderInline.h
Source/WebCore/rendering/RenderLayerModelObject.h
Source/WebCore/rendering/RenderLineBreak.h
Source/WebCore/rendering/RenderListBox.h
Source/WebCore/rendering/RenderListItem.h
Source/WebCore/rendering/RenderMedia.h
Source/WebCore/rendering/RenderMenuList.h
Source/WebCore/rendering/RenderMeter.h
Source/WebCore/rendering/RenderMultiColumnBlock.h
Source/WebCore/rendering/RenderMultiColumnSet.h
Source/WebCore/rendering/RenderNamedFlowFragment.h
Source/WebCore/rendering/RenderNamedFlowThread.h
Source/WebCore/rendering/RenderObject.h
Source/WebCore/rendering/RenderProgress.h
Source/WebCore/rendering/RenderQuote.h
Source/WebCore/rendering/RenderRegion.h
Source/WebCore/rendering/RenderReplaced.h
Source/WebCore/rendering/RenderRubyRun.h
Source/WebCore/rendering/RenderScrollbarPart.h
Source/WebCore/rendering/RenderSearchField.h
Source/WebCore/rendering/RenderSlider.h
Source/WebCore/rendering/RenderSnapshottedPlugIn.h
Source/WebCore/rendering/RenderTable.h
Source/WebCore/rendering/RenderTableCaption.h
Source/WebCore/rendering/RenderTableCell.h
Source/WebCore/rendering/RenderTableCol.h
Source/WebCore/rendering/RenderTableRow.h
Source/WebCore/rendering/RenderTableSection.h
Source/WebCore/rendering/RenderText.h
Source/WebCore/rendering/RenderTextControl.h
Source/WebCore/rendering/RenderTextControlMultiLine.h
Source/WebCore/rendering/RenderTextControlSingleLine.h
Source/WebCore/rendering/RenderWidget.h
Source/WebCore/rendering/mathml/RenderMathMLBlock.h
Source/WebCore/rendering/svg/RenderSVGContainer.h
Source/WebCore/rendering/svg/RenderSVGGradientStop.h
Source/WebCore/rendering/svg/RenderSVGImage.h
Source/WebCore/rendering/svg/RenderSVGInlineText.h
Source/WebCore/rendering/svg/RenderSVGPath.h
Source/WebCore/rendering/svg/RenderSVGResourceFilter.h
Source/WebCore/rendering/svg/RenderSVGResourceFilterPrimitive.cpp
Source/WebCore/rendering/svg/RenderSVGRoot.h
Source/WebCore/rendering/svg/RenderSVGShape.h
Source/WebCore/rendering/svg/RenderSVGText.h
Source/WebCore/rendering/svg/RenderSVGTextPath.h
Source/WebCore/rendering/svg/RenderSVGViewportContainer.h
Source/WebCore/rendering/svg/SVGInlineFlowBox.cpp

index a6dedea..7af4cce 100644 (file)
@@ -1,3 +1,87 @@
+2013-10-23  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
+
+        Introduce RENDER_OBJECT_TYPE_CASTS to replace manual toFoo() in child render object
+        https://bugs.webkit.org/show_bug.cgi?id=123150
+
+        Reviewed by Andreas Kling.
+
+        As a step to let toFoo use TYPE_CASTS_BASE, toRenderFoo() can use it for child render object.
+        So, this patch introduces RENDER_OBJECT_TYPE_CASTS based on the TYPE_CASTS_BASE. This will
+        generate plenty more helper functions for render object type cast.
+
+        Some unnecessary type casts are fixed by this change.
+
+        No new tests, no behavior changes.
+
+        * rendering/RenderBlock.h:
+        * rendering/RenderBlockFlow.h:
+        * rendering/RenderBox.h:
+        * rendering/RenderBoxModelObject.h:
+        * rendering/RenderButton.h:
+        * rendering/RenderCounter.h:
+        * rendering/RenderElement.h:
+        (WebCore::RenderElement::generatingElement):
+        * 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/RenderHTMLCanvas.h:
+        * rendering/RenderIFrame.h:
+        * rendering/RenderImage.h:
+        * rendering/RenderInline.h:
+        * rendering/RenderLayerModelObject.h:
+        * rendering/RenderLineBreak.h:
+        * rendering/RenderListBox.h:
+        * rendering/RenderListItem.h:
+        * rendering/RenderMedia.h:
+        * rendering/RenderMenuList.h:
+        * rendering/RenderMeter.h:
+        * rendering/RenderMultiColumnBlock.h:
+        * rendering/RenderMultiColumnSet.h:
+        * rendering/RenderNamedFlowFragment.h:
+        * rendering/RenderNamedFlowThread.h:
+        * rendering/RenderObject.h:
+        * 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/RenderWidget.h:
+        * rendering/mathml/RenderMathMLBlock.h:
+        * rendering/svg/RenderSVGContainer.h:
+        * rendering/svg/RenderSVGGradientStop.h:
+        * rendering/svg/RenderSVGImage.h:
+        * rendering/svg/RenderSVGInlineText.h:
+        * rendering/svg/RenderSVGPath.h:
+        * rendering/svg/RenderSVGResourceFilter.h:
+        * rendering/svg/RenderSVGResourceFilterPrimitive.cpp:
+        (WebCore::RenderSVGResourceFilterPrimitive::styleDidChange):
+        * rendering/svg/RenderSVGRoot.h:
+        * rendering/svg/RenderSVGShape.h:
+        * rendering/svg/RenderSVGText.h:
+        * rendering/svg/RenderSVGTextPath.h:
+        * rendering/svg/RenderSVGViewportContainer.h:
+        * rendering/svg/SVGInlineFlowBox.cpp:
+        (WebCore::SVGInlineFlowBox::paint):
+
 2013-10-23  Myles C. Maxfield  <mmaxfield@apple.com>
 
         Include misspelling dot gap width when centering misspelling dots
index b447d82..d6e4422 100644 (file)
@@ -772,33 +772,7 @@ private:
     static bool s_canPropagateFloatIntoSibling;
 };
 
-inline RenderBlock& toRenderBlock(RenderObject& object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(object.isRenderBlock());
-    return static_cast<RenderBlock&>(object);
-}
-
-inline const RenderBlock& toRenderBlock(const RenderObject& object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(object.isRenderBlock());
-    return static_cast<const RenderBlock&>(object);
-}
-
-inline RenderBlock* toRenderBlock(RenderObject* object)
-{ 
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderBlock());
-    return static_cast<RenderBlock*>(object);
-}
-
-inline const RenderBlock* toRenderBlock(const RenderObject* object)
-{ 
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderBlock());
-    return static_cast<const RenderBlock*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderBlock(const RenderBlock*);
-void toRenderBlock(const RenderBlock&);
+RENDER_OBJECT_TYPE_CASTS(RenderBlock, isRenderBlock())
 
 LayoutUnit blockDirectionOffset(RenderBlock& rootBlock, const LayoutSize& offsetFromRootBlock);
 LayoutUnit inlineDirectionOffset(RenderBlock& rootBlock, const LayoutSize& offsetFromRootBlock);
index c7d54f4..41f257e 100644 (file)
@@ -485,39 +485,13 @@ protected:
     friend class LineWidth; // Needs to know FloatingObject
 };
 
-inline RenderBlockFlow& toRenderBlockFlow(RenderObject& object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(object.isRenderBlockFlow());
-    return static_cast<RenderBlockFlow&>(object);
-}
-
-inline const RenderBlockFlow& toRenderBlockFlow(const RenderObject& object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(object.isRenderBlockFlow());
-    return static_cast<const RenderBlockFlow&>(object);
-}
-
-inline RenderBlockFlow* toRenderBlockFlow(RenderObject* object)
-{ 
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderBlockFlow());
-    return static_cast<RenderBlockFlow*>(object);
-}
-
-inline const RenderBlockFlow* toRenderBlockFlow(const RenderObject* object)
-{ 
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderBlockFlow());
-    return static_cast<const RenderBlockFlow*>(object);
-}
+RENDER_OBJECT_TYPE_CASTS(RenderBlockFlow, isRenderBlockFlow())
 
 inline bool RenderElement::isRenderNamedFlowFragmentContainer() const
 {
     return isRenderBlockFlow() && toRenderBlockFlow(this)->renderNamedFlowFragment();
 }
 
-// This will catch anyone doing an unnecessary cast.
-void toRenderBlockFlow(const RenderBlockFlow*);
-void toRenderBlockFlow(const RenderBlockFlow&);
-
 } // namespace WebCore
 
 #endif // RenderBlockFlow_h
index 1ff04b0..35af07e 100644 (file)
@@ -712,33 +712,7 @@ private:
     static bool s_hadOverflowClip;
 };
 
-inline RenderBox& toRenderBox(RenderObject& object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(object.isBox());
-    return static_cast<RenderBox&>(object);
-}
-
-inline const RenderBox& toRenderBox(const RenderObject& object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(object.isBox());
-    return static_cast<const RenderBox&>(object);
-}
-
-inline RenderBox* toRenderBox(RenderObject* object)
-{ 
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isBox());
-    return static_cast<RenderBox*>(object);
-}
-
-inline const RenderBox* toRenderBox(const RenderObject* object)
-{ 
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isBox());
-    return static_cast<const RenderBox*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderBox(const RenderBox*);
-void toRenderBox(const RenderBox&);
+RENDER_OBJECT_TYPE_CASTS(RenderBox, isBox())
 
 inline RenderBox* RenderBox::previousSiblingBox() const
 {
index 945876f..fb3a967 100644 (file)
@@ -340,33 +340,7 @@ private:
                             Color, EBorderStyle, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge);
 };
 
-inline RenderBoxModelObject& toRenderBoxModelObject(RenderObject& object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(object.isBoxModelObject());
-    return static_cast<RenderBoxModelObject&>(object);
-}
-
-inline const RenderBoxModelObject& toRenderBoxModelObject(const RenderObject& object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(object.isBoxModelObject());
-    return static_cast<const RenderBoxModelObject&>(object);
-}
-
-inline RenderBoxModelObject* toRenderBoxModelObject(RenderObject* object)
-{ 
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isBoxModelObject());
-    return static_cast<RenderBoxModelObject*>(object);
-}
-
-inline const RenderBoxModelObject* toRenderBoxModelObject(const RenderObject* object)
-{ 
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isBoxModelObject());
-    return static_cast<const RenderBoxModelObject*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderBoxModelObject(const RenderBoxModelObject*);
-void toRenderBoxModelObject(const RenderBoxModelObject&);
+RENDER_OBJECT_TYPE_CASTS(RenderBoxModelObject, isBoxModelObject())
 
 } // namespace WebCore
 
index b92bba5..2b27c34 100644 (file)
@@ -79,20 +79,7 @@ private:
     bool m_default;
 };
 
-inline RenderButton* toRenderButton(RenderObject* object)
-{ 
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderButton());
-    return static_cast<RenderButton*>(object);
-}
-
-inline const RenderButton* toRenderButton(const RenderObject* object)
-{ 
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderButton());
-    return static_cast<const RenderButton*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderButton(const RenderButton*);
+RENDER_OBJECT_TYPE_CASTS(RenderButton, isRenderButton())
 
 } // namespace WebCore
 
index f6a6266..03d8a2c 100644 (file)
@@ -62,21 +62,7 @@ private:
     friend class CounterNode;
 };
 
-inline RenderCounter& toRenderCounter(RenderObject& object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(object.isCounter());
-    return static_cast<RenderCounter&>(object);
-}
-
-inline RenderCounter* toRenderCounter(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isCounter());
-    return static_cast<RenderCounter*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderCounter(const RenderCounter&);
-void toRenderCounter(const RenderCounter*);
+RENDER_OBJECT_TYPE_CASTS(RenderCounter, isCounter())
 
 } // namespace WebCore
 
index 6d9bbe0..db4b545 100644 (file)
@@ -236,41 +236,15 @@ inline bool RenderElement::isRenderInline() const
     return m_baseTypeFlags & RenderInlineFlag;
 }
 
-inline RenderElement& toRenderElement(RenderObject& object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(object.isRenderElement());
-    return static_cast<RenderElement&>(object);
-}
-
-inline const RenderElement& toRenderElement(const RenderObject& object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(object.isRenderElement());
-    return static_cast<const RenderElement&>(object);
-}
-
-inline RenderElement* toRenderElement(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderElement());
-    return static_cast<RenderElement*>(object);
-}
-
-inline const RenderElement* toRenderElement(const RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderElement());
-    return static_cast<const RenderElement*>(object);
-}
+RENDER_OBJECT_TYPE_CASTS(RenderElement, isRenderElement())
 
 inline Element* RenderElement::generatingElement() const
 {
     if (parent() && isRenderNamedFlowFragment())
-        return toRenderElement(parent())->generatingElement();
+        return parent()->generatingElement();
     return toElement(RenderObject::generatingNode());
 }
 
-// This will catch anyone doing an unnecessary cast.
-void toRenderElement(const RenderElement*);
-void toRenderElement(const RenderElement&);
-
 inline bool RenderObject::isRenderLayerModelObject() const
 {
     return isRenderElement() && toRenderElement(this)->isRenderLayerModelObject();
index e060540..3aef925 100644 (file)
@@ -113,14 +113,7 @@ private:
     String m_unavailabilityDescription;
 };
 
-inline RenderEmbeddedObject* toRenderEmbeddedObject(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isEmbeddedObject());
-    return static_cast<RenderEmbeddedObject*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderEmbeddedObject(const RenderEmbeddedObject*);
+RENDER_OBJECT_TYPE_CASTS(RenderEmbeddedObject, isEmbeddedObject())
 
 } // namespace WebCore
 
index 439da7b..b2a3033 100644 (file)
@@ -55,14 +55,7 @@ private:
     virtual void paintMask(PaintInfo&, const LayoutPoint&) OVERRIDE;
 };
 
-inline RenderFieldset* toRenderFieldset(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isFieldset());
-    return static_cast<RenderFieldset*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderFieldset(const RenderFieldset*);
+RENDER_OBJECT_TYPE_CASTS(RenderFieldset, isFieldset())
 
 } // namespace WebCore
 
index f6b2744..4047553 100644 (file)
@@ -65,20 +65,7 @@ private:
     bool m_canReceiveDroppedFiles;
 };
 
-inline RenderFileUploadControl* toRenderFileUploadControl(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isFileUploadControl());
-    return static_cast<RenderFileUploadControl*>(object);
-}
-
-inline const RenderFileUploadControl* toRenderFileUploadControl(const RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isFileUploadControl());
-    return static_cast<const RenderFileUploadControl*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderFileUploadControl(const RenderFileUploadControl*);
+RENDER_OBJECT_TYPE_CASTS(RenderFileUploadControl, isFileUploadControl())
 
 } // namespace WebCore
 
index 81ac12e..6b24f28 100644 (file)
@@ -177,20 +177,7 @@ private:
     int m_numberOfInFlowChildrenOnFirstLine;
 };
 
-inline RenderFlexibleBox* toRenderFlexibleBox(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isFlexibleBox());
-    return static_cast<RenderFlexibleBox*>(object);
-}
-
-inline const RenderFlexibleBox* toRenderFlexibleBox(const RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isFlexibleBox());
-    return static_cast<const RenderFlexibleBox*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderFlexibleBox(const RenderFlexibleBox*);
+RENDER_OBJECT_TYPE_CASTS(RenderFlexibleBox, isFlexibleBox())
 
 } // namespace WebCore
 
index 71d6eec..96079f8 100644 (file)
@@ -355,33 +355,7 @@ protected:
     bool m_layersToRegionMappingsDirty : 1;
 };
 
-inline RenderFlowThread& toRenderFlowThread(RenderObject& object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(object.isRenderFlowThread());
-    return static_cast<RenderFlowThread&>(object);
-}
-
-inline const RenderFlowThread& toRenderFlowThread(const RenderObject& object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(object.isRenderFlowThread());
-    return static_cast<const RenderFlowThread&>(object);
-}
-
-inline RenderFlowThread* toRenderFlowThread(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderFlowThread());
-    return static_cast<RenderFlowThread*>(object);
-}
-
-inline const RenderFlowThread* toRenderFlowThread(const RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderFlowThread());
-    return static_cast<const RenderFlowThread*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderFlowThread(const RenderFlowThread*);
-void toRenderFlowThread(const RenderFlowThread&);
+RENDER_OBJECT_TYPE_CASTS(RenderFlowThread, isRenderFlowThread())
 
 class CurrentRenderFlowThreadMaintainer {
     WTF_MAKE_NONCOPYABLE(CurrentRenderFlowThreadMaintainer);
index 1a70492..f999726 100644 (file)
@@ -47,14 +47,7 @@ private:
     virtual void viewCleared() OVERRIDE;
 };
 
-inline RenderFrame* toRenderFrame(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isFrame());
-    return static_cast<RenderFrame*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderFrame(const RenderFrame*);
+RENDER_OBJECT_TYPE_CASTS(RenderFrame, isFrame())
 
 } // namespace WebCore
 
index e6ed3c3..f6b44ab 100644 (file)
@@ -126,15 +126,7 @@ private:
     bool m_isChildResizing;
 };
 
-
-inline RenderFrameSet* toRenderFrameSet(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isFrameSet());
-    return static_cast<RenderFrameSet*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderFrameSet(const RenderFrameSet*);
+RENDER_OBJECT_TYPE_CASTS(RenderFrameSet, isFrameSet())
 
 } // namespace WebCore
 
index 7dba780..dee5689 100644 (file)
@@ -53,15 +53,9 @@ private:
 protected:
     RenderBlock* m_placeholder;
 };
-    
-inline RenderFullScreen* toRenderFullScreen(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(object->isRenderFullScreen());
-    return static_cast<RenderFullScreen*>(object);
-}
-    
-// This will catch anyone doing an unnecessary cast:
-void toRenderFullScreen(RenderFullScreen*);
+
+RENDER_OBJECT_TYPE_CASTS(RenderFullScreen, isRenderFullScreen())
+
 }
 
 #endif
index eb7b7fc..dce6e92 100644 (file)
@@ -49,14 +49,7 @@ private:
     virtual void intrinsicSizeChanged() OVERRIDE { canvasSizeChanged(); }
 };
 
-inline RenderHTMLCanvas* toRenderHTMLCanvas(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isCanvas());
-    return static_cast<RenderHTMLCanvas*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderHTMLCanvas(const RenderHTMLCanvas*);
+RENDER_OBJECT_TYPE_CASTS(RenderHTMLCanvas, isCanvas())
 
 } // namespace WebCore
 
index 7b786aa..0837f8f 100644 (file)
@@ -63,21 +63,7 @@ private:
     RenderView* contentRootRenderer() const;
 };
 
-inline RenderIFrame* toRenderIFrame(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderIFrame());
-    return static_cast<RenderIFrame*>(object);
-}
-
-inline const RenderIFrame* toRenderIFrame(const RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderIFrame());
-    return static_cast<const RenderIFrame*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderIFrame(const RenderIFrame*);
-
+RENDER_OBJECT_TYPE_CASTS(RenderIFrame, isRenderIFrame())
 
 } // namespace WebCore
 
index 1380acb..f527be5 100644 (file)
@@ -118,33 +118,7 @@ private:
     friend class RenderImageScaleObserver;
 };
 
-inline RenderImage& toRenderImage(RenderObject& object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(object.isRenderImage());
-    return static_cast<RenderImage&>(object);
-}
-
-inline const RenderImage& toRenderImage(const RenderObject& object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(object.isRenderImage());
-    return static_cast<const RenderImage&>(object);
-}
-
-inline RenderImage* toRenderImage(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderImage());
-    return static_cast<RenderImage*>(object);
-}
-
-inline const RenderImage* toRenderImage(const RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderImage());
-    return static_cast<const RenderImage*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderImage(const RenderImage*);
-void toRenderImage(const RenderImage&);
+RENDER_OBJECT_TYPE_CASTS(RenderImage, isRenderImage())
 
 } // namespace WebCore
 
index e34c32a..0e78ed5 100644 (file)
@@ -176,33 +176,7 @@ private:
     bool m_alwaysCreateLineBoxes : 1;
 };
 
-inline RenderInline& toRenderInline(RenderObject& object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(object.isRenderInline());
-    return static_cast<RenderInline&>(object);
-}
-
-inline const RenderInline& toRenderInline(const RenderObject& object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(object.isRenderInline());
-    return static_cast<const RenderInline&>(object);
-}
-
-inline RenderInline* toRenderInline(RenderObject* object)
-{ 
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderInline());
-    return static_cast<RenderInline*>(object);
-}
-
-inline const RenderInline* toRenderInline(const RenderObject* object)
-{ 
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderInline());
-    return static_cast<const RenderInline*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderInline(const RenderInline*);
-void toRenderInline(const RenderInline&);
+RENDER_OBJECT_TYPE_CASTS(RenderInline, isRenderInline())
 
 } // namespace WebCore
 
index 5e4b333..aff588f 100644 (file)
@@ -67,20 +67,7 @@ private:
     static bool s_layerWasSelfPainting;
 };
 
-inline RenderLayerModelObject* toRenderLayerModelObject(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderLayerModelObject());
-    return static_cast<RenderLayerModelObject*>(object);
-}
-
-inline const RenderLayerModelObject* toRenderLayerModelObject(const RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderLayerModelObject());
-    return static_cast<const RenderLayerModelObject*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderLayerModelObject(const RenderLayerModelObject*);
+RENDER_OBJECT_TYPE_CASTS(RenderLayerModelObject, isRenderLayerModelObject())
 
 } // namespace WebCore
 
index 9b58927..0f84448 100644 (file)
@@ -89,32 +89,7 @@ private:
     bool m_isWBR;
 };
 
-inline RenderLineBreak& toRenderLineBreak(RenderObject& object)
-{ 
-    ASSERT_WITH_SECURITY_IMPLICATION(object.isLineBreak());
-    return static_cast<RenderLineBreak&>(object);
-}
-
-inline const RenderLineBreak& toRenderLineBreak(const RenderObject& object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(object.isLineBreak());
-    return static_cast<const RenderLineBreak&>(object);
-}
-
-inline RenderLineBreak* toRenderLineBreak(RenderObject* object)
-{ 
-    ASSERT_WITH_SECURITY_IMPLICATION(object->isLineBreak());
-    return static_cast<RenderLineBreak*>(object);
-}
-
-inline const RenderLineBreak* toRenderLineBreak(const RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(object->isLineBreak());
-    return static_cast<const RenderLineBreak*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderLineBreak(const RenderLineBreak&);
+RENDER_OBJECT_TYPE_CASTS(RenderLineBreak, isLineBreak())
 
 } // namespace WebCore
 
index daa0778..95b292c 100644 (file)
@@ -154,14 +154,7 @@ private:
     RefPtr<Scrollbar> m_vBar;
 };
 
-inline RenderListBox* toRenderListBox(RenderObject* object)
-{ 
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isListBox());
-    return static_cast<RenderListBox*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderListBox(const RenderListBox*);
+RENDER_OBJECT_TYPE_CASTS(RenderListBox, isListBox())
 
 } // namepace WebCore
 
index b1ff29d..371d78a 100644 (file)
@@ -92,14 +92,7 @@ private:
     bool m_notInList : 1;
 };
 
-inline RenderListItem* toRenderListItem(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isListItem());
-    return static_cast<RenderListItem*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderListItem(const RenderListItem*);
+RENDER_OBJECT_TYPE_CASTS(RenderListItem, isListItem())
 
 } // namespace WebCore
 
index 4c847a9..20e2297 100644 (file)
@@ -57,14 +57,7 @@ private:
     virtual bool requiresForcedStyleRecalcPropagation() const OVERRIDE FINAL { return true; }
 };
 
-inline RenderMedia* toRenderMedia(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isMedia());
-    return static_cast<RenderMedia*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderMedia(const RenderMedia*);
+RENDER_OBJECT_TYPE_CASTS(RenderMedia, isMedia())
 
 } // namespace WebCore
 
index d1a2e4c..6235b46 100644 (file)
@@ -149,14 +149,7 @@ private:
     bool m_popupIsVisible;
 };
 
-inline RenderMenuList* toRenderMenuList(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isMenuList());
-    return static_cast<RenderMenuList*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderMenuList(const RenderMenuList*);
+RENDER_OBJECT_TYPE_CASTS(RenderMenuList, isMenuList())
 
 }
 
index 3800df4..c655ae7 100644 (file)
@@ -47,14 +47,7 @@ private:
     virtual bool requiresForcedStyleRecalcPropagation() const OVERRIDE { return true; }
 };
 
-inline RenderMeter* toRenderMeter(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isMeter());
-    return static_cast<RenderMeter*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderMeter(const RenderMeter*);
+RENDER_OBJECT_TYPE_CASTS(RenderMeter, isMeter())
 
 } // namespace WebCore
 
index 2895a9d..b190003 100644 (file)
@@ -73,20 +73,7 @@ private:
     bool m_inBalancingPass; // Set when relayouting for column balancing.
 };
 
-inline RenderMultiColumnBlock* toRenderMultiColumnBlock(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderMultiColumnBlock());
-    return static_cast<RenderMultiColumnBlock*>(object);
-}
-
-inline const RenderMultiColumnBlock* toRenderMultiColumnBlock(const RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderMultiColumnBlock());
-    return static_cast<const RenderMultiColumnBlock*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderMultiColumnBlock(const RenderMultiColumnBlock*);
+RENDER_OBJECT_TYPE_CASTS(RenderMultiColumnBlock, isRenderMultiColumnBlock())
 
 } // namespace WebCore
 
index ceab37e..a0f017d 100644 (file)
@@ -152,20 +152,7 @@ private:
     LayoutUnit m_forcedBreakOffset;
 };
 
-inline RenderMultiColumnSet* toRenderMultiColumnSet(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderMultiColumnSet());
-    return static_cast<RenderMultiColumnSet*>(object);
-}
-
-inline const RenderMultiColumnSet* toRenderMultiColumnSet(const RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderMultiColumnSet());
-    return static_cast<const RenderMultiColumnSet*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderMultiColumnSet(const RenderMultiColumnSet*);
+RENDER_OBJECT_TYPE_CASTS(RenderMultiColumnSet, isRenderMultiColumnSet())
 
 } // namespace WebCore
 
index 3456205..706b56a 100644 (file)
@@ -63,20 +63,7 @@ private:
     virtual const char* renderName() const OVERRIDE { return "RenderNamedFlowFragment"; }
 };
 
-inline RenderNamedFlowFragment* toRenderNamedFlowFragment(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderNamedFlowFragment());
-    return static_cast<RenderNamedFlowFragment*>(object);
-}
-
-inline const RenderNamedFlowFragment* toRenderNamedFlowFragment(const RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderNamedFlowFragment());
-    return static_cast<const RenderNamedFlowFragment*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderNamedFlowFragment(const RenderNamedFlowFragment*);
+RENDER_OBJECT_TYPE_CASTS(RenderNamedFlowFragment, isRenderNamedFlowFragment())
 
 } // namespace WebCore
 
index 93a0628..427e897 100644 (file)
@@ -138,20 +138,7 @@ private:
     Timer<RenderNamedFlowThread> m_regionOversetChangeEventTimer;
 };
 
-inline RenderNamedFlowThread* toRenderNamedFlowThread(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderNamedFlowThread());
-    return static_cast<RenderNamedFlowThread*>(object);
-}
-
-inline const RenderNamedFlowThread* toRenderNamedFlowThread(const RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderNamedFlowThread());
-    return static_cast<const RenderNamedFlowThread*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderNamedFlowThread(const RenderNamedFlowThread*);
+RENDER_OBJECT_TYPE_CASTS(RenderNamedFlowThread, isRenderNamedFlowThread())
 
 } // namespace WebCore
 
index 652589e..a3b2131 100644 (file)
@@ -1158,6 +1158,9 @@ inline LayoutUnit adjustLayoutUnitForAbsoluteZoom(LayoutUnit value, RenderObject
 }
 #endif
 
+#define RENDER_OBJECT_TYPE_CASTS(ToValueTypeName, predicate) \
+    TYPE_CASTS_BASE(ToValueTypeName, RenderObject, object, object->predicate, object.predicate)
+
 } // namespace WebCore
 
 #ifndef NDEBUG
index 3df549d..c416c6f 100644 (file)
@@ -60,14 +60,7 @@ private:
     Timer<RenderProgress> m_animationTimer;
 };
 
-inline RenderProgress* toRenderProgress(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isProgress());
-    return static_cast<RenderProgress*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderProgress(const RenderProgress*);
+RENDER_OBJECT_TYPE_CASTS(RenderProgress, isProgress())
 
 } // namespace WebCore
 
index f9e4289..5e46681 100644 (file)
@@ -53,14 +53,7 @@ private:
     bool m_isAttached;
 };
 
-inline RenderQuote* toRenderQuote(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isQuote());
-    return static_cast<RenderQuote*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderQuote(const RenderQuote*);
+RENDER_OBJECT_TYPE_CASTS(RenderQuote, isQuote())
 
 } // namespace WebCore
 
index de407b8..e0f1db6 100644 (file)
@@ -235,33 +235,7 @@ private:
     LayoutUnit m_computedAutoHeight;
 };
 
-inline RenderRegion* toRenderRegion(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderRegion());
-    return static_cast<RenderRegion*>(object);
-}
-
-inline const RenderRegion* toRenderRegion(const RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderRegion());
-    return static_cast<const RenderRegion*>(object);
-}
-
-inline RenderRegion& toRenderRegion(RenderObject& object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(object.isRenderRegion());
-    return static_cast<RenderRegion&>(object);
-}
-
-inline const RenderRegion& toRenderRegion(const RenderObject& object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(object.isRenderRegion());
-    return static_cast<const RenderRegion&>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderRegion(const RenderRegion*);
-void toRenderRegion(const RenderRegion&);
+RENDER_OBJECT_TYPE_CASTS(RenderRegion, isRenderRegion())
 
 } // namespace WebCore
 
index 5ad4137..22f3e0c 100644 (file)
@@ -89,20 +89,7 @@ private:
     mutable LayoutSize m_intrinsicSize;
 };
 
-inline RenderReplaced* toRenderReplaced(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderReplaced());
-    return static_cast<RenderReplaced*>(object);
-}
-
-inline const RenderReplaced* toRenderReplaced(const RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderReplaced());
-    return static_cast<const RenderReplaced*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderReplaced(const RenderReplaced*);
+RENDER_OBJECT_TYPE_CASTS(RenderReplaced, isRenderReplaced())
 
 }
 
index bd743bc..baa1eec 100644 (file)
@@ -77,32 +77,7 @@ private:
     virtual void removeLeftoverAnonymousBlock(RenderBlock*) { }
 };
 
-inline RenderRubyRun& toRenderRubyRun(RenderObject& object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(object.isRubyRun());
-    return static_cast<RenderRubyRun&>(object);
-}
-
-inline const RenderRubyRun& toRenderRubyRun(const RenderObject& object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(object.isRubyRun());
-    return static_cast<const RenderRubyRun&>(object);
-}
-
-inline RenderRubyRun* toRenderRubyRun(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRubyRun());
-    return static_cast<RenderRubyRun*>(object);
-}
-
-inline const RenderRubyRun* toRenderRubyRun(const RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isBox());
-    return static_cast<const RenderRubyRun*>(object);
-}
-
-void toRenderRubyRun(const RenderRubyRun*);
-void toRenderRubyRun(const RenderRubyRun&);
+RENDER_OBJECT_TYPE_CASTS(RenderRubyRun, isRubyRun())
 
 } // namespace WebCore
 
index d01ebf4..12e3614 100644 (file)
@@ -73,20 +73,7 @@ private:
     ScrollbarPart m_part;
 };
 
-inline RenderScrollbarPart* toRenderScrollbarPart(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderScrollbarPart());
-    return static_cast<RenderScrollbarPart*>(object);
-}
-
-inline const RenderScrollbarPart* toRenderScrollbarPart(const RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderScrollbarPart());
-    return static_cast<const RenderScrollbarPart*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderScrollbarPart(const RenderScrollbarPart*);
+RENDER_OBJECT_TYPE_CASTS(RenderScrollbarPart, isRenderScrollbarPart())
 
 } // namespace WebCore
 
index d4114d3..7fdc938 100644 (file)
@@ -90,14 +90,7 @@ private:
     Vector<String> m_recentSearches;
 };
 
-inline RenderSearchField* toRenderSearchField(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isTextField());
-    return static_cast<RenderSearchField*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderSearchField(const RenderSearchField*);
+RENDER_OBJECT_TYPE_CASTS(RenderSearchField, isTextField())
 
 }
 
index 1c47c22..d652911 100644 (file)
@@ -52,14 +52,7 @@ private:
     virtual void layout() OVERRIDE;
 };
 
-inline RenderSlider* toRenderSlider(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isSlider());
-    return static_cast<RenderSlider*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderSlider(const RenderSlider*);
+RENDER_OBJECT_TYPE_CASTS(RenderSlider, isSlider())
 
 } // namespace WebCore
 
index c0cf7ca..8139ba9 100644 (file)
@@ -63,14 +63,7 @@ private:
     bool m_isPotentialMouseActivation;
 };
 
-inline RenderSnapshottedPlugIn* toRenderSnapshottedPlugIn(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isSnapshottedPlugIn());
-    return static_cast<RenderSnapshottedPlugIn*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderSnapshottedPlugIn(const RenderSnapshottedPlugIn*);
+RENDER_OBJECT_TYPE_CASTS(RenderSnapshottedPlugIn, isSnapshottedPlugIn())
 
 } // namespace WebCore
 
index 62a87b3..4b35c1d 100644 (file)
@@ -350,20 +350,7 @@ inline RenderTableSection* RenderTable::topSection() const
     return m_foot;
 }
 
-inline RenderTable* toRenderTable(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isTable());
-    return static_cast<RenderTable*>(object);
-}
-
-inline const RenderTable* toRenderTable(const RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isTable());
-    return static_cast<const RenderTable*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderTable(const RenderTable*);
+RENDER_OBJECT_TYPE_CASTS(RenderTable, isTable())
 
 } // namespace WebCore
 
index 614092a..4fb0b89 100644 (file)
@@ -44,20 +44,7 @@ private:
     RenderTable* table() const;
 };
 
-inline RenderTableCaption* toRenderTableCaption(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isTableCaption());
-    return static_cast<RenderTableCaption*>(object);
-}
-
-inline const RenderTableCaption* toRenderTableCaption(const RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isTableCaption());
-    return static_cast<const RenderTableCaption*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderTableCaption(const RenderTableCaption*);
+RENDER_OBJECT_TYPE_CASTS(RenderTableCaption, isTableCaption())
 
 } // namespace WebCore
 
index 07e783f..01116b2 100644 (file)
@@ -296,20 +296,7 @@ private:
     int m_intrinsicPaddingAfter;
 };
 
-inline RenderTableCell* toRenderTableCell(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isTableCell());
-    return static_cast<RenderTableCell*>(object);
-}
-
-inline const RenderTableCell* toRenderTableCell(const RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isTableCell());
-    return static_cast<const RenderTableCell*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderTableCell(const RenderTableCell*);
+RENDER_OBJECT_TYPE_CASTS(RenderTableCell, isTableCell())
 
 inline RenderTableCell* RenderTableCell::nextCell() const
 {
index b3672f6..644131b 100644 (file)
@@ -95,20 +95,7 @@ private:
     unsigned m_span;
 };
 
-inline RenderTableCol* toRenderTableCol(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderTableCol());
-    return static_cast<RenderTableCol*>(object);
-}
-
-inline const RenderTableCol* toRenderTableCol(const RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderTableCol());
-    return static_cast<const RenderTableCol*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderTableCol(const RenderTableCol*);
+RENDER_OBJECT_TYPE_CASTS(RenderTableCol, isRenderTableCol())
 
 }
 
index 52861f6..338aaa2 100644 (file)
@@ -119,26 +119,7 @@ private:
     unsigned m_rowIndex : 31;
 };
 
-inline RenderTableRow& toRenderTableRow(RenderObject& object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(object.isTableRow());
-    return static_cast<RenderTableRow&>(object);
-}
-
-inline RenderTableRow* toRenderTableRow(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isTableRow());
-    return static_cast<RenderTableRow*>(object);
-}
-
-inline const RenderTableRow* toRenderTableRow(const RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isTableRow());
-    return static_cast<const RenderTableRow*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderTableRow(const RenderTableRow*);
+RENDER_OBJECT_TYPE_CASTS(RenderTableRow, isTableRow())
 
 inline RenderTableRow* RenderTableSection::firstRow() const
 {
index 887a4a8..147c550 100644 (file)
@@ -309,20 +309,7 @@ private:
     HashMap<pair<const RenderTableCell*, int>, CollapsedBorderValue > m_cellsCollapsedBorders;
 };
 
-inline RenderTableSection* toRenderTableSection(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isTableSection());
-    return static_cast<RenderTableSection*>(object);
-}
-
-inline const RenderTableSection* toRenderTableSection(const RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isTableSection());
-    return static_cast<const RenderTableSection*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderTableSection(const RenderTableSection*);
+RENDER_OBJECT_TYPE_CASTS(RenderTableSection, isTableSection())
 
 } // namespace WebCore
 
index 73106cc..032887b 100644 (file)
@@ -212,33 +212,7 @@ private:
     RenderTextLineBoxes m_lineBoxes;
 };
 
-inline RenderText& toRenderText(RenderObject& object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(object.isText());
-    return static_cast<RenderText&>(object);
-}
-
-inline const RenderText& toRenderText(const RenderObject& object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(object.isText());
-    return static_cast<const RenderText&>(object);
-}
-
-inline RenderText* toRenderText(RenderObject* object)
-{ 
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isText());
-    return static_cast<RenderText*>(object);
-}
-
-inline const RenderText* toRenderText(const RenderObject* object)
-{ 
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isText());
-    return static_cast<const RenderText*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderText(const RenderText*);
-void toRenderText(const RenderText&);
+RENDER_OBJECT_TYPE_CASTS(RenderText, isText())
 
 inline RenderStyle* RenderText::style() const
 {
index 6c07e0d..2e40202 100644 (file)
@@ -84,20 +84,7 @@ private:
     virtual bool requiresForcedStyleRecalcPropagation() const OVERRIDE { return true; }
 };
 
-inline RenderTextControl* toRenderTextControl(RenderObject* object)
-{ 
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isTextControl());
-    return static_cast<RenderTextControl*>(object);
-}
-
-inline const RenderTextControl* toRenderTextControl(const RenderObject* object)
-{ 
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isTextControl());
-    return static_cast<const RenderTextControl*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderTextControl(const RenderTextControl*);
+RENDER_OBJECT_TYPE_CASTS(RenderTextControl, isTextControl())
 
 // Renderer for our inner container, for <search> and others.
 // We can't use RenderFlexibleBox directly, because flexboxes have a different
index 16cd2cf..215ba01 100644 (file)
@@ -52,14 +52,7 @@ private:
     virtual RenderObject* layoutSpecialExcludedChild(bool relayoutChildren);
 };
 
-inline RenderTextControlMultiLine* toRenderTextControlMultiLine(RenderObject* object)
-{ 
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isTextArea());
-    return static_cast<RenderTextControlMultiLine*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderTextControlMultiLine(const RenderTextControlMultiLine*);
+RENDER_OBJECT_TYPE_CASTS(RenderTextControlMultiLine, isTextArea())
 
 }
 
index 60964c9..daa82c2 100644 (file)
@@ -98,14 +98,7 @@ inline HTMLElement* RenderTextControlSingleLine::innerBlockElement() const
     return inputElement().innerBlockElement();
 }
 
-inline RenderTextControlSingleLine* toRenderTextControlSingleLine(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isTextField());
-    return static_cast<RenderTextControlSingleLine*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderTextControlSingleLine(const RenderTextControlSingleLine*);
+RENDER_OBJECT_TYPE_CASTS(RenderTextControlSingleLine, isTextField())
 
 // ----------------------------
 
@@ -121,14 +114,7 @@ private:
     virtual bool isTextControlInnerBlock() const OVERRIDE { return true; }
 };
 
-inline RenderTextControlInnerBlock* toRenderTextControlInnerBlock(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isTextControlInnerBlock());
-    return static_cast<RenderTextControlInnerBlock*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderTextControlInnerBlock(const RenderTextControlInnerBlock*);
+RENDER_OBJECT_TYPE_CASTS(RenderTextControlInnerBlock, isTextControlInnerBlock())
 
 }
 
index bf9bccb..8f8759f 100644 (file)
@@ -113,20 +113,7 @@ private:
     IntRect m_clipRect; // The rectangle needs to remain correct after scrolling, so it is stored in content view coordinates, and not clipped to window.
 };
 
-inline RenderWidget* toRenderWidget(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isWidget());
-    return static_cast<RenderWidget*>(object);
-}
-
-inline const RenderWidget* toRenderWidget(const RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isWidget());
-    return static_cast<const RenderWidget*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderWidget(const RenderWidget*);
+RENDER_OBJECT_TYPE_CASTS(RenderWidget, isWidget())
 
 } // namespace WebCore
 
index 172793f..b07dc38 100644 (file)
@@ -85,20 +85,7 @@ private:
     bool m_ignoreInAccessibilityTree;
 };
 
-inline RenderMathMLBlock* toRenderMathMLBlock(RenderObject* object)
-{ 
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderMathMLBlock());
-    return static_cast<RenderMathMLBlock*>(object);
-}
-
-inline const RenderMathMLBlock* toRenderMathMLBlock(const RenderObject* object)
-{ 
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderMathMLBlock());
-    return static_cast<const RenderMathMLBlock*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderMathMLBlock(const RenderMathMLBlock*);
+RENDER_OBJECT_TYPE_CASTS(RenderMathMLBlock, isRenderMathMLBlock())
 
 class RenderMathMLTable FINAL : public RenderTable {
 public:
index 1cc7fb7..bafa15a 100644 (file)
@@ -81,21 +81,8 @@ private:
     FloatRect m_repaintBoundingBox;
     bool m_needsBoundariesUpdate : 1;
 };
-  
-inline RenderSVGContainer* toRenderSVGContainer(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isSVGContainer());
-    return static_cast<RenderSVGContainer*>(object);
-}
-
-inline const RenderSVGContainer* toRenderSVGContainer(const RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isSVGContainer());
-    return static_cast<const RenderSVGContainer*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderSVGContainer(const RenderSVGContainer*);
+
+RENDER_OBJECT_TYPE_CASTS(RenderSVGContainer, isSVGContainer())
 
 } // namespace WebCore
 
index 6529b9e..e20f317 100644 (file)
@@ -59,11 +59,7 @@ private:
     SVGGradientElement* gradientElement() const;
 };
 
-inline const RenderSVGGradientStop* toRenderSVGGradientStop(const RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isSVGGradientStop());
-    return static_cast<const RenderSVGGradientStop*>(object);
-}
+RENDER_OBJECT_TYPE_CASTS(RenderSVGGradientStop, isSVGGradientStop())
 
 }
 
index 314fa74..44389b4 100644 (file)
@@ -93,20 +93,7 @@ private:
     OwnPtr<ImageBuffer> m_bufferedForeground;
 };
 
-inline RenderSVGImage* toRenderSVGImage(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isSVGImage());
-    return static_cast<RenderSVGImage*>(object);
-}
-
-inline const RenderSVGImage* toRenderSVGImage(const RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isSVGImage());
-    return static_cast<const RenderSVGImage*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderSVGImage(const RenderSVGImage*);
+RENDER_OBJECT_TYPE_CASTS(RenderSVGImage, isSVGImage())
 
 } // namespace WebCore
 
index 1a0b5f7..a82e7fc 100644 (file)
@@ -69,32 +69,7 @@ private:
     SVGTextLayoutAttributes m_layoutAttributes;
 };
 
-inline RenderSVGInlineText& toRenderSVGInlineText(RenderObject& object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(object.isSVGInlineText());
-    return static_cast<RenderSVGInlineText&>(object);
-}
-
-inline const RenderSVGInlineText& toRenderSVGInlineText(const RenderObject& object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(object.isSVGInlineText());
-    return static_cast<const RenderSVGInlineText&>(object);
-}
-
-inline RenderSVGInlineText* toRenderSVGInlineText(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isSVGInlineText());
-    return static_cast<RenderSVGInlineText*>(object);
-}
-
-inline const RenderSVGInlineText* toRenderSVGInlineText(const RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isSVGInlineText());
-    return static_cast<const RenderSVGInlineText*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderSVGInlineText(const RenderSVGInlineText*);
+RENDER_OBJECT_TYPE_CASTS(RenderSVGInlineText, isSVGInlineText())
 
 }
 
index 0eea2a9..b97475d 100644 (file)
@@ -54,11 +54,7 @@ private:
     Vector<FloatPoint> m_zeroLengthLinecapLocations;
 };
 
-inline RenderSVGPath* toRenderSVGPath(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isSVGPath());
-    return static_cast<RenderSVGPath*>(object);
-}
+RENDER_OBJECT_TYPE_CASTS(RenderSVGPath, isSVGPath())
 
 }
 
index 10a2490..2dceda1 100644 (file)
@@ -101,11 +101,7 @@ private:
     HashMap<RenderObject*, std::unique_ptr<FilterData>> m_filter;
 };
 
-inline RenderSVGResourceFilter* toRenderSVGFilter(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isSVGResourceFilter());
-    return static_cast<RenderSVGResourceFilter*>(object);
-}
+RENDER_OBJECT_TYPE_CASTS(RenderSVGResourceFilter, isSVGResourceFilter())
 
 }
 
index 7dd6df5..a711bd9 100644 (file)
@@ -63,12 +63,12 @@ void RenderSVGResourceFilterPrimitive::styleDidChange(StyleDifference diff, cons
     const SVGRenderStyle* newStyle = this->style()->svgStyle();
     if (filterPrimitiveElement().hasTagName(SVGNames::feFloodTag)) {
         if (newStyle->floodColor() != oldStyle->svgStyle()->floodColor())
-            toRenderSVGFilter(filter)->primitiveAttributeChanged(this, SVGNames::flood_colorAttr);
+            toRenderSVGResourceFilter(filter)->primitiveAttributeChanged(this, SVGNames::flood_colorAttr);
         if (newStyle->floodOpacity() != oldStyle->svgStyle()->floodOpacity())
-            toRenderSVGFilter(filter)->primitiveAttributeChanged(this, SVGNames::flood_opacityAttr);
+            toRenderSVGResourceFilter(filter)->primitiveAttributeChanged(this, SVGNames::flood_opacityAttr);
     } else if (filterPrimitiveElement().hasTagName(SVGNames::feDiffuseLightingTag) || filterPrimitiveElement().hasTagName(SVGNames::feSpecularLightingTag)) {
         if (newStyle->lightingColor() != oldStyle->svgStyle()->lightingColor())
-            toRenderSVGFilter(filter)->primitiveAttributeChanged(this, SVGNames::lighting_colorAttr);
+            toRenderSVGResourceFilter(filter)->primitiveAttributeChanged(this, SVGNames::lighting_colorAttr);
     }
 }
 
index f50d094..4046234 100644 (file)
@@ -122,20 +122,7 @@ private:
     bool m_hasSVGShadow : 1;
 };
 
-inline RenderSVGRoot* toRenderSVGRoot(RenderObject* object)
-{ 
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isSVGRoot());
-    return static_cast<RenderSVGRoot*>(object);
-}
-
-inline const RenderSVGRoot* toRenderSVGRoot(const RenderObject* object)
-{ 
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isSVGRoot());
-    return static_cast<const RenderSVGRoot*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderSVGRoot(const RenderSVGRoot*);
+RENDER_OBJECT_TYPE_CASTS(RenderSVGRoot, isSVGRoot())
 
 } // namespace WebCore
 
index 0369fa1..54ec0ad 100644 (file)
@@ -153,20 +153,7 @@ private:
     bool m_needsTransformUpdate : 1;
 };
 
-inline RenderSVGShape* toRenderSVGShape(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isSVGShape());
-    return static_cast<RenderSVGShape*>(object);
-}
-
-inline const RenderSVGShape* toRenderSVGShape(const RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isSVGShape());
-    return static_cast<const RenderSVGShape*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderSVGShape(const RenderSVGShape*);
+RENDER_OBJECT_TYPE_CASTS(RenderSVGShape, isSVGShape())
 
 }
 
index 65c2a2a..dd7840f 100644 (file)
@@ -106,33 +106,7 @@ private:
     Vector<SVGTextLayoutAttributes*> m_layoutAttributes;
 };
 
-inline RenderSVGText& toRenderSVGText(RenderObject& object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(object.isSVGText());
-    return static_cast<RenderSVGText&>(object);
-}
-
-inline const RenderSVGText& toRenderSVGText(const RenderObject& object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(object.isSVGText());
-    return static_cast<const RenderSVGText&>(object);
-}
-
-inline RenderSVGText* toRenderSVGText(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isSVGText());
-    return static_cast<RenderSVGText*>(object);
-}
-
-inline const RenderSVGText* toRenderSVGText(const RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isSVGText());
-    return static_cast<const RenderSVGText*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderSVGText(const RenderSVGText&);
-void toRenderSVGText(const RenderSVGText*);
+RENDER_OBJECT_TYPE_CASTS(RenderSVGText, isSVGText())
 
 }
 
index 2d98463..c8021e1 100644 (file)
@@ -46,14 +46,7 @@ private:
     Path m_layoutPath;
 };
 
-inline RenderSVGTextPath* toRenderSVGTextPath(RenderObject* object)
-{ 
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isSVGTextPath());
-    return static_cast<RenderSVGTextPath*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderSVGTextPath(const RenderSVGTextPath*);
+RENDER_OBJECT_TYPE_CASTS(RenderSVGTextPath, isSVGTextPath())
 
 }
 
index fa3d94d..7b64b4c 100644 (file)
@@ -67,21 +67,8 @@ private:
     bool m_isLayoutSizeChanged : 1;
     bool m_needsTransformUpdate : 1;
 };
-  
-inline RenderSVGViewportContainer* toRenderSVGViewportContainer(RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isSVGViewportContainer());
-    return static_cast<RenderSVGViewportContainer*>(object);
-}
-
-inline const RenderSVGViewportContainer* toRenderSVGViewportContainer(const RenderObject* object)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isSVGViewportContainer());
-    return static_cast<const RenderSVGViewportContainer*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toRenderSVGViewportContainer(const RenderSVGViewportContainer*);
+
+RENDER_OBJECT_TYPE_CASTS(RenderSVGViewportContainer, isSVGViewportContainer())
 
 } // namespace WebCore
 
index c82fcd4..8d7101b 100644 (file)
@@ -58,7 +58,7 @@ void SVGInlineFlowBox::paint(PaintInfo& paintInfo, const LayoutPoint&, LayoutUni
     if (renderingContext.isRenderingPrepared()) {
         for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
             if (child->isSVGInlineTextBox())
-                computeTextMatchMarkerRectForRenderer(&toRenderSVGInlineText(toSVGInlineTextBox(child)->renderer()));
+                computeTextMatchMarkerRectForRenderer(&(toSVGInlineTextBox(child)->renderer()));
 
             child->paint(paintInfo, LayoutPoint(), 0, 0);
         }