示例#1
0
RenderedPosition::RenderedPosition(const Position& position, EAffinity affinity)
    : m_offset(0)
    , m_prevLeafChild(uncachedInlineBox())
    , m_nextLeafChild(uncachedInlineBox())
{
    if (position.isNull())
        return;
    position.getInlineBoxAndOffset(affinity, m_inlineBox, m_offset);
    if (m_inlineBox)
        m_renderer = &m_inlineBox->renderer();
    else
        m_renderer = rendererFromPosition(position);
}
示例#2
0
RenderedPosition::RenderedPosition(const VisiblePosition& position)
    : m_offset(0)
    , m_prevLeafChild(uncachedInlineBox())
    , m_nextLeafChild(uncachedInlineBox())
{
    if (position.isNull())
        return;
    position.getInlineBoxAndOffset(m_inlineBox, m_offset);
    if (m_inlineBox)
        m_renderer = &m_inlineBox->renderer();
    else
        m_renderer = rendererFromPosition(position.deepEquivalent());
}
RenderedPosition::RenderedPosition(const Position& position, EAffinity affinity)
    : m_layoutObject(nullptr)
    , m_inlineBox(nullptr)
    , m_offset(0)
    , m_prevLeafChild(uncachedInlineBox())
    , m_nextLeafChild(uncachedInlineBox())
{
    if (position.isNull())
        return;
    position.getInlineBoxAndOffset(affinity, m_inlineBox, m_offset);
    if (m_inlineBox)
        m_layoutObject = &m_inlineBox->layoutObject();
    else
        m_layoutObject = layoutObjectFromPosition(position);
}
RenderedPosition::RenderedPosition(const Position& position, TextAffinity affinity)
    : m_layoutObject(nullptr)
    , m_inlineBox(nullptr)
    , m_offset(0)
    , m_prevLeafChild(uncachedInlineBox())
    , m_nextLeafChild(uncachedInlineBox())
{
    if (position.isNull())
        return;
    InlineBoxPosition boxPosition = computeInlineBoxPosition(position, affinity);
    m_inlineBox = boxPosition.inlineBox;
    m_offset = boxPosition.offsetInBox;
    if (m_inlineBox)
        m_layoutObject = &m_inlineBox->layoutObject();
    else
        m_layoutObject = layoutObjectFromPosition(position);
}
RenderedPosition::RenderedPosition(const VisiblePosition& position)
    : m_layoutObject(nullptr)
    , m_inlineBox(nullptr)
    , m_offset(0)
    , m_prevLeafChild(uncachedInlineBox())
    , m_nextLeafChild(uncachedInlineBox())
{
    if (position.isNull())
        return;
    InlineBoxPosition boxPosition = position.computeInlineBoxPosition();
    m_inlineBox = boxPosition.inlineBox;
    m_offset = boxPosition.offsetInBox;
    if (m_inlineBox)
        m_layoutObject = &m_inlineBox->layoutObject();
    else
        m_layoutObject = layoutObjectFromPosition(position.deepEquivalent());
}
InlineBox* RenderedPosition::nextLeafChild() const
{
    if (m_nextLeafChild == uncachedInlineBox())
        m_nextLeafChild = m_inlineBox->nextLeafChildIgnoringLineBreak();
    return m_nextLeafChild;
}
示例#7
0
InlineBox* RenderedPosition::prevLeafChild() const
{
    if (m_prevLeafChild == uncachedInlineBox())
        m_prevLeafChild = m_inlineBox->prevLeafChild();
    return m_prevLeafChild;
}