Ignore:
Timestamp:
Sep 8, 2013, 7:11:06 PM (12 years ago)
Author:
[email protected]
Message:

InlineBox::root() should return a reference.
<https://webkit.org/b/121014>

Reviewed by Antti Koivisto.

There is always a root inline box, so make root() return a reference.
Also make some effort to cache the result in a local at call sites.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/rendering/RenderReplaced.cpp

    r155026 r155318  
    190190    LayoutUnit bottom = adjustedPaintOffset.y() + visualOverflowRect().maxY();
    191191    if (isSelected() && m_inlineBoxWrapper) {
    192         LayoutUnit selTop = paintOffset.y() + m_inlineBoxWrapper->root()->selectionTop();
    193         LayoutUnit selBottom = paintOffset.y() + selTop + m_inlineBoxWrapper->root()->selectionHeight();
     192        const RootInlineBox& rootBox = m_inlineBoxWrapper->root();
     193        LayoutUnit selTop = paintOffset.y() + rootBox.selectionTop();
     194        LayoutUnit selBottom = paintOffset.y() + selTop + rootBox.selectionHeight();
    194195        top = min(selTop, top);
    195196        bottom = max(selBottom, bottom);
     
    491492    // FIXME: This code is buggy if the replaced element is relative positioned.
    492493    InlineBox* box = inlineBoxWrapper();
    493     RootInlineBox* rootBox = box ? box->root() : 0;
     494    const RootInlineBox* rootBox = box ? &box->root() : 0;
    494495   
    495496    LayoutUnit top = rootBox ? rootBox->selectionTop() : logicalTop();
     
    539540        return LayoutRect(LayoutPoint(), size());
    540541   
    541     RootInlineBox* root = m_inlineBoxWrapper->root();
    542     LayoutUnit newLogicalTop = root->block().style()->isFlippedBlocksWritingMode() ? m_inlineBoxWrapper->logicalBottom() - root->selectionBottom() : root->selectionTop() - m_inlineBoxWrapper->logicalTop();
    543     if (root->block().style()->isHorizontalWritingMode())
    544         return LayoutRect(0, newLogicalTop, width(), root->selectionHeight());
    545     return LayoutRect(newLogicalTop, 0, root->selectionHeight(), height());
     542    const RootInlineBox& rootBox = m_inlineBoxWrapper->root();
     543    LayoutUnit newLogicalTop = rootBox.block().style()->isFlippedBlocksWritingMode() ? m_inlineBoxWrapper->logicalBottom() - rootBox.selectionBottom() : rootBox.selectionTop() - m_inlineBoxWrapper->logicalTop();
     544    if (rootBox.block().style()->isHorizontalWritingMode())
     545        return LayoutRect(0, newLogicalTop, width(), rootBox.selectionHeight());
     546    return LayoutRect(newLogicalTop, 0, rootBox.selectionHeight(), height());
    546547}
    547548
     
    552553
    553554    if (m_inlineBoxWrapper && canUpdateSelectionOnRootLineBoxes())
    554         if (RootInlineBox* root = m_inlineBoxWrapper->root())
    555             root->setHasSelectedChildren(isSelected());
     555        m_inlineBoxWrapper->root().setHasSelectedChildren(isSelected());
    556556}
    557557
Note: See TracChangeset for help on using the changeset viewer.