Commit 92605a32 authored by jbroman@chromium.org's avatar jbroman@chromium.org

When accessing line boxes, use RenderBlockFlow instead of RenderBlock.

BUG=393945, 302024

Review URL: https://codereview.chromium.org/390173003

git-svn-id: svn://svn.chromium.org/blink/trunk@178516 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent f4dbda06
......@@ -4218,21 +4218,21 @@ static bool shouldCheckLines(RenderObject* obj)
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 (block->isRenderBlockFlow() && block->childrenInline()) {
for (RootInlineBox* box = toRenderBlockFlow(block)->firstRootBox(); box; box = box->nextRootBox()) {
if (++count == l)
return box->lineBottom() + (includeBottom ? (block->borderBottom() + block->paddingBottom()) : LayoutUnit());
}
}
else {
} 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())
} else if (!obj->isFloatingOrOutOfFlowPositioned()) {
normalFlowChildWithoutLines = obj;
}
}
if (normalFlowChildWithoutLines && l == 0)
return normalFlowChildWithoutLines->y() + normalFlowChildWithoutLines->height();
......
......@@ -81,11 +81,16 @@ public:
LayoutUnit minLineHeightForReplacedRenderer(bool isFirstLine, LayoutUnit replacedHeight) const;
protected:
RenderLineBoxList* lineBoxes() { return &m_lineBoxes; }
InlineFlowBox* firstLineBox() const { return m_lineBoxes.firstLineBox(); }
InlineFlowBox* lastLineBox() const { return m_lineBoxes.lastLineBox(); }
RootInlineBox* firstRootBox() const { return static_cast<RootInlineBox*>(firstLineBox()); }
RootInlineBox* lastRootBox() const { return static_cast<RootInlineBox*>(lastLineBox()); }
public:
// FIXME-BLOCKFLOW: Remove virtualizaion when all callers have moved to RenderBlockFlow
virtual void deleteLineBoxTree();
......@@ -152,9 +157,6 @@ public:
LayoutUnit blockDirectionOffset(const LayoutSize& offsetFromBlock) const;
LayoutUnit inlineDirectionOffset(const LayoutSize& offsetFromBlock) const;
RootInlineBox* firstRootBox() const { return static_cast<RootInlineBox*>(firstLineBox()); }
RootInlineBox* lastRootBox() const { return static_cast<RootInlineBox*>(lastLineBox()); }
virtual bool shouldPaintSelectionGaps() const OVERRIDE FINAL;
GapRects selectionGapRectsForRepaint(const RenderLayerModelObject* repaintContainer);
LayoutRect logicalLeftSelectionGap(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
......
......@@ -86,6 +86,14 @@ public:
: logicalWidth() - logicalRightOffsetForLine(position, shouldIndentText, logicalHeight);
}
// FIXME-BLOCKFLOW: Move this into RenderBlockFlow once there are no calls
// in RenderBlock. http://crbug.com/393945, http://crbug.com/302024
using RenderBlock::lineBoxes;
using RenderBlock::firstLineBox;
using RenderBlock::lastLineBox;
using RenderBlock::firstRootBox;
using RenderBlock::lastRootBox;
virtual LayoutUnit logicalLeftSelectionOffset(RenderBlock* rootBlock, LayoutUnit position) OVERRIDE;
virtual LayoutUnit logicalRightSelectionOffset(RenderBlock* rootBlock, LayoutUnit position) OVERRIDE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment