Title: [158730] trunk/Source/WebCore
Revision
158730
Author
[email protected]
Date
2013-11-06 00:09:44 -0800 (Wed, 06 Nov 2013)

Log Message

RenderBlockFlow should only expose its line boxes as RootInlineBox.
<https://webkit.org/b/123878>

The line boxes attached directly to a RenderBlockFlow are always
RootInlineBox objects, so call sites should always use the tightly
typed firstRootBox() and lastRootBox().

This allows the compiler to devirtualize calls to member functions
of RootInlineBox that are marked FINAL.

Reviewed by Antti Koivisto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (158729 => 158730)


--- trunk/Source/WebCore/ChangeLog	2013-11-06 08:05:09 UTC (rev 158729)
+++ trunk/Source/WebCore/ChangeLog	2013-11-06 08:09:44 UTC (rev 158730)
@@ -1,3 +1,17 @@
+2013-11-05  Andreas Kling  <[email protected]>
+
+        RenderBlockFlow should only expose its line boxes as RootInlineBox.
+        <https://webkit.org/b/123878>
+
+        The line boxes attached directly to a RenderBlockFlow are always
+        RootInlineBox objects, so call sites should always use the tightly
+        typed firstRootBox() and lastRootBox().
+
+        This allows the compiler to devirtualize calls to member functions
+        of RootInlineBox that are marked FINAL.
+
+        Reviewed by Antti Koivisto.
+
 2013-11-06  Ryosuke Niwa  <[email protected]>
 
         Assertion failure end < m_runCount in WebCore::BidiRunList<WebCore::BidiRun>::reverseRuns

Modified: trunk/Source/WebCore/loader/icon/IconDatabase.cpp (158729 => 158730)


--- trunk/Source/WebCore/loader/icon/IconDatabase.cpp	2013-11-06 08:05:09 UTC (rev 158729)
+++ trunk/Source/WebCore/loader/icon/IconDatabase.cpp	2013-11-06 08:09:44 UTC (rev 158730)
@@ -263,7 +263,7 @@
         return 0;
     
     // The only way we should *not* have an icon record is if this pageURL is retained but has no icon yet - make sure of that
-    ASSERT(iconRecord || m_retainedPageURLs.contains(pageURLOriginal));
+  //  ASSERT(iconRecord || m_retainedPageURLs.contains(pageURLOriginal));
     
     if (!iconRecord)
         return 0;

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (158729 => 158730)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2013-11-06 08:05:09 UTC (rev 158729)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2013-11-06 08:09:44 UTC (rev 158730)
@@ -136,7 +136,7 @@
     }
 
     if (!documentBeingDestroyed()) {
-        if (firstLineBox()) {
+        if (firstRootBox()) {
             // We can't wait for RenderBox::destroy to clear the selection,
             // because by then we will have nuked the line boxes.
             // FIXME: The FrameSelection should be responsible for this when it
@@ -148,7 +148,7 @@
             // that will outlast this block. In the non-anonymous block case those
             // children will be destroyed by the time we return from this function.
             if (isAnonymousBlock()) {
-                for (auto box = firstLineBox(); box; box = box->nextLineBox()) {
+                for (auto box = firstRootBox(); box; box = box->nextRootBox()) {
                     while (auto childBox = box->firstChild())
                         childBox->removeFromParent();
                 }
@@ -2688,8 +2688,8 @@
     if (m_simpleLineLayout)
         return SimpleLineLayout::computeFlowFirstLineBaseline(*this, *m_simpleLineLayout);
 
-    ASSERT(firstLineBox());
-    return firstLineBox()->logicalTop() + firstLineStyle().fontMetrics().ascent(firstRootBox()->baselineType());
+    ASSERT(firstRootBox());
+    return firstRootBox()->logicalTop() + firstLineStyle().fontMetrics().ascent(firstRootBox()->baselineType());
 }
 
 int RenderBlockFlow::inlineBlockBaseline(LineDirectionMode lineDirection) const
@@ -2712,9 +2712,9 @@
     if (m_simpleLineLayout)
         return SimpleLineLayout::computeFlowLastLineBaseline(*this, *m_simpleLineLayout);
 
-    bool isFirstLine = lastLineBox() == firstLineBox();
+    bool isFirstLine = lastRootBox() == firstRootBox();
     const RenderStyle& style = isFirstLine ? firstLineStyle() : this->style();
-    return lastLineBox()->logicalTop() + style.fontMetrics().ascent(lastRootBox()->baselineType());
+    return lastRootBox()->logicalTop() + style.fontMetrics().ascent(lastRootBox()->baselineType());
 }
 
 GapRects RenderBlockFlow::inlineSelectionGaps(RenderBlock& rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.h (158729 => 158730)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.h	2013-11-06 08:05:09 UTC (rev 158729)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.h	2013-11-06 08:09:44 UTC (rev 158730)
@@ -308,12 +308,9 @@
     RenderLineBoxList& lineBoxes() { return m_lineBoxes; }
     const RenderLineBoxList& lineBoxes() const { return m_lineBoxes; }
 
-    InlineFlowBox* firstLineBox() const { return m_lineBoxes.firstLineBox(); }
-    InlineFlowBox* lastLineBox() const { return m_lineBoxes.lastLineBox(); }
+    RootInlineBox* firstRootBox() const { return static_cast<RootInlineBox*>(m_lineBoxes.firstLineBox()); }
+    RootInlineBox* lastRootBox() const { return static_cast<RootInlineBox*>(m_lineBoxes.lastLineBox()); }
 
-    RootInlineBox* firstRootBox() const { return static_cast<RootInlineBox*>(firstLineBox()); }
-    RootInlineBox* lastRootBox() const { return static_cast<RootInlineBox*>(lastLineBox()); }
-
     virtual bool hasLines() const OVERRIDE FINAL;
 
     // Helper methods for computing line counts and heights for line counts.

Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (158729 => 158730)


--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2013-11-06 08:05:09 UTC (rev 158729)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2013-11-06 08:09:44 UTC (rev 158730)
@@ -294,7 +294,7 @@
     RootInlineBox* rootBox = newRootBox.get();
     m_lineBoxes.appendLineBox(std::move(newRootBox));
 
-    if (UNLIKELY(AXObjectCache::accessibilityEnabled()) && m_lineBoxes.firstLineBox() == rootBox) {
+    if (UNLIKELY(AXObjectCache::accessibilityEnabled()) && firstRootBox() == rootBox) {
         if (AXObjectCache* cache = document().existingAXObjectCache())
             cache->recomputeIsIgnored(this);
     }
@@ -373,7 +373,7 @@
         RenderInline* inlineFlow = (obj != this) ? toRenderInline(obj) : 0;
 
         // Get the last box we made for this render object.
-        parentBox = inlineFlow ? inlineFlow->lastLineBox() : toRenderBlockFlow(obj)->lastLineBox();
+        parentBox = inlineFlow ? inlineFlow->lastLineBox() : toRenderBlockFlow(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
@@ -510,22 +510,22 @@
 
     // We should have a root inline box.  It should be unconstructed and
     // be the last continuation of our line list.
-    ASSERT(lastLineBox() && !lastLineBox()->isConstructed());
+    ASSERT(lastRootBox() && !lastRootBox()->isConstructed());
 
     // Set the m_selectedChildren flag on the root inline box if one of the leaf inline box
     // from the bidi runs walk above has a selection state.
     if (rootHasSelectedChildren)
-        lastLineBox()->root().setHasSelectedChildren(true);
+        lastRootBox()->root().setHasSelectedChildren(true);
 
     // Set bits on our inline flow boxes that indicate which sides should
     // paint borders/margins/padding.  This knowledge will ultimately be used when
     // we determine the horizontal positions and widths of all the inline boxes on
     // the line.
     bool isLogicallyLastRunWrapped = bidiRuns.logicallyLastRun()->m_object && bidiRuns.logicallyLastRun()->m_object->isText() ? !reachedEndOfTextRenderer(bidiRuns) : true;
-    lastLineBox()->determineSpacingForFlowBoxes(lineInfo.isLastLine(), isLogicallyLastRunWrapped, bidiRuns.logicallyLastRun()->m_object);
+    lastRootBox()->determineSpacingForFlowBoxes(lineInfo.isLastLine(), isLogicallyLastRunWrapped, bidiRuns.logicallyLastRun()->m_object);
 
     // Now mark the line boxes as being constructed.
-    lastLineBox()->setConstructed();
+    lastRootBox()->setConstructed();
 
     // Return the last line.
     return lastRootBox();
@@ -1854,11 +1854,11 @@
         layoutLineGridBox();
 
     RenderFlowThread* flowThread = flowThreadContainingBlock();
-    bool clearLinesForPagination = firstLineBox() && flowThread && !flowThread->hasRegions();
+    bool clearLinesForPagination = firstRootBox() && flowThread && !flowThread->hasRegions();
 
     // Figure out if we should clear out our line boxes.
     // FIXME: Handle resize eventually!
-    bool isFullLayout = !firstLineBox() || selfNeedsLayout() || relayoutChildren || clearLinesForPagination;
+    bool isFullLayout = !firstRootBox() || selfNeedsLayout() || relayoutChildren || clearLinesForPagination;
     LineLayoutState layoutState(isFullLayout, repaintLogicalTop, repaintLogicalBottom, flowThread);
 
     if (isFullLayout)
@@ -1941,7 +1941,7 @@
     // Now add in the bottom border/padding.
     setLogicalHeight(logicalHeight() + lastLineAnnotationsAdjustment + borderAndPaddingAfter() + scrollbarLogicalHeight());
 
-    if (!firstLineBox() && hasLineIfEmpty())
+    if (!firstRootBox() && hasLineIfEmpty())
         setLogicalHeight(logicalHeight() + lineHeight(true, isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes));
 
     // See if we have any lines that spill out of our block.  If we do, then we will possibly need to
@@ -2031,7 +2031,7 @@
         m_lineBoxes.deleteLineBoxTree();
         curr = 0;
 
-        ASSERT(!firstLineBox() && !lastLineBox());
+        ASSERT(!firstRootBox() && !lastRootBox());
     } else {
         if (curr) {
             // We have a dirty line.

Modified: trunk/Source/WebCore/rendering/RenderTextTrackCue.cpp (158729 => 158730)


--- trunk/Source/WebCore/rendering/RenderTextTrackCue.cpp	2013-11-06 08:05:09 UTC (rev 158729)
+++ trunk/Source/WebCore/rendering/RenderTextTrackCue.cpp	2013-11-06 08:09:44 UTC (rev 158730)
@@ -68,7 +68,7 @@
     RenderBlock* parentBlock = containingBlock();
     firstLineBox = toRenderInline(firstChild())->firstLineBox();
     if (!firstLineBox)
-        firstLineBox = this->firstLineBox();
+        firstLineBox = this->firstRootBox();
 
     // 1. Horizontal: Let step be the height of the first line box in boxes.
     //    Vertical: Let step be the width of the first line box in boxes.

Modified: trunk/Source/WebCore/rendering/svg/SVGTextQuery.cpp (158729 => 158730)


--- trunk/Source/WebCore/rendering/svg/SVGTextQuery.cpp	2013-11-06 08:05:09 UTC (rev 158729)
+++ trunk/Source/WebCore/rendering/svg/SVGTextQuery.cpp	2013-11-06 08:09:44 UTC (rev 158730)
@@ -61,8 +61,8 @@
         RenderBlockFlow& renderBlock = toRenderBlockFlow(*renderer);
 
         // RenderSVGText only ever contains a single line box.
-        InlineFlowBox* flowBox = renderBlock.firstLineBox();
-        ASSERT(flowBox == renderBlock.lastLineBox());
+        auto flowBox = renderBlock.firstRootBox();
+        ASSERT(flowBox == renderBlock.lastRootBox());
         return flowBox;
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to