Rename InlineBox::nextLeafChild to nextLeafOnLine
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Sep 2019 14:23:03 +0000 (14:23 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Sep 2019 14:23:03 +0000 (14:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=202197

Reviewed by Zalan Bujtas.

The name is confusing as it never returns a child of the inline box it is called on.
Rename it and other similar functions that traverse within a line.

* dom/Position.cpp:
(WebCore::Position::getInlineBoxAndOffset const):
* editing/RenderedPosition.cpp:
(WebCore::RenderedPosition::RenderedPosition):
(WebCore::RenderedPosition::previousLeafOnLine const):
(WebCore::RenderedPosition::nextLeafOnLine const):
(WebCore::RenderedPosition::isEquivalent const):
(WebCore::RenderedPosition::bidiLevelOnLeft const):
(WebCore::RenderedPosition::bidiLevelOnRight const):
(WebCore::RenderedPosition::leftBoundaryOfBidiRun):
(WebCore::RenderedPosition::rightBoundaryOfBidiRun):
(WebCore::RenderedPosition::atLeftBoundaryOfBidiRun const):
(WebCore::RenderedPosition::atRightBoundaryOfBidiRun const):
(WebCore::RenderedPosition::positionAtLeftBoundaryOfBiDiRun const):
(WebCore::RenderedPosition::positionAtRightBoundaryOfBiDiRun const):
(WebCore::RenderedPosition::prevLeafChild const): Deleted.
(WebCore::RenderedPosition::nextLeafChild const): Deleted.
* editing/RenderedPosition.h:
(WebCore::RenderedPosition::RenderedPosition):
* editing/VisiblePosition.cpp:
(WebCore::VisiblePosition::leftVisuallyDistinctCandidate const):
(WebCore::VisiblePosition::rightVisuallyDistinctCandidate const):
* editing/VisibleUnits.cpp:
(WebCore::startPositionForLine):
(WebCore::endPositionForLine):
(WebCore::previousLinePosition):
(WebCore::nextLinePosition):
* layout/Verification.cpp:
(WebCore::Layout::collectFlowBoxSubtree):
* rendering/ComplexLineLayout.cpp:
(WebCore::ComplexLineLayout::updateRubyForJustifiedText):
(WebCore::expansionBehaviorForInlineTextBox):
(WebCore::ComplexLineLayout::computeInlineDirectionPositionsForSegment):
(WebCore::ComplexLineLayout::layoutRunsAndFloats):
* rendering/InlineBox.cpp:
(WebCore::InlineBox::previousOnLineExists const):
(WebCore::InlineBox::nextLeafOnLine const):
(WebCore::InlineBox::previousLeafOnLine const):
(WebCore::InlineBox::nextLeafOnLineIgnoringLineBreak const):
(WebCore::InlineBox::previousLeafOnLineIgnoringLineBreak const):
(WebCore::InlineBox::nextLeafChild const): Deleted.
(WebCore::InlineBox::prevLeafChild const): Deleted.
(WebCore::InlineBox::nextLeafChildIgnoringLineBreak const): Deleted.
(WebCore::InlineBox::prevLeafChildIgnoringLineBreak const): Deleted.
* rendering/InlineBox.h:
(WebCore::InlineBox::nextOnLine const):
(WebCore::InlineBox::previousOnLine const):
(WebCore::InlineBox::setNextOnLine):
(WebCore::InlineBox::setPreviousOnLine):
(WebCore::InlineBox::InlineBox):
(WebCore::InlineBox::prevOnLine const): Deleted.
(WebCore::InlineBox::setPrevOnLine): Deleted.
* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::addToLine):
(WebCore::InlineFlowBox::removeChild):
(WebCore::InlineFlowBox::nodeAtPoint):
(WebCore::InlineFlowBox::firstLeafDescendant const):
(WebCore::InlineFlowBox::lastLeafDescendant const):
(WebCore::InlineFlowBox::placeEllipsisBox):
(WebCore::InlineFlowBox::collectLeafBoxesInLogicalOrder const):
(WebCore::InlineFlowBox::checkConsistency const):
(WebCore::InlineFlowBox::firstLeafChild const): Deleted.
(WebCore::InlineFlowBox::lastLeafChild const): Deleted.
* rendering/InlineFlowBox.h:
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::expansionBehavior const):
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::containsNonZeroBidiLevel const):
(WebCore::RenderBlockFlow::positionForPointWithInlineChildren):
* rendering/RenderCounter.cpp:
(WebCore::RenderCounter::rendererRemovedFromTree):
* rendering/RenderTextLineBoxes.cpp:
(WebCore::lineDirectionPointFitsInBox):
(WebCore::createVisiblePositionAfterAdjustingOffsetForBiDi):
(WebCore::RenderTextLineBoxes::positionForPoint const):
* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::isHyphenated const):
(WebCore::RootInlineBox::lineSelectionGap):
(WebCore::RootInlineBox::selectionState):
(WebCore::RootInlineBox::firstSelectedBox):
(WebCore::RootInlineBox::lastSelectedBox):
(WebCore::RootInlineBox::closestLeafChildForLogicalLeftPosition):
* rendering/svg/SVGRootInlineBox.cpp:
(WebCore::SVGRootInlineBox::closestLeafChildForPosition):
(WebCore::SVGRootInlineBox::nodeAtPoint):

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

17 files changed:
Source/WebCore/ChangeLog
Source/WebCore/dom/Position.cpp
Source/WebCore/editing/RenderedPosition.cpp
Source/WebCore/editing/RenderedPosition.h
Source/WebCore/editing/VisiblePosition.cpp
Source/WebCore/editing/VisibleUnits.cpp
Source/WebCore/layout/Verification.cpp
Source/WebCore/rendering/ComplexLineLayout.cpp
Source/WebCore/rendering/InlineBox.cpp
Source/WebCore/rendering/InlineBox.h
Source/WebCore/rendering/InlineFlowBox.cpp
Source/WebCore/rendering/InlineFlowBox.h
Source/WebCore/rendering/InlineTextBox.cpp
Source/WebCore/rendering/RenderBlockFlow.cpp
Source/WebCore/rendering/RenderTextLineBoxes.cpp
Source/WebCore/rendering/RootInlineBox.cpp
Source/WebCore/rendering/svg/SVGRootInlineBox.cpp

index 191fe6d..f146f9a 100644 (file)
@@ -1,3 +1,99 @@
+2019-09-25  Antti Koivisto  <antti@apple.com>
+
+        Rename InlineBox::nextLeafChild to nextLeafOnLine
+        https://bugs.webkit.org/show_bug.cgi?id=202197
+
+        Reviewed by Zalan Bujtas.
+
+        The name is confusing as it never returns a child of the inline box it is called on.
+        Rename it and other similar functions that traverse within a line.
+
+        * dom/Position.cpp:
+        (WebCore::Position::getInlineBoxAndOffset const):
+        * editing/RenderedPosition.cpp:
+        (WebCore::RenderedPosition::RenderedPosition):
+        (WebCore::RenderedPosition::previousLeafOnLine const):
+        (WebCore::RenderedPosition::nextLeafOnLine const):
+        (WebCore::RenderedPosition::isEquivalent const):
+        (WebCore::RenderedPosition::bidiLevelOnLeft const):
+        (WebCore::RenderedPosition::bidiLevelOnRight const):
+        (WebCore::RenderedPosition::leftBoundaryOfBidiRun):
+        (WebCore::RenderedPosition::rightBoundaryOfBidiRun):
+        (WebCore::RenderedPosition::atLeftBoundaryOfBidiRun const):
+        (WebCore::RenderedPosition::atRightBoundaryOfBidiRun const):
+        (WebCore::RenderedPosition::positionAtLeftBoundaryOfBiDiRun const):
+        (WebCore::RenderedPosition::positionAtRightBoundaryOfBiDiRun const):
+        (WebCore::RenderedPosition::prevLeafChild const): Deleted.
+        (WebCore::RenderedPosition::nextLeafChild const): Deleted.
+        * editing/RenderedPosition.h:
+        (WebCore::RenderedPosition::RenderedPosition):
+        * editing/VisiblePosition.cpp:
+        (WebCore::VisiblePosition::leftVisuallyDistinctCandidate const):
+        (WebCore::VisiblePosition::rightVisuallyDistinctCandidate const):
+        * editing/VisibleUnits.cpp:
+        (WebCore::startPositionForLine):
+        (WebCore::endPositionForLine):
+        (WebCore::previousLinePosition):
+        (WebCore::nextLinePosition):
+        * layout/Verification.cpp:
+        (WebCore::Layout::collectFlowBoxSubtree):
+        * rendering/ComplexLineLayout.cpp:
+        (WebCore::ComplexLineLayout::updateRubyForJustifiedText):
+        (WebCore::expansionBehaviorForInlineTextBox):
+        (WebCore::ComplexLineLayout::computeInlineDirectionPositionsForSegment):
+        (WebCore::ComplexLineLayout::layoutRunsAndFloats):
+        * rendering/InlineBox.cpp:
+        (WebCore::InlineBox::previousOnLineExists const):
+        (WebCore::InlineBox::nextLeafOnLine const):
+        (WebCore::InlineBox::previousLeafOnLine const):
+        (WebCore::InlineBox::nextLeafOnLineIgnoringLineBreak const):
+        (WebCore::InlineBox::previousLeafOnLineIgnoringLineBreak const):
+        (WebCore::InlineBox::nextLeafChild const): Deleted.
+        (WebCore::InlineBox::prevLeafChild const): Deleted.
+        (WebCore::InlineBox::nextLeafChildIgnoringLineBreak const): Deleted.
+        (WebCore::InlineBox::prevLeafChildIgnoringLineBreak const): Deleted.
+        * rendering/InlineBox.h:
+        (WebCore::InlineBox::nextOnLine const):
+        (WebCore::InlineBox::previousOnLine const):
+        (WebCore::InlineBox::setNextOnLine):
+        (WebCore::InlineBox::setPreviousOnLine):
+        (WebCore::InlineBox::InlineBox):
+        (WebCore::InlineBox::prevOnLine const): Deleted.
+        (WebCore::InlineBox::setPrevOnLine): Deleted.
+        * rendering/InlineFlowBox.cpp:
+        (WebCore::InlineFlowBox::addToLine):
+        (WebCore::InlineFlowBox::removeChild):
+        (WebCore::InlineFlowBox::nodeAtPoint):
+        (WebCore::InlineFlowBox::firstLeafDescendant const):
+        (WebCore::InlineFlowBox::lastLeafDescendant const):
+        (WebCore::InlineFlowBox::placeEllipsisBox):
+        (WebCore::InlineFlowBox::collectLeafBoxesInLogicalOrder const):
+        (WebCore::InlineFlowBox::checkConsistency const):
+        (WebCore::InlineFlowBox::firstLeafChild const): Deleted.
+        (WebCore::InlineFlowBox::lastLeafChild const): Deleted.
+        * rendering/InlineFlowBox.h:
+        * rendering/InlineTextBox.cpp:
+        (WebCore::InlineTextBox::expansionBehavior const):
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::containsNonZeroBidiLevel const):
+        (WebCore::RenderBlockFlow::positionForPointWithInlineChildren):
+        * rendering/RenderCounter.cpp:
+        (WebCore::RenderCounter::rendererRemovedFromTree):
+        * rendering/RenderTextLineBoxes.cpp:
+        (WebCore::lineDirectionPointFitsInBox):
+        (WebCore::createVisiblePositionAfterAdjustingOffsetForBiDi):
+        (WebCore::RenderTextLineBoxes::positionForPoint const):
+        * rendering/RootInlineBox.cpp:
+        (WebCore::RootInlineBox::isHyphenated const):
+        (WebCore::RootInlineBox::lineSelectionGap):
+        (WebCore::RootInlineBox::selectionState):
+        (WebCore::RootInlineBox::firstSelectedBox):
+        (WebCore::RootInlineBox::lastSelectedBox):
+        (WebCore::RootInlineBox::closestLeafChildForLogicalLeftPosition):
+        * rendering/svg/SVGRootInlineBox.cpp:
+        (WebCore::SVGRootInlineBox::closestLeafChildForPosition):
+        (WebCore::SVGRootInlineBox::nodeAtPoint):
+
 2019-09-25  Zan Dobersek  <zdobersek@igalia.com>
 
         [Nicosia] Add implementations for fixed, positioned, sticky ScrollingTreeNodes
index d2c9f73..24d36a9 100644 (file)
@@ -1244,7 +1244,7 @@ void Position::getInlineBoxAndOffset(EAffinity affinity, TextDirection primaryDi
 
             if (((caretOffset == caretMaxOffset) ^ (affinity == DOWNSTREAM))
                 || ((caretOffset == caretMinOffset) ^ (affinity == UPSTREAM))
-                || (caretOffset == caretMaxOffset && box->nextLeafChild() && box->nextLeafChild()->isLineBreak()))
+                || (caretOffset == caretMaxOffset && box->nextLeafOnLine() && box->nextLeafOnLine()->isLineBreak()))
                 break;
 
             candidate = box;
@@ -1285,41 +1285,41 @@ void Position::getInlineBoxAndOffset(EAffinity affinity, TextDirection primaryDi
 
     if (inlineBox->direction() == primaryDirection) {
         if (caretOffset == inlineBox->caretRightmostOffset()) {
-            InlineBox* nextBox = inlineBox->nextLeafChild();
+            InlineBox* nextBox = inlineBox->nextLeafOnLine();
             if (!nextBox || nextBox->bidiLevel() >= level)
                 return;
 
             level = nextBox->bidiLevel();
             InlineBox* prevBox = inlineBox;
             do {
-                prevBox = prevBox->prevLeafChild();
+                prevBox = prevBox->previousLeafOnLine();
             } while (prevBox && prevBox->bidiLevel() > level);
 
             if (prevBox && prevBox->bidiLevel() == level)   // For example, abc FED 123 ^ CBA
                 return;
 
             // For example, abc 123 ^ CBA
-            while (InlineBox* nextBox = inlineBox->nextLeafChild()) {
+            while (InlineBox* nextBox = inlineBox->nextLeafOnLine()) {
                 if (nextBox->bidiLevel() < level)
                     break;
                 inlineBox = nextBox;
             }
             caretOffset = inlineBox->caretRightmostOffset();
         } else {
-            InlineBox* prevBox = inlineBox->prevLeafChild();
+            InlineBox* prevBox = inlineBox->previousLeafOnLine();
             if (!prevBox || prevBox->bidiLevel() >= level)
                 return;
 
             level = prevBox->bidiLevel();
             InlineBox* nextBox = inlineBox;
             do {
-                nextBox = nextBox->nextLeafChild();
+                nextBox = nextBox->nextLeafOnLine();
             } while (nextBox && nextBox->bidiLevel() > level);
 
             if (nextBox && nextBox->bidiLevel() == level)
                 return;
 
-            while (InlineBox* prevBox = inlineBox->prevLeafChild()) {
+            while (InlineBox* prevBox = inlineBox->previousLeafOnLine()) {
                 if (prevBox->bidiLevel() < level)
                     break;
                 inlineBox = prevBox;
@@ -1330,10 +1330,10 @@ void Position::getInlineBoxAndOffset(EAffinity affinity, TextDirection primaryDi
     }
 
     if (caretOffset == inlineBox->caretLeftmostOffset()) {
-        InlineBox* prevBox = inlineBox->prevLeafChildIgnoringLineBreak();
+        InlineBox* prevBox = inlineBox->previousLeafOnLineIgnoringLineBreak();
         if (!prevBox || prevBox->bidiLevel() < level) {
             // Left edge of a secondary run. Set to the right edge of the entire run.
-            while (InlineBox* nextBox = inlineBox->nextLeafChildIgnoringLineBreak()) {
+            while (InlineBox* nextBox = inlineBox->nextLeafOnLineIgnoringLineBreak()) {
                 if (nextBox->bidiLevel() < level)
                     break;
                 inlineBox = nextBox;
@@ -1341,7 +1341,7 @@ void Position::getInlineBoxAndOffset(EAffinity affinity, TextDirection primaryDi
             caretOffset = inlineBox->caretRightmostOffset();
         } else if (prevBox->bidiLevel() > level) {
             // Right edge of a "tertiary" run. Set to the left edge of that run.
-            while (InlineBox* tertiaryBox = inlineBox->prevLeafChildIgnoringLineBreak()) {
+            while (InlineBox* tertiaryBox = inlineBox->previousLeafOnLineIgnoringLineBreak()) {
                 if (tertiaryBox->bidiLevel() <= level)
                     break;
                 inlineBox = tertiaryBox;
@@ -1349,10 +1349,10 @@ void Position::getInlineBoxAndOffset(EAffinity affinity, TextDirection primaryDi
             caretOffset = inlineBox->caretLeftmostOffset();
         }
     } else {
-        InlineBox* nextBox = inlineBox->nextLeafChildIgnoringLineBreak();
+        InlineBox* nextBox = inlineBox->nextLeafOnLineIgnoringLineBreak();
         if (!nextBox || nextBox->bidiLevel() < level) {
             // Right edge of a secondary run. Set to the left edge of the entire run.
-            while (InlineBox* prevBox = inlineBox->prevLeafChildIgnoringLineBreak()) {
+            while (InlineBox* prevBox = inlineBox->previousLeafOnLineIgnoringLineBreak()) {
                 if (prevBox->bidiLevel() < level)
                     break;
                 inlineBox = prevBox;
@@ -1360,7 +1360,7 @@ void Position::getInlineBoxAndOffset(EAffinity affinity, TextDirection primaryDi
             caretOffset = inlineBox->caretLeftmostOffset();
         } else if (nextBox->bidiLevel() > level) {
             // Left edge of a "tertiary" run. Set to the right edge of that run.
-            while (InlineBox* tertiaryBox = inlineBox->nextLeafChildIgnoringLineBreak()) {
+            while (InlineBox* tertiaryBox = inlineBox->nextLeafOnLineIgnoringLineBreak()) {
                 if (tertiaryBox->bidiLevel() <= level)
                     break;
                 inlineBox = tertiaryBox;
index 9938218..43d4a4f 100644 (file)
@@ -65,8 +65,8 @@ static inline RenderObject* rendererFromPosition(const Position& position)
 
 RenderedPosition::RenderedPosition(const VisiblePosition& position)
     : m_offset(0)
-    , m_prevLeafChild(uncachedInlineBox())
-    , m_nextLeafChild(uncachedInlineBox())
+    , m_previousLeafOnLine(uncachedInlineBox())
+    , m_nextLeafOnLine(uncachedInlineBox())
 {
     if (position.isNull())
         return;
@@ -79,8 +79,8 @@ RenderedPosition::RenderedPosition(const VisiblePosition& position)
 
 RenderedPosition::RenderedPosition(const Position& position, EAffinity affinity)
     : m_offset(0)
-    , m_prevLeafChild(uncachedInlineBox())
-    , m_nextLeafChild(uncachedInlineBox())
+    , m_previousLeafOnLine(uncachedInlineBox())
+    , m_nextLeafOnLine(uncachedInlineBox())
 {
     if (position.isNull())
         return;
@@ -91,36 +91,36 @@ RenderedPosition::RenderedPosition(const Position& position, EAffinity affinity)
         m_renderer = rendererFromPosition(position);
 }
 
-InlineBox* RenderedPosition::prevLeafChild() const
+InlineBox* RenderedPosition::previousLeafOnLine() const
 {
-    if (m_prevLeafChild == uncachedInlineBox())
-        m_prevLeafChild = m_inlineBox->prevLeafChildIgnoringLineBreak();
-    return m_prevLeafChild;
+    if (m_previousLeafOnLine == uncachedInlineBox())
+        m_previousLeafOnLine = m_inlineBox->previousLeafOnLineIgnoringLineBreak();
+    return m_previousLeafOnLine;
 }
 
-InlineBox* RenderedPosition::nextLeafChild() const
+InlineBox* RenderedPosition::nextLeafOnLine() const
 {
-    if (m_nextLeafChild == uncachedInlineBox())
-        m_nextLeafChild = m_inlineBox->nextLeafChildIgnoringLineBreak();
-    return m_nextLeafChild;
+    if (m_nextLeafOnLine == uncachedInlineBox())
+        m_nextLeafOnLine = m_inlineBox->nextLeafOnLineIgnoringLineBreak();
+    return m_nextLeafOnLine;
 }
 
 bool RenderedPosition::isEquivalent(const RenderedPosition& other) const
 {
     return (m_renderer == other.m_renderer && m_inlineBox == other.m_inlineBox && m_offset == other.m_offset)
-        || (atLeftmostOffsetInBox() && other.atRightmostOffsetInBox() && prevLeafChild() == other.m_inlineBox)
-        || (atRightmostOffsetInBox() && other.atLeftmostOffsetInBox() && nextLeafChild() == other.m_inlineBox);
+        || (atLeftmostOffsetInBox() && other.atRightmostOffsetInBox() && previousLeafOnLine() == other.m_inlineBox)
+        || (atRightmostOffsetInBox() && other.atLeftmostOffsetInBox() && nextLeafOnLine() == other.m_inlineBox);
 }
 
 unsigned char RenderedPosition::bidiLevelOnLeft() const
 {
-    InlineBox* box = atLeftmostOffsetInBox() ? prevLeafChild() : m_inlineBox;
+    InlineBox* box = atLeftmostOffsetInBox() ? previousLeafOnLine() : m_inlineBox;
     return box ? box->bidiLevel() : 0;
 }
 
 unsigned char RenderedPosition::bidiLevelOnRight() const
 {
-    InlineBox* box = atRightmostOffsetInBox() ? nextLeafChild() : m_inlineBox;
+    InlineBox* box = atRightmostOffsetInBox() ? nextLeafOnLine() : m_inlineBox;
     return box ? box->bidiLevel() : 0;
 }
 
@@ -131,7 +131,7 @@ RenderedPosition RenderedPosition::leftBoundaryOfBidiRun(unsigned char bidiLevel
 
     InlineBox* box = m_inlineBox;
     do {
-        InlineBox* prev = box->prevLeafChildIgnoringLineBreak();
+        InlineBox* prev = box->previousLeafOnLineIgnoringLineBreak();
         if (!prev || prev->bidiLevel() < bidiLevelOfRun)
             return RenderedPosition(&box->renderer(), box, box->caretLeftmostOffset());
         box = prev;
@@ -148,7 +148,7 @@ RenderedPosition RenderedPosition::rightBoundaryOfBidiRun(unsigned char bidiLeve
 
     InlineBox* box = m_inlineBox;
     do {
-        InlineBox* next = box->nextLeafChildIgnoringLineBreak();
+        InlineBox* next = box->nextLeafOnLineIgnoringLineBreak();
         if (!next || next->bidiLevel() < bidiLevelOfRun)
             return RenderedPosition(&box->renderer(), box, box->caretRightmostOffset());
         box = next;
@@ -165,14 +165,14 @@ bool RenderedPosition::atLeftBoundaryOfBidiRun(ShouldMatchBidiLevel shouldMatchB
 
     if (atLeftmostOffsetInBox()) {
         if (shouldMatchBidiLevel == IgnoreBidiLevel)
-            return !prevLeafChild() || prevLeafChild()->bidiLevel() < m_inlineBox->bidiLevel();
-        return m_inlineBox->bidiLevel() >= bidiLevelOfRun && (!prevLeafChild() || prevLeafChild()->bidiLevel() < bidiLevelOfRun);
+            return !previousLeafOnLine() || previousLeafOnLine()->bidiLevel() < m_inlineBox->bidiLevel();
+        return m_inlineBox->bidiLevel() >= bidiLevelOfRun && (!previousLeafOnLine() || previousLeafOnLine()->bidiLevel() < bidiLevelOfRun);
     }
 
     if (atRightmostOffsetInBox()) {
         if (shouldMatchBidiLevel == IgnoreBidiLevel)
-            return nextLeafChild() && m_inlineBox->bidiLevel() < nextLeafChild()->bidiLevel();
-        return nextLeafChild() && m_inlineBox->bidiLevel() < bidiLevelOfRun && nextLeafChild()->bidiLevel() >= bidiLevelOfRun;
+            return nextLeafOnLine() && m_inlineBox->bidiLevel() < nextLeafOnLine()->bidiLevel();
+        return nextLeafOnLine() && m_inlineBox->bidiLevel() < bidiLevelOfRun && nextLeafOnLine()->bidiLevel() >= bidiLevelOfRun;
     }
 
     return false;
@@ -185,14 +185,14 @@ bool RenderedPosition::atRightBoundaryOfBidiRun(ShouldMatchBidiLevel shouldMatch
 
     if (atRightmostOffsetInBox()) {
         if (shouldMatchBidiLevel == IgnoreBidiLevel)
-            return !nextLeafChild() || nextLeafChild()->bidiLevel() < m_inlineBox->bidiLevel();
-        return m_inlineBox->bidiLevel() >= bidiLevelOfRun && (!nextLeafChild() || nextLeafChild()->bidiLevel() < bidiLevelOfRun);
+            return !nextLeafOnLine() || nextLeafOnLine()->bidiLevel() < m_inlineBox->bidiLevel();
+        return m_inlineBox->bidiLevel() >= bidiLevelOfRun && (!nextLeafOnLine() || nextLeafOnLine()->bidiLevel() < bidiLevelOfRun);
     }
 
     if (atLeftmostOffsetInBox()) {
         if (shouldMatchBidiLevel == IgnoreBidiLevel)
-            return prevLeafChild() && m_inlineBox->bidiLevel() < prevLeafChild()->bidiLevel();
-        return prevLeafChild() && m_inlineBox->bidiLevel() < bidiLevelOfRun && prevLeafChild()->bidiLevel() >= bidiLevelOfRun;
+            return previousLeafOnLine() && m_inlineBox->bidiLevel() < previousLeafOnLine()->bidiLevel();
+        return previousLeafOnLine() && m_inlineBox->bidiLevel() < bidiLevelOfRun && previousLeafOnLine()->bidiLevel() >= bidiLevelOfRun;
     }
 
     return false;
@@ -205,7 +205,7 @@ Position RenderedPosition::positionAtLeftBoundaryOfBiDiRun() const
     if (atLeftmostOffsetInBox())
         return createLegacyEditingPosition(m_renderer->node(), m_offset);
 
-    return createLegacyEditingPosition(nextLeafChild()->renderer().node(), nextLeafChild()->caretLeftmostOffset());
+    return createLegacyEditingPosition(nextLeafOnLine()->renderer().node(), nextLeafOnLine()->caretLeftmostOffset());
 }
 
 Position RenderedPosition::positionAtRightBoundaryOfBiDiRun() const
@@ -215,7 +215,7 @@ Position RenderedPosition::positionAtRightBoundaryOfBiDiRun() const
     if (atRightmostOffsetInBox())
         return createLegacyEditingPosition(m_renderer->node(), m_offset);
 
-    return createLegacyEditingPosition(prevLeafChild()->renderer().node(), prevLeafChild()->caretRightmostOffset());
+    return createLegacyEditingPosition(previousLeafOnLine()->renderer().node(), previousLeafOnLine()->caretRightmostOffset());
 }
 
 IntRect RenderedPosition::absoluteRect(LayoutUnit* extraWidthToEndOfLine) const
index 729c1ab..155a7df 100644 (file)
@@ -72,8 +72,8 @@ private:
     bool operator==(const RenderedPosition&) const { return false; }
     explicit RenderedPosition(RenderObject*, InlineBox*, int offset);
 
-    InlineBox* prevLeafChild() const;
-    InlineBox* nextLeafChild() const;
+    InlineBox* previousLeafOnLine() const;
+    InlineBox* nextLeafOnLine() const;
     bool atLeftmostOffsetInBox() const { return m_inlineBox && m_offset == m_inlineBox->caretLeftmostOffset(); }
     bool atRightmostOffsetInBox() const { return m_inlineBox && m_offset == m_inlineBox->caretRightmostOffset(); }
     bool atLeftBoundaryOfBidiRun(ShouldMatchBidiLevel, unsigned char bidiLevelOfRun) const;
@@ -86,14 +86,14 @@ private:
     static InlineBox* uncachedInlineBox() { return reinterpret_cast<InlineBox*>(1); }
     // Needs to be different form 0 so pick 1 because it's also on the null page.
 
-    mutable InlineBox* m_prevLeafChild;
-    mutable InlineBox* m_nextLeafChild;
+    mutable InlineBox* m_previousLeafOnLine;
+    mutable InlineBox* m_nextLeafOnLine;
 };
 
 inline RenderedPosition::RenderedPosition()
     : m_offset(0)
-    , m_prevLeafChild(uncachedInlineBox())
-    , m_nextLeafChild(uncachedInlineBox())
+    , m_previousLeafOnLine(uncachedInlineBox())
+    , m_nextLeafOnLine(uncachedInlineBox())
 {
 }
 
@@ -101,8 +101,8 @@ inline RenderedPosition::RenderedPosition(RenderObject* renderer, InlineBox* box
     : m_renderer(renderer)
     , m_inlineBox(box)
     , m_offset(offset)
-    , m_prevLeafChild(uncachedInlineBox())
-    , m_nextLeafChild(uncachedInlineBox())
+    , m_previousLeafOnLine(uncachedInlineBox())
+    , m_nextLeafOnLine(uncachedInlineBox())
 {
 }
 
index 0f4786a..2fcb6e8 100644 (file)
@@ -136,7 +136,7 @@ Position VisiblePosition::leftVisuallyDistinctCandidate() const
                 return box->isLeftToRightDirection() ? previousVisuallyDistinctCandidate(m_deepPosition) : nextVisuallyDistinctCandidate(m_deepPosition);
 
             if (!renderer->node()) {
-                box = box->prevLeafChild();
+                box = box->previousLeafOnLine();
                 if (!box)
                     return primaryDirection == TextDirection::LTR ? previousVisuallyDistinctCandidate(m_deepPosition) : nextVisuallyDistinctCandidate(m_deepPosition);
                 renderer = &box->renderer();
@@ -154,7 +154,7 @@ Position VisiblePosition::leftVisuallyDistinctCandidate() const
 
             if (box->isLeftToRightDirection() ? offset < caretMinOffset : offset > caretMaxOffset) {
                 // Overshot to the left.
-                InlineBox* prevBox = box->prevLeafChildIgnoringLineBreak();
+                InlineBox* prevBox = box->previousLeafOnLineIgnoringLineBreak();
                 if (!prevBox) {
                     Position positionOnLeft = primaryDirection == TextDirection::LTR ? previousVisuallyDistinctCandidate(m_deepPosition) : nextVisuallyDistinctCandidate(m_deepPosition);
                     if (positionOnLeft.isNull())
@@ -178,7 +178,7 @@ Position VisiblePosition::leftVisuallyDistinctCandidate() const
             ASSERT(offset == box->caretLeftmostOffset());
 
             unsigned char level = box->bidiLevel();
-            InlineBox* prevBox = box->prevLeafChild();
+            InlineBox* prevBox = box->previousLeafOnLine();
 
             if (box->direction() == primaryDirection) {
                 if (!prevBox) {
@@ -197,7 +197,7 @@ Position VisiblePosition::leftVisuallyDistinctCandidate() const
 
                 InlineBox* nextBox = box;
                 do {
-                    nextBox = nextBox->nextLeafChild();
+                    nextBox = nextBox->nextLeafOnLine();
                 } while (nextBox && nextBox->bidiLevel() > level);
 
                 if (nextBox && nextBox->bidiLevel() == level)
@@ -212,7 +212,7 @@ Position VisiblePosition::leftVisuallyDistinctCandidate() const
             }
 
             while (prevBox && !prevBox->renderer().node())
-                prevBox = prevBox->prevLeafChild();
+                prevBox = prevBox->previousLeafOnLine();
 
             if (prevBox) {
                 box = prevBox;
@@ -220,7 +220,7 @@ Position VisiblePosition::leftVisuallyDistinctCandidate() const
                 offset = box->caretRightmostOffset();
                 if (box->bidiLevel() > level) {
                     do {
-                        prevBox = prevBox->prevLeafChild();
+                        prevBox = prevBox->previousLeafOnLine();
                     } while (prevBox && prevBox->bidiLevel() > level);
 
                     if (!prevBox || prevBox->bidiLevel() < level)
@@ -229,7 +229,7 @@ Position VisiblePosition::leftVisuallyDistinctCandidate() const
             } else {
                 // Trailing edge of a secondary run. Set to the leading edge of the entire run.
                 while (true) {
-                    while (InlineBox* nextBox = box->nextLeafChild()) {
+                    while (InlineBox* nextBox = box->nextLeafOnLine()) {
                         if (nextBox->bidiLevel() < level)
                             break;
                         box = nextBox;
@@ -237,7 +237,7 @@ Position VisiblePosition::leftVisuallyDistinctCandidate() const
                     if (box->bidiLevel() == level)
                         break;
                     level = box->bidiLevel();
-                    while (InlineBox* prevBox = box->prevLeafChild()) {
+                    while (InlineBox* prevBox = box->previousLeafOnLine()) {
                         if (prevBox->bidiLevel() < level)
                             break;
                         box = prevBox;
@@ -306,7 +306,7 @@ Position VisiblePosition::rightVisuallyDistinctCandidate() const
                 return box->isLeftToRightDirection() ? nextVisuallyDistinctCandidate(m_deepPosition) : previousVisuallyDistinctCandidate(m_deepPosition);
 
             if (!renderer->node()) {
-                box = box->nextLeafChild();
+                box = box->nextLeafOnLine();
                 if (!box)
                     return primaryDirection == TextDirection::LTR ? nextVisuallyDistinctCandidate(m_deepPosition) : previousVisuallyDistinctCandidate(m_deepPosition);
                 renderer = &box->renderer();
@@ -324,7 +324,7 @@ Position VisiblePosition::rightVisuallyDistinctCandidate() const
 
             if (box->isLeftToRightDirection() ? offset > caretMaxOffset : offset < caretMinOffset) {
                 // Overshot to the right.
-                InlineBox* nextBox = box->nextLeafChildIgnoringLineBreak();
+                InlineBox* nextBox = box->nextLeafOnLineIgnoringLineBreak();
                 if (!nextBox) {
                     Position positionOnRight = primaryDirection == TextDirection::LTR ? nextVisuallyDistinctCandidate(m_deepPosition) : previousVisuallyDistinctCandidate(m_deepPosition);
                     if (positionOnRight.isNull())
@@ -348,7 +348,7 @@ Position VisiblePosition::rightVisuallyDistinctCandidate() const
             ASSERT(offset == box->caretRightmostOffset());
 
             unsigned char level = box->bidiLevel();
-            InlineBox* nextBox = box->nextLeafChild();
+            InlineBox* nextBox = box->nextLeafOnLine();
 
             if (box->direction() == primaryDirection) {
                 if (!nextBox) {
@@ -368,7 +368,7 @@ Position VisiblePosition::rightVisuallyDistinctCandidate() const
 
                 InlineBox* prevBox = box;
                 do {
-                    prevBox = prevBox->prevLeafChild();
+                    prevBox = prevBox->previousLeafOnLine();
                 } while (prevBox && prevBox->bidiLevel() > level);
 
                 if (prevBox && prevBox->bidiLevel() == level)   // For example, abc FED 123 ^ CBA
@@ -384,7 +384,7 @@ Position VisiblePosition::rightVisuallyDistinctCandidate() const
             }
 
             while (nextBox && !nextBox->renderer().node())
-                nextBox = nextBox->nextLeafChild();
+                nextBox = nextBox->nextLeafOnLine();
 
             if (nextBox) {
                 box = nextBox;
@@ -393,7 +393,7 @@ Position VisiblePosition::rightVisuallyDistinctCandidate() const
 
                 if (box->bidiLevel() > level) {
                     do {
-                        nextBox = nextBox->nextLeafChild();
+                        nextBox = nextBox->nextLeafOnLine();
                     } while (nextBox && nextBox->bidiLevel() > level);
 
                     if (!nextBox || nextBox->bidiLevel() < level)
@@ -402,7 +402,7 @@ Position VisiblePosition::rightVisuallyDistinctCandidate() const
             } else {
                 // Trailing edge of a secondary run. Set to the leading edge of the entire run.
                 while (true) {
-                    while (InlineBox* prevBox = box->prevLeafChild()) {
+                    while (InlineBox* prevBox = box->previousLeafOnLine()) {
                         if (prevBox->bidiLevel() < level)
                             break;
                         box = prevBox;
@@ -410,7 +410,7 @@ Position VisiblePosition::rightVisuallyDistinctCandidate() const
                     if (box->bidiLevel() == level)
                         break;
                     level = box->bidiLevel();
-                    while (InlineBox* nextBox = box->nextLeafChild()) {
+                    while (InlineBox* nextBox = box->nextLeafOnLine()) {
                         if (nextBox->bidiLevel() < level)
                             break;
                         box = nextBox;
index 5399b08..97c622b 100644 (file)
@@ -824,7 +824,7 @@ static VisiblePosition startPositionForLine(const VisiblePosition& c, LineEndpoi
     } else {
         // Generated content (e.g. list markers and CSS :before and :after pseudoelements) have no corresponding DOM element,
         // and so cannot be represented by a VisiblePosition. Use whatever follows instead.
-        startBox = rootBox->firstLeafChild();
+        startBox = rootBox->firstLeafDescendant();
         while (true) {
             if (!startBox)
                 return VisiblePosition();
@@ -833,7 +833,7 @@ static VisiblePosition startPositionForLine(const VisiblePosition& c, LineEndpoi
             if (startNode)
                 break;
 
-            startBox = startBox->nextLeafChild();
+            startBox = startBox->nextLeafOnLine();
         }
     }
 
@@ -898,7 +898,7 @@ static VisiblePosition endPositionForLine(const VisiblePosition& c, LineEndpoint
     } else {
         // Generated content (e.g. list markers and CSS :before and :after pseudoelements) have no corresponding DOM element,
         // and so cannot be represented by a VisiblePosition. Use whatever precedes instead.
-        endBox = rootBox->lastLeafChild();
+        endBox = rootBox->lastLeafDescendant();
         while (true) {
             if (!endBox)
                 return VisiblePosition();
@@ -907,7 +907,7 @@ static VisiblePosition endPositionForLine(const VisiblePosition& c, LineEndpoint
             if (endNode)
                 break;
             
-            endBox = endBox->prevLeafChild();
+            endBox = endBox->previousLeafOnLine();
         }
     }
 
@@ -1046,7 +1046,7 @@ VisiblePosition previousLinePosition(const VisiblePosition& visiblePosition, int
         root = box->root().prevRootBox();
         // We want to skip zero height boxes.
         // This could happen in case it is a TrailingFloatsRootInlineBox.
-        if (!root || !root->logicalHeight() || !root->firstLeafChild())
+        if (!root || !root->logicalHeight() || !root->firstLeafDescendant())
             root = nullptr;
     }
 
@@ -1101,7 +1101,7 @@ VisiblePosition nextLinePosition(const VisiblePosition& visiblePosition, int lin
         root = box->root().nextRootBox();
         // We want to skip zero height boxes.
         // This could happen in case it is a TrailingFloatsRootInlineBox.
-        if (!root || !root->logicalHeight() || !root->firstLeafChild())
+        if (!root || !root->logicalHeight() || !root->firstLeafDescendant())
             root = nullptr;
     }
 
index 2a2cc59..ffa0633 100644 (file)
@@ -127,13 +127,13 @@ static bool checkForMatchingTextRuns(const Display::Run& inlineRun, const Inline
 
 static void collectFlowBoxSubtree(const InlineFlowBox& flowbox, Vector<WebCore::InlineBox*>& inlineBoxes)
 {
-    auto* inlineBox = flowbox.firstLeafChild();
-    auto* lastLeafChild = flowbox.lastLeafChild();
+    auto* inlineBox = flowbox.firstLeafDescendant();
+    auto* lastLeafDescendant = flowbox.lastLeafDescendant();
     while (inlineBox) {
         inlineBoxes.append(inlineBox);
-        if (inlineBox == lastLeafChild)
+        if (inlineBox == lastLeafDescendant)
             break;
-        inlineBox = inlineBox->nextLeafChild();
+        inlineBox = inlineBox->nextLeafOnLine();
     }
 }
 
index bd3c9be..f4d2d5f 100644 (file)
@@ -570,7 +570,7 @@ void ComplexLineLayout::updateRubyForJustifiedText(RenderRubyRun& rubyRun, BidiR
 
     float totalExpansion = 0;
     unsigned totalOpportunitiesInRun = 0;
-    for (auto* leafChild = rootBox.firstLeafChild(); leafChild; leafChild = leafChild->nextLeafChild()) {
+    for (auto* leafChild = rootBox.firstLeafDescendant(); leafChild; leafChild = leafChild->nextLeafOnLine()) {
         if (!leafChild->isInlineTextBox())
             continue;
 
@@ -735,7 +735,7 @@ static inline ExpansionBehavior expansionBehaviorForInlineTextBox(RenderBlockFlo
         if (nextRun && is<RenderRubyRun>(nextRun->renderer()) && downcast<RenderRubyRun>(nextRun->renderer()).rubyBase() && nextRun->renderer().style().collapseWhiteSpace()) {
             auto& rubyBase = *downcast<RenderRubyRun>(nextRun->renderer()).rubyBase();
             if (rubyBase.firstRootBox() && !rubyBase.firstRootBox()->nextRootBox()) {
-                if (auto* leafChild = rubyBase.firstRootBox()->firstLeafChild()) {
+                if (auto* leafChild = rubyBase.firstRootBox()->firstLeafDescendant()) {
                     if (is<InlineTextBox>(*leafChild)) {
                         // FIXME: This leadingExpansionOpportunity doesn't actually work because it doesn't perform the UBA
                         if (FontCascade::leadingExpansionOpportunity(downcast<RenderText>(leafChild->renderer()).stringView(), leafChild->direction())) {
@@ -750,7 +750,7 @@ static inline ExpansionBehavior expansionBehaviorForInlineTextBox(RenderBlockFlo
         if (previousRun && is<RenderRubyRun>(previousRun->renderer()) && downcast<RenderRubyRun>(previousRun->renderer()).rubyBase() && previousRun->renderer().style().collapseWhiteSpace()) {
             auto& rubyBase = *downcast<RenderRubyRun>(previousRun->renderer()).rubyBase();
             if (rubyBase.firstRootBox() && !rubyBase.firstRootBox()->nextRootBox()) {
-                if (auto* leafChild = rubyBase.firstRootBox()->lastLeafChild()) {
+                if (auto* leafChild = rubyBase.firstRootBox()->lastLeafDescendant()) {
                     if (is<InlineTextBox>(*leafChild)) {
                         // FIXME: This leadingExpansionOpportunity doesn't actually work because it doesn't perform the UBA
                         if (FontCascade::trailingExpansionOpportunity(downcast<RenderText>(leafChild->renderer()).stringView(), leafChild->direction())) {
@@ -764,10 +764,10 @@ static inline ExpansionBehavior expansionBehaviorForInlineTextBox(RenderBlockFlo
         // If we're the first box inside a ruby base, forbid a leading expansion, and vice-versa
         if (is<RenderRubyBase>(block)) {
             RenderRubyBase& rubyBase = downcast<RenderRubyBase>(block);
-            if (&textBox == rubyBase.firstRootBox()->firstLeafChild()) {
+            if (&textBox == rubyBase.firstRootBox()->firstLeafDescendant()) {
                 setLeadingExpansion = true;
                 result |= ForbidLeadingExpansion;
-            } if (&textBox == rubyBase.firstRootBox()->lastLeafChild()) {
+            } if (&textBox == rubyBase.firstRootBox()->lastLeafDescendant()) {
                 setTrailingExpansion = true;
                 result |= ForbidTrailingExpansion;
             }
@@ -920,7 +920,7 @@ BidiRun* ComplexLineLayout::computeInlineDirectionPositionsForSegment(RootInline
                 auto* rubyBase = downcast<RenderRubyRun>(run->renderer()).rubyBase();
                 if (rubyBase->firstRootBox() && !rubyBase->firstRootBox()->nextRootBox() && run->renderer().style().collapseWhiteSpace()) {
                     rubyBase->setIsAfterExpansion(isAfterExpansion);
-                    for (auto* leafChild = rubyBase->firstRootBox()->firstLeafChild(); leafChild; leafChild = leafChild->nextLeafChild()) {
+                    for (auto* leafChild = rubyBase->firstRootBox()->firstLeafDescendant(); leafChild; leafChild = leafChild->nextLeafOnLine()) {
                         if (!is<InlineTextBox>(*leafChild))
                             continue;
                         encounteredJustifiedRuby = true;
@@ -1317,10 +1317,10 @@ void ComplexLineLayout::layoutRunsAndFloats(LineLayoutState& layoutState, bool h
         // If the last line before the start line ends with a line break that clear floats,
         // adjust the height accordingly.
         // A line break can be either the first or the last object on a line, depending on its direction.
-        if (InlineBox* lastLeafChild = lastRootBox()->lastLeafChild()) {
-            RenderObject* lastObject = &lastLeafChild->renderer();
+        if (InlineBox* lastLeafDescendant = lastRootBox()->lastLeafDescendant()) {
+            RenderObject* lastObject = &lastLeafDescendant->renderer();
             if (!lastObject->isBR())
-                lastObject = &lastRootBox()->firstLeafChild()->renderer();
+                lastObject = &lastRootBox()->firstLeafDescendant()->renderer();
             if (lastObject->isBR()) {
                 Clear clear = lastObject->style().clear();
                 if (clear != Clear::None)
index a6fca02..3204b8d 100644 (file)
@@ -220,42 +220,42 @@ bool InlineBox::previousOnLineExists() const
 {
     if (!parent())
         return false;
-    if (prevOnLine())
+    if (previousOnLine())
         return true;
     return parent()->previousOnLineExists();
 }
 
-InlineBox* InlineBox::nextLeafChild() const
+InlineBox* InlineBox::nextLeafOnLine() const
 {
     InlineBox* leaf = nullptr;
     for (InlineBox* box = nextOnLine(); box && !leaf; box = box->nextOnLine())
-        leaf = box->isLeaf() ? box : downcast<InlineFlowBox>(*box).firstLeafChild();
+        leaf = box->isLeaf() ? box : downcast<InlineFlowBox>(*box).firstLeafDescendant();
     if (!leaf && parent())
-        leaf = parent()->nextLeafChild();
+        leaf = parent()->nextLeafOnLine();
     return leaf;
 }
     
-InlineBox* InlineBox::prevLeafChild() const
+InlineBox* InlineBox::previousLeafOnLine() const
 {
     InlineBox* leaf = nullptr;
-    for (InlineBox* box = prevOnLine(); box && !leaf; box = box->prevOnLine())
-        leaf = box->isLeaf() ? box : downcast<InlineFlowBox>(*box).lastLeafChild();
+    for (InlineBox* box = previousOnLine(); box && !leaf; box = box->previousOnLine())
+        leaf = box->isLeaf() ? box : downcast<InlineFlowBox>(*box).lastLeafDescendant();
     if (!leaf && parent())
-        leaf = parent()->prevLeafChild();
+        leaf = parent()->previousLeafOnLine();
     return leaf;
 }
 
-InlineBox* InlineBox::nextLeafChildIgnoringLineBreak() const
+InlineBox* InlineBox::nextLeafOnLineIgnoringLineBreak() const
 {
-    InlineBox* leaf = nextLeafChild();
+    InlineBox* leaf = nextLeafOnLine();
     if (leaf && leaf->isLineBreak())
         return nullptr;
     return leaf;
 }
 
-InlineBox* InlineBox::prevLeafChildIgnoringLineBreak() const
+InlineBox* InlineBox::previousLeafOnLineIgnoringLineBreak() const
 {
-    InlineBox* leaf = prevLeafChild();
+    InlineBox* leaf = previousLeafOnLine();
     if (leaf && leaf->isLineBreak())
         return nullptr;
     return leaf;
index 5ccdefd..2ab1125 100644 (file)
@@ -120,31 +120,31 @@ public:
 
     void removeFromParent();
 
-    InlineBox* nextOnLine() const { return m_next; }
-    InlineBox* prevOnLine() const { return m_prev; }
+    InlineBox* nextOnLine() const { return m_nextOnLine; }
+    InlineBox* previousOnLine() const { return m_previousOnLine; }
     void setNextOnLine(InlineBox* next)
     {
         ASSERT(m_parent || !next);
-        m_next = next;
+        m_nextOnLine = next;
     }
-    void setPrevOnLine(InlineBox* prev)
+    void setPreviousOnLine(InlineBox* previous)
     {
-        ASSERT(m_parent || !prev);
-        m_prev = prev;
+        ASSERT(m_parent || !previous);
+        m_previousOnLine = previous;
     }
     bool nextOnLineExists() const;
     bool previousOnLineExists() const;
 
     virtual bool isLeaf() const { return true; }
     
-    InlineBox* nextLeafChild() const;
-    InlineBox* prevLeafChild() const;
+    InlineBox* nextLeafOnLine() const;
+    InlineBox* previousLeafOnLine() const;
 
     // Helper functions for editing and hit-testing code.
     // FIXME: These two functions should be moved to RenderedPosition once the code to convert between
     // Position and inline box, offset pair is moved to RenderedPosition.
-    InlineBox* nextLeafChildIgnoringLineBreak() const;
-    InlineBox* prevLeafChildIgnoringLineBreak() const;
+    InlineBox* nextLeafOnLineIgnoringLineBreak() const;
+    InlineBox* previousLeafOnLineIgnoringLineBreak() const;
 
     // FIXME: Hide this once all callers are using tighter types.
     RenderObject& renderer() const { return m_renderer; }
@@ -287,8 +287,8 @@ public:
     void setForceLeadingExpansion() { m_bitfields.setForceLeadingExpansion(true); }
 
 private:
-    InlineBox* m_next { nullptr }; // The next element on the same line as us.
-    InlineBox* m_prev { nullptr }; // The previous element on the same line as us.
+    InlineBox* m_nextOnLine { nullptr }; // The next element on the same line as us.
+    InlineBox* m_previousOnLine { nullptr }; // The previous element on the same line as us.
 
     InlineFlowBox* m_parent { nullptr }; // The box that contains us.
 
@@ -383,9 +383,9 @@ protected:
     {
     }
 
-    InlineBox(RenderObject& renderer, FloatPoint topLeft, float logicalWidth, bool firstLine, bool constructed, bool dirty, bool extracted, bool isHorizontal, InlineBox* next, InlineBox* prev, InlineFlowBox* parent)
-        : m_next(next)
-        , m_prev(prev)
+    InlineBox(RenderObject& renderer, FloatPoint topLeft, float logicalWidth, bool firstLine, bool constructed, bool dirty, bool extracted, bool isHorizontal, InlineBox* next, InlineBox* previous, InlineFlowBox* parent)
+        : m_nextOnLine(next)
+        , m_previousOnLine(previous)
         , m_parent(parent)
         , m_renderer(renderer)
         , m_logicalWidth(logicalWidth)
index 49fc8d1..9971ea1 100644 (file)
@@ -96,7 +96,7 @@ void InlineFlowBox::addToLine(InlineBox* child)
 {
     ASSERT(!child->parent());
     ASSERT(!child->nextOnLine());
-    ASSERT(!child->prevOnLine());
+    ASSERT(!child->previousOnLine());
     checkConsistency();
 
     child->setParent(this);
@@ -105,7 +105,7 @@ void InlineFlowBox::addToLine(InlineBox* child)
         m_lastChild = child;
     } else {
         m_lastChild->setNextOnLine(child);
-        child->setPrevOnLine(m_lastChild);
+        child->setPreviousOnLine(m_lastChild);
         m_lastChild = child;
     }
     child->setIsFirstLine(isFirstLine());
@@ -195,11 +195,11 @@ void InlineFlowBox::removeChild(InlineBox* child)
     if (child == m_firstChild)
         m_firstChild = child->nextOnLine();
     if (child == m_lastChild)
-        m_lastChild = child->prevOnLine();
+        m_lastChild = child->previousOnLine();
     if (child->nextOnLine())
-        child->nextOnLine()->setPrevOnLine(child->prevOnLine());
-    if (child->prevOnLine())
-        child->prevOnLine()->setNextOnLine(child->nextOnLine());
+        child->nextOnLine()->setPreviousOnLine(child->previousOnLine());
+    if (child->previousOnLine())
+        child->previousOnLine()->setNextOnLine(child->nextOnLine());
     
     child->setParent(nullptr);
 
@@ -1068,7 +1068,7 @@ bool InlineFlowBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re
     // Check children first.
     // We need to account for culled inline parents of the hit-tested nodes, so that they may also get included in area-based hit-tests.
     RenderElement* culledParent = nullptr;
-    for (InlineBox* child = lastChild(); child; child = child->prevOnLine()) {
+    for (InlineBox* child = lastChild(); child; child = child->previousOnLine()) {
         if (is<RenderText>(child->renderer()) || !child->boxModelObject()->hasSelfPaintingLayer()) {
             RenderElement* newParent = nullptr;
             // Culled parents are only relevant for area-based hit-tests, so ignore it in point-based ones.
@@ -1489,19 +1489,19 @@ void InlineFlowBox::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOffs
         paintInfo.context().endTransparencyLayer();
 }
 
-InlineBox* InlineFlowBox::firstLeafChild() const
+InlineBox* InlineFlowBox::firstLeafDescendant() const
 {
     InlineBox* leaf = nullptr;
     for (InlineBox* child = firstChild(); child && !leaf; child = child->nextOnLine())
-        leaf = child->isLeaf() ? child : downcast<InlineFlowBox>(*child).firstLeafChild();
+        leaf = child->isLeaf() ? child : downcast<InlineFlowBox>(*child).firstLeafDescendant();
     return leaf;
 }
 
-InlineBox* InlineFlowBox::lastLeafChild() const
+InlineBox* InlineFlowBox::lastLeafDescendant() const
 {
     InlineBox* leaf = nullptr;
-    for (InlineBox* child = lastChild(); child && !leaf; child = child->prevOnLine())
-        leaf = child->isLeaf() ? child : downcast<InlineFlowBox>(*child).lastLeafChild();
+    for (InlineBox* child = lastChild(); child && !leaf; child = child->previousOnLine())
+        leaf = child->isLeaf() ? child : downcast<InlineFlowBox>(*child).lastLeafDescendant();
     return leaf;
 }
 
@@ -1543,7 +1543,7 @@ float InlineFlowBox::placeEllipsisBox(bool ltr, float blockLeftEdge, float block
         }
         else {
             visibleRightEdge -= box->logicalWidth();
-            box = box->prevOnLine();
+            box = box->previousOnLine();
         }
     }
     return result;
@@ -1653,7 +1653,7 @@ LayoutUnit InlineFlowBox::computeUnderAnnotationAdjustment(LayoutUnit allowedPos
 
 void InlineFlowBox::collectLeafBoxesInLogicalOrder(Vector<InlineBox*>& leafBoxesInLogicalOrder, CustomInlineBoxRangeReverse customReverseImplementation, void* userData) const
 {
-    InlineBox* leaf = firstLeafChild();
+    InlineBox* leaf = firstLeafDescendant();
 
     // FIXME: The reordering code is a copy of parts from BidiResolver::createBidiRunsForLine, operating directly on InlineBoxes, instead of BidiRuns.
     // Investigate on how this code could possibly be shared.
@@ -1661,7 +1661,7 @@ void InlineFlowBox::collectLeafBoxesInLogicalOrder(Vector<InlineBox*>& leafBoxes
     unsigned char maxLevel = 0;
 
     // First find highest and lowest levels, and initialize leafBoxesInLogicalOrder with the leaf boxes in visual order.
-    for (; leaf; leaf = leaf->nextLeafChild()) {
+    for (; leaf; leaf = leaf->nextLeafOnLine()) {
         minLevel = std::min(minLevel, leaf->bidiLevel());
         maxLevel = std::max(maxLevel, leaf->bidiLevel());
         leafBoxesInLogicalOrder.append(leaf);
@@ -1744,7 +1744,7 @@ void InlineFlowBox::checkConsistency() const
     const InlineBox* previousChild = nullptr;
     for (const InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
         ASSERT(child->parent() == this);
-        ASSERT(child->prevOnLine() == previousChild);
+        ASSERT(child->previousOnLine() == previousChild);
         previousChild = child;
     }
     ASSERT(previousChild == m_lastChild);
index b161215..80415d9 100644 (file)
@@ -88,8 +88,8 @@ public:
 
     bool isLeaf() const final { return false; }
     
-    InlineBox* firstLeafChild() const;
-    InlineBox* lastLeafChild() const;
+    InlineBox* firstLeafDescendant() const;
+    InlineBox* lastLeafDescendant() const;
 
     typedef void (*CustomInlineBoxRangeReverse)(void* userData, Vector<InlineBox*>::iterator first, Vector<InlineBox*>::iterator last);
     void collectLeafBoxesInLogicalOrder(Vector<InlineBox*>&, CustomInlineBoxRangeReverse customReverseImplementation = nullptr, void* userData = nullptr) const;
index 90aeacf..433a074 100644 (file)
@@ -1304,7 +1304,7 @@ ExpansionBehavior InlineTextBox::expansionBehavior() const
     ExpansionBehavior trailingBehavior;
     if (forceTrailingExpansion())
         trailingBehavior = ForceTrailingExpansion;
-    else if (expansion() && nextLeafChild() && !nextLeafChild()->isLineBreak())
+    else if (expansion() && nextLeafOnLine() && !nextLeafOnLine()->isLineBreak())
         trailingBehavior = AllowTrailingExpansion;
     else
         trailingBehavior = ForbidTrailingExpansion;
index b8642d1..7146511 100644 (file)
@@ -3328,7 +3328,7 @@ void RenderBlockFlow::clearTruncation()
 bool RenderBlockFlow::containsNonZeroBidiLevel() const
 {
     for (auto* root = firstRootBox(); root; root = root->nextRootBox()) {
-        for (auto* box = root->firstLeafChild(); box; box = box->nextLeafChild()) {
+        for (auto* box = root->firstLeafDescendant(); box; box = box->nextLeafOnLine()) {
             if (box->bidiLevel())
                 return true;
         }
@@ -3436,7 +3436,7 @@ VisiblePosition RenderBlockFlow::positionForPointWithInlineChildren(const Layout
         if (fragment && root->containingFragment() != fragment)
             continue;
 
-        if (!root->firstLeafChild())
+        if (!root->firstLeafDescendant())
             continue;
         if (!firstRootBoxWithChildren)
             firstRootBoxWithChildren = root;
@@ -3451,7 +3451,7 @@ VisiblePosition RenderBlockFlow::positionForPointWithInlineChildren(const Layout
         if (pointInLogicalContents.y() < root->selectionBottom() || (blocksAreFlipped && pointInLogicalContents.y() == root->selectionBottom())) {
             if (linesAreFlipped) {
                 RootInlineBox* nextRootBoxWithChildren = root->nextRootBox();
-                while (nextRootBoxWithChildren && !nextRootBoxWithChildren->firstLeafChild())
+                while (nextRootBoxWithChildren && !nextRootBoxWithChildren->firstLeafDescendant())
                     nextRootBoxWithChildren = nextRootBoxWithChildren->nextRootBox();
 
                 if (nextRootBoxWithChildren && nextRootBoxWithChildren->isFirstAfterPageBreak() && (pointInLogicalContents.y() > nextRootBoxWithChildren->lineTopWithLeading()
@@ -3476,9 +3476,9 @@ VisiblePosition RenderBlockFlow::positionForPointWithInlineChildren(const Layout
             LayoutUnit firstRootBoxWithChildrenTop = std::min(firstRootBoxWithChildren->selectionTop(), LayoutUnit(firstRootBoxWithChildren->logicalTop()));
             if (pointInLogicalContents.y() < firstRootBoxWithChildrenTop
                 || (blocksAreFlipped && pointInLogicalContents.y() == firstRootBoxWithChildrenTop)) {
-                InlineBox* box = firstRootBoxWithChildren->firstLeafChild();
+                InlineBox* box = firstRootBoxWithChildren->firstLeafDescendant();
                 if (box->isLineBreak()) {
-                    if (InlineBox* newBox = box->nextLeafChildIgnoringLineBreak())
+                    if (InlineBox* newBox = box->nextLeafOnLineIgnoringLineBreak())
                         box = newBox;
                 }
                 // y coordinate is above first root line box, so return the start of the first
index 6633713..34822b4 100644 (file)
@@ -275,7 +275,7 @@ static bool lineDirectionPointFitsInBox(int pointLineDirection, const InlineText
     // the affinity must be downstream so the position doesn't jump back to the previous line
     // except when box is the first box in the line
     if (pointLineDirection <= box.logicalLeft()) {
-        shouldAffinityBeDownstream = !box.prevLeafChild() ? UpstreamIfPositionIsNotAtStart : AlwaysDownstream;
+        shouldAffinityBeDownstream = !box.previousLeafOnLine() ? UpstreamIfPositionIsNotAtStart : AlwaysDownstream;
         return true;
     }
 
@@ -290,10 +290,10 @@ static bool lineDirectionPointFitsInBox(int pointLineDirection, const InlineText
 
     // box is first on line
     // and the x coordinate is to the left of the first text box left edge
-    if (!box.prevLeafChildIgnoringLineBreak() && pointLineDirection < box.logicalLeft())
+    if (!box.previousLeafOnLineIgnoringLineBreak() && pointLineDirection < box.logicalLeft())
         return true;
 
-    if (!box.nextLeafChildIgnoringLineBreak()) {
+    if (!box.nextLeafOnLineIgnoringLineBreak()) {
         // box is last on line
         // and the x coordinate is to the right of the last text box right edge
         // generate VisiblePosition, use UPSTREAM affinity if possible
@@ -332,7 +332,7 @@ static VisiblePosition createVisiblePositionAfterAdjustingOffsetForBiDi(const In
     if (positionIsAtStartOfBox == box.isLeftToRightDirection()) {
         // offset is on the left edge
 
-        const InlineBox* prevBox = box.prevLeafChildIgnoringLineBreak();
+        const InlineBox* prevBox = box.previousLeafOnLineIgnoringLineBreak();
         if ((prevBox && prevBox->bidiLevel() == box.bidiLevel())
             || box.renderer().containingBlock()->style().direction() == box.direction()) // FIXME: left on 12CBA
             return createVisiblePositionForBox(box, box.caretLeftmostOffset(), shouldAffinityBeDownstream);
@@ -342,7 +342,7 @@ static VisiblePosition createVisiblePositionAfterAdjustingOffsetForBiDi(const In
             const InlineBox* leftmostBox;
             do {
                 leftmostBox = prevBox;
-                prevBox = leftmostBox->prevLeafChildIgnoringLineBreak();
+                prevBox = leftmostBox->previousLeafOnLineIgnoringLineBreak();
             } while (prevBox && prevBox->bidiLevel() > box.bidiLevel());
             return createVisiblePositionForBox(*leftmostBox, leftmostBox->caretRightmostOffset(), shouldAffinityBeDownstream);
         }
@@ -353,7 +353,7 @@ static VisiblePosition createVisiblePositionAfterAdjustingOffsetForBiDi(const In
             const InlineBox* nextBox = &box;
             do {
                 rightmostBox = nextBox;
-                nextBox = rightmostBox->nextLeafChildIgnoringLineBreak();
+                nextBox = rightmostBox->nextLeafOnLineIgnoringLineBreak();
             } while (nextBox && nextBox->bidiLevel() >= box.bidiLevel());
             return createVisiblePositionForBox(*rightmostBox,
                 box.isLeftToRightDirection() ? rightmostBox->caretMaxOffset() : rightmostBox->caretMinOffset(), shouldAffinityBeDownstream);
@@ -362,7 +362,7 @@ static VisiblePosition createVisiblePositionAfterAdjustingOffsetForBiDi(const In
         return createVisiblePositionForBox(box, box.caretRightmostOffset(), shouldAffinityBeDownstream);
     }
 
-    const InlineBox* nextBox = box.nextLeafChildIgnoringLineBreak();
+    const InlineBox* nextBox = box.nextLeafOnLineIgnoringLineBreak();
     if ((nextBox && nextBox->bidiLevel() == box.bidiLevel())
         || box.renderer().containingBlock()->style().direction() == box.direction())
         return createVisiblePositionForBox(box, box.caretRightmostOffset(), shouldAffinityBeDownstream);
@@ -373,7 +373,7 @@ static VisiblePosition createVisiblePositionAfterAdjustingOffsetForBiDi(const In
         const InlineBox* rightmostBox;
         do {
             rightmostBox = nextBox;
-            nextBox = rightmostBox->nextLeafChildIgnoringLineBreak();
+            nextBox = rightmostBox->nextLeafOnLineIgnoringLineBreak();
         } while (nextBox && nextBox->bidiLevel() > box.bidiLevel());
         return createVisiblePositionForBox(*rightmostBox, rightmostBox->caretLeftmostOffset(), shouldAffinityBeDownstream);
     }
@@ -384,7 +384,7 @@ static VisiblePosition createVisiblePositionAfterAdjustingOffsetForBiDi(const In
         const InlineBox* prevBox = &box;
         do {
             leftmostBox = prevBox;
-            prevBox = leftmostBox->prevLeafChildIgnoringLineBreak();
+            prevBox = leftmostBox->previousLeafOnLineIgnoringLineBreak();
         } while (prevBox && prevBox->bidiLevel() >= box.bidiLevel());
         return createVisiblePositionForBox(*leftmostBox,
             box.isLeftToRightDirection() ? leftmostBox->caretMinOffset() : leftmostBox->caretMaxOffset(), shouldAffinityBeDownstream);
@@ -404,7 +404,7 @@ VisiblePosition RenderTextLineBoxes::positionForPoint(const RenderText& renderer
 
     InlineTextBox* lastBox = nullptr;
     for (auto* box = m_first; box; box = box->nextTextBox()) {
-        if (box->isLineBreak() && !box->prevLeafChild() && box->nextLeafChild() && !box->nextLeafChild()->isLineBreak())
+        if (box->isLineBreak() && !box->previousLeafOnLine() && box->nextLeafOnLine() && !box->nextLeafOnLine()->isLineBreak())
             box = box->nextTextBox();
 
         auto& rootBox = box->root();
index 4455841..8194309 100644 (file)
@@ -94,7 +94,7 @@ void RootInlineBox::clearTruncation()
 
 bool RootInlineBox::isHyphenated() const
 {
-    for (InlineBox* box = firstLeafChild(); box; box = box->nextLeafChild()) {
+    for (InlineBox* box = firstLeafDescendant(); box; box = box->nextLeafOnLine()) {
         if (is<InlineTextBox>(*box) && downcast<InlineTextBox>(*box).hasHyphen())
             return true;
     }
@@ -452,7 +452,7 @@ GapRects RootInlineBox::lineSelectionGap(RenderBlock& rootBlock, const LayoutPoi
         // Now fill in any gaps on the line that occurred between two selected elements.
         LayoutUnit lastLogicalLeft { firstBox->logicalRight() };
         bool isPreviousBoxSelected = firstBox->selectionState() != RenderObject::SelectionNone;
-        for (InlineBox* box = firstBox->nextLeafChild(); box; box = box->nextLeafChild()) {
+        for (InlineBox* box = firstBox->nextLeafOnLine(); box; box = box->nextLeafOnLine()) {
             if (box->selectionState() != RenderObject::SelectionNone) {
                 LayoutRect logicalRect { lastLogicalLeft, selTop, LayoutUnit(box->logicalLeft() - lastLogicalLeft), selHeight };
                 logicalRect.move(renderer().isHorizontalWritingMode() ? offsetFromRootBlock : LayoutSize(offsetFromRootBlock.height(), offsetFromRootBlock.width()));
@@ -531,7 +531,7 @@ RenderObject::SelectionState RootInlineBox::selectionState()
 {
     // Walk over all of the selected boxes.
     RenderObject::SelectionState state = RenderObject::SelectionNone;
-    for (InlineBox* box = firstLeafChild(); box; box = box->nextLeafChild()) {
+    for (InlineBox* box = firstLeafDescendant(); box; box = box->nextLeafOnLine()) {
         RenderObject::SelectionState boxState = box->selectionState();
         if ((boxState == RenderObject::SelectionStart && state == RenderObject::SelectionEnd) ||
             (boxState == RenderObject::SelectionEnd && state == RenderObject::SelectionStart))
@@ -553,7 +553,7 @@ RenderObject::SelectionState RootInlineBox::selectionState()
 
 InlineBox* RootInlineBox::firstSelectedBox()
 {
-    for (auto* box = firstLeafChild(); box; box = box->nextLeafChild()) {
+    for (auto* box = firstLeafDescendant(); box; box = box->nextLeafOnLine()) {
         if (box->selectionState() != RenderObject::SelectionNone)
             return box;
     }
@@ -562,7 +562,7 @@ InlineBox* RootInlineBox::firstSelectedBox()
 
 InlineBox* RootInlineBox::lastSelectedBox()
 {
-    for (auto* box = lastLeafChild(); box; box = box->prevLeafChild()) {
+    for (auto* box = lastLeafDescendant(); box; box = box->previousLeafOnLine()) {
         if (box->selectionState() != RenderObject::SelectionNone)
             return box;
     }
@@ -766,14 +766,14 @@ InlineBox* RootInlineBox::closestLeafChildForPoint(const IntPoint& pointInConten
 
 InlineBox* RootInlineBox::closestLeafChildForLogicalLeftPosition(int leftPosition, bool onlyEditableLeaves)
 {
-    InlineBox* firstLeaf = firstLeafChild();
-    InlineBox* lastLeaf = lastLeafChild();
+    InlineBox* firstLeaf = firstLeafDescendant();
+    InlineBox* lastLeaf = lastLeafDescendant();
 
     if (firstLeaf != lastLeaf) {
         if (firstLeaf->isLineBreak())
-            firstLeaf = firstLeaf->nextLeafChildIgnoringLineBreak();
+            firstLeaf = firstLeaf->nextLeafOnLineIgnoringLineBreak();
         else if (lastLeaf->isLineBreak())
-            lastLeaf = lastLeaf->prevLeafChildIgnoringLineBreak();
+            lastLeaf = lastLeaf->previousLeafOnLineIgnoringLineBreak();
     }
 
     if (firstLeaf == lastLeaf && (!onlyEditableLeaves || isEditableLeaf(firstLeaf)))
@@ -791,7 +791,7 @@ InlineBox* RootInlineBox::closestLeafChildForLogicalLeftPosition(int leftPositio
         return lastLeaf;
 
     InlineBox* closestLeaf = nullptr;
-    for (InlineBox* leaf = firstLeaf; leaf; leaf = leaf->nextLeafChildIgnoringLineBreak()) {
+    for (InlineBox* leaf = firstLeaf; leaf; leaf = leaf->nextLeafOnLineIgnoringLineBreak()) {
         if (!leaf->renderer().isListMarker() && (!onlyEditableLeaves || isEditableLeaf(leaf))) {
             closestLeaf = leaf;
             if (leftPosition < leaf->logicalRight())
index 9719342..bf5f3ad 100644 (file)
@@ -190,14 +190,14 @@ void SVGRootInlineBox::layoutRootBox(const FloatRect& childRect)
 
 InlineBox* SVGRootInlineBox::closestLeafChildForPosition(const LayoutPoint& point)
 {
-    InlineBox* firstLeaf = firstLeafChild();
-    InlineBox* lastLeaf = lastLeafChild();
+    InlineBox* firstLeaf = firstLeafDescendant();
+    InlineBox* lastLeaf = lastLeafDescendant();
     if (firstLeaf == lastLeaf)
         return firstLeaf;
 
     // FIXME: Check for vertical text!
     InlineBox* closestLeaf = nullptr;
-    for (InlineBox* leaf = firstLeaf; leaf; leaf = leaf->nextLeafChild()) {
+    for (InlineBox* leaf = firstLeaf; leaf; leaf = leaf->nextLeafOnLine()) {
         if (!leaf->isSVGInlineTextBox())
             continue;
         if (point.y() < leaf->y())
@@ -215,7 +215,7 @@ InlineBox* SVGRootInlineBox::closestLeafChildForPosition(const LayoutPoint& poin
 
 bool SVGRootInlineBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom, HitTestAction hitTestAction)
 {
-    for (InlineBox* leaf = firstLeafChild(); leaf; leaf = leaf->nextLeafChild()) {
+    for (InlineBox* leaf = firstLeafDescendant(); leaf; leaf = leaf->nextLeafOnLine()) {
         if (!leaf->isSVGInlineTextBox())
             continue;
         if (leaf->nodeAtPoint(request, result, locationInContainer, accumulatedOffset, lineTop, lineBottom, hitTestAction))