Title: [174504] trunk/Source/WebCore
Revision
174504
Author
cdu...@apple.com
Date
2014-10-09 09:17:06 -0700 (Thu, 09 Oct 2014)

Log Message

Use is<>() / downcast<>() for RenderBlockFlow
https://bugs.webkit.org/show_bug.cgi?id=137545

Reviewed by Darin Adler.

Use is<>() / downcast<>() for RenderBlockFlow and clean up the
surrounding code.

No new tests, no behavior change.

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored):
* dom/Element.cpp:
(WebCore::Element::renderNamedFlowFragment):
(WebCore::Element::webkitGetRegionFlowRanges):
* editing/Editor.cpp:
(WebCore::Editor::hasBidiSelection):
* inspector/InspectorOverlay.cpp:
(WebCore::buildObjectForRegionHighlight):
(WebCore::buildObjectForElementInfo):
* rendering/EllipsisBox.h:
* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::innerTextIfTruncated):
* rendering/LayoutState.cpp:
(WebCore::LayoutState::LayoutState):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::removeChild):
* rendering/RenderBlock.h:
(WebCore::RenderBlock::moveAllChildrenIncludingFloatsTo):
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::rebuildFloatingObjectSetFromIntrudingFloats):
(WebCore::RenderBlockFlow::layoutBlockChild):
(WebCore::RenderBlockFlow::marginOffsetForSelfCollapsingBlock):
(WebCore::RenderBlockFlow::marginValuesForChild):
(WebCore::RenderBlockFlow::collapseMargins):
(WebCore::RenderBlockFlow::marginBeforeEstimateForChild):
(WebCore::RenderBlockFlow::handleAfterSideOfBlock):
(WebCore::RenderBlockFlow::mustDiscardMarginBeforeForChild):
(WebCore::RenderBlockFlow::mustDiscardMarginAfterForChild):
(WebCore::RenderBlockFlow::adjustBlockChildForPagination):
(WebCore::RenderBlockFlow::moveAllChildrenIncludingFloatsTo):
(WebCore::RenderBlockFlow::markAllDescendantsWithFloatsForLayout):
(WebCore::RenderBlockFlow::adjustForBorderFit):
(WebCore::getHeightForLineCount):
* rendering/RenderBlockFlow.h:
(WebCore::RenderElement::isRenderNamedFlowFragmentContainer):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::createLineBoxes):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::styleDidChange):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintMaskForTextFillBox):
* rendering/RenderDeprecatedFlexibleBox.cpp:
(WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
(WebCore::RenderDeprecatedFlexibleBox::clearLineClamp):
* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::removeFlowChildInfo):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateLayerPositions):
(WebCore::expandClipRectForRegionAndReflection):
(WebCore::RenderLayer::calculateClipRects):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::computeCompositingRequirements):
(WebCore::RenderLayerCompositor::rebuildCompositingLayerTree):
* rendering/RenderMultiColumnFlowThread.cpp:
(WebCore::RenderMultiColumnFlowThread::evacuateAndDestroy):
(WebCore::RenderMultiColumnFlowThread::processPossibleSpannerDescendant):
(WebCore::RenderMultiColumnFlowThread::flowThreadDescendantInserted):
* rendering/RenderMultiColumnFlowThread.h:
* rendering/RenderMultiColumnSet.cpp:
(WebCore::RenderMultiColumnSet::heightAdjustedForSetOffset):
(WebCore::RenderMultiColumnSet::columnGap):
* rendering/RenderMultiColumnSet.h:
* rendering/RenderNamedFlowFragment.cpp:
(WebCore::RenderNamedFlowFragment::fragmentContainer):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::adjustComputedFontSizesOnBlocks):
(WebCore::RenderObject::resetTextAutosizing):
(WebCore::RenderObject::showLineTreeForThis):
(WebCore::RenderObject::showRenderSubTreeAndMark):
* rendering/RenderText.cpp:
(WebCore::RenderText::setText):
(WebCore::RenderText::ensureLineBoxes):
(WebCore::RenderText::simpleLineLayout):
* rendering/RenderTreeAsText.cpp:
(WebCore::write):
* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::selectionTopAdjustedForPrecedingBlock):
(WebCore::RootInlineBox::blockFlow):
* rendering/SimpleLineLayoutFunctions.cpp:
(WebCore::SimpleLineLayout::computeTextBoundingBox):
(WebCore::SimpleLineLayout::computeTextFirstRunLocation):
(WebCore::SimpleLineLayout::collectTextAbsoluteRects):
(WebCore::SimpleLineLayout::collectTextAbsoluteQuads):
* rendering/svg/SVGTextQuery.cpp:
(WebCore::flowBoxForRenderer):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (174503 => 174504)


--- trunk/Source/WebCore/ChangeLog	2014-10-09 15:59:06 UTC (rev 174503)
+++ trunk/Source/WebCore/ChangeLog	2014-10-09 16:17:06 UTC (rev 174504)
@@ -1,3 +1,102 @@
+2014-10-09  Christophe Dumez  <cdu...@apple.com>
+
+        Use is<>() / downcast<>() for RenderBlockFlow
+        https://bugs.webkit.org/show_bug.cgi?id=137545
+
+        Reviewed by Darin Adler.
+
+        Use is<>() / downcast<>() for RenderBlockFlow and clean up the
+        surrounding code.
+
+        No new tests, no behavior change.
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored):
+        * dom/Element.cpp:
+        (WebCore::Element::renderNamedFlowFragment):
+        (WebCore::Element::webkitGetRegionFlowRanges):
+        * editing/Editor.cpp:
+        (WebCore::Editor::hasBidiSelection):
+        * inspector/InspectorOverlay.cpp:
+        (WebCore::buildObjectForRegionHighlight):
+        (WebCore::buildObjectForElementInfo):
+        * rendering/EllipsisBox.h:
+        * rendering/HitTestResult.cpp:
+        (WebCore::HitTestResult::innerTextIfTruncated):
+        * rendering/LayoutState.cpp:
+        (WebCore::LayoutState::LayoutState):
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::removeChild):
+        * rendering/RenderBlock.h:
+        (WebCore::RenderBlock::moveAllChildrenIncludingFloatsTo):
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::rebuildFloatingObjectSetFromIntrudingFloats):
+        (WebCore::RenderBlockFlow::layoutBlockChild):
+        (WebCore::RenderBlockFlow::marginOffsetForSelfCollapsingBlock):
+        (WebCore::RenderBlockFlow::marginValuesForChild):
+        (WebCore::RenderBlockFlow::collapseMargins):
+        (WebCore::RenderBlockFlow::marginBeforeEstimateForChild):
+        (WebCore::RenderBlockFlow::handleAfterSideOfBlock):
+        (WebCore::RenderBlockFlow::mustDiscardMarginBeforeForChild):
+        (WebCore::RenderBlockFlow::mustDiscardMarginAfterForChild):
+        (WebCore::RenderBlockFlow::adjustBlockChildForPagination):
+        (WebCore::RenderBlockFlow::moveAllChildrenIncludingFloatsTo):
+        (WebCore::RenderBlockFlow::markAllDescendantsWithFloatsForLayout):
+        (WebCore::RenderBlockFlow::adjustForBorderFit):
+        (WebCore::getHeightForLineCount):
+        * rendering/RenderBlockFlow.h:
+        (WebCore::RenderElement::isRenderNamedFlowFragmentContainer):
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::RenderBlockFlow::createLineBoxes):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::styleDidChange):
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::paintMaskForTextFillBox):
+        * rendering/RenderDeprecatedFlexibleBox.cpp:
+        (WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
+        (WebCore::RenderDeprecatedFlexibleBox::clearLineClamp):
+        * rendering/RenderFlowThread.cpp:
+        (WebCore::RenderFlowThread::removeFlowChildInfo):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::updateLayerPositions):
+        (WebCore::expandClipRectForRegionAndReflection):
+        (WebCore::RenderLayer::calculateClipRects):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::computeCompositingRequirements):
+        (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree):
+        * rendering/RenderMultiColumnFlowThread.cpp:
+        (WebCore::RenderMultiColumnFlowThread::evacuateAndDestroy):
+        (WebCore::RenderMultiColumnFlowThread::processPossibleSpannerDescendant):
+        (WebCore::RenderMultiColumnFlowThread::flowThreadDescendantInserted):
+        * rendering/RenderMultiColumnFlowThread.h:
+        * rendering/RenderMultiColumnSet.cpp:
+        (WebCore::RenderMultiColumnSet::heightAdjustedForSetOffset):
+        (WebCore::RenderMultiColumnSet::columnGap):
+        * rendering/RenderMultiColumnSet.h:
+        * rendering/RenderNamedFlowFragment.cpp:
+        (WebCore::RenderNamedFlowFragment::fragmentContainer):
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::adjustComputedFontSizesOnBlocks):
+        (WebCore::RenderObject::resetTextAutosizing):
+        (WebCore::RenderObject::showLineTreeForThis):
+        (WebCore::RenderObject::showRenderSubTreeAndMark):
+        * rendering/RenderText.cpp:
+        (WebCore::RenderText::setText):
+        (WebCore::RenderText::ensureLineBoxes):
+        (WebCore::RenderText::simpleLineLayout):
+        * rendering/RenderTreeAsText.cpp:
+        (WebCore::write):
+        * rendering/RootInlineBox.cpp:
+        (WebCore::RootInlineBox::selectionTopAdjustedForPrecedingBlock):
+        (WebCore::RootInlineBox::blockFlow):
+        * rendering/SimpleLineLayoutFunctions.cpp:
+        (WebCore::SimpleLineLayout::computeTextBoundingBox):
+        (WebCore::SimpleLineLayout::computeTextFirstRunLocation):
+        (WebCore::SimpleLineLayout::collectTextAbsoluteRects):
+        (WebCore::SimpleLineLayout::collectTextAbsoluteQuads):
+        * rendering/svg/SVGTextQuery.cpp:
+        (WebCore::flowBoxForRenderer):
+
 2014-10-09  Philip Chimento  <philip.chime...@gmail.com>
 
         [GTK] Netscape plugin API symbol used outside feature guards

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (174503 => 174504)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2014-10-09 15:59:06 UTC (rev 174503)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2014-10-09 16:17:06 UTC (rev 174504)
@@ -1285,8 +1285,8 @@
         return false;
 #endif
     
-    if (m_renderer->isRenderBlockFlow() && m_renderer->childrenInline() && !canSetFocusAttribute())
-        return !toRenderBlockFlow(m_renderer)->hasLines() && !mouseButtonListener();
+    if (is<RenderBlockFlow>(*m_renderer) && m_renderer->childrenInline() && !canSetFocusAttribute())
+        return !downcast<RenderBlockFlow>(*m_renderer).hasLines() && !mouseButtonListener();
     
     // ignore images seemingly used as spacers
     if (isImage()) {
@@ -1298,9 +1298,9 @@
         // First check the RenderImage's altText (which can be set through a style sheet, or come from the Element).
         // However, if this is not a native image, fallback to the attribute on the Element.
         AccessibilityObjectInclusion altTextInclusion = DefaultBehavior;
-        bool isRenderImage = m_renderer && m_renderer->isRenderImage();
+        bool isRenderImage = is<RenderImage>(m_renderer);
         if (isRenderImage)
-            altTextInclusion = objectInclusionFromAltText(toRenderImage(m_renderer)->altText());
+            altTextInclusion = objectInclusionFromAltText(downcast<RenderImage>(*m_renderer).altText());
         else
             altTextInclusion = objectInclusionFromAltText(getAttribute(altAttr).string());
 
@@ -1315,13 +1315,13 @@
     
         if (isRenderImage) {
             // check for one-dimensional image
-            RenderImage* image = toRenderImage(m_renderer);
-            if (image->height() <= 1 || image->width() <= 1)
+            RenderImage& image = downcast<RenderImage>(*m_renderer);
+            if (image.height() <= 1 || image.width() <= 1)
                 return true;
             
             // check whether rendered image was stretched from one-dimensional file image
-            if (image->cachedImage()) {
-                LayoutSize imageSize = image->cachedImage()->imageSizeForRenderer(toRenderElement(m_renderer), image->view().zoomFactor());
+            if (image.cachedImage()) {
+                LayoutSize imageSize = image.cachedImage()->imageSizeForRenderer(toRenderElement(m_renderer), image.view().zoomFactor());
                 return imageSize.height() <= 1 || imageSize.width() <= 1;
             }
         }

Modified: trunk/Source/WebCore/dom/Element.cpp (174503 => 174504)


--- trunk/Source/WebCore/dom/Element.cpp	2014-10-09 15:59:06 UTC (rev 174503)
+++ trunk/Source/WebCore/dom/Element.cpp	2014-10-09 16:17:06 UTC (rev 174504)
@@ -2494,7 +2494,7 @@
 RenderNamedFlowFragment* Element::renderNamedFlowFragment() const
 {
     if (renderer() && renderer()->isRenderNamedFlowFragmentContainer())
-        return toRenderBlockFlow(renderer())->renderNamedFlowFragment();
+        return downcast<RenderBlockFlow>(*renderer()).renderNamedFlowFragment();
 
     return nullptr;
 }
@@ -2554,9 +2554,9 @@
 
     document().updateLayoutIgnorePendingStylesheets();
     if (renderer() && renderer()->isRenderNamedFlowFragmentContainer()) {
-        RenderNamedFlowFragment* namedFlowFragment = toRenderBlockFlow(renderer())->renderNamedFlowFragment();
-        if (namedFlowFragment->isValid())
-            namedFlowFragment->getRanges(rangeObjects);
+        RenderNamedFlowFragment& namedFlowFragment = *downcast<RenderBlockFlow>(*renderer()).renderNamedFlowFragment();
+        if (namedFlowFragment.isValid())
+            namedFlowFragment.getRanges(rangeObjects);
     }
 
     return rangeObjects;

Modified: trunk/Source/WebCore/editing/Editor.cpp (174503 => 174504)


--- trunk/Source/WebCore/editing/Editor.cpp	2014-10-09 15:59:06 UTC (rev 174503)
+++ trunk/Source/WebCore/editing/Editor.cpp	2014-10-09 16:17:06 UTC (rev 174504)
@@ -769,7 +769,7 @@
         startNode = m_frame.selection().selection().visibleStart().deepEquivalent().deprecatedNode();
 
     auto renderer = startNode->renderer();
-    while (renderer && !renderer->isRenderBlockFlow())
+    while (renderer && !is<RenderBlockFlow>(*renderer))
         renderer = renderer->parent();
 
     if (!renderer)
@@ -778,7 +778,7 @@
     if (!renderer->style().isLeftToRightDirection())
         return true;
 
-    return toRenderBlockFlow(renderer)->containsNonZeroBidiLevel();
+    return downcast<RenderBlockFlow>(*renderer).containsNonZeroBidiLevel();
 }
 
 TriState Editor::selectionUnorderedListState() const

Modified: trunk/Source/WebCore/inspector/InspectorOverlay.cpp (174503 => 174504)


--- trunk/Source/WebCore/inspector/InspectorOverlay.cpp	2014-10-09 15:59:06 UTC (rev 174503)
+++ trunk/Source/WebCore/inspector/InspectorOverlay.cpp	2014-10-09 16:17:06 UTC (rev 174504)
@@ -379,10 +379,10 @@
     if (!containingView)
         return nullptr;
 
-    RenderBlockFlow* regionContainer = toRenderBlockFlow(region->parent());
-    LayoutRect borderBox = regionContainer->borderBoxRect();
-    borderBox.setWidth(borderBox.width() + regionContainer->verticalScrollbarWidth());
-    borderBox.setHeight(borderBox.height() + regionContainer->horizontalScrollbarHeight());
+    RenderBlockFlow& regionContainer = downcast<RenderBlockFlow>(*region->parent());
+    LayoutRect borderBox = regionContainer.borderBoxRect();
+    borderBox.setWidth(borderBox.width() + regionContainer.verticalScrollbarWidth());
+    borderBox.setHeight(borderBox.height() + regionContainer.horizontalScrollbarHeight());
 
     // Create incoming and outgoing boxes that we use to chain the regions toghether.
     const LayoutSize linkBoxSize(10, 10);
@@ -397,9 +397,9 @@
     incomingRectBox.move(0, linkBoxVerticalOffset);
     outgoingRectBox.move(0, -linkBoxVerticalOffset);
 
-    FloatQuad borderRectQuad = regionContainer->localToAbsoluteQuad(FloatRect(borderBox));
-    FloatQuad incomingRectQuad = regionContainer->localToAbsoluteQuad(FloatRect(incomingRectBox));
-    FloatQuad outgoingRectQuad = regionContainer->localToAbsoluteQuad(FloatRect(outgoingRectBox));
+    FloatQuad borderRectQuad = regionContainer.localToAbsoluteQuad(FloatRect(borderBox));
+    FloatQuad incomingRectQuad = regionContainer.localToAbsoluteQuad(FloatRect(incomingRectBox));
+    FloatQuad outgoingRectQuad = regionContainer.localToAbsoluteQuad(FloatRect(outgoingRectBox));
 
     contentsQuadToPage(mainView, containingView, borderRectQuad);
     contentsQuadToPage(mainView, containingView, incomingRectQuad);
@@ -711,13 +711,12 @@
     elementInfo->setString("nodeHeight", String::number(modelObject ? adjustForAbsoluteZoom(modelObject->pixelSnappedOffsetHeight(), *modelObject) : boundingBox.height()));
     
     if (renderer->isRenderNamedFlowFragmentContainer()) {
-        RenderNamedFlowFragment* region = toRenderBlockFlow(renderer)->renderNamedFlowFragment();
-        if (region->isValid()) {
-            RenderFlowThread* flowThread = region->flowThread();
-            ASSERT(flowThread && flowThread->isRenderNamedFlowThread());
+        RenderNamedFlowFragment& region = *downcast<RenderBlockFlow>(*renderer).renderNamedFlowFragment();
+        if (region.isValid()) {
+            RenderFlowThread* flowThread = region.flowThread();
             RefPtr<InspectorObject> regionFlowInfo = InspectorObject::create();
-            regionFlowInfo->setString("name", toRenderNamedFlowThread(flowThread)->flowThreadName());
-            regionFlowInfo->setArray("regions", buildObjectForCSSRegionsHighlight(region, flowThread));
+            regionFlowInfo->setString("name", downcast<RenderNamedFlowThread>(*flowThread).flowThreadName());
+            regionFlowInfo->setArray("regions", buildObjectForCSSRegionsHighlight(&region, flowThread));
             elementInfo->setObject("regionFlowInfo", regionFlowInfo.release());
         }
     }

Modified: trunk/Source/WebCore/rendering/EllipsisBox.h (174503 => 174504)


--- trunk/Source/WebCore/rendering/EllipsisBox.h	2014-10-09 15:59:06 UTC (rev 174503)
+++ trunk/Source/WebCore/rendering/EllipsisBox.h	2014-10-09 16:17:06 UTC (rev 174504)
@@ -36,7 +36,7 @@
     void setSelectionState(RenderObject::SelectionState s) { m_selectionState = s; }
     IntRect selectionRect();
 
-    RenderBlockFlow& blockFlow() const { return toRenderBlockFlow(InlineBox::renderer()); }
+    RenderBlockFlow& blockFlow() const { return downcast<RenderBlockFlow>(InlineBox::renderer()); }
 
 private:
     void paintMarkupBox(PaintInfo&, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom, const RenderStyle&);

Modified: trunk/Source/WebCore/rendering/HitTestResult.cpp (174503 => 174504)


--- trunk/Source/WebCore/rendering/HitTestResult.cpp	2014-10-09 15:59:06 UTC (rev 174503)
+++ trunk/Source/WebCore/rendering/HitTestResult.cpp	2014-10-09 16:17:06 UTC (rev 174504)
@@ -243,12 +243,12 @@
             continue;
 
         if (auto renderer = downcast<Element>(*truncatedNode).renderer()) {
-            if (renderer->isRenderBlockFlow()) {
-                RenderBlockFlow* block = toRenderBlockFlow(renderer);
-                if (block->style().textOverflow()) {
-                    for (RootInlineBox* line = block->firstRootBox(); line; line = line->nextRootBox()) {
+            if (is<RenderBlockFlow>(*renderer)) {
+                RenderBlockFlow& block = downcast<RenderBlockFlow>(*renderer);
+                if (block.style().textOverflow()) {
+                    for (RootInlineBox* line = block.firstRootBox(); line; line = line->nextRootBox()) {
                         if (line->hasEllipsisBox()) {
-                            dir = block->style().direction();
+                            dir = block.style().direction();
                             return downcast<Element>(*truncatedNode).innerText();
                         }
                     }

Modified: trunk/Source/WebCore/rendering/LayoutState.cpp (174503 => 174504)


--- trunk/Source/WebCore/rendering/LayoutState.cpp	2014-10-09 15:59:06 UTC (rev 174503)
+++ trunk/Source/WebCore/rendering/LayoutState.cpp	2014-10-09 16:17:06 UTC (rev 174504)
@@ -116,8 +116,8 @@
         toRenderMultiColumnFlowThread(renderer)->computeLineGridPaginationOrigin(*this);
 
     // If we have a new grid to track, then add it to our set.
-    if (renderer->style().lineGrid() != RenderStyle::initialLineGrid() && renderer->isRenderBlockFlow())
-        establishLineGrid(toRenderBlockFlow(renderer));
+    if (renderer->style().lineGrid() != RenderStyle::initialLineGrid() && is<RenderBlockFlow>(*renderer))
+        establishLineGrid(downcast<RenderBlockFlow>(renderer));
 
     // FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip if present.
 }

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (174503 => 174504)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2014-10-09 15:59:06 UTC (rev 174503)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2014-10-09 16:17:06 UTC (rev 174504)
@@ -745,7 +745,7 @@
         } else {
             // Take all the children out of the |next| block and put them in
             // the |prev| block.
-            nextBlock.moveAllChildrenIncludingFloatsTo(&prevBlock, nextBlock.hasLayer() || prevBlock.hasLayer());
+            nextBlock.moveAllChildrenIncludingFloatsTo(prevBlock, nextBlock.hasLayer() || prevBlock.hasLayer());
             
             // Delete the now-empty block's lines and nuke it.
             nextBlock.deleteLines();

Modified: trunk/Source/WebCore/rendering/RenderBlock.h (174503 => 174504)


--- trunk/Source/WebCore/rendering/RenderBlock.h	2014-10-09 15:59:06 UTC (rev 174503)
+++ trunk/Source/WebCore/rendering/RenderBlock.h	2014-10-09 16:17:06 UTC (rev 174504)
@@ -407,7 +407,7 @@
     virtual void removeLeftoverAnonymousBlock(RenderBlock* child);
 
     // FIXME-BLOCKFLOW: Remove virtualizaion when all callers have moved to RenderBlockFlow
-    virtual void moveAllChildrenIncludingFloatsTo(RenderBlock* toBlock, bool fullRemoveInsert) { moveAllChildrenTo(toBlock, fullRemoveInsert); }
+    virtual void moveAllChildrenIncludingFloatsTo(RenderBlock& toBlock, bool fullRemoveInsert) { moveAllChildrenTo(&toBlock, fullRemoveInsert); }
 
     void addChildToContinuation(RenderObject* newChild, RenderObject* beforeChild);
     virtual void addChildIgnoringContinuation(RenderObject* newChild, RenderObject* beforeChild) override;

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (174503 => 174504)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2014-10-09 15:59:06 UTC (rev 174503)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2014-10-09 16:17:06 UTC (rev 174504)
@@ -227,16 +227,16 @@
     // We should not process floats if the parent node is not a RenderBlock. Otherwise, we will add 
     // floats in an invalid context. This will cause a crash arising from a bad cast on the parent.
     // See <rdar://problem/8049753>, where float property is applied on a text node in a SVG.
-    if (!parent() || !parent()->isRenderBlockFlow())
+    if (!is<RenderBlockFlow>(parent()))
         return;
 
     // Attempt to locate a previous sibling with overhanging floats. We skip any elements that are
     // out of flow (like floating/positioned elements), and we also skip over any objects that may have shifted
     // to avoid floats.
-    RenderBlockFlow* parentBlock = toRenderBlockFlow(parent());
+    RenderBlockFlow& parentBlock = downcast<RenderBlockFlow>(*parent());
     bool parentHasFloats = false;
     RenderObject* prev = previousSibling();
-    while (prev && (prev->isFloatingOrOutOfFlowPositioned() || !prev->isBox() || !prev->isRenderBlockFlow() || toRenderBlockFlow(prev)->avoidsFloats())) {
+    while (prev && (prev->isFloatingOrOutOfFlowPositioned() || !is<RenderBox>(*prev) || !is<RenderBlockFlow>(*prev) || downcast<RenderBlockFlow>(*prev).avoidsFloats())) {
         if (prev->isFloating())
             parentHasFloats = true;
         prev = prev->previousSibling();
@@ -245,21 +245,21 @@
     // First add in floats from the parent. Self-collapsing blocks let their parent track any floats that intrude into
     // them (as opposed to floats they contain themselves) so check for those here too.
     LayoutUnit logicalTopOffset = logicalTop();
-    if (parentHasFloats || (parentBlock->lowestFloatLogicalBottom() > logicalTopOffset && prev && toRenderBlockFlow(prev)->isSelfCollapsingBlock()))
-        addIntrudingFloats(parentBlock, parentBlock->logicalLeftOffsetForContent(), logicalTopOffset);
+    if (parentHasFloats || (parentBlock.lowestFloatLogicalBottom() > logicalTopOffset && prev && downcast<RenderBlockFlow>(*prev).isSelfCollapsingBlock()))
+        addIntrudingFloats(&parentBlock, parentBlock.logicalLeftOffsetForContent(), logicalTopOffset);
     
     LayoutUnit logicalLeftOffset = 0;
     if (prev)
         logicalTopOffset -= toRenderBox(prev)->logicalTop();
     else {
-        prev = parentBlock;
-        logicalLeftOffset += parentBlock->logicalLeftOffsetForContent();
+        prev = &parentBlock;
+        logicalLeftOffset += parentBlock.logicalLeftOffsetForContent();
     }
 
     // Add overhanging floats from the previous RenderBlock, but only if it has a float that intrudes into our space.    
-    RenderBlockFlow* block = toRenderBlockFlow(prev);
-    if (block->m_floatingObjects && block->lowestFloatLogicalBottom() > logicalTopOffset)
-        addIntrudingFloats(block, logicalLeftOffset, logicalTopOffset);
+    RenderBlockFlow& block = downcast<RenderBlockFlow>(*prev);
+    if (block.m_floatingObjects && block.lowestFloatLogicalBottom() > logicalTopOffset)
+        addIntrudingFloats(&block, logicalLeftOffset, logicalTopOffset);
 
     if (childrenInline()) {
         LayoutUnit changeLogicalTop = LayoutUnit::max();
@@ -678,7 +678,7 @@
     setLogicalTopForChild(child, logicalTopEstimate, ApplyLayoutDelta);
     estimateRegionRangeForBoxChild(child);
 
-    RenderBlockFlow* childBlockFlow = child.isRenderBlockFlow() ? toRenderBlockFlow(&child) : nullptr;
+    RenderBlockFlow* childBlockFlow = is<RenderBlockFlow>(child) ? &downcast<RenderBlockFlow>(child) : nullptr;
     bool markDescendantsWithFloats = false;
     if (logicalTopEstimate != oldLogicalTop && !child.avoidsFloats() && childBlockFlow && childBlockFlow->containsFloats())
         markDescendantsWithFloats = true;
@@ -827,7 +827,7 @@
 LayoutUnit RenderBlockFlow::marginOffsetForSelfCollapsingBlock()
 {
     ASSERT(isSelfCollapsingBlock());
-    RenderBlockFlow* parentBlock = toRenderBlockFlow(parent());
+    RenderBlockFlow* parentBlock = downcast<RenderBlockFlow>(parent());
     if (parentBlock && style().clear() && parentBlock->getClearDelta(*this, logicalHeight()))
         return marginValuesForChild(*this).positiveMarginBefore();
     return LayoutUnit();
@@ -900,7 +900,7 @@
     LayoutUnit beforeMargin = 0;
     LayoutUnit afterMargin = 0;
 
-    RenderBlockFlow* childRenderBlock = child.isRenderBlockFlow() ? toRenderBlockFlow(&child) : nullptr;
+    RenderBlockFlow* childRenderBlock = is<RenderBlockFlow>(child) ? &downcast<RenderBlockFlow>(child) : nullptr;
     
     // If the child has the same directionality as we do, then we can just return its
     // margins in the same direction.
@@ -1023,8 +1023,8 @@
     // If the child's previous sibling is a self-collapsing block that cleared a float then its top border edge has been set at the bottom border edge
     // of the float. Since we want to collapse the child's top margin with the self-collapsing block's top and bottom margins we need to adjust our parent's height to match the 
     // margin top of the self-collapsing block. If the resulting collapsed margin leaves the child still intruding into the float then we will want to clear it.
-    if (!marginInfo.canCollapseWithMarginBefore() && prev && prev->isRenderBlockFlow() && toRenderBlockFlow(prev)->isSelfCollapsingBlock()) {
-        clearanceForSelfCollapsingBlock = toRenderBlockFlow(prev)->marginOffsetForSelfCollapsingBlock();
+    if (!marginInfo.canCollapseWithMarginBefore() && is<RenderBlockFlow>(prev) && downcast<RenderBlockFlow>(*prev).isSelfCollapsingBlock()) {
+        clearanceForSelfCollapsingBlock = downcast<RenderBlockFlow>(*prev).marginOffsetForSelfCollapsingBlock();
         setLogicalHeight(logicalHeight() - clearanceForSelfCollapsingBlock);
     }
 
@@ -1091,10 +1091,10 @@
         setLogicalHeight(logicalHeight() + (logicalTop - oldLogicalTop));
     }
 
-    if (prev && prev->isRenderBlockFlow() && !prev->isFloatingOrOutOfFlowPositioned()) {
+    if (is<RenderBlockFlow>(prev) && !prev->isFloatingOrOutOfFlowPositioned()) {
         // If |child| is a self-collapsing block it may have collapsed into a previous sibling and although it hasn't reduced the height of the parent yet
         // any floats from the parent will now overhang.
-        RenderBlockFlow& block = toRenderBlockFlow(*prev);
+        RenderBlockFlow& block = downcast<RenderBlockFlow>(*prev);
         LayoutUnit oldLogicalHeight = logicalHeight();
         setLogicalHeight(logicalTop);
         if (block.containsFloats() && !block.avoidsFloats() && (block.logicalTop() + block.lowestFloatLogicalBottom()) > logicalTop)
@@ -1195,10 +1195,10 @@
     positiveMarginBefore = std::max(positiveMarginBefore, beforeChildMargin);
     negativeMarginBefore = std::max(negativeMarginBefore, -beforeChildMargin);
 
-    if (!child.isRenderBlockFlow())
+    if (!is<RenderBlockFlow>(child))
         return;
     
-    RenderBlockFlow& childBlock = toRenderBlockFlow(child);
+    RenderBlockFlow& childBlock = downcast<RenderBlockFlow>(child);
     if (childBlock.childrenInline() || childBlock.isWritingModeRoot())
         return;
 
@@ -1314,8 +1314,8 @@
     // bottom edge of the float that the child clears. The correct vertical position for the margin-collapsing we want
     // to perform now is at the child's margin-top - so adjust our height to that position.
     RenderObject* lastBlock = lastChild();
-    if (lastBlock && lastBlock->isRenderBlockFlow() && toRenderBlockFlow(lastBlock)->isSelfCollapsingBlock())
-        setLogicalHeight(logicalHeight() - toRenderBlockFlow(lastBlock)->marginOffsetForSelfCollapsingBlock());
+    if (is<RenderBlockFlow>(lastBlock) && downcast<RenderBlockFlow>(*lastBlock).isSelfCollapsingBlock())
+        setLogicalHeight(logicalHeight() - downcast<RenderBlockFlow>(*lastBlock).marginOffsetForSelfCollapsingBlock());
 
     // If we can't collapse with children then go ahead and add in the bottom margin.
     if (!marginInfo.discardMargin() && (!marginInfo.canCollapseWithMarginAfter() && !marginInfo.canCollapseWithMarginBefore()
@@ -1403,9 +1403,9 @@
 {
     ASSERT(!child.selfNeedsLayout());
     if (!child.isWritingModeRoot())
-        return child.isRenderBlockFlow() ? toRenderBlockFlow(child).mustDiscardMarginBefore() : (child.style().marginBeforeCollapse() == MDISCARD);
+        return is<RenderBlockFlow>(child) ? downcast<RenderBlockFlow>(child).mustDiscardMarginBefore() : (child.style().marginBeforeCollapse() == MDISCARD);
     if (child.isHorizontalWritingMode() == isHorizontalWritingMode())
-        return child.isRenderBlockFlow() ? toRenderBlockFlow(child).mustDiscardMarginAfter() : (child.style().marginAfterCollapse() == MDISCARD);
+        return is<RenderBlockFlow>(child) ? downcast<RenderBlockFlow>(child).mustDiscardMarginAfter() : (child.style().marginAfterCollapse() == MDISCARD);
 
     // FIXME: We return false here because the implementation is not geometrically complete. We have values only for before/after, not start/end.
     // In case the boxes are perpendicular we assume the property is not specified.
@@ -1416,9 +1416,9 @@
 {
     ASSERT(!child.selfNeedsLayout());
     if (!child.isWritingModeRoot())
-        return child.isRenderBlockFlow() ? toRenderBlockFlow(child).mustDiscardMarginAfter() : (child.style().marginAfterCollapse() == MDISCARD);
+        return is<RenderBlockFlow>(child) ? downcast<RenderBlockFlow>(child).mustDiscardMarginAfter() : (child.style().marginAfterCollapse() == MDISCARD);
     if (child.isHorizontalWritingMode() == isHorizontalWritingMode())
-        return child.isRenderBlockFlow() ? toRenderBlockFlow(child).mustDiscardMarginBefore() : (child.style().marginBeforeCollapse() == MDISCARD);
+        return is<RenderBlockFlow>(child) ? downcast<RenderBlockFlow>(child).mustDiscardMarginBefore() : (child.style().marginBeforeCollapse() == MDISCARD);
 
     // FIXME: See |mustDiscardMarginBeforeForChild| above.
     return false;
@@ -1540,7 +1540,7 @@
         
         if (childRenderBlock) {
             if (!child.avoidsFloats() && childRenderBlock->containsFloats())
-                toRenderBlockFlow(childRenderBlock)->markAllDescendantsWithFloatsForLayout();
+                downcast<RenderBlockFlow>(*childRenderBlock).markAllDescendantsWithFloatsForLayout();
             if (!child.needsLayout())
                 child.markForPaginationRelayoutIfNeeded();
         }
@@ -2055,11 +2055,11 @@
     }
 }
 
-void RenderBlockFlow::moveAllChildrenIncludingFloatsTo(RenderBlock* toBlock, bool fullRemoveInsert)
+void RenderBlockFlow::moveAllChildrenIncludingFloatsTo(RenderBlock& toBlock, bool fullRemoveInsert)
 {
-    RenderBlockFlow* toBlockFlow = toRenderBlockFlow(toBlock);
-    moveAllChildrenTo(toBlockFlow, fullRemoveInsert);
-    moveFloatsTo(toBlockFlow);
+    RenderBlockFlow& toBlockFlow = downcast<RenderBlockFlow>(toBlock);
+    moveAllChildrenTo(&toBlockFlow, fullRemoveInsert);
+    moveFloatsTo(&toBlockFlow);
 }
 
 void RenderBlockFlow::addOverflowFromFloats()
@@ -2709,12 +2709,12 @@
     for (auto& block : childrenOfType<RenderBlock>(*this)) {
         if (!floatToRemove && block.isFloatingOrOutOfFlowPositioned())
             continue;
-        if (!block.isRenderBlockFlow()) {
+        if (!is<RenderBlockFlow>(block)) {
             if (block.shrinkToAvoidFloats() && block.everHadLayout())
                 block.setChildNeedsLayout(markParents);
             continue;
         }
-        auto& blockFlow = toRenderBlockFlow(block);
+        auto& blockFlow = downcast<RenderBlockFlow>(block);
         if ((floatToRemove ? blockFlow.containsFloat(*floatToRemove) : blockFlow.containsFloats()) || blockFlow.shrinkToAvoidFloats())
             blockFlow.markAllDescendantsWithFloatsForLayout(floatToRemove, inLayout);
     }
@@ -2885,8 +2885,8 @@
     } else {
         for (RenderBox* obj = firstChildBox(); obj; obj = obj->nextSiblingBox()) {
             if (!obj->isFloatingOrOutOfFlowPositioned()) {
-                if (obj->isRenderBlockFlow() && !obj->hasOverflowClip())
-                    toRenderBlockFlow(obj)->adjustForBorderFit(x + obj->x(), left, right);
+                if (is<RenderBlockFlow>(*obj) && !obj->hasOverflowClip())
+                    downcast<RenderBlockFlow>(*obj).adjustForBorderFit(x + obj->x(), left, right);
                 else if (obj->style().visibility() == VISIBLE) {
                     // We are a replaced element or some kind of non-block-flow object.
                     left = std::min(left, x + obj->x());
@@ -3209,10 +3209,10 @@
                 return box->lineBottom() + (includeBottom ? (block.borderBottom() + block.paddingBottom()) : LayoutUnit());
         }
     } else {
-        RenderBox* normalFlowChildWithoutLines = 0;
+        RenderBox* normalFlowChildWithoutLines = nullptr;
         for (auto obj = block.firstChildBox(); obj; obj = obj->nextSiblingBox()) {
-            if (obj->isRenderBlockFlow() && shouldCheckLines(toRenderBlockFlow(*obj))) {
-                int result = getHeightForLineCount(toRenderBlockFlow(*obj), lineCount, false, count);
+            if (is<RenderBlockFlow>(*obj) && shouldCheckLines(downcast<RenderBlockFlow>(*obj))) {
+                int result = getHeightForLineCount(downcast<RenderBlockFlow>(*obj), lineCount, false, count);
                 if (result != -1)
                     return result + obj->y() + (includeBottom ? (block.borderBottom() + block.paddingBottom()) : LayoutUnit());
             } else if (!obj->isFloatingOrOutOfFlowPositioned())

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.h (174503 => 174504)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.h	2014-10-09 15:59:06 UTC (rev 174503)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.h	2014-10-09 16:17:06 UTC (rev 174504)
@@ -471,7 +471,7 @@
     virtual void paintInlineChildren(PaintInfo&, const LayoutPoint&) override;
     virtual void paintFloats(PaintInfo&, const LayoutPoint&, bool preservePhase = false) override;
 
-    virtual void moveAllChildrenIncludingFloatsTo(RenderBlock* toBlock, bool fullRemoveInsert) override;
+    virtual void moveAllChildrenIncludingFloatsTo(RenderBlock& toBlock, bool fullRemoveInsert) override;
     virtual void repaintOverhangingFloats(bool paintAllDescendants) override final;
     virtual void clipOutFloatingObjects(RenderBlock&, const PaintInfo*, const LayoutPoint&, const LayoutSize&) override;
 
@@ -621,11 +621,9 @@
     friend class LineWidth; // Needs to know FloatingObject
 };
 
-RENDER_OBJECT_TYPE_CASTS(RenderBlockFlow, isRenderBlockFlow())
-
 inline bool RenderElement::isRenderNamedFlowFragmentContainer() const
 {
-    return isRenderBlockFlow() && toRenderBlockFlow(this)->renderNamedFlowFragment();
+    return is<RenderBlockFlow>(*this) && downcast<RenderBlockFlow>(*this).renderNamedFlowFragment();
 }
 
 inline const SimpleLineLayout::Layout* RenderBlockFlow::simpleLineLayout() const

Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (174503 => 174504)


--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2014-10-09 15:59:06 UTC (rev 174503)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2014-10-09 16:17:06 UTC (rev 174504)
@@ -190,16 +190,16 @@
     // See if we have an unconstructed line box for this object that is also
     // the last item on the line.
     unsigned lineDepth = 1;
-    InlineFlowBox* parentBox = 0;
-    InlineFlowBox* result = 0;
+    InlineFlowBox* parentBox = nullptr;
+    InlineFlowBox* result = nullptr;
     bool hasDefaultLineBoxContain = style().lineBoxContain() == RenderStyle::initialLineBoxContain();
     do {
-        ASSERT_WITH_SECURITY_IMPLICATION(obj->isRenderInline() || obj == this);
+        ASSERT_WITH_SECURITY_IMPLICATION(is<RenderInline>(*obj) || obj == this);
 
-        RenderInline* inlineFlow = (obj != this) ? toRenderInline(obj) : 0;
+        RenderInline* inlineFlow = obj != this ? downcast<RenderInline>(obj) : nullptr;
 
         // Get the last box we made for this render object.
-        parentBox = inlineFlow ? inlineFlow->lastLineBox() : toRenderBlockFlow(obj)->lastRootBox();
+        parentBox = inlineFlow ? inlineFlow->lastLineBox() : downcast<RenderBlockFlow>(*obj).lastRootBox();
 
         // If this box or its ancestor is constructed then it is from a previous line, and we need
         // to make a new box for our line.  If this box or its ancestor is unconstructed but it has

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (174503 => 174504)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2014-10-09 15:59:06 UTC (rev 174503)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2014-10-09 16:17:06 UTC (rev 174504)
@@ -408,8 +408,8 @@
         if (viewStyleChanged && view().multiColumnFlowThread())
             view().updateStylesForColumnChildren();
         
-        if (rootStyleChanged && rootRenderer && rootRenderer->isRenderBlockFlow() && toRenderBlockFlow(rootRenderer)->multiColumnFlowThread())
-            toRenderBlockFlow(rootRenderer)->updateStylesForColumnChildren();
+        if (rootStyleChanged && is<RenderBlockFlow>(rootRenderer) && downcast<RenderBlockFlow>(*rootRenderer).multiColumnFlowThread())
+            downcast<RenderBlockFlow>(*rootRenderer).updateStylesForColumnChildren();
     }
 
 #if ENABLE(CSS_SHAPES)

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (174503 => 174504)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2014-10-09 15:59:06 UTC (rev 174503)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2014-10-09 16:17:06 UTC (rev 174504)
@@ -611,11 +611,11 @@
         const RootInlineBox& rootBox = box->root();
         box->paint(info, LayoutPoint(scrolledPaintRect.x() - box->x(), scrolledPaintRect.y() - box->y()), rootBox.lineTop(), rootBox.lineBottom());
     } else if (isRenderNamedFlowFragmentContainer()) {
-        RenderNamedFlowFragment* region = toRenderBlockFlow(this)->renderNamedFlowFragment();
-        if (region->isValid())
-            region->flowThread()->layer()->paintNamedFlowThreadInsideRegion(maskImageContext, region, maskRect, maskRect.location(), PaintBehaviorForceBlackText, RenderLayer::PaintLayerTemporaryClipRects);
+        RenderNamedFlowFragment& region = *downcast<RenderBlockFlow>(*this).renderNamedFlowFragment();
+        if (region.isValid())
+            region.flowThread()->layer()->paintNamedFlowThreadInsideRegion(maskImageContext, &region, maskRect, maskRect.location(), PaintBehaviorForceBlackText, RenderLayer::PaintLayerTemporaryClipRects);
     } else {
-        LayoutSize localOffset = isBox() ? toRenderBox(this)->locationOffset() : LayoutSize();
+        LayoutSize localOffset = is<RenderBox>(*this) ? downcast<RenderBox>(*this).locationOffset() : LayoutSize();
         paint(info, scrolledPaintRect.location() - localOffset);
     }
 }

Modified: trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp (174503 => 174504)


--- trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp	2014-10-09 15:59:06 UTC (rev 174503)
+++ trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp	2014-10-09 16:17:06 UTC (rev 174504)
@@ -942,18 +942,18 @@
 
         child->clearOverrideSize();
         if (relayoutChildren || (child->isReplaced() && (child->style().width().isPercent() || child->style().height().isPercent()))
-            || (child->style().height().isAuto() && child->isRenderBlockFlow())) {
+            || (child->style().height().isAuto() && is<RenderBlockFlow>(*child))) {
             child->setChildNeedsLayout(MarkOnlyThis);
 
             // Dirty all the positioned objects.
-            if (child->isRenderBlockFlow()) {
-                toRenderBlockFlow(child)->markPositionedObjectsForLayout();
-                toRenderBlockFlow(child)->clearTruncation();
+            if (is<RenderBlockFlow>(*child)) {
+                downcast<RenderBlockFlow>(*child).markPositionedObjectsForLayout();
+                downcast<RenderBlockFlow>(*child).clearTruncation();
             }
         }
         child->layoutIfNeeded();
-        if (child->style().height().isAuto() && child->isRenderBlockFlow())
-            maxLineCount = std::max(maxLineCount, toRenderBlockFlow(child)->lineCount());
+        if (child->style().height().isAuto() && is<RenderBlockFlow>(*child))
+            maxLineCount = std::max(maxLineCount, downcast<RenderBlockFlow>(*child).lineCount());
     }
 
     // Get the number of lines and then alter all block flow children with auto height to use the
@@ -964,15 +964,15 @@
         return;
 
     for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
-        if (childDoesNotAffectWidthOrFlexing(child) || !child->style().height().isAuto() || !child->isRenderBlockFlow())
+        if (childDoesNotAffectWidthOrFlexing(child) || !child->style().height().isAuto() || !is<RenderBlockFlow>(*child))
             continue;
 
-        RenderBlockFlow* blockChild = toRenderBlockFlow(child);
-        int lineCount = blockChild->lineCount();
+        RenderBlockFlow& blockChild = downcast<RenderBlockFlow>(*child);
+        int lineCount = blockChild.lineCount();
         if (lineCount <= numVisibleLines)
             continue;
 
-        LayoutUnit newHeight = blockChild->heightForLineCount(numVisibleLines);
+        LayoutUnit newHeight = blockChild.heightForLineCount(numVisibleLines);
         if (newHeight == child->height())
             continue;
 
@@ -985,11 +985,11 @@
             continue;
 
         // Get the last line
-        RootInlineBox* lastLine = blockChild->lineAtIndex(lineCount - 1);
+        RootInlineBox* lastLine = blockChild.lineAtIndex(lineCount - 1);
         if (!lastLine)
             continue;
 
-        RootInlineBox* lastVisibleLine = blockChild->lineAtIndex(numVisibleLines - 1);
+        RootInlineBox* lastVisibleLine = blockChild.lineAtIndex(numVisibleLines - 1);
         if (!lastVisibleLine)
             continue;
 
@@ -1005,7 +1005,7 @@
         if (anchorBox && anchorBox->renderer().style().isLink())
             totalWidth = anchorBox->logicalWidth() + font.width(constructTextRun(this, font, ellipsisAndSpace, 2, style()));
         else {
-            anchorBox = 0;
+            anchorBox = nullptr;
             totalWidth = font.width(constructTextRun(this, font, &horizontalEllipsis, 1, style()));
         }
 
@@ -1042,12 +1042,12 @@
 
         child->clearOverrideSize();
         if ((child->isReplaced() && (child->style().width().isPercent() || child->style().height().isPercent()))
-            || (child->style().height().isAuto() && child->isRenderBlock())) {
+            || (child->style().height().isAuto() && is<RenderBlockFlow>(*child))) {
             child->setChildNeedsLayout();
 
-            if (child->isRenderBlockFlow()) {
-                toRenderBlockFlow(child)->markPositionedObjectsForLayout();
-                toRenderBlockFlow(child)->clearTruncation();
+            if (is<RenderBlockFlow>(*child)) {
+                downcast<RenderBlockFlow>(*child).markPositionedObjectsForLayout();
+                downcast<RenderBlockFlow>(*child).clearTruncation();
             }
         }
     }

Modified: trunk/Source/WebCore/rendering/RenderFlowThread.cpp (174503 => 174504)


--- trunk/Source/WebCore/rendering/RenderFlowThread.cpp	2014-10-09 15:59:06 UTC (rev 174503)
+++ trunk/Source/WebCore/rendering/RenderFlowThread.cpp	2014-10-09 16:17:06 UTC (rev 174504)
@@ -92,10 +92,10 @@
 
 void RenderFlowThread::removeFlowChildInfo(RenderObject* child)
 {
-    if (child->isRenderBlockFlow())
-        removeLineRegionInfo(toRenderBlockFlow(child));
-    if (child->isBox())
-        removeRenderBoxRegionInfo(toRenderBox(child));
+    if (is<RenderBlockFlow>(*child))
+        removeLineRegionInfo(downcast<RenderBlockFlow>(child));
+    if (is<RenderBox>(*child))
+        removeRenderBoxRegionInfo(downcast<RenderBox>(child));
 }
 
 void RenderFlowThread::removeRegionFromThread(RenderRegion* renderRegion)

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (174503 => 174504)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2014-10-09 15:59:06 UTC (rev 174503)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2014-10-09 16:17:06 UTC (rev 174504)
@@ -412,9 +412,9 @@
                 if (didRepaint && renderer().isRenderNamedFlowFragmentContainer()) {
                     // If we just repainted a region, we must also repaint the flow thread since it is the one
                     // doing the actual painting of the flowed content.
-                    RenderNamedFlowFragment* region = toRenderBlockFlow(&renderer())->renderNamedFlowFragment();
-                    if (region->isValid())
-                        region->flowThread()->layer()->repaintIncludingDescendants();
+                    RenderNamedFlowFragment& region = *downcast<RenderBlockFlow>(renderer()).renderNamedFlowFragment();
+                    if (region.isValid())
+                        region.flowThread()->layer()->repaintIncludingDescendants();
                 }
             }
         }
@@ -1579,12 +1579,12 @@
 {
     // If this is a region, then the painting is actually done by its flow thread's layer.
     if (layer.renderer().isRenderNamedFlowFragmentContainer()) {
-        RenderBlockFlow* regionContainer = toRenderBlockFlow(&layer.renderer());
-        RenderNamedFlowFragment* region = regionContainer->renderNamedFlowFragment();
-        RenderLayer* flowThreadLayer = region->flowThread()->layer();
+        RenderBlockFlow& regionContainer = downcast<RenderBlockFlow>(layer.renderer());
+        RenderNamedFlowFragment& region = *regionContainer.renderNamedFlowFragment();
+        RenderLayer* flowThreadLayer = region.flowThread()->layer();
         if (flowThreadLayer && (!layer.reflection() || layer.reflectionLayer() != flowThreadLayer)) {
             LayoutRect flowThreadClipRect = transparencyClipBox(*flowThreadLayer, rootLayer, transparencyBehavior, DescendantsOfTransparencyClipBox, paintBehavior);
-            LayoutSize moveOffset = (regionContainer->contentBoxRect().location() + layer.offsetFromAncestor(flowThreadLayer)) - region->flowThreadPortionRect().location();
+            LayoutSize moveOffset = (regionContainer.contentBoxRect().location() + layer.offsetFromAncestor(flowThreadLayer)) - region.flowThreadPortionRect().location();
             flowThreadClipRect.move(moveOffset);
             
             clipRect.unite(flowThreadClipRect);
@@ -6160,15 +6160,15 @@
 void RenderLayer::repaintIncludingDescendants()
 {
     renderer().repaint();
-    for (RenderLayer* curr = firstChild(); curr; curr = curr->nextSibling())
-        curr->repaintIncludingDescendants();
+    for (RenderLayer* current = firstChild(); current; current = current->nextSibling())
+        current->repaintIncludingDescendants();
 
     // If this is a region, we must also repaint the flow thread's layer since it is the one
     // doing the actual painting of the flowed content, but only if the region is valid.
     if (renderer().isRenderNamedFlowFragmentContainer()) {
-        RenderNamedFlowFragment* region = toRenderBlockFlow(renderer()).renderNamedFlowFragment();
-        if (region->isValid())
-            region->flowThread()->layer()->repaintIncludingDescendants();
+        RenderNamedFlowFragment& region = *downcast<RenderBlockFlow>(renderer()).renderNamedFlowFragment();
+        if (region.isValid())
+            region.flowThread()->layer()->repaintIncludingDescendants();
     }
 }
 
@@ -6730,8 +6730,8 @@
     if (!renderer().isRenderNamedFlowFragmentContainer())
         return;
     
-    RenderBlockFlow* renderNamedFlowFragmentContainer = toRenderBlockFlow(&renderer());
-    RenderNamedFlowFragment* flowFragment = renderNamedFlowFragmentContainer->renderNamedFlowFragment();
+    RenderBlockFlow& renderNamedFlowFragmentContainer = downcast<RenderBlockFlow>(renderer());
+    RenderNamedFlowFragment* flowFragment = renderNamedFlowFragmentContainer.renderNamedFlowFragment();
     if (!flowFragment->isValid())
         return;
 
@@ -6740,7 +6740,7 @@
 
     LayoutRect regionClipRect = LayoutRect::infiniteRect();
     if (flowFragment->shouldClipFlowThreadContent()) {
-        regionClipRect = renderNamedFlowFragmentContainer->paddingBoxRect();
+        regionClipRect = renderNamedFlowFragmentContainer.paddingBoxRect();
 
         // When the layer of the flow fragment's container is composited, the flow fragment container receives a
         // GraphicsLayer of its own so the clipping coordinates (caused by overflow:hidden) must be relative to the
@@ -6778,23 +6778,23 @@
     const HitTestingTransformState* unflattenedTransformState, bool depthSortDescendants)
 {
     if (!renderer().isRenderNamedFlowFragmentContainer())
-        return 0;
+        return nullptr;
 
-    RenderNamedFlowFragment* region = toRenderBlockFlow(&renderer())->renderNamedFlowFragment();
-    if (!region->isValid())
-        return 0;
+    RenderNamedFlowFragment& region = *downcast<RenderBlockFlow>(renderer()).renderNamedFlowFragment();
+    if (!region.isValid())
+        return nullptr;
 
-    RenderFlowThread* flowThread = region->flowThread();
-    LayoutPoint portionLocation = region->flowThreadPortionRect().location();
+    RenderFlowThread* flowThread = region.flowThread();
+    LayoutPoint portionLocation = region.flowThreadPortionRect().location();
     if (flowThread->style().isFlippedBlocksWritingMode()) {
         // The portion location coordinate must be translated into physical coordinates.
         if (flowThread->style().isHorizontalWritingMode())
-            portionLocation.setY(flowThread->height() - (portionLocation.y() + region->contentHeight()));
+            portionLocation.setY(flowThread->height() - (portionLocation.y() + region.contentHeight()));
         else
-            portionLocation.setX(flowThread->width() - (portionLocation.x() + region->contentWidth()));
+            portionLocation.setX(flowThread->width() - (portionLocation.x() + region.contentWidth()));
     }
 
-    LayoutRect regionContentBox = toRenderBlockFlow(&renderer())->contentBoxRect();
+    LayoutRect regionContentBox = downcast<RenderBlockFlow>(renderer()).contentBoxRect();
 
     RenderLayer* resultLayer = nullptr;
     for (int i = fragments.size() - 1; i >= 0; --i) {
@@ -6803,7 +6803,7 @@
         if (!fragment.backgroundRect.intersects(hitTestLocation))
             continue;
 
-        LayoutSize hitTestOffset = portionLocation - (fragment.layerBounds.location() + regionContentBox.location()) + region->fragmentContainer().scrolledContentOffset();
+        LayoutSize hitTestOffset = portionLocation - (fragment.layerBounds.location() + regionContentBox.location()) + region.fragmentContainer().scrolledContentOffset();
 
         // Always ignore clipping, since the RenderFlowThread has nothing to do with the bounds of the FrameView.
         HitTestRequest newRequest(request.type() | HitTestRequest::IgnoreClipping | HitTestRequest::DisallowShadowContent);
@@ -6817,10 +6817,10 @@
         hitTestRectInFlowThread.expand(LayoutSize(fabs((double)hitTestOffset.width()), fabs((double)hitTestOffset.height())));
 
         CurrentRenderFlowThreadMaintainer flowThreadMaintainer(flowThread);
-        CurrentRenderRegionMaintainer regionMaintainer(*region);
+        CurrentRenderRegionMaintainer regionMaintainer(region);
 
         HitTestResult tempResult(result.hitTestLocation());
-        RenderLayer* hitLayer = flowThread->layer()->hitTestLayer(flowThread->layer(), 0, newRequest, tempResult, hitTestRectInFlowThread, newHitTestLocation, false, transformState, zOffsetForDescendants);
+        RenderLayer* hitLayer = flowThread->layer()->hitTestLayer(flowThread->layer(), nullptr, newRequest, tempResult, hitTestRectInFlowThread, newHitTestLocation, false, transformState, zOffsetForDescendants);
         if (result.isRectBasedTest())
             result.append(tempResult);
         if (isHitCandidate(hitLayer, depthSortDescendants, zOffset, unflattenedTransformState)) {

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (174503 => 174504)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2014-10-09 15:59:06 UTC (rev 174503)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2014-10-09 16:17:06 UTC (rev 174504)
@@ -1287,7 +1287,7 @@
         // anonymous RenderRegion, but first we need to make sure that the parent itself of the region is going to
         // have a composited layer. We only want to make regions composited when there's an actual layer that we
         // need to move to that region.
-        computeRegionCompositingRequirements(toRenderBlockFlow(layer.renderer()).renderNamedFlowFragment(), overlapMap, childState, layersChanged, anyDescendantHas3DTransform);
+        computeRegionCompositingRequirements(downcast<RenderBlockFlow>(layer.renderer()).renderNamedFlowFragment(), overlapMap, childState, layersChanged, anyDescendantHas3DTransform);
     }
 
     
@@ -1544,7 +1544,7 @@
     }
 
     if (layer.renderer().isRenderNamedFlowFragmentContainer())
-        rebuildRegionCompositingLayerTree(toRenderBlockFlow(layer.renderer()).renderNamedFlowFragment(), layerChildren, depth + 1);
+        rebuildRegionCompositingLayerTree(downcast<RenderBlockFlow>(layer.renderer()).renderNamedFlowFragment(), layerChildren, depth + 1);
 
     if (Vector<RenderLayer*>* normalFlowList = layer.normalFlowList()) {
         for (size_t i = 0, size = normalFlowList->size(); i < size; ++i)

Modified: trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp (174503 => 174504)


--- trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp	2014-10-09 15:59:06 UTC (rev 174503)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp	2014-10-09 16:17:06 UTC (rev 174504)
@@ -183,9 +183,9 @@
     while ((it = m_spannerMap.begin()) != m_spannerMap.end()) {
         RenderBox* spanner = it->key;
         RenderMultiColumnSpannerPlaceholder* placeholder = it->value;
-        RenderBlockFlow* originalContainer = toRenderBlockFlow(placeholder->parent());
+        RenderBlockFlow& originalContainer = downcast<RenderBlockFlow>(*placeholder->parent());
         multicolContainer->removeChild(*spanner);
-        originalContainer->addChild(spanner, placeholder);
+        originalContainer.addChild(spanner, placeholder);
         placeholder->destroy();
         m_spannerMap.remove(it);
     }
@@ -296,7 +296,7 @@
         // so that they live among the column sets. This simplifies the layout implementation, and
         // basically just relies on regular block layout done by the RenderBlockFlow that
         // establishes the multicol container.
-        RenderBlockFlow* container = toRenderBlockFlow(descendant->parent());
+        RenderBlockFlow* container = downcast<RenderBlockFlow>(descendant->parent());
         RenderMultiColumnSet* setToSplit = nullptr;
         if (nextRendererInFlowThread) {
             setToSplit = findSetRendering(descendant);
@@ -311,7 +311,7 @@
         // content before and after the spanner, so that it becomes separate line boxes. Secondly,
         // this placeholder serves as a break point for column sets, so that, when encountered, we
         // end flowing one column set and move to the next one.
-        RenderMultiColumnSpannerPlaceholder* placeholder = RenderMultiColumnSpannerPlaceholder::createAnonymous(this, toRenderBox(descendant), &container->style());
+        RenderMultiColumnSpannerPlaceholder* placeholder = RenderMultiColumnSpannerPlaceholder::createAnonymous(this, downcast<RenderBox>(descendant), &container->style());
         container->addChild(placeholder, descendant->nextSibling());
         container->removeChild(*descendant);
         
@@ -329,14 +329,14 @@
         nextDescendant = placeholder;
     } else {
         // This is regular multicol content, i.e. not part of a spanner.
-        if (nextRendererInFlowThread && nextRendererInFlowThread->isRenderMultiColumnSpannerPlaceholder()) {
+        if (is<RenderMultiColumnSpannerPlaceholder>(nextRendererInFlowThread)) {
             // Inserted right before a spanner. Is there a set for us there?
-            RenderMultiColumnSpannerPlaceholder* placeholder = toRenderMultiColumnSpannerPlaceholder(nextRendererInFlowThread);
-            if (RenderObject* previous = placeholder->spanner()->previousSibling()) {
-                if (previous->isRenderMultiColumnSet())
+            RenderMultiColumnSpannerPlaceholder& placeholder = downcast<RenderMultiColumnSpannerPlaceholder>(*nextRendererInFlowThread);
+            if (RenderObject* previous = placeholder.spanner()->previousSibling()) {
+                if (is<RenderMultiColumnSet>(*previous))
                     return nextDescendant; // There's already a set there. Nothing to do.
             }
-            insertBeforeMulticolChild = placeholder->spanner();
+            insertBeforeMulticolChild = placeholder.spanner();
         } else if (RenderMultiColumnSet* lastSet = lastMultiColumnSet()) {
             // This child is not an immediate predecessor of a spanner, which means that if this
             // child precedes a spanner at all, there has to be a column set created for us there
@@ -383,13 +383,13 @@
                 
                 // Insert after the placeholder, but don't let a notification happen.
                 gShiftingSpanner = true;
-                RenderBlockFlow* ancestorBlock = toRenderBlockFlow(spanner->parent());
-                ancestorBlock->moveChildTo(placeholder->parentBox(), spanner, placeholder->nextSibling(), true);
+                RenderBlockFlow& ancestorBlock = downcast<RenderBlockFlow>(*spanner->parent());
+                ancestorBlock.moveChildTo(placeholder->parentBox(), spanner, placeholder->nextSibling(), true);
                 gShiftingSpanner = false;
                 
                 // We have to nuke the placeholder, since the ancestor already lost the mapping to it when
                 // we shifted the placeholder down into this flow thread.
-                ancestorBlock->multiColumnFlowThread()->handleSpannerRemoval(spanner);
+                ancestorBlock.multiColumnFlowThread()->handleSpannerRemoval(spanner);
                 placeholder->destroy();
                 
                 // Now we process the spanner.

Modified: trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.h (174503 => 174504)


--- trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.h	2014-10-09 15:59:06 UTC (rev 174503)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.h	2014-10-09 16:17:06 UTC (rev 174504)
@@ -45,7 +45,7 @@
 
     virtual void removeFlowChildInfo(RenderObject*) override;
 
-    RenderBlockFlow* multiColumnBlockFlow() const { return toRenderBlockFlow(parent()); }
+    RenderBlockFlow* multiColumnBlockFlow() const { return downcast<RenderBlockFlow>(parent()); }
 
     RenderMultiColumnSet* firstMultiColumnSet() const;
     RenderMultiColumnSet* lastMultiColumnSet() const;

Modified: trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp (174503 => 174504)


--- trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp	2014-10-09 15:59:06 UTC (rev 174503)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp	2014-10-09 16:17:06 UTC (rev 174504)
@@ -137,8 +137,8 @@
 
 LayoutUnit RenderMultiColumnSet::heightAdjustedForSetOffset(LayoutUnit height) const
 {
-    RenderBlockFlow* multicolBlock = toRenderBlockFlow(parent());
-    LayoutUnit contentLogicalTop = logicalTop() - multicolBlock->borderAndPaddingBefore();
+    RenderBlockFlow& multicolBlock = downcast<RenderBlockFlow>(*parent());
+    LayoutUnit contentLogicalTop = logicalTop() - multicolBlock.borderAndPaddingBefore();
 
     height -= contentLogicalTop;
     return std::max(height, LayoutUnit::fromPixel(1)); // Let's avoid zero height, as that would probably cause an infinite amount of columns to be created.
@@ -421,10 +421,10 @@
 {
     // FIXME: Eventually we will cache the column gap when the widths of columns start varying, but for now we just
     // go to the parent block to get the gap.
-    RenderBlockFlow* parentBlock = toRenderBlockFlow(parent());
-    if (parentBlock->style().hasNormalColumnGap())
-        return parentBlock->style().fontDescription().computedPixelSize(); // "1em" is recommended as the normal gap setting. Matches <p> margins.
-    return parentBlock->style().columnGap();
+    RenderBlockFlow& parentBlock = downcast<RenderBlockFlow>(*parent());
+    if (parentBlock.style().hasNormalColumnGap())
+        return parentBlock.style().fontDescription().computedPixelSize(); // "1em" is recommended as the normal gap setting. Matches <p> margins.
+    return parentBlock.style().columnGap();
 }
 
 unsigned RenderMultiColumnSet::columnCount() const

Modified: trunk/Source/WebCore/rendering/RenderMultiColumnSet.h (174503 => 174504)


--- trunk/Source/WebCore/rendering/RenderMultiColumnSet.h	2014-10-09 15:59:06 UTC (rev 174503)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnSet.h	2014-10-09 16:17:06 UTC (rev 174504)
@@ -49,7 +49,7 @@
 
     virtual bool isRenderMultiColumnSet() const override { return true; }
 
-    RenderBlockFlow* multiColumnBlockFlow() const { return toRenderBlockFlow(parent()); }
+    RenderBlockFlow* multiColumnBlockFlow() const { return downcast<RenderBlockFlow>(parent()); }
     RenderMultiColumnFlowThread* multiColumnFlowThread() const { return static_cast<RenderMultiColumnFlowThread*>(flowThread()); }
 
     RenderMultiColumnSet* nextSiblingMultiColumnSet() const;

Modified: trunk/Source/WebCore/rendering/RenderNamedFlowFragment.cpp (174503 => 174504)


--- trunk/Source/WebCore/rendering/RenderNamedFlowFragment.cpp	2014-10-09 15:59:06 UTC (rev 174503)
+++ trunk/Source/WebCore/rendering/RenderNamedFlowFragment.cpp	2014-10-09 16:17:06 UTC (rev 174504)
@@ -231,7 +231,7 @@
 {
     ASSERT(parent());
     ASSERT(parent()->isRenderNamedFlowFragmentContainer());
-    return *toRenderBlockFlow(parent());
+    return downcast<RenderBlockFlow>(*parent());
 }
 
 RenderLayer& RenderNamedFlowFragment::fragmentContainerLayer() const

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (174503 => 174504)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2014-10-09 15:59:06 UTC (rev 174503)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2014-10-09 16:17:06 UTC (rev 174504)
@@ -437,8 +437,8 @@
             depthStack.append(newFixedDepth);
 
         int stackSize = depthStack.size();
-        if (descendent->isRenderBlockFlow() && !descendent->isListItem() && (!stackSize || currentDepth - depthStack[stackSize - 1] > TextAutoSizingFixedHeightDepth))
-            toRenderBlockFlow(descendent)->adjustComputedFontSizes(size, visibleWidth);
+        if (is<RenderBlockFlow>(*descendent) && !descendent->isListItem() && (!stackSize || currentDepth - depthStack[stackSize - 1] > TextAutoSizingFixedHeightDepth))
+            downcast<RenderBlockFlow>(*descendent).adjustComputedFontSizes(size, visibleWidth);
         newFixedDepth = 0;
     }
 
@@ -465,8 +465,8 @@
             depthStack.append(newFixedDepth);
 
         int stackSize = depthStack.size();
-        if (descendent->isRenderBlockFlow() && !descendent->isListItem() && (!stackSize || currentDepth - depthStack[stackSize - 1] > TextAutoSizingFixedHeightDepth))
-            toRenderBlockFlow(descendent)->resetComputedFontSize();
+        if (is<RenderBlockFlow>(*descendent) && !descendent->isListItem() && (!stackSize || currentDepth - depthStack[stackSize - 1] > TextAutoSizingFixedHeightDepth))
+            downcast<RenderBlockFlow>(*descendent).resetComputedFontSize();
         newFixedDepth = 0;
     }
 }
@@ -1429,11 +1429,11 @@
 
 void RenderObject::showLineTreeForThis() const
 {
-    if (!isRenderBlockFlow())
+    if (!is<RenderBlockFlow>(*this))
         return;
     showRenderTreeLegend();
     showRenderObject(false, 1);
-    toRenderBlockFlow(this)->showLineTreeAndMark(nullptr, 2);
+    downcast<RenderBlockFlow>(*this).showLineTreeAndMark(nullptr, 2);
 }
 
 void RenderObject::showRegionsInformation() const
@@ -1586,8 +1586,8 @@
 #endif
 
     showRenderObject(markedObject == this, depth);
-    if (isRenderBlockFlow())
-        toRenderBlockFlow(this)->showLineTreeAndMark(nullptr, depth + 1);
+    if (is<RenderBlockFlow>(*this))
+        downcast<RenderBlockFlow>(*this).showLineTreeAndMark(nullptr, depth + 1);
 
     for (const RenderObject* child = firstChildSlow(); child; child = child->nextSibling())
         child->showRenderSubTreeAndMark(markedObject, depth + 1);

Modified: trunk/Source/WebCore/rendering/RenderText.cpp (174503 => 174504)


--- trunk/Source/WebCore/rendering/RenderText.cpp	2014-10-09 15:59:06 UTC (rev 174503)
+++ trunk/Source/WebCore/rendering/RenderText.cpp	2014-10-09 16:17:06 UTC (rev 174504)
@@ -1102,8 +1102,8 @@
     setNeedsLayoutAndPrefWidthsRecalc();
     m_knownToHaveNoOverflowAndNoFallbackFonts = false;
 
-    if (parent()->isRenderBlockFlow())
-        toRenderBlockFlow(parent())->invalidateLineLayoutPath();
+    if (is<RenderBlockFlow>(*parent()))
+        downcast<RenderBlockFlow>(*parent()).invalidateLineLayoutPath();
     
     if (AXObjectCache* cache = document().existingAXObjectCache())
         cache->textChanged(this);
@@ -1149,16 +1149,16 @@
 
 void RenderText::ensureLineBoxes()
 {
-    if (!parent()->isRenderBlockFlow())
+    if (!is<RenderBlockFlow>(*parent()))
         return;
-    toRenderBlockFlow(parent())->ensureLineBoxes();
+    downcast<RenderBlockFlow>(*parent()).ensureLineBoxes();
 }
 
 const SimpleLineLayout::Layout* RenderText::simpleLineLayout() const
 {
-    if (!parent()->isRenderBlockFlow())
+    if (!is<RenderBlockFlow>(*parent()))
         return nullptr;
-    return toRenderBlockFlow(parent())->simpleLineLayout();
+    return downcast<RenderBlockFlow>(*parent()).simpleLineLayout();
 }
 
 float RenderText::width(unsigned from, unsigned len, float xPos, bool firstLine, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const

Modified: trunk/Source/WebCore/rendering/RenderTreeAsText.cpp (174503 => 174504)


--- trunk/Source/WebCore/rendering/RenderTreeAsText.cpp	2014-10-09 15:59:06 UTC (rev 174503)
+++ trunk/Source/WebCore/rendering/RenderTreeAsText.cpp	2014-10-09 16:17:06 UTC (rev 174504)
@@ -542,7 +542,7 @@
         auto& text = downcast<RenderText>(o);
         if (auto layout = text.simpleLineLayout()) {
             ASSERT(!text.firstTextBox());
-            auto resolver = runResolver(toRenderBlockFlow(*text.parent()), *layout);
+            auto resolver = runResolver(downcast<RenderBlockFlow>(*text.parent()), *layout);
             for (auto it = resolver.begin(), end = resolver.end(); it != end; ++it) {
                 auto run = *it;
                 writeIndent(ts, indent + 1);

Modified: trunk/Source/WebCore/rendering/RootInlineBox.cpp (174503 => 174504)


--- trunk/Source/WebCore/rendering/RootInlineBox.cpp	2014-10-09 15:59:06 UTC (rev 174503)
+++ trunk/Source/WebCore/rendering/RootInlineBox.cpp	2014-10-09 16:17:06 UTC (rev 174504)
@@ -630,8 +630,8 @@
 
     LayoutSize offsetToBlockBefore;
     if (RenderBlock* block = rootBox.blockFlow().blockBeforeWithinSelectionRoot(offsetToBlockBefore)) {
-        if (block->isRenderBlockFlow()) {
-            if (RootInlineBox* lastLine = toRenderBlockFlow(block)->lastRootBox()) {
+        if (is<RenderBlockFlow>(*block)) {
+            if (RootInlineBox* lastLine = downcast<RenderBlockFlow>(*block).lastRootBox()) {
                 RenderObject::SelectionState lastLineSelectionState = lastLine->selectionState();
                 if (lastLineSelectionState != RenderObject::SelectionInside && lastLineSelectionState != RenderObject::SelectionStart)
                     return top;
@@ -678,7 +678,7 @@
 
 RenderBlockFlow& RootInlineBox::blockFlow() const
 {
-    return toRenderBlockFlow(renderer());
+    return downcast<RenderBlockFlow>(renderer());
 }
 
 static bool isEditableLeaf(InlineBox* leaf)

Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp (174503 => 174504)


--- trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp	2014-10-09 15:59:06 UTC (rev 174503)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp	2014-10-09 16:17:06 UTC (rev 174504)
@@ -140,7 +140,7 @@
 
 IntRect computeTextBoundingBox(const RenderText& textRenderer, const Layout& layout)
 {
-    auto resolver = lineResolver(toRenderBlockFlow(*textRenderer.parent()), layout);
+    auto resolver = lineResolver(downcast<RenderBlockFlow>(*textRenderer.parent()), layout);
     auto it = resolver.begin();
     auto end = resolver.end();
     if (it == end)
@@ -167,7 +167,7 @@
 
 IntPoint computeTextFirstRunLocation(const RenderText& textRenderer, const Layout& layout)
 {
-    auto resolver = runResolver(toRenderBlockFlow(*textRenderer.parent()), layout);
+    auto resolver = runResolver(downcast<RenderBlockFlow>(*textRenderer.parent()), layout);
     auto begin = resolver.begin();
     if (begin == resolver.end())
         return IntPoint();
@@ -177,7 +177,7 @@
 Vector<IntRect> collectTextAbsoluteRects(const RenderText& textRenderer, const Layout& layout, const LayoutPoint& accumulatedOffset)
 {
     Vector<IntRect> rects;
-    auto resolver = runResolver(toRenderBlockFlow(*textRenderer.parent()), layout);
+    auto resolver = runResolver(downcast<RenderBlockFlow>(*textRenderer.parent()), layout);
     for (auto it = resolver.begin(), end = resolver.end(); it != end; ++it) {
         const auto& run = *it;
         auto rect = run.rect();
@@ -189,7 +189,7 @@
 Vector<FloatQuad> collectTextAbsoluteQuads(const RenderText& textRenderer, const Layout& layout, bool* wasFixed)
 {
     Vector<FloatQuad> quads;
-    auto resolver = runResolver(toRenderBlockFlow(*textRenderer.parent()), layout);
+    auto resolver = runResolver(downcast<RenderBlockFlow>(*textRenderer.parent()), layout);
     for (auto it = resolver.begin(), end = resolver.end(); it != end; ++it) {
         const auto& run = *it;
         auto rect = run.rect();

Modified: trunk/Source/WebCore/rendering/svg/SVGTextQuery.cpp (174503 => 174504)


--- trunk/Source/WebCore/rendering/svg/SVGTextQuery.cpp	2014-10-09 15:59:06 UTC (rev 174503)
+++ trunk/Source/WebCore/rendering/svg/SVGTextQuery.cpp	2014-10-09 16:17:06 UTC (rev 174504)
@@ -50,12 +50,12 @@
 static inline InlineFlowBox* flowBoxForRenderer(RenderObject* renderer)
 {
     if (!renderer)
-        return 0;
+        return nullptr;
 
-    if (renderer->isRenderBlockFlow()) {
+    if (is<RenderBlockFlow>(*renderer)) {
         // If we're given a block element, it has to be a RenderSVGText.
-        ASSERT(renderer->isSVGText());
-        RenderBlockFlow& renderBlock = toRenderBlockFlow(*renderer);
+        ASSERT(is<RenderSVGText>(*renderer));
+        RenderBlockFlow& renderBlock = downcast<RenderBlockFlow>(*renderer);
 
         // RenderSVGText only ever contains a single line box.
         auto flowBox = renderBlock.firstRootBox();
@@ -63,9 +63,9 @@
         return flowBox;
     }
 
-    if (renderer->isRenderInline()) {
+    if (is<RenderInline>(*renderer)) {
         // We're given a RenderSVGInline or objects that derive from it (RenderSVGTSpan / RenderSVGTextPath)
-        RenderInline& renderInline = toRenderInline(*renderer);
+        RenderInline& renderInline = downcast<RenderInline>(*renderer);
 
         // RenderSVGInline only ever contains a single line box.
         InlineFlowBox* flowBox = renderInline.firstLineBox();
@@ -74,7 +74,7 @@
     }
 
     ASSERT_NOT_REACHED();
-    return 0;
+    return nullptr;
 }
 
 SVGTextQuery::SVGTextQuery(RenderObject* renderer)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to