Position RenderedPosition::positionAtLeftBoundaryOfBiDiRun() const { ASSERT(atLeftBoundaryOfBidiRun()); if (atLeftmostOffsetInBox()) return Position::editingPositionOf(m_layoutObject->node(), m_offset); return Position::editingPositionOf(nextLeafChild()->layoutObject().node(), nextLeafChild()->caretLeftmostOffset()); }
Position RenderedPosition::positionAtLeftBoundaryOfBiDiRun() const { ASSERT(atLeftBoundaryOfBidiRun()); if (atLeftmostOffsetInBox()) return createLegacyEditingPosition(m_renderer->node(), m_offset); return createLegacyEditingPosition(nextLeafChild()->renderer().node(), nextLeafChild()->caretLeftmostOffset()); }
bool RenderedPosition::atRightBoundaryOfBidiRun(ShouldMatchBidiLevel shouldMatchBidiLevel, unsigned char bidiLevelOfRun) const { if (!m_inlineBox) return false; if (atRightmostOffsetInBox()) { if (shouldMatchBidiLevel == IgnoreBidiLevel) return !nextLeafChild() || nextLeafChild()->bidiLevel() < m_inlineBox->bidiLevel(); return m_inlineBox->bidiLevel() >= bidiLevelOfRun && (!nextLeafChild() || nextLeafChild()->bidiLevel() < bidiLevelOfRun); } if (atLeftmostOffsetInBox()) { if (shouldMatchBidiLevel == IgnoreBidiLevel) return prevLeafChild() && m_inlineBox->bidiLevel() < prevLeafChild()->bidiLevel(); return prevLeafChild() && m_inlineBox->bidiLevel() < bidiLevelOfRun && prevLeafChild()->bidiLevel() >= bidiLevelOfRun; } return false; }
unsigned char RenderedPosition::bidiLevelOnLeft() const { InlineBox* box = atLeftmostOffsetInBox() ? prevLeafChild() : m_inlineBox; return box ? box->bidiLevel() : 0; }
bool RenderedPosition::isEquivalent(const RenderedPosition& other) const { return (m_layoutObject == other.m_layoutObject && m_inlineBox == other.m_inlineBox && m_offset == other.m_offset) || (atLeftmostOffsetInBox() && other.atRightmostOffsetInBox() && prevLeafChild() == other.m_inlineBox) || (atRightmostOffsetInBox() && other.atLeftmostOffsetInBox() && nextLeafChild() == other.m_inlineBox); }