Move m_lineBoxes from RenderBlock to RenderBlockFlow (Part 1)
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 19 Oct 2013 03:14:44 +0000 (03:14 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 19 Oct 2013 03:14:44 +0000 (03:14 +0000)
https://bugs.webkit.org/show_bug.cgi?id=122969

Reviewed by Dan Bernstein.

- Make the RootInlineBox constructor take a RenderBlockFlow.
- Move createRootInlineBox, and createAndAppendRootInlineBox to RenderBlockFlow.

* editing/VisibleUnits.cpp:
(WebCore::absoluteLineDirectionPointToLocalPointInBlock):
* rendering/InlineBox.cpp:
(WebCore::InlineBox::locationIncludingFlipping):
(WebCore::InlineBox::flipForWritingMode):
* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::placeBoxRangeInInlineDirection):
* rendering/RenderBlock.cpp:
* rendering/RenderBlock.h:
* rendering/RenderBlockFlow.h:
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::createRootInlineBox):
(WebCore::RenderBlockFlow::createAndAppendRootInlineBox):
(WebCore::createInlineBoxForRenderer):
(WebCore::RenderBlockFlow::createLineBoxes):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::positionLineBox):
* rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::localSelectionRect):
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::localSelectionRect):
* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::RootInlineBox):
(WebCore::RootInlineBox::rendererLineBoxes):
(WebCore::RootInlineBox::placeEllipsis):
(WebCore::RootInlineBox::containingRegion):
(WebCore::RootInlineBox::setContainingRegion):
(WebCore::RootInlineBox::alignBoxesInBlockDirection):
(WebCore::RootInlineBox::beforeAnnotationsAdjustment):
(WebCore::RootInlineBox::lineSnapAdjustment):
(WebCore::RootInlineBox::lineSelectionGap):
(WebCore::RootInlineBox::computeCaretRect):
(WebCore::RootInlineBox::selectionTop):
(WebCore::RootInlineBox::selectionTopAdjustedForPrecedingBlock):
(WebCore::RootInlineBox::selectionBottom):
(WebCore::RootInlineBox::blockDirectionPointInLine):
(WebCore::RootInlineBox::blockFlow):
(WebCore::RootInlineBox::closestLeafChildForPoint):
(WebCore::RootInlineBox::removeLineBoxFromRenderObject):
(WebCore::RootInlineBox::extractLineBoxFromRenderObject):
(WebCore::RootInlineBox::attachLineBoxToRenderObject):
* rendering/RootInlineBox.h:
* rendering/TrailingFloatsRootInlineBox.h:
* rendering/svg/RenderSVGText.h:
(WebCore::toRenderSVGText):
* rendering/svg/SVGRootInlineBox.cpp:
(WebCore::SVGRootInlineBox::SVGRootInlineBox):
(WebCore::SVGRootInlineBox::renderSVGText):
(WebCore::SVGRootInlineBox::paint):
(WebCore::SVGRootInlineBox::computePerCharacterLayoutInformation):
(WebCore::SVGRootInlineBox::layoutRootBox):
* rendering/svg/SVGRootInlineBox.h:

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

17 files changed:
Source/WebCore/ChangeLog
Source/WebCore/editing/VisibleUnits.cpp
Source/WebCore/rendering/InlineBox.cpp
Source/WebCore/rendering/InlineFlowBox.cpp
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBlock.h
Source/WebCore/rendering/RenderBlockFlow.h
Source/WebCore/rendering/RenderBlockLineLayout.cpp
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderListMarker.cpp
Source/WebCore/rendering/RenderReplaced.cpp
Source/WebCore/rendering/RootInlineBox.cpp
Source/WebCore/rendering/RootInlineBox.h
Source/WebCore/rendering/TrailingFloatsRootInlineBox.h
Source/WebCore/rendering/svg/RenderSVGText.h
Source/WebCore/rendering/svg/SVGRootInlineBox.cpp
Source/WebCore/rendering/svg/SVGRootInlineBox.h

index a0808f6..93af6ec 100644 (file)
@@ -1,3 +1,66 @@
+2013-10-18  Sam Weinig  <sam@webkit.org>
+
+        Move m_lineBoxes from RenderBlock to RenderBlockFlow (Part 1)
+        https://bugs.webkit.org/show_bug.cgi?id=122969
+
+        Reviewed by Dan Bernstein.
+
+        - Make the RootInlineBox constructor take a RenderBlockFlow.
+        - Move createRootInlineBox, and createAndAppendRootInlineBox to RenderBlockFlow.
+
+        * editing/VisibleUnits.cpp:
+        (WebCore::absoluteLineDirectionPointToLocalPointInBlock):
+        * rendering/InlineBox.cpp:
+        (WebCore::InlineBox::locationIncludingFlipping):
+        (WebCore::InlineBox::flipForWritingMode):
+        * rendering/InlineFlowBox.cpp:
+        (WebCore::InlineFlowBox::placeBoxRangeInInlineDirection):
+        * rendering/RenderBlock.cpp:
+        * rendering/RenderBlock.h:
+        * rendering/RenderBlockFlow.h:
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::RenderBlockFlow::createRootInlineBox):
+        (WebCore::RenderBlockFlow::createAndAppendRootInlineBox):
+        (WebCore::createInlineBoxForRenderer):
+        (WebCore::RenderBlockFlow::createLineBoxes):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::positionLineBox):
+        * rendering/RenderListMarker.cpp:
+        (WebCore::RenderListMarker::localSelectionRect):
+        * rendering/RenderReplaced.cpp:
+        (WebCore::RenderReplaced::localSelectionRect):
+        * rendering/RootInlineBox.cpp:
+        (WebCore::RootInlineBox::RootInlineBox):
+        (WebCore::RootInlineBox::rendererLineBoxes):
+        (WebCore::RootInlineBox::placeEllipsis):
+        (WebCore::RootInlineBox::containingRegion):
+        (WebCore::RootInlineBox::setContainingRegion):
+        (WebCore::RootInlineBox::alignBoxesInBlockDirection):
+        (WebCore::RootInlineBox::beforeAnnotationsAdjustment):
+        (WebCore::RootInlineBox::lineSnapAdjustment):
+        (WebCore::RootInlineBox::lineSelectionGap):
+        (WebCore::RootInlineBox::computeCaretRect):
+        (WebCore::RootInlineBox::selectionTop):
+        (WebCore::RootInlineBox::selectionTopAdjustedForPrecedingBlock):
+        (WebCore::RootInlineBox::selectionBottom):
+        (WebCore::RootInlineBox::blockDirectionPointInLine):
+        (WebCore::RootInlineBox::blockFlow):
+        (WebCore::RootInlineBox::closestLeafChildForPoint):
+        (WebCore::RootInlineBox::removeLineBoxFromRenderObject):
+        (WebCore::RootInlineBox::extractLineBoxFromRenderObject):
+        (WebCore::RootInlineBox::attachLineBoxToRenderObject):
+        * rendering/RootInlineBox.h:
+        * rendering/TrailingFloatsRootInlineBox.h:
+        * rendering/svg/RenderSVGText.h:
+        (WebCore::toRenderSVGText):
+        * rendering/svg/SVGRootInlineBox.cpp:
+        (WebCore::SVGRootInlineBox::SVGRootInlineBox):
+        (WebCore::SVGRootInlineBox::renderSVGText):
+        (WebCore::SVGRootInlineBox::paint):
+        (WebCore::SVGRootInlineBox::computePerCharacterLayoutInformation):
+        (WebCore::SVGRootInlineBox::layoutRootBox):
+        * rendering/svg/SVGRootInlineBox.h:
+
 2013-10-18  Tim Horton  <timothy_horton@apple.com>
 
         Remote Layer Tree: Double-buffering and minimization of repaints
index 34b7c47..af2ea13 100644 (file)
@@ -32,7 +32,7 @@
 #include "InlineTextBox.h"
 #include "NodeTraversal.h"
 #include "Position.h"
-#include "RenderBlock.h"
+#include "RenderBlockFlow.h"
 #include "RenderObject.h"
 #include "RenderedPosition.h"
 #include "Text.h"
@@ -905,7 +905,7 @@ bool isEndOfLine(const VisiblePosition &p)
 static inline IntPoint absoluteLineDirectionPointToLocalPointInBlock(RootInlineBox* root, int lineDirectionPoint)
 {
     ASSERT(root);
-    RenderBlock& containingBlock = root->block();
+    RenderBlockFlow& containingBlock = root->blockFlow();
     FloatPoint absoluteBlockPoint = containingBlock.localToAbsolute(FloatPoint());
     if (containingBlock.hasOverflowClip())
         absoluteBlockPoint -= containingBlock.scrolledContentOffset();
index 1a78c41..f2c82e5 100644 (file)
@@ -27,7 +27,7 @@
 #include "Page.h"
 #include "PaintInfo.h"
 #include "RenderArena.h"
-#include "RenderBlock.h"
+#include "RenderBlockFlow.h"
 #include "RenderLineBreak.h"
 #include "RootInlineBox.h"
 
@@ -366,7 +366,7 @@ FloatPoint InlineBox::locationIncludingFlipping()
 {
     if (!m_renderer.style()->isFlippedBlocksWritingMode())
         return FloatPoint(x(), y());
-    RenderBlock& block = root().block();
+    RenderBlockFlow& block = root().blockFlow();
     if (block.style()->isHorizontalWritingMode())
         return FloatPoint(x(), block.height() - height() - y());
     else
@@ -377,28 +377,28 @@ void InlineBox::flipForWritingMode(FloatRect& rect)
 {
     if (!m_renderer.style()->isFlippedBlocksWritingMode())
         return;
-    root().block().flipForWritingMode(rect);
+    root().blockFlow().flipForWritingMode(rect);
 }
 
 FloatPoint InlineBox::flipForWritingMode(const FloatPoint& point)
 {
     if (!m_renderer.style()->isFlippedBlocksWritingMode())
         return point;
-    return root().block().flipForWritingMode(point);
+    return root().blockFlow().flipForWritingMode(point);
 }
 
 void InlineBox::flipForWritingMode(LayoutRect& rect)
 {
     if (!m_renderer.style()->isFlippedBlocksWritingMode())
         return;
-    root().block().flipForWritingMode(rect);
+    root().blockFlow().flipForWritingMode(rect);
 }
 
 LayoutPoint InlineBox::flipForWritingMode(const LayoutPoint& point)
 {
     if (!m_renderer.style()->isFlippedBlocksWritingMode())
         return point;
-    return root().block().flipForWritingMode(point);
+    return root().blockFlow().flipForWritingMode(point);
 }
 
 } // namespace WebCore
index 4911f50..8df4604 100644 (file)
@@ -409,7 +409,7 @@ float InlineFlowBox::placeBoxRangeInInlineDirection(InlineBox* firstChild, Inlin
                     // Our offset that we cache needs to be from the edge of the right border box and
                     // not the left border box.  We have to subtract |x| from the width of the block
                     // (which can be obtained from the root line box).
-                    curr->setLogicalLeft(root().block().logicalWidth() - logicalLeft);
+                    curr->setLogicalLeft(root().blockFlow().logicalWidth() - logicalLeft);
                 continue; // The positioned object has no effect on the width.
             }
             if (curr->renderer().isRenderInline()) {
index 2563196..9551a4d 100644 (file)
@@ -917,24 +917,6 @@ void RenderBlock::deleteLineBoxTree()
         cache->recomputeIsIgnored(this);
 }
 
-RootInlineBox* RenderBlock::createRootInlineBox()
-{
-    return new (renderArena()) RootInlineBox(*this);
-}
-
-RootInlineBox* RenderBlock::createAndAppendRootInlineBox()
-{
-    RootInlineBox* rootBox = createRootInlineBox();
-    m_lineBoxes.appendLineBox(rootBox);
-
-    if (UNLIKELY(AXObjectCache::accessibilityEnabled()) && m_lineBoxes.firstLineBox() == rootBox) {
-        if (AXObjectCache* cache = document().existingAXObjectCache())
-            cache->recomputeIsIgnored(this);
-    }
-
-    return rootBox;
-}
-
 void RenderBlock::makeChildrenNonInline(RenderObject *insertionPoint)
 {    
     // makeChildrenNonInline takes a block whose children are *all* inline and it
index f4ae09d..48ae40f 100644 (file)
@@ -155,8 +155,6 @@ public:
     bool hasMarginBeforeQuirk(const RenderBox* child) const;
     bool hasMarginAfterQuirk(const RenderBox* child) const;
 
-    RootInlineBox* createAndAppendRootInlineBox();
-
     bool generatesLineBoxesForInlineChild(RenderObject*);
 
     void markPositionedObjectsForLayout();
@@ -564,8 +562,6 @@ private:
     void insertIntoTrackedRendererMaps(RenderBox* descendant, TrackedDescendantsMap*&, TrackedContainerMap*&);
     static void removeFromTrackedRendererMaps(RenderBox* descendant, TrackedDescendantsMap*&, TrackedContainerMap*&);
 
-    virtual RootInlineBox* createRootInlineBox(); // Subclassed by SVG and Ruby.
-
     // Called to lay out the legend for a fieldset or the ruby text of a ruby run.
     virtual RenderObject* layoutSpecialExcludedChild(bool /*relayoutChildren*/) { return 0; }
 
index b9fcc30..9ede098 100644 (file)
@@ -375,8 +375,10 @@ private:
 // START METHODS DEFINED IN RenderBlockLineLayout
 public:
     static void appendRunsForObject(BidiRunList<BidiRun>&, int start, int end, RenderObject*, InlineBidiResolver&);
+    RootInlineBox* createAndAppendRootInlineBox();
 
 private:
+    virtual RootInlineBox* createRootInlineBox(); // Subclassed by SVG and Ruby.
     InlineFlowBox* createLineBoxes(RenderObject*, const LineInfo&, InlineBox* childBox, bool startsNewSegment);
     RootInlineBox* constructLine(BidiRunList<BidiRun>&, const LineInfo&);
     void setMarginsForRubyRun(BidiRun*, RenderRubyRun*, RenderObject*, const LineInfo&);
index 275d478..cd54324 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "config.h"
 
+#include "AXObjectCache.h"
 #include "BidiResolver.h"
 #include "FloatingObjects.h"
 #include "Hyphenation.h"
@@ -280,10 +281,29 @@ void RenderBlockFlow::appendRunsForObject(BidiRunList<BidiRun>& runs, int start,
     }
 }
 
+RootInlineBox* RenderBlockFlow::createRootInlineBox()
+{
+    return new (renderArena()) RootInlineBox(*this);
+}
+
+RootInlineBox* RenderBlockFlow::createAndAppendRootInlineBox()
+{
+    RootInlineBox* rootBox = createRootInlineBox();
+    m_lineBoxes.appendLineBox(rootBox);
+
+    if (UNLIKELY(AXObjectCache::accessibilityEnabled()) && m_lineBoxes.firstLineBox() == rootBox) {
+        if (AXObjectCache* cache = document().existingAXObjectCache())
+            cache->recomputeIsIgnored(this);
+    }
+
+    return rootBox;
+}
+
+
 static inline InlineBox* createInlineBoxForRenderer(RenderObject* obj, bool isRootLineBox, bool isOnlyRun = false)
 {
     if (isRootLineBox)
-        return toRenderBlock(obj)->createAndAppendRootInlineBox();
+        return toRenderBlockFlow(obj)->createAndAppendRootInlineBox();
 
     if (obj->isText())
         return toRenderText(obj)->createInlineTextBox();
@@ -347,7 +367,7 @@ InlineFlowBox* RenderBlockFlow::createLineBoxes(RenderObject* obj, const LineInf
         RenderInline* inlineFlow = (obj != this) ? toRenderInline(obj) : 0;
 
         // Get the last box we made for this render object.
-        parentBox = inlineFlow ? inlineFlow->lastLineBox() : toRenderBlock(obj)->lastLineBox();
+        parentBox = inlineFlow ? inlineFlow->lastLineBox() : toRenderBlockFlow(obj)->lastLineBox();
 
         // 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
index 77825c6..f7dafe6 100644 (file)
@@ -1966,7 +1966,7 @@ void RenderBox::positionLineBox(InlineBox* box)
             // our object was inline originally, since otherwise it would have ended up underneath
             // the inlines.
             RootInlineBox& rootBox = box->root();
-            rootBox.block().setStaticInlinePositionForChild(this, rootBox.lineTopWithLeading(), roundedLayoutUnit(box->logicalLeft()));
+            rootBox.blockFlow().setStaticInlinePositionForChild(this, rootBox.lineTopWithLeading(), roundedLayoutUnit(box->logicalLeft()));
             if (style()->hasStaticInlinePosition(box->isHorizontal()))
                 setChildNeedsLayout(MarkOnlyThis); // Just go ahead and mark the positioned object as needing layout, so it will update its position properly.
         } else {
index c6de8a8..684ac90 100644 (file)
@@ -1171,8 +1171,8 @@ LayoutRect RenderListMarker::localSelectionRect()
     if (!box)
         return LayoutRect(LayoutPoint(), size());
     const RootInlineBox& rootBox = m_inlineBoxWrapper->root();
-    LayoutUnit newLogicalTop = rootBox.block().style()->isFlippedBlocksWritingMode() ? m_inlineBoxWrapper->logicalBottom() - rootBox.selectionBottom() : rootBox.selectionTop() - m_inlineBoxWrapper->logicalTop();
-    if (rootBox.block().style()->isHorizontalWritingMode())
+    LayoutUnit newLogicalTop = rootBox.blockFlow().style()->isFlippedBlocksWritingMode() ? m_inlineBoxWrapper->logicalBottom() - rootBox.selectionBottom() : rootBox.selectionTop() - m_inlineBoxWrapper->logicalTop();
+    if (rootBox.blockFlow().style()->isHorizontalWritingMode())
         return LayoutRect(0, newLogicalTop, width(), rootBox.selectionHeight());
     return LayoutRect(newLogicalTop, 0, rootBox.selectionHeight(), height());
 }
index e0a284f..7568419 100644 (file)
@@ -547,8 +547,8 @@ LayoutRect RenderReplaced::localSelectionRect(bool checkWhetherSelected) const
         return LayoutRect(LayoutPoint(), size());
     
     const RootInlineBox& rootBox = m_inlineBoxWrapper->root();
-    LayoutUnit newLogicalTop = rootBox.block().style()->isFlippedBlocksWritingMode() ? m_inlineBoxWrapper->logicalBottom() - rootBox.selectionBottom() : rootBox.selectionTop() - m_inlineBoxWrapper->logicalTop();
-    if (rootBox.block().style()->isHorizontalWritingMode())
+    LayoutUnit newLogicalTop = rootBox.blockFlow().style()->isFlippedBlocksWritingMode() ? m_inlineBoxWrapper->logicalBottom() - rootBox.selectionBottom() : rootBox.selectionTop() - m_inlineBoxWrapper->logicalTop();
+    if (rootBox.blockFlow().style()->isHorizontalWritingMode())
         return LayoutRect(0, newLogicalTop, width(), rootBox.selectionHeight());
     return LayoutRect(newLogicalTop, 0, rootBox.selectionHeight(), height());
 }
index de72ad4..d72267c 100644 (file)
@@ -52,7 +52,7 @@ COMPILE_ASSERT(sizeof(RootInlineBox) == sizeof(SameSizeAsRootInlineBox), RootInl
 typedef WTF::HashMap<const RootInlineBox*, EllipsisBox*> EllipsisBoxMap;
 static EllipsisBoxMap* gEllipsisBoxMap = 0;
 
-RootInlineBox::RootInlineBox(RenderBlock& block)
+RootInlineBox::RootInlineBox(RenderBlockFlow& block)
     : InlineFlowBox(block)
     , m_lineBreakPos(0)
     , m_lineBreakObj(0)
@@ -83,7 +83,7 @@ void RootInlineBox::detachEllipsisBox(RenderArena& arena)
 
 RenderLineBoxList& RootInlineBox::rendererLineBoxes() const
 {
-    return block().lineBoxes();
+    return blockFlow().lineBoxes();
 }
 
 void RootInlineBox::clearTruncation()
@@ -132,7 +132,7 @@ float RootInlineBox::placeEllipsis(const AtomicString& ellipsisStr,  bool ltr, f
                                   InlineBox* markupBox)
 {
     // Create an ellipsis box.
-    EllipsisBox* ellipsisBox = new (renderer().renderArena()) EllipsisBox(block(), ellipsisStr, this,
+    EllipsisBox* ellipsisBox = new (renderer().renderArena()) EllipsisBox(blockFlow(), ellipsisStr, this,
                                                               ellipsisWidth - (markupBox ? markupBox->logicalWidth() : 0), logicalHeight(),
                                                               y(), !prevRootBox(), isHorizontal(), markupBox);
     
@@ -257,7 +257,7 @@ RenderRegion* RootInlineBox::containingRegion() const
 
 #ifndef NDEBUG
     if (region) {
-        RenderFlowThread* flowThread = block().flowThreadContainingBlock();
+        RenderFlowThread* flowThread = blockFlow().flowThreadContainingBlock();
         const RenderRegionList& regionList = flowThread->renderRegionList();
         ASSERT(regionList.contains(region));
     }
@@ -269,7 +269,7 @@ RenderRegion* RootInlineBox::containingRegion() const
 void RootInlineBox::setContainingRegion(RenderRegion* region)
 {
     ASSERT(!isDirty());
-    ASSERT(block().flowThreadContainingBlock());
+    ASSERT(blockFlow().flowThreadContainingBlock());
     LineFragmentationData* fragmentationData  = ensureLineFragmentationData();
     fragmentationData->m_containingRegion = region;
 }
@@ -316,7 +316,7 @@ LayoutUnit RootInlineBox::alignBoxesInBlockDirection(LayoutUnit heightOfBlock, G
     maxHeight = max<LayoutUnit>(0, maxHeight); // FIXME: Is this really necessary?
 
     setLineTopBottomPositions(lineTop, lineBottom, heightOfBlock, heightOfBlock + maxHeight);
-    setPaginatedLineWidth(block().availableLogicalWidthForContent(heightOfBlock));
+    setPaginatedLineWidth(blockFlow().availableLogicalWidthForContent(heightOfBlock));
 
     LayoutUnit annotationsAdjustment = beforeAnnotationsAdjustment();
     if (annotationsAdjustment) {
@@ -357,12 +357,12 @@ LayoutUnit RootInlineBox::beforeAnnotationsAdjustment() const
             return result;
 
         // Annotations over this line may push us further down.
-        LayoutUnit highestAllowedPosition = prevRootBox() ? min(prevRootBox()->lineBottom(), lineTop()) + result : static_cast<LayoutUnit>(block().borderBefore());
+        LayoutUnit highestAllowedPosition = prevRootBox() ? min(prevRootBox()->lineBottom(), lineTop()) + result : static_cast<LayoutUnit>(blockFlow().borderBefore());
         result = computeOverAnnotationAdjustment(highestAllowedPosition);
     } else {
         // Annotations under this line may push us up.
         if (hasAnnotationsBefore())
-            result = computeUnderAnnotationAdjustment(prevRootBox() ? prevRootBox()->lineBottom() : static_cast<LayoutUnit>(block().borderBefore()));
+            result = computeUnderAnnotationAdjustment(prevRootBox() ? prevRootBox()->lineBottom() : static_cast<LayoutUnit>(blockFlow().borderBefore()));
 
         if (!prevRootBox() || !prevRootBox()->hasAnnotationsAfter())
             return result;
@@ -379,14 +379,14 @@ LayoutUnit RootInlineBox::lineSnapAdjustment(LayoutUnit delta) const
 {
     // If our block doesn't have snapping turned on, do nothing.
     // FIXME: Implement bounds snapping.
-    if (block().style()->lineSnap() == LineSnapNone)
+    if (blockFlow().style()->lineSnap() == LineSnapNone)
         return 0;
 
     // Get the current line grid and offset.
-    LayoutState* layoutState = block().view().layoutState();
+    LayoutState* layoutState = blockFlow().view().layoutState();
     RenderBlockFlow* lineGrid = layoutState->lineGrid();
     LayoutSize lineGridOffset = layoutState->lineGridOffset();
-    if (!lineGrid || lineGrid->style()->writingMode() != block().style()->writingMode())
+    if (!lineGrid || lineGrid->style()->writingMode() != blockFlow().style()->writingMode())
         return 0;
 
     // Get the hypothetical line box used to establish the grid.
@@ -395,7 +395,7 @@ LayoutUnit RootInlineBox::lineSnapAdjustment(LayoutUnit delta) const
         return 0;
     
     LayoutUnit lineGridBlockOffset = lineGrid->isHorizontalWritingMode() ? lineGridOffset.height() : lineGridOffset.width();
-    LayoutUnit blockOffset = block().isHorizontalWritingMode() ? layoutState->layoutOffset().height() : layoutState->layoutOffset().width();
+    LayoutUnit blockOffset = blockFlow().isHorizontalWritingMode() ? layoutState->layoutOffset().height() : layoutState->layoutOffset().width();
 
     // Now determine our position on the grid. Our baseline needs to be adjusted to the nearest baseline multiple
     // as established by the line box.
@@ -412,7 +412,7 @@ LayoutUnit RootInlineBox::lineSnapAdjustment(LayoutUnit delta) const
     LayoutUnit firstBaselinePosition = firstTextTop + lineGridFontAscent;
 
     LayoutUnit currentTextTop = blockOffset + logicalTop() + delta;
-    LayoutUnit currentFontAscent = block().style()->fontMetrics().ascent(baselineType());
+    LayoutUnit currentFontAscent = blockFlow().style()->fontMetrics().ascent(baselineType());
     LayoutUnit currentBaselinePosition = currentTextTop + currentFontAscent;
 
     LayoutUnit lineGridPaginationOrigin = isHorizontal() ? layoutState->lineGridPaginationOrigin().height() : layoutState->lineGridPaginationOrigin().width();
@@ -421,12 +421,12 @@ LayoutUnit RootInlineBox::lineSnapAdjustment(LayoutUnit delta) const
     // FIXME: If the grid is an ancestor of the pagination establisher, then this is incorrect.
     LayoutUnit pageLogicalTop = 0;
     if (layoutState->isPaginated() && layoutState->pageLogicalHeight()) {
-        pageLogicalTop = block().pageLogicalTopForOffset(lineTopWithLeading() + delta);
+        pageLogicalTop = blockFlow().pageLogicalTopForOffset(lineTopWithLeading() + delta);
         if (pageLogicalTop > firstLineTopWithLeading)
             firstTextTop = pageLogicalTop + lineGridBox->logicalTop() - lineGrid->borderAndPaddingBefore() + lineGridPaginationOrigin;
     }
 
-    if (block().style()->lineSnap() == LineSnapContain) {
+    if (blockFlow().style()->lineSnap() == LineSnapContain) {
         // Compute the desired offset from the text-top of a grid line.
         // Look at our height (logicalHeight()).
         // Look at the total available height. It's going to be (textBottom - textTop) + (n-1)*(multiple with leading)
@@ -458,7 +458,7 @@ LayoutUnit RootInlineBox::lineSnapAdjustment(LayoutUnit delta) const
         return result;
     
     // We may end up shifted to a new page. We need to do a re-snap when that happens.
-    LayoutUnit newPageLogicalTop = block().pageLogicalTopForOffset(lineBottomWithLeading() + result);
+    LayoutUnit newPageLogicalTop = blockFlow().pageLogicalTopForOffset(lineBottomWithLeading() + result);
     if (newPageLogicalTop == pageLogicalTop)
         return result;
     
@@ -472,18 +472,18 @@ GapRects RootInlineBox::lineSelectionGap(RenderBlock* rootBlock, const LayoutPoi
     RenderObject::SelectionState lineState = selectionState();
 
     bool leftGap, rightGap;
-    block().getSelectionGapInfo(lineState, leftGap, rightGap);
+    blockFlow().getSelectionGapInfo(lineState, leftGap, rightGap);
 
     GapRects result;
 
     InlineBox* firstBox = firstSelectedBox();
     InlineBox* lastBox = lastSelectedBox();
     if (leftGap) {
-        result.uniteLeft(block().logicalLeftSelectionGap(rootBlock, rootBlockPhysicalPosition, offsetFromRootBlock, &firstBox->parent()->renderer(), firstBox->logicalLeft(),
+        result.uniteLeft(blockFlow().logicalLeftSelectionGap(rootBlock, rootBlockPhysicalPosition, offsetFromRootBlock, &firstBox->parent()->renderer(), firstBox->logicalLeft(),
             selTop, selHeight, cache, paintInfo));
     }
     if (rightGap) {
-        result.uniteRight(block().logicalRightSelectionGap(rootBlock, rootBlockPhysicalPosition, offsetFromRootBlock, &lastBox->parent()->renderer(), lastBox->logicalRight(),
+        result.uniteRight(blockFlow().logicalRightSelectionGap(rootBlock, rootBlockPhysicalPosition, offsetFromRootBlock, &lastBox->parent()->renderer(), lastBox->logicalRight(),
             selTop, selHeight, cache, paintInfo));
     }
 
@@ -538,7 +538,7 @@ IntRect RootInlineBox::computeCaretRect(float logicalLeftPosition, unsigned care
     if (extraWidthToEndOfLine)
         *extraWidthToEndOfLine = (logicalWidth() + rootLeft) - (left + caretWidth);
 
-    RenderStyle* blockStyle = block().style();
+    RenderStyle* blockStyle = blockFlow().style();
 
     bool rightAligned = false;
     switch (blockStyle->textAlign()) {
@@ -561,7 +561,7 @@ IntRect RootInlineBox::computeCaretRect(float logicalLeftPosition, unsigned care
     }
 
     float leftEdge = std::min<float>(0, rootLeft);
-    float rightEdge = std::max<float>(block().logicalWidth(), rootRight);
+    float rightEdge = std::max<float>(blockFlow().logicalWidth(), rootRight);
 
     if (rightAligned) {
         left = std::max(left, leftEdge);
@@ -627,15 +627,15 @@ LayoutUnit RootInlineBox::selectionTop() const
     if (renderer().style()->isFlippedLinesWritingMode())
         return selectionTop;
 
-    LayoutUnit prevBottom = prevRootBox() ? prevRootBox()->selectionBottom() : block().borderAndPaddingBefore();
-    if (prevBottom < selectionTop && block().containsFloats()) {
+    LayoutUnit prevBottom = prevRootBox() ? prevRootBox()->selectionBottom() : blockFlow().borderAndPaddingBefore();
+    if (prevBottom < selectionTop && blockFlow().containsFloats()) {
         // This line has actually been moved further down, probably from a large line-height, but possibly because the
         // line was forced to clear floats.  If so, let's check the offsets, and only be willing to use the previous
         // line's bottom if the offsets are greater on both sides.
-        LayoutUnit prevLeft = block().logicalLeftOffsetForLine(prevBottom, false);
-        LayoutUnit prevRight = block().logicalRightOffsetForLine(prevBottom, false);
-        LayoutUnit newLeft = block().logicalLeftOffsetForLine(selectionTop, false);
-        LayoutUnit newRight = block().logicalRightOffsetForLine(selectionTop, false);
+        LayoutUnit prevLeft = blockFlow().logicalLeftOffsetForLine(prevBottom, false);
+        LayoutUnit prevRight = blockFlow().logicalRightOffsetForLine(prevBottom, false);
+        LayoutUnit newLeft = blockFlow().logicalLeftOffsetForLine(selectionTop, false);
+        LayoutUnit newRight = blockFlow().logicalRightOffsetForLine(selectionTop, false);
         if (prevLeft > newLeft || prevRight < newRight)
             return selectionTop;
     }
@@ -648,12 +648,12 @@ LayoutUnit RootInlineBox::selectionTopAdjustedForPrecedingBlock() const
     const RootInlineBox& rootBox = root();
     LayoutUnit top = selectionTop();
 
-    RenderObject::SelectionState blockSelectionState = rootBox.block().selectionState();
+    RenderObject::SelectionState blockSelectionState = rootBox.blockFlow().selectionState();
     if (blockSelectionState != RenderObject::SelectionInside && blockSelectionState != RenderObject::SelectionEnd)
         return top;
 
     LayoutSize offsetToBlockBefore;
-    if (RenderBlock* block = rootBox.block().blockBeforeWithinSelectionRoot(offsetToBlockBefore)) {
+    if (RenderBlock* block = rootBox.blockFlow().blockBeforeWithinSelectionRoot(offsetToBlockBefore)) {
         if (RootInlineBox* lastLine = block->lastRootBox()) {
             RenderObject::SelectionState lastLineSelectionState = lastLine->selectionState();
             if (lastLineSelectionState != RenderObject::SelectionInside && lastLineSelectionState != RenderObject::SelectionStart)
@@ -678,14 +678,14 @@ LayoutUnit RootInlineBox::selectionBottom() const
         return selectionBottom;
 
     LayoutUnit nextTop = nextRootBox()->selectionTop();
-    if (nextTop > selectionBottom && block().containsFloats()) {
+    if (nextTop > selectionBottom && blockFlow().containsFloats()) {
         // The next line has actually been moved further over, probably from a large line-height, but possibly because the
         // line was forced to clear floats.  If so, let's check the offsets, and only be willing to use the next
         // line's top if the offsets are greater on both sides.
-        LayoutUnit nextLeft = block().logicalLeftOffsetForLine(nextTop, false);
-        LayoutUnit nextRight = block().logicalRightOffsetForLine(nextTop, false);
-        LayoutUnit newLeft = block().logicalLeftOffsetForLine(selectionBottom, false);
-        LayoutUnit newRight = block().logicalRightOffsetForLine(selectionBottom, false);
+        LayoutUnit nextLeft = blockFlow().logicalLeftOffsetForLine(nextTop, false);
+        LayoutUnit nextRight = blockFlow().logicalRightOffsetForLine(nextTop, false);
+        LayoutUnit newLeft = blockFlow().logicalLeftOffsetForLine(selectionBottom, false);
+        LayoutUnit newRight = blockFlow().logicalRightOffsetForLine(selectionBottom, false);
         if (nextLeft > newLeft || nextRight < newRight)
             return selectionBottom;
     }
@@ -695,12 +695,12 @@ LayoutUnit RootInlineBox::selectionBottom() const
 
 int RootInlineBox::blockDirectionPointInLine() const
 {
-    return !block().style()->isFlippedBlocksWritingMode() ? max(lineTop(), selectionTop()) : min(lineBottom(), selectionBottom());
+    return !blockFlow().style()->isFlippedBlocksWritingMode() ? max(lineTop(), selectionTop()) : min(lineBottom(), selectionBottom());
 }
 
-RenderBlock& RootInlineBox::block() const
+RenderBlockFlow& RootInlineBox::blockFlow() const
 {
-    return toRenderBlock(renderer());
+    return toRenderBlockFlow(renderer());
 }
 
 static bool isEditableLeaf(InlineBox* leaf)
@@ -710,7 +710,7 @@ static bool isEditableLeaf(InlineBox* leaf)
 
 InlineBox* RootInlineBox::closestLeafChildForPoint(const IntPoint& pointInContents, bool onlyEditableLeaves)
 {
-    return closestLeafChildForLogicalLeftPosition(block().isHorizontalWritingMode() ? pointInContents.x() : pointInContents.y(), onlyEditableLeaves);
+    return closestLeafChildForLogicalLeftPosition(blockFlow().isHorizontalWritingMode() ? pointInContents.x() : pointInContents.y(), onlyEditableLeaves);
 }
 
 InlineBox* RootInlineBox::closestLeafChildForLogicalLeftPosition(int leftPosition, bool onlyEditableLeaves)
@@ -777,17 +777,17 @@ EllipsisBox* RootInlineBox::ellipsisBox() const
 
 void RootInlineBox::removeLineBoxFromRenderObject()
 {
-    block().lineBoxes().removeLineBox(this);
+    blockFlow().lineBoxes().removeLineBox(this);
 }
 
 void RootInlineBox::extractLineBoxFromRenderObject()
 {
-    block().lineBoxes().extractLineBox(this);
+    blockFlow().lineBoxes().extractLineBox(this);
 }
 
 void RootInlineBox::attachLineBoxToRenderObject()
 {
-    block().lineBoxes().attachLineBox(this);
+    blockFlow().lineBoxes().attachLineBox(this);
 }
 
 LayoutRect RootInlineBox::paddedLayoutOverflowRect(LayoutUnit endPadding) const
index 2816acb..39c680a 100644 (file)
@@ -29,6 +29,7 @@ namespace WebCore {
 class EllipsisBox;
 class HitTestResult;
 class LogicalSelectionOffsetCaches;
+class RenderBlockFlow;
 class RenderRegion;
 
 struct BidiStatus;
@@ -36,11 +37,12 @@ struct GapRects;
 
 class RootInlineBox : public InlineFlowBox {
 public:
-    explicit RootInlineBox(RenderBlock&);
+    explicit RootInlineBox(RenderBlockFlow&);
 
     virtual void destroy(RenderArena&) OVERRIDE FINAL;
 
     virtual bool isRootInlineBox() const OVERRIDE FINAL { return true; }
+    RenderBlockFlow& blockFlow() const;
 
     void detachEllipsisBox(RenderArena&);
 
@@ -137,8 +139,6 @@ public:
 
     IntRect computeCaretRect(float logicalLeftPosition, unsigned caretWidth, LayoutUnit* extraWidthToEndOfLine) const;
 
-    RenderBlock& block() const;
-
     InlineBox* closestLeafChildForPoint(const IntPoint&, bool onlyEditableLeaves);
     InlineBox* closestLeafChildForLogicalLeftPosition(int, bool onlyEditableLeaves = false);
 
index 3e53106..25a2ed6 100644 (file)
@@ -32,8 +32,8 @@ namespace WebCore {
 
 class TrailingFloatsRootInlineBox FINAL : public RootInlineBox {
 public:
-    explicit TrailingFloatsRootInlineBox(RenderBlock& block)
-        : RootInlineBox(block)
+    explicit TrailingFloatsRootInlineBox(RenderBlockFlow& blockFlow)
+        : RootInlineBox(blockFlow)
     {
         setHasVirtualLogicalHeight();
     }
index 6b5ef90..65c2a2a 100644 (file)
@@ -106,6 +106,18 @@ 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());
@@ -119,6 +131,7 @@ inline const RenderSVGText* toRenderSVGText(const RenderObject* object)
 }
 
 // This will catch anyone doing an unnecessary cast.
+void toRenderSVGText(const RenderSVGText&);
 void toRenderSVGText(const RenderSVGText*);
 
 }
index 9b3c0b3..4d796ca 100644 (file)
 
 namespace WebCore {
 
+SVGRootInlineBox::SVGRootInlineBox(RenderSVGText& renderSVGText)
+    : RootInlineBox(renderSVGText)
+    , m_logicalHeight(0)
+{
+}
+
+RenderSVGText& SVGRootInlineBox::renderSVGText()
+{
+    return toRenderSVGText(blockFlow());
+}
+
 void SVGRootInlineBox::paint(PaintInfo& paintInfo, const LayoutPoint&, LayoutUnit, LayoutUnit)
 {
     ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection);
     ASSERT(!paintInfo.context->paintingDisabled());
 
-    bool isPrinting = renderer().document().printing();
+    bool isPrinting = renderSVGText().document().printing();
     bool hasSelection = !isPrinting && selectionState() != RenderObject::SelectionNone;
 
     PaintInfo childPaintInfo(paintInfo);
@@ -54,7 +65,7 @@ void SVGRootInlineBox::paint(PaintInfo& paintInfo, const LayoutPoint&, LayoutUni
         }
     }
 
-    SVGRenderingContext renderingContext(&renderer(), paintInfo, SVGRenderingContext::SaveGraphicsContext);
+    SVGRenderingContext renderingContext(&renderSVGText(), paintInfo, SVGRenderingContext::SaveGraphicsContext);
     if (renderingContext.isRenderingPrepared()) {
         for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
             if (child->isSVGInlineTextBox())
@@ -67,7 +78,7 @@ void SVGRootInlineBox::paint(PaintInfo& paintInfo, const LayoutPoint&, LayoutUni
 
 void SVGRootInlineBox::computePerCharacterLayoutInformation()
 {
-    RenderSVGText* textRoot = toRenderSVGText(&block());
+    RenderSVGText* textRoot = toRenderSVGText(&blockFlow());
     ASSERT(textRoot);
 
     Vector<SVGTextLayoutAttributes*>& layoutAttributes = textRoot->layoutAttributes();
@@ -162,7 +173,7 @@ void SVGRootInlineBox::layoutChildBoxes(InlineFlowBox* start, FloatRect* childRe
 
 void SVGRootInlineBox::layoutRootBox(const FloatRect& childRect)
 {
-    RenderBlock& parentBlock = block();
+    RenderSVGText& parentBlock = renderSVGText();
 
     // Finally, assign the root block position, now that all content is laid out.
     LayoutRect boundingRect = enclosingLayoutRect(childRect);
index 6bdf2c0..38d6aab 100644 (file)
 
 namespace WebCore {
 
+class RenderSVGText;
 class SVGInlineTextBox;
 
 class SVGRootInlineBox FINAL : public RootInlineBox {
 public:
-    SVGRootInlineBox(RenderBlock& block)
-        : RootInlineBox(block)
-        , m_logicalHeight(0)
-    {
-    }
+    SVGRootInlineBox(RenderSVGText&);
 
     virtual bool isSVGRootInlineBox() const { return true; }
+    RenderSVGText& renderSVGText();
 
     virtual float virtualLogicalHeight() const { return m_logicalHeight; }
     void setLogicalHeight(float height) { m_logicalHeight = height; }
@@ -60,7 +58,6 @@ private:
     void layoutChildBoxes(InlineFlowBox*, FloatRect* = 0);
     void layoutRootBox(const FloatRect&);
 
-private:
     float m_logicalHeight;
 };