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

Reviewed by Antti Koivisto.

- Move truncation (e.g. line clamp and ellipse) support to RenderBlockFlow.

* rendering/EllipsisBox.cpp:
(WebCore::EllipsisBox::EllipsisBox):
(WebCore::EllipsisBox::paint):
(WebCore::EllipsisBox::markupBox):
(WebCore::EllipsisBox::selectionRect):
(WebCore::EllipsisBox::paintSelection):
(WebCore::EllipsisBox::nodeAtPoint):
* rendering/EllipsisBox.h:
* rendering/RenderBlock.cpp:
* rendering/RenderBlock.h:
* rendering/RenderBlockFlow.cpp:
(WebCore::shouldCheckLines):
(WebCore::RenderBlockFlow::lineAtIndex):
(WebCore::RenderBlockFlow::lineCount):
(WebCore::getHeightForLineCount):
(WebCore::RenderBlockFlow::heightForLineCount):
(WebCore::RenderBlockFlow::clearTruncation):
* rendering/RenderBlockFlow.h:
* rendering/RenderDeprecatedFlexibleBox.cpp:
(WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
(WebCore::RenderDeprecatedFlexibleBox::clearLineClamp):
* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::placeEllipsis):

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

Source/WebCore/ChangeLog
Source/WebCore/rendering/EllipsisBox.cpp
Source/WebCore/rendering/EllipsisBox.h
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBlock.h
Source/WebCore/rendering/RenderBlockFlow.cpp
Source/WebCore/rendering/RenderBlockFlow.h
Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp
Source/WebCore/rendering/RootInlineBox.cpp

index b1a812d..0aca8e5 100644 (file)
@@ -1,3 +1,36 @@
+2013-10-18  Sam Weinig  <sam@webkit.org>
+
+        Move m_lineBoxes from RenderBlock to RenderBlockFlow (Part 2)
+        https://bugs.webkit.org/show_bug.cgi?id=122969
+
+        Reviewed by Antti Koivisto.
+
+        - Move truncation (e.g. line clamp and ellipse) support to RenderBlockFlow.
+
+        * rendering/EllipsisBox.cpp:
+        (WebCore::EllipsisBox::EllipsisBox):
+        (WebCore::EllipsisBox::paint):
+        (WebCore::EllipsisBox::markupBox):
+        (WebCore::EllipsisBox::selectionRect):
+        (WebCore::EllipsisBox::paintSelection):
+        (WebCore::EllipsisBox::nodeAtPoint):
+        * rendering/EllipsisBox.h:
+        * rendering/RenderBlock.cpp:
+        * rendering/RenderBlock.h:
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::shouldCheckLines):
+        (WebCore::RenderBlockFlow::lineAtIndex):
+        (WebCore::RenderBlockFlow::lineCount):
+        (WebCore::getHeightForLineCount):
+        (WebCore::RenderBlockFlow::heightForLineCount):
+        (WebCore::RenderBlockFlow::clearTruncation):
+        * rendering/RenderBlockFlow.h:
+        * rendering/RenderDeprecatedFlexibleBox.cpp:
+        (WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
+        (WebCore::RenderDeprecatedFlexibleBox::clearLineClamp):
+        * rendering/RootInlineBox.cpp:
+        (WebCore::RootInlineBox::placeEllipsis):
+
 2013-10-19  Andreas Kling  <akling@apple.com>
 
         StyleResolver should deal in PassRef<RenderStyle> where possible.
index ba18841..b3b7497 100644 (file)
 #include "HitTestResult.h"
 #include "InlineTextBox.h"
 #include "PaintInfo.h"
-#include "RenderBlock.h"
 #include "RootInlineBox.h"
 #include "TextRun.h"
 
 namespace WebCore {
 
-EllipsisBox::EllipsisBox(RenderBlock& renderer, const AtomicString& ellipsisStr, InlineFlowBox* parent, int width, int height, int y, bool firstLine, bool isVertical, InlineBox* markupBox)
+EllipsisBox::EllipsisBox(RenderBlockFlow& renderer, const AtomicString& ellipsisStr, InlineFlowBox* parent, int width, int height, int y, bool firstLine, bool isVertical, InlineBox* markupBox)
     : InlineBox(renderer, FloatPoint(0, y), width, firstLine, true, false, false, isVertical, 0, 0, parent)
     , m_shouldPaintMarkupBox(markupBox)
     , m_height(height)
@@ -60,13 +59,13 @@ void EllipsisBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, La
         paintSelection(context, paintOffset, lineStyle, font);
 
         // Select the correct color for painting the text.
-        Color foreground = paintInfo.forceBlackText() ? Color::black : renderer().selectionForegroundColor();
+        Color foreground = paintInfo.forceBlackText() ? Color::black : blockFlow().selectionForegroundColor();
         if (foreground.isValid() && foreground != textColor)
             context->setFillColor(foreground, lineStyle.colorSpace());
     }
 
     // FIXME: Why is this always LTR? Fix by passing correct text run flags below.
-    context->drawText(font, RenderBlock::constructTextRun(&renderer(), font, m_str, lineStyle, TextRun::AllowTrailingExpansion), LayoutPoint(x() + paintOffset.x(), y() + paintOffset.y() + lineStyle.fontMetrics().ascent()));
+    context->drawText(font, RenderBlock::constructTextRun(&blockFlow(), font, m_str, lineStyle, TextRun::AllowTrailingExpansion), LayoutPoint(x() + paintOffset.x(), y() + paintOffset.y() + lineStyle.fontMetrics().ascent()));
 
     // Restore the regular fill color.
     if (textColor != context->fillColor())
@@ -83,7 +82,7 @@ InlineBox* EllipsisBox::markupBox() const
     if (!m_shouldPaintMarkupBox)
         return 0;
 
-    RootInlineBox* lastLine = renderer().lineAtIndex(renderer().lineCount() - 1);
+    RootInlineBox* lastLine = blockFlow().lineAtIndex(blockFlow().lineCount() - 1);
     if (!lastLine)
         return 0;
 
@@ -114,13 +113,13 @@ IntRect EllipsisBox::selectionRect()
     const Font& font = lineStyle.font();
     const RootInlineBox& rootBox = root();
     // FIXME: Why is this always LTR? Fix by passing correct text run flags below.
-    return enclosingIntRect(font.selectionRectForText(RenderBlock::constructTextRun(&renderer(), font, m_str, lineStyle, TextRun::AllowTrailingExpansion), IntPoint(x(), y() + rootBox.selectionTopAdjustedForPrecedingBlock()), rootBox.selectionHeightAdjustedForPrecedingBlock()));
+    return enclosingIntRect(font.selectionRectForText(RenderBlock::constructTextRun(&blockFlow(), font, m_str, lineStyle, TextRun::AllowTrailingExpansion), IntPoint(x(), y() + rootBox.selectionTopAdjustedForPrecedingBlock()), rootBox.selectionHeightAdjustedForPrecedingBlock()));
 }
 
 void EllipsisBox::paintSelection(GraphicsContext* context, const LayoutPoint& paintOffset, const RenderStyle& style, const Font& font)
 {
     Color textColor = style.visitedDependentColor(CSSPropertyColor);
-    Color c = renderer().selectionBackgroundColor();
+    Color c = blockFlow().selectionBackgroundColor();
     if (!c.isValid() || !c.alpha())
         return;
 
@@ -138,7 +137,7 @@ void EllipsisBox::paintSelection(GraphicsContext* context, const LayoutPoint& pa
     GraphicsContextStateSaver stateSaver(*context);
     context->clip(clipRect);
     // FIXME: Why is this always LTR? Fix by passing correct text run flags below.
-    context->drawHighlightForText(font, RenderBlock::constructTextRun(&renderer(), font, m_str, style, TextRun::AllowTrailingExpansion), roundedIntPoint(LayoutPoint(x() + paintOffset.x(), y() + paintOffset.y() + top)), h, c, style.colorSpace());
+    context->drawHighlightForText(font, RenderBlock::constructTextRun(&blockFlow(), font, m_str, style, TextRun::AllowTrailingExpansion), roundedIntPoint(LayoutPoint(x() + paintOffset.x(), y() + paintOffset.y() + top)), h, c, style.colorSpace());
 }
 
 bool EllipsisBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom)
@@ -151,15 +150,15 @@ bool EllipsisBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu
         LayoutUnit mtx = adjustedLocation.x() + m_logicalWidth - markupBox->x();
         LayoutUnit mty = adjustedLocation.y() + lineStyle.fontMetrics().ascent() - (markupBox->y() + markupBox->lineStyle().fontMetrics().ascent());
         if (markupBox->nodeAtPoint(request, result, locationInContainer, LayoutPoint(mtx, mty), lineTop, lineBottom)) {
-            renderer().updateHitTestResult(result, locationInContainer.point() - LayoutSize(mtx, mty));
+            blockFlow().updateHitTestResult(result, locationInContainer.point() - LayoutSize(mtx, mty));
             return true;
         }
     }
 
     LayoutRect boundsRect(adjustedLocation, LayoutSize(m_logicalWidth, m_height));
     if (visibleToHitTesting() && boundsRect.intersects(HitTestLocation::rectForPoint(locationInContainer.point(), 0, 0, 0, 0))) {
-        renderer().updateHitTestResult(result, locationInContainer.point() - toLayoutSize(adjustedLocation));
-        if (!result.addNodeToRectBasedTestResult(renderer().element(), request, locationInContainer, boundsRect))
+        blockFlow().updateHitTestResult(result, locationInContainer.point() - toLayoutSize(adjustedLocation));
+        if (!result.addNodeToRectBasedTestResult(blockFlow().element(), request, locationInContainer, boundsRect))
             return true;
     }
 
index 439254c..8fc5ef4 100644 (file)
@@ -21,7 +21,7 @@
 #define EllipsisBox_h
 
 #include "InlineBox.h"
-#include "RenderBlock.h"
+#include "RenderBlockFlow.h"
 
 namespace WebCore {
 
@@ -30,13 +30,13 @@ class HitTestResult;
 
 class EllipsisBox FINAL : public InlineBox {
 public:
-    EllipsisBox(RenderBlock&, const AtomicString& ellipsisStr, InlineFlowBox* parent, int width, int height, int y, bool firstLine, bool isVertical, InlineBox* markupBox);
+    EllipsisBox(RenderBlockFlow&, const AtomicString& ellipsisStr, InlineFlowBox* parent, int width, int height, int y, bool firstLine, bool isVertical, InlineBox* markupBox);
     virtual void paint(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, LayoutUnit lineBottom);
     virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom) OVERRIDE;
     void setSelectionState(RenderObject::SelectionState s) { m_selectionState = s; }
     IntRect selectionRect();
 
-    RenderBlock& renderer() const { return toRenderBlock(InlineBox::renderer()); }
+    RenderBlockFlow& blockFlow() const { return toRenderBlockFlow(InlineBox::renderer()); }
 
 private:
     void paintMarkupBox(PaintInfo&, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom, const RenderStyle&);
index afc052e..cd8a985 100644 (file)
@@ -5181,100 +5181,6 @@ void RenderBlock::updateFirstLetter()
     createFirstLetterRenderer(firstLetterBlock, toRenderText(descendant));
 }
 
-// Helper methods for obtaining the last line, computing line counts and heights for line counts
-// (crawling into blocks).
-static bool shouldCheckLines(RenderObject* obj)
-{
-    return !obj->isFloatingOrOutOfFlowPositioned() && !obj->isRunIn()
-            && obj->isRenderBlock() && obj->style()->height().isAuto()
-            && (!obj->isDeprecatedFlexibleBox() || obj->style()->boxOrient() == VERTICAL);
-}
-
-static int getHeightForLineCount(RenderBlock* block, int l, bool includeBottom, int& count)
-{
-    if (block->style()->visibility() == VISIBLE) {
-        if (block->childrenInline()) {
-            for (RootInlineBox* box = block->firstRootBox(); box; box = box->nextRootBox()) {
-                if (++count == l)
-                    return box->lineBottom() + (includeBottom ? (block->borderBottom() + block->paddingBottom()) : LayoutUnit());
-            }
-        }
-        else {
-            RenderBox* normalFlowChildWithoutLines = 0;
-            for (RenderBox* obj = block->firstChildBox(); obj; obj = obj->nextSiblingBox()) {
-                if (shouldCheckLines(obj)) {
-                    int result = getHeightForLineCount(toRenderBlock(obj), l, false, count);
-                    if (result != -1)
-                        return result + obj->y() + (includeBottom ? (block->borderBottom() + block->paddingBottom()) : LayoutUnit());
-                } else if (!obj->isFloatingOrOutOfFlowPositioned() && !obj->isRunIn())
-                    normalFlowChildWithoutLines = obj;
-            }
-            if (normalFlowChildWithoutLines && l == 0)
-                return normalFlowChildWithoutLines->y() + normalFlowChildWithoutLines->height();
-        }
-    }
-    
-    return -1;
-}
-
-RootInlineBox* RenderBlock::lineAtIndex(int i) const
-{
-    ASSERT(i >= 0);
-
-    if (style()->visibility() != VISIBLE)
-        return 0;
-
-    if (childrenInline()) {
-        for (RootInlineBox* box = firstRootBox(); box; box = box->nextRootBox())
-            if (!i--)
-                return box;
-    } else {
-        for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
-            if (!shouldCheckLines(child))
-                continue;
-            if (RootInlineBox* box = toRenderBlock(child)->lineAtIndex(i))
-                return box;
-        }
-    }
-
-    return 0;
-}
-
-int RenderBlock::lineCount(const RootInlineBox* stopRootInlineBox, bool* found) const
-{
-    int count = 0;
-
-    if (style()->visibility() == VISIBLE) {
-        if (childrenInline())
-            for (RootInlineBox* box = firstRootBox(); box; box = box->nextRootBox()) {
-                count++;
-                if (box == stopRootInlineBox) {
-                    if (found)
-                        *found = true;
-                    break;
-                }
-            }
-        else
-            for (RenderObject* obj = firstChild(); obj; obj = obj->nextSibling())
-                if (shouldCheckLines(obj)) {
-                    bool recursiveFound = false;
-                    count += toRenderBlock(obj)->lineCount(stopRootInlineBox, &recursiveFound);
-                    if (recursiveFound) {
-                        if (found)
-                            *found = true;
-                        break;
-                    }
-                }
-    }
-    return count;
-}
-
-int RenderBlock::heightForLineCount(int l)
-{
-    int count = 0;
-    return getHeightForLineCount(this, l, true, count);
-}
-
 void RenderBlock::adjustForBorderFit(LayoutUnit x, LayoutUnit& left, LayoutUnit& right) const
 {
     // We don't deal with relative positioning.  Our assumption is that you shrink to fit the lines without accounting
@@ -5330,22 +5236,6 @@ void RenderBlock::fitBorderToLinesIfNeeded()
     clearOverrideLogicalContentWidth();
 }
 
-void RenderBlock::clearTruncation()
-{
-    if (style()->visibility() == VISIBLE) {
-        if (childrenInline() && hasMarkupTruncation()) {
-            setHasMarkupTruncation(false);
-            for (RootInlineBox* box = firstRootBox(); box; box = box->nextRootBox())
-                box->clearTruncation();
-        } else {
-            for (RenderObject* obj = firstChild(); obj; obj = obj->nextSibling()) {
-                if (shouldCheckLines(obj))
-                    toRenderBlock(obj)->clearTruncation();
-            }
-        }
-    }
-}
-
 void RenderBlock::setPaginationStrut(LayoutUnit strut)
 {
     if (!m_rareData) {
index 48ae40f..6f5434e 100644 (file)
@@ -143,9 +143,6 @@ public:
     static void clearPercentHeightDescendantsFrom(RenderBox*);
     static void removePercentHeightDescendantIfNeeded(RenderBox*);
 
-    void setHasMarkupTruncation(bool b) { m_hasMarkupTruncation = b; }
-    bool hasMarkupTruncation() const { return m_hasMarkupTruncation; }
-
     void setHasMarginBeforeQuirk(bool b) { m_hasMarginBeforeQuirk = b; }
     void setHasMarginAfterQuirk(bool b) { m_hasMarginAfterQuirk = b; }
 
@@ -250,12 +247,6 @@ public:
 
     LayoutRect logicalRectToPhysicalRect(const LayoutPoint& physicalPosition, const LayoutRect& logicalRect);
 
-    // Helper methods for computing line counts and heights for line counts.
-    RootInlineBox* lineAtIndex(int) const;
-    int lineCount(const RootInlineBox* = 0, bool* = 0) const;
-    int heightForLineCount(int);
-    void clearTruncation();
-
     void adjustRectForColumns(LayoutRect&) const;
     virtual void adjustForColumns(LayoutSize&, const LayoutPoint&) const OVERRIDE FINAL;
     void adjustForColumnRect(LayoutSize& offset, const LayoutPoint& locationInContainer) const;
index d4fd9f1..1c415cb 100644 (file)
@@ -2411,4 +2411,116 @@ void RenderBlockFlow::setRenderNamedFlowFragment(RenderNamedFlowFragment* flowFr
     m_rareData->m_renderNamedFlowFragment = flowFragment;
 }
 
+static bool shouldCheckLines(RenderObject& obj)
+{
+    return !obj.isFloatingOrOutOfFlowPositioned() && !obj.isRunIn() && obj.isRenderBlockFlow() && obj.style()->height().isAuto() && (!obj.isDeprecatedFlexibleBox() || obj.style()->boxOrient() == VERTICAL);
+}
+
+RootInlineBox* RenderBlockFlow::lineAtIndex(int i) const
+{
+    ASSERT(i >= 0);
+
+    if (style()->visibility() != VISIBLE)
+        return nullptr;
+
+    if (childrenInline()) {
+        for (auto box = firstRootBox(); box; box = box->nextRootBox()) {
+            if (!i--)
+                return box;
+        }
+    } else {
+        for (auto child = firstChild(); child; child = child->nextSibling()) {
+            if (!shouldCheckLines(*child))
+                continue;
+            if (RootInlineBox* box = toRenderBlockFlow(child)->lineAtIndex(i))
+                return box;
+        }
+    }
+
+    return nullptr;
+}
+
+int RenderBlockFlow::lineCount(const RootInlineBox* stopRootInlineBox, bool* found) const
+{
+    if (style()->visibility() != VISIBLE)
+        return 0;
+
+    int count = 0;
+
+    if (childrenInline()) {
+        for (auto box = firstRootBox(); box; box = box->nextRootBox()) {
+            count++;
+            if (box == stopRootInlineBox) {
+                if (found)
+                    *found = true;
+                break;
+            }
+        }
+    } else {
+        for (auto child = firstChild(); child; child = child->nextSibling()) {
+            if (shouldCheckLines(*child)) {
+                bool recursiveFound = false;
+                count += toRenderBlockFlow(child)->lineCount(stopRootInlineBox, &recursiveFound);
+                if (recursiveFound) {
+                    if (found)
+                        *found = true;
+                    break;
+                }
+            }
+        }
+    }
+
+    return count;
+}
+
+static int getHeightForLineCount(const RenderBlockFlow& block, int lineCount, bool includeBottom, int& count)
+{
+    if (block.style()->visibility() != VISIBLE)
+        return -1;
+
+    if (block.childrenInline()) {
+        for (auto box = block.firstRootBox(); box; box = box->nextRootBox()) {
+            if (++count == lineCount)
+                return box->lineBottom() + (includeBottom ? (block.borderBottom() + block.paddingBottom()) : LayoutUnit());
+        }
+    } else {
+        RenderBox* normalFlowChildWithoutLines = 0;
+        for (auto obj = block.firstChildBox(); obj; obj = obj->nextSiblingBox()) {
+            if (shouldCheckLines(*obj)) {
+                int result = getHeightForLineCount(toRenderBlockFlow(*obj), lineCount, false, count);
+                if (result != -1)
+                    return result + obj->y() + (includeBottom ? (block.borderBottom() + block.paddingBottom()) : LayoutUnit());
+            } else if (!obj->isFloatingOrOutOfFlowPositioned() && !obj->isRunIn())
+                normalFlowChildWithoutLines = obj;
+        }
+        if (normalFlowChildWithoutLines && !lineCount)
+            return normalFlowChildWithoutLines->y() + normalFlowChildWithoutLines->height();
+    }
+    
+    return -1;
+}
+
+int RenderBlockFlow::heightForLineCount(int lineCount)
+{
+    int count = 0;
+    return getHeightForLineCount(*this, lineCount, true, count);
+}
+
+void RenderBlockFlow::clearTruncation()
+{
+    if (style()->visibility() != VISIBLE)
+        return;
+
+    if (childrenInline() && hasMarkupTruncation()) {
+        setHasMarkupTruncation(false);
+        for (auto box = firstRootBox(); box; box = box->nextRootBox())
+            box->clearTruncation();
+    } else {
+        for (auto child = firstChild(); child; child = child->nextSibling()) {
+            if (shouldCheckLines(*child))
+                toRenderBlockFlow(child)->clearTruncation();
+        }
+    }
+}
+
 } // namespace WebCore
index 9ede098..fabb696 100644 (file)
@@ -296,6 +296,15 @@ public:
             floatingObject->setHeight(logicalWidth);
     }
 
+    // Helper methods for computing line counts and heights for line counts.
+    RootInlineBox* lineAtIndex(int) const;
+    int lineCount(const RootInlineBox* = nullptr, bool* = nullptr) const;
+    int heightForLineCount(int);
+    void clearTruncation();
+
+    void setHasMarkupTruncation(bool b) { m_hasMarkupTruncation = b; }
+    bool hasMarkupTruncation() const { return m_hasMarkupTruncation; }
+
 protected:
     LayoutUnit maxPositiveMarginBefore() const { return m_rareData ? m_rareData->m_margins.positiveMarginBefore() : RenderBlockFlowRareData::positiveMarginBeforeDefault(this); }
     LayoutUnit maxNegativeMarginBefore() const { return m_rareData ? m_rareData->m_margins.negativeMarginBefore() : RenderBlockFlowRareData::negativeMarginBeforeDefault(this); }
index e349366..e7cd02b 100644 (file)
@@ -954,18 +954,18 @@ void RenderDeprecatedFlexibleBox::applyLineClamp(FlexBoxIterator& iterator, bool
 
         child->clearOverrideSize();
         if (relayoutChildren || (child->isReplaced() && (child->style()->width().isPercent() || child->style()->height().isPercent()))
-            || (child->style()->height().isAuto() && child->isRenderBlock())) {
+            || (child->style()->height().isAuto() && child->isRenderBlockFlow())) {
             child->setChildNeedsLayout(MarkOnlyThis);
 
             // Dirty all the positioned objects.
-            if (child->isRenderBlock()) {
-                toRenderBlock(child)->markPositionedObjectsForLayout();
-                toRenderBlock(child)->clearTruncation();
+            if (child->isRenderBlockFlow()) {
+                toRenderBlockFlow(child)->markPositionedObjectsForLayout();
+                toRenderBlockFlow(child)->clearTruncation();
             }
         }
         child->layoutIfNeeded();
-        if (child->style()->height().isAuto() && child->isRenderBlock())
-            maxLineCount = max(maxLineCount, toRenderBlock(child)->lineCount());
+        if (child->style()->height().isAuto() && child->isRenderBlockFlow())
+            maxLineCount = max(maxLineCount, toRenderBlockFlow(child)->lineCount());
     }
 
     // Get the number of lines and then alter all block flow children with auto height to use the
@@ -976,10 +976,10 @@ void RenderDeprecatedFlexibleBox::applyLineClamp(FlexBoxIterator& iterator, bool
         return;
 
     for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
-        if (childDoesNotAffectWidthOrFlexing(child) || !child->style()->height().isAuto() || !child->isRenderBlock())
+        if (childDoesNotAffectWidthOrFlexing(child) || !child->style()->height().isAuto() || !child->isRenderBlockFlow())
             continue;
 
-        RenderBlock* blockChild = toRenderBlock(child);
+        RenderBlockFlow* blockChild = toRenderBlockFlow(child);
         int lineCount = blockChild->lineCount();
         if (lineCount <= numVisibleLines)
             continue;
@@ -1022,8 +1022,8 @@ void RenderDeprecatedFlexibleBox::applyLineClamp(FlexBoxIterator& iterator, bool
         }
 
         // See if this width can be accommodated on the last visible line
-        RenderBlock& destBlock = toRenderBlock(lastVisibleLine->renderer());
-        RenderBlock& srcBlock = toRenderBlock(lastLine->renderer());
+        RenderBlockFlow& destBlock = lastVisibleLine->blockFlow();
+        RenderBlockFlow& srcBlock = lastLine->blockFlow();
 
         // FIXME: Directions of src/destBlock could be different from our direction and from one another.
         if (!srcBlock.style()->isLeftToRightDirection())
@@ -1057,9 +1057,9 @@ void RenderDeprecatedFlexibleBox::clearLineClamp()
             || (child->style()->height().isAuto() && child->isRenderBlock())) {
             child->setChildNeedsLayout();
 
-            if (child->isRenderBlock()) {
-                toRenderBlock(child)->markPositionedObjectsForLayout();
-                toRenderBlock(child)->clearTruncation();
+            if (child->isRenderBlockFlow()) {
+                toRenderBlockFlow(child)->markPositionedObjectsForLayout();
+                toRenderBlockFlow(child)->clearTruncation();
             }
         }
     }
index d72267c..2c30b54 100644 (file)
@@ -128,14 +128,11 @@ bool RootInlineBox::lineCanAccommodateEllipsis(bool ltr, int blockEdge, int line
     return InlineFlowBox::canAccommodateEllipsis(ltr, blockEdge, ellipsisWidth);
 }
 
-float RootInlineBox::placeEllipsis(const AtomicString& ellipsisStr,  bool ltr, float blockLeftEdge, float blockRightEdge, float ellipsisWidth,
-                                  InlineBox* markupBox)
+float RootInlineBox::placeEllipsis(const AtomicString& ellipsisStr,  bool ltr, float blockLeftEdge, float blockRightEdge, float ellipsisWidth, InlineBox* markupBox)
 {
     // Create an ellipsis box.
-    EllipsisBox* ellipsisBox = new (renderer().renderArena()) EllipsisBox(blockFlow(), ellipsisStr, this,
-                                                              ellipsisWidth - (markupBox ? markupBox->logicalWidth() : 0), logicalHeight(),
-                                                              y(), !prevRootBox(), isHorizontal(), markupBox);
-    
+    EllipsisBox* ellipsisBox = new (renderer().renderArena()) EllipsisBox(blockFlow(), ellipsisStr, this, ellipsisWidth - (markupBox ? markupBox->logicalWidth() : 0), logicalHeight(), y(), !prevRootBox(), isHorizontal(), markupBox);
+
     if (!gEllipsisBoxMap)
         gEllipsisBoxMap = new EllipsisBoxMap();
     gEllipsisBoxMap->add(this, ellipsisBox);