Diff
Modified: trunk/Source/WebCore/ChangeLog (282657 => 282658)
--- trunk/Source/WebCore/ChangeLog 2021-09-17 12:30:03 UTC (rev 282657)
+++ trunk/Source/WebCore/ChangeLog 2021-09-17 13:24:01 UTC (rev 282658)
@@ -1,3 +1,118 @@
+2021-09-17 Antti Koivisto <[email protected]>
+
+ [LFC][Integration] Move non-traversal functions from iterator to the dereferenced type
+ https://bugs.webkit.org/show_bug.cgi?id=230396
+
+ Reviewed by Alan Bujtas.
+
+ Improve the logic of the iterator interface so the code does not end up as a mixture of . and -> access.
+ This also makes the dereferenced box/line type more useful in itself.
+
+ For example to get a new iterator pointing to the next line:
+
+ auto nextLine = line->next();
+
+ but to mutate the iterator so it points to the next line:
+
+ line.traverseNext();
+
+ * dom/Position.cpp:
+ (WebCore::Position::upstream const):
+ (WebCore::Position::downstream const):
+ (WebCore::Position::rendersInDifferentPosition const):
+ (WebCore::Position::inlineRunAndOffset const):
+ * editing/RenderedPosition.cpp:
+ (WebCore::RenderedPosition::previousLeafOnLine const):
+ (WebCore::RenderedPosition::nextLeafOnLine const):
+ (WebCore::RenderedPosition::leftBoundaryOfBidiRun):
+ (WebCore::RenderedPosition::rightBoundaryOfBidiRun):
+ * editing/RenderedPosition.h:
+ (WebCore::RenderedPosition::line const):
+ * editing/VisiblePosition.cpp:
+ (WebCore::VisiblePosition::leftVisuallyDistinctCandidate const):
+ (WebCore::VisiblePosition::rightVisuallyDistinctCandidate const):
+ (WebCore::VisiblePosition::absoluteSelectionBoundsForLine const):
+ * editing/VisibleUnits.cpp:
+ (WebCore::startTextOrLineBreakRun):
+ (WebCore::endTextOrLineBreakRun):
+ (WebCore::logicallyPreviousRun):
+ (WebCore::logicallyNextRun):
+ (WebCore::startPositionForLine):
+ (WebCore::endPositionForLine):
+ (WebCore::previousLinePosition):
+ (WebCore::nextLinePosition):
+ * html/HTMLTextFormControlElement.cpp:
+ (WebCore::HTMLTextFormControlElement::valueWithHardLineBreaks const):
+ * layout/integration/LayoutIntegrationLineIterator.cpp:
+ (WebCore::LayoutIntegration::LineIterator::LineIterator):
+ (WebCore::LayoutIntegration::firstLineFor):
+ (WebCore::LayoutIntegration::lastLineFor):
+ (WebCore::LayoutIntegration::PathLine::next const):
+ (WebCore::LayoutIntegration::PathLine::previous const):
+ (WebCore::LayoutIntegration::PathLine::firstRun const):
+ (WebCore::LayoutIntegration::PathLine::lastRun const):
+ (WebCore::LayoutIntegration::PathLine::logicalStartRun const):
+ (WebCore::LayoutIntegration::PathLine::logicalEndRun const):
+ (WebCore::LayoutIntegration::PathLine::logicalStartRunWithNode const):
+ (WebCore::LayoutIntegration::PathLine::logicalEndRunWithNode const):
+ (WebCore::LayoutIntegration::PathLine::closestRunForPoint const):
+ (WebCore::LayoutIntegration::PathLine::closestRunForLogicalLeftPosition const):
+ (WebCore::LayoutIntegration::LineIterator::next const): Deleted.
+ (WebCore::LayoutIntegration::LineIterator::previous const): Deleted.
+ (WebCore::LayoutIntegration::LineIterator::firstRun const): Deleted.
+ (WebCore::LayoutIntegration::LineIterator::lastRun const): Deleted.
+ (WebCore::LayoutIntegration::LineIterator::logicalStartRun const): Deleted.
+ (WebCore::LayoutIntegration::LineIterator::logicalEndRun const): Deleted.
+ (WebCore::LayoutIntegration::LineIterator::logicalStartRunWithNode const): Deleted.
+ (WebCore::LayoutIntegration::LineIterator::logicalEndRunWithNode const): Deleted.
+ (WebCore::LayoutIntegration::LineIterator::closestRunForPoint): Deleted.
+ (WebCore::LayoutIntegration::LineIterator::closestRunForLogicalLeftPosition): Deleted.
+ * layout/integration/LayoutIntegrationLineIterator.h:
+ (WebCore::LayoutIntegration::PathLine::isFirst const):
+ (WebCore::LayoutIntegration::LineIterator::isFirst const): Deleted.
+ * layout/integration/LayoutIntegrationRunIterator.cpp:
+ (WebCore::LayoutIntegration::RunIterator::RunIterator):
+ (WebCore::LayoutIntegration::PathRun::nextOnLine const):
+ (WebCore::LayoutIntegration::PathRun::previousOnLine const):
+ (WebCore::LayoutIntegration::PathRun::nextOnLineIgnoringLineBreak const):
+ (WebCore::LayoutIntegration::PathRun::previousOnLineIgnoringLineBreak const):
+ (WebCore::LayoutIntegration::PathRun::style const):
+ (WebCore::LayoutIntegration::PathTextRun::nextTextRun const):
+ (WebCore::LayoutIntegration::PathTextRun::nextTextRunInTextOrder const):
+ (WebCore::LayoutIntegration::TextRunIterator::TextRunIterator):
+ (WebCore::LayoutIntegration::RunIterator::nextOnLine const): Deleted.
+ (WebCore::LayoutIntegration::RunIterator::previousOnLine const): Deleted.
+ (WebCore::LayoutIntegration::RunIterator::nextOnLineIgnoringLineBreak const): Deleted.
+ (WebCore::LayoutIntegration::RunIterator::previousOnLineIgnoringLineBreak const): Deleted.
+ (WebCore::LayoutIntegration::RunIterator::line const): Deleted.
+ * layout/integration/LayoutIntegrationRunIterator.h:
+ (WebCore::LayoutIntegration::TextRunIterator::nextTextRun const): Deleted.
+ (WebCore::LayoutIntegration::TextRunIterator::nextTextRunInTextOrder const): Deleted.
+ * rendering/CaretRectComputation.cpp:
+ (WebCore::computeCaretRectForText):
+ (WebCore::computeCaretRectForLineBreak):
+ (WebCore::computeCaretRectForBox):
+ * rendering/RenderBlockFlow.cpp:
+ (WebCore::RenderBlockFlow::findClosestTextAtAbsolutePoint):
+ (WebCore::RenderBlockFlow::positionForPointWithInlineChildren):
+ * rendering/RenderElement.cpp:
+ (WebCore::RenderElement::getLeadingCorner const):
+ * rendering/RenderImage.cpp:
+ (WebCore::RenderImage::collectSelectionGeometries):
+ * rendering/RenderLineBreak.cpp:
+ (WebCore::RenderLineBreak::collectSelectionGeometries):
+ * rendering/RenderReplaced.cpp:
+ (WebCore::RenderReplaced::positionForPoint):
+ * rendering/RenderText.cpp:
+ (WebCore::RenderText::collectSelectionGeometries):
+ (WebCore::lineDirectionPointFitsInBox):
+ (WebCore::createVisiblePositionAfterAdjustingOffsetForBiDi):
+ (WebCore::RenderText::positionForPoint):
+ * style/InlineTextBoxStyle.cpp:
+ (WebCore::minLogicalTopForTextDecorationLine):
+ (WebCore::maxLogicalBottomForTextDecorationLine):
+ (WebCore::computeUnderlineOffset):
+
2021-09-17 Carlos Garcia Campos <[email protected]>
[GTK][a11y] Add a build option to enable ATSPI
Modified: trunk/Source/WebCore/dom/Position.cpp (282657 => 282658)
--- trunk/Source/WebCore/dom/Position.cpp 2021-09-17 12:30:03 UTC (rev 282657)
+++ trunk/Source/WebCore/dom/Position.cpp 2021-09-17 13:24:01 UTC (rev 282658)
@@ -757,8 +757,8 @@
if (textOffset > run->start() && textOffset <= run->end())
return currentPosition;
- auto nextRun = run.nextTextRunInTextOrder();
- if (textOffset == run->end() + 1 && nextRun && run.line() != nextRun.line())
+ auto nextRun = run->nextTextRunInTextOrder();
+ if (textOffset == run->end() + 1 && nextRun && run->line() != nextRun->line())
return currentPosition;
run = nextRun;
@@ -863,8 +863,8 @@
if (textOffset >= run->start() && textOffset < run->end())
return currentPosition;
- auto nextRun = run.nextTextRunInTextOrder();
- if (textOffset == run->end() && nextRun && run.line() != nextRun.line())
+ auto nextRun = run->nextTextRunInTextOrder();
+ if (textOffset == run->end() && nextRun && run->line() != nextRun->line())
return currentPosition;
run = nextRun;
@@ -1095,7 +1095,7 @@
if (!run1 || !run2)
return false;
- if (run1.line() != run2.line())
+ if (run1->line() != run2->line())
return true;
if (nextRenderedEditable(deprecatedNode()) == position.deprecatedNode()
@@ -1241,7 +1241,7 @@
break;
if (caretOffset == caretMaxOffset) {
- auto nextOnLine = textRun.nextOnLine();
+ auto nextOnLine = textRun->nextOnLine();
if (nextOnLine && nextOnLine->isLineBreak())
break;
}
@@ -1249,7 +1249,7 @@
candidate = textRun;
}
- if (candidate && !candidate.nextTextRun() && affinity == Affinity::Downstream) {
+ if (candidate && !candidate->nextTextRun() && affinity == Affinity::Downstream) {
textRun = searchAheadForBetterMatch(textRenderer);
if (textRun)
caretOffset = textRun->minimumCaretOffset();
@@ -1285,13 +1285,13 @@
if (run->direction() == primaryDirection) {
if (caretOffset == run->rightmostCaretOffset()) {
- auto nextRun = run.nextOnLine();
+ auto nextRun = run->nextOnLine();
if (!nextRun || nextRun->bidiLevel() >= level)
return { run, caretOffset };
level = nextRun->bidiLevel();
- auto previousRun = run.previousOnLine();
+ auto previousRun = run->previousOnLine();
for (; previousRun; previousRun.traversePreviousOnLine()) {
if (previousRun->bidiLevel() <= level)
break;
@@ -1308,13 +1308,13 @@
}
caretOffset = run->rightmostCaretOffset();
} else {
- auto previousRun = run.previousOnLine();
+ auto previousRun = run->previousOnLine();
if (!previousRun || previousRun->bidiLevel() >= level)
return { run, caretOffset };
level = previousRun->bidiLevel();
- auto nextRun = run.nextOnLine();
+ auto nextRun = run->nextOnLine();
for (; nextRun; nextRun.traverseNextOnLine()) {
if (nextRun->bidiLevel() <= level)
break;
@@ -1335,10 +1335,10 @@
}
if (caretOffset == run->leftmostCaretOffset()) {
- auto previousRun = run.previousOnLineIgnoringLineBreak();
+ auto previousRun = run->previousOnLineIgnoringLineBreak();
if (!previousRun || previousRun->bidiLevel() < level) {
// Left edge of a secondary run. Set to the right edge of the entire run.
- for (auto nextRun = run.nextOnLineIgnoringLineBreak(); nextRun; nextRun.traverseNextOnLineIgnoringLineBreak()) {
+ for (auto nextRun = run->nextOnLineIgnoringLineBreak(); nextRun; nextRun.traverseNextOnLineIgnoringLineBreak()) {
if (nextRun->bidiLevel() < level)
break;
run = nextRun;
@@ -1346,7 +1346,7 @@
caretOffset = run->rightmostCaretOffset();
} else if (previousRun->bidiLevel() > level) {
// Right edge of a "tertiary" run. Set to the left edge of that run.
- for (auto tertiaryRun = run.previousOnLineIgnoringLineBreak(); tertiaryRun; tertiaryRun.traversePreviousOnLineIgnoringLineBreak()) {
+ for (auto tertiaryRun = run->previousOnLineIgnoringLineBreak(); tertiaryRun; tertiaryRun.traversePreviousOnLineIgnoringLineBreak()) {
if (tertiaryRun->bidiLevel() <= level)
break;
run = tertiaryRun;
@@ -1354,10 +1354,10 @@
caretOffset = run->leftmostCaretOffset();
}
} else {
- auto nextRun = run.nextOnLineIgnoringLineBreak();
+ auto nextRun = run->nextOnLineIgnoringLineBreak();
if (!nextRun || nextRun->bidiLevel() < level) {
// Right edge of a secondary run. Set to the left edge of the entire run.
- for (auto previousRun = run.previousOnLineIgnoringLineBreak(); previousRun; previousRun.traversePreviousOnLineIgnoringLineBreak()) {
+ for (auto previousRun = run->previousOnLineIgnoringLineBreak(); previousRun; previousRun.traversePreviousOnLineIgnoringLineBreak()) {
if (previousRun->bidiLevel() < level)
break;
run = previousRun;
@@ -1365,7 +1365,7 @@
caretOffset = run->leftmostCaretOffset();
} else if (nextRun->bidiLevel() > level) {
// Left edge of a "tertiary" run. Set to the right edge of that run.
- for (auto tertiaryRun = run.nextOnLineIgnoringLineBreak(); tertiaryRun; tertiaryRun.traverseNextOnLineIgnoringLineBreak()) {
+ for (auto tertiaryRun = run->nextOnLineIgnoringLineBreak(); tertiaryRun; tertiaryRun.traverseNextOnLineIgnoringLineBreak()) {
if (tertiaryRun->bidiLevel() <= level)
break;
run = tertiaryRun;
Modified: trunk/Source/WebCore/editing/RenderedPosition.cpp (282657 => 282658)
--- trunk/Source/WebCore/editing/RenderedPosition.cpp 2021-09-17 12:30:03 UTC (rev 282657)
+++ trunk/Source/WebCore/editing/RenderedPosition.cpp 2021-09-17 13:24:01 UTC (rev 282658)
@@ -98,7 +98,7 @@
LayoutIntegration::RunIterator RenderedPosition::previousLeafOnLine() const
{
if (!m_previousLeafOnLine)
- m_previousLeafOnLine = m_run.previousOnLineIgnoringLineBreak();
+ m_previousLeafOnLine = m_run->previousOnLineIgnoringLineBreak();
return *m_previousLeafOnLine;
}
@@ -105,7 +105,7 @@
LayoutIntegration::RunIterator RenderedPosition::nextLeafOnLine() const
{
if (!m_nextLeafOnLine)
- m_nextLeafOnLine = m_run.nextOnLineIgnoringLineBreak();
+ m_nextLeafOnLine = m_run->nextOnLineIgnoringLineBreak();
return *m_nextLeafOnLine;
}
@@ -135,7 +135,7 @@
auto run = m_run;
do {
- auto prev = run.previousOnLineIgnoringLineBreak();
+ auto prev = run->previousOnLineIgnoringLineBreak();
if (!prev || prev->bidiLevel() < bidiLevelOfRun)
return RenderedPosition(&run->renderer(), run, run->leftmostCaretOffset());
run = prev;
@@ -152,7 +152,7 @@
auto run = m_run;
do {
- auto next = run.nextOnLineIgnoringLineBreak();
+ auto next = run->nextOnLineIgnoringLineBreak();
if (!next || next->bidiLevel() < bidiLevelOfRun)
return RenderedPosition(&run->renderer(), run, run->rightmostCaretOffset());
run = next;
Modified: trunk/Source/WebCore/editing/RenderedPosition.h (282657 => 282658)
--- trunk/Source/WebCore/editing/RenderedPosition.h 2021-09-17 12:30:03 UTC (rev 282657)
+++ trunk/Source/WebCore/editing/RenderedPosition.h 2021-09-17 13:24:01 UTC (rev 282658)
@@ -50,7 +50,7 @@
bool isEquivalent(const RenderedPosition&) const;
bool isNull() const { return !m_renderer; }
- LayoutIntegration::LineIterator line() const { return m_run ? m_run.line() : LayoutIntegration::LineIterator(); }
+ LayoutIntegration::LineIterator line() const { return m_run ? m_run->line() : LayoutIntegration::LineIterator(); }
unsigned char bidiLevelOnLeft() const;
unsigned char bidiLevelOnRight() const;
Modified: trunk/Source/WebCore/editing/VisiblePosition.cpp (282657 => 282658)
--- trunk/Source/WebCore/editing/VisiblePosition.cpp 2021-09-17 12:30:03 UTC (rev 282657)
+++ trunk/Source/WebCore/editing/VisiblePosition.cpp 2021-09-17 13:24:01 UTC (rev 282658)
@@ -153,11 +153,11 @@
if (offset != run->leftmostCaretOffset()) {
// Overshot to the left.
- auto previousRun = run.previousOnLineIgnoringLineBreak();
+ auto previousRun = run->previousOnLineIgnoringLineBreak();
if (!previousRun) {
Position positionOnLeft = primaryDirection == TextDirection::LTR ? previousVisuallyDistinctCandidate(m_deepPosition) : nextVisuallyDistinctCandidate(m_deepPosition);
auto runOnLeft = positionOnLeft.inlineRunAndOffset(m_affinity, primaryDirection).run;
- if (runOnLeft && runOnLeft.line() == run.line())
+ if (runOnLeft && runOnLeft->line() == run->line())
return Position();
return positionOnLeft;
}
@@ -170,11 +170,11 @@
}
unsigned char level = run->bidiLevel();
- auto previousRun = run.previousOnLine();
+ auto previousRun = run->previousOnLine();
if (run->direction() == primaryDirection) {
if (!previousRun) {
- auto logicalStart = (primaryDirection == TextDirection::LTR) ? run.line().logicalStartRunWithNode() : run.line().logicalEndRunWithNode();
+ auto logicalStart = (primaryDirection == TextDirection::LTR) ? run->line()->logicalStartRunWithNode() : run->line()->logicalEndRunWithNode();
if (logicalStart) {
run = logicalStart;
renderer = &run->renderer();
@@ -221,7 +221,7 @@
} else {
// Trailing edge of a secondary run. Set to the leading edge of the entire run.
while (true) {
- while (auto nextRun = run.nextOnLine()) {
+ while (auto nextRun = run->nextOnLine()) {
if (nextRun->bidiLevel() < level)
break;
run = nextRun;
@@ -229,7 +229,7 @@
if (run->bidiLevel() == level)
break;
level = run->bidiLevel();
- while (auto previousRun = run.previousOnLine()) {
+ while (auto previousRun = run->previousOnLine()) {
if (previousRun->bidiLevel() < level)
break;
run = previousRun;
@@ -315,11 +315,11 @@
if (offset != run->rightmostCaretOffset()) {
// Overshot to the right.
- auto nextRun = run.nextOnLineIgnoringLineBreak();
+ auto nextRun = run->nextOnLineIgnoringLineBreak();
if (!nextRun) {
Position positionOnRight = primaryDirection == TextDirection::LTR ? nextVisuallyDistinctCandidate(m_deepPosition) : previousVisuallyDistinctCandidate(m_deepPosition);
auto runOnRight = positionOnRight.inlineRunAndOffset(m_affinity, primaryDirection).run;
- if (runOnRight && runOnRight.line() == run.line())
+ if (runOnRight && runOnRight->line() == run->line())
return Position();
return positionOnRight;
}
@@ -332,11 +332,11 @@
}
unsigned char level = run->bidiLevel();
- auto nextRun = run.nextOnLine();
+ auto nextRun = run->nextOnLine();
if (run->direction() == primaryDirection) {
if (!nextRun) {
- auto logicalEnd = primaryDirection == TextDirection::LTR ? run.line().logicalEndRunWithNode() : run.line().logicalStartRunWithNode();
+ auto logicalEnd = primaryDirection == TextDirection::LTR ? run->line()->logicalEndRunWithNode() : run->line()->logicalStartRunWithNode();
if (logicalEnd) {
run = logicalEnd;
renderer = &run->renderer();
@@ -386,7 +386,7 @@
} else {
// Trailing edge of a secondary run. Set to the leading edge of the entire run.
while (true) {
- while (auto previousRun = run.previousOnLine()) {
+ while (auto previousRun = run->previousOnLine()) {
if (previousRun->bidiLevel() < level)
break;
run = previousRun;
@@ -394,7 +394,7 @@
if (run->bidiLevel() == level)
break;
level = run->bidiLevel();
- while (auto nextRun = run.nextOnLine()) {
+ while (auto nextRun = run->nextOnLine()) {
if (nextRun->bidiLevel() < level)
break;
run = nextRun;
@@ -659,7 +659,7 @@
if (!run)
return { };
- auto line = run.line();
+ auto line = run->line();
auto localRect = FloatRect { FloatPoint { line->contentLogicalLeft(), line->selectionTop() }, FloatPoint { line->contentLogicalRight(), line->selectionBottom() } };
if (!line->isHorizontal())
localRect = localRect.transposedRect();
Modified: trunk/Source/WebCore/editing/VisibleUnits.cpp (282657 => 282658)
--- trunk/Source/WebCore/editing/VisibleUnits.cpp 2021-09-17 12:30:03 UTC (rev 282657)
+++ trunk/Source/WebCore/editing/VisibleUnits.cpp 2021-09-17 13:24:01 UTC (rev 282658)
@@ -151,7 +151,7 @@
static LayoutIntegration::RunIterator startTextOrLineBreakRun(LayoutIntegration::LineIterator line)
{
- auto run = line.logicalStartRun();
+ auto run = line->logicalStartRun();
if (isTextOrLineBreakRun(run))
return run;
return nextTextOrLineBreakRun(run);
@@ -159,7 +159,7 @@
static LayoutIntegration::RunIterator endTextOrLineBreakRun(LayoutIntegration::LineIterator line)
{
- auto run = line.logicalEndRun();
+ auto run = line->logicalEndRun();
if (isTextOrLineBreakRun(run))
return run;
return previousTextOrLineBreakRun(run);
@@ -170,7 +170,7 @@
if (auto previousRun = previousTextOrLineBreakRun(startRun))
return previousRun;
- if (auto previousLine = startRun.line().previous()) {
+ if (auto previousLine = startRun->line()->previous()) {
// FIXME: Why isn't previousBoxInDifferentLine set here?
if (auto previousRun = endTextOrLineBreakRun(previousLine))
return previousRun;
@@ -190,7 +190,7 @@
if (!previousLine)
break;
- if (previousLine != startRun.line()) {
+ if (previousLine != startRun->line()) {
if (auto previousRun = endTextOrLineBreakRun(previousLine)) {
previousBoxInDifferentLine = true;
return previousRun;
@@ -197,7 +197,7 @@
}
}
- startRun = previousLine.logicalStartRun();
+ startRun = previousLine->logicalStartRun();
}
return { };
}
@@ -208,7 +208,7 @@
if (auto nextRun = nextTextOrLineBreakRun(startRun))
return nextRun;
- if (auto nextLine = startRun.line().next()) {
+ if (auto nextLine = startRun->line()->next()) {
// FIXME: Why isn't previousBoxInDifferentLine set here?
if (auto nextRun = startTextOrLineBreakRun(nextLine))
return nextRun;
@@ -228,7 +228,7 @@
if (!nextLine)
break;
- if (nextLine != startRun.line()) {
+ if (nextLine != startRun->line()) {
if (auto nextRun = startTextOrLineBreakRun(nextLine)) {
nextBoxInDifferentLine = true;
return nextRun;
@@ -235,7 +235,7 @@
}
}
- startRun = nextLine.logicalEndRun();
+ startRun = nextLine->logicalEndRun();
}
return { };
}
@@ -746,8 +746,8 @@
return VisiblePosition();
}
- Node* startNode;
- LayoutIntegration::RunIterator startRun = mode == UseLogicalOrdering ? line.logicalStartRunWithNode() : line.firstRun();
+ Node* startNode = nullptr;
+ auto startRun = mode == UseLogicalOrdering ? line->logicalStartRunWithNode() : line->firstRun();
// 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.
while (true) {
@@ -816,8 +816,8 @@
return VisiblePosition();
}
- Node* endNode;
- LayoutIntegration::RunIterator endRun = mode == UseLogicalOrdering ? line.logicalEndRunWithNode() : line.lastRun();
+ Node* endNode = nullptr;
+ auto endRun = mode == UseLogicalOrdering ? line->logicalEndRunWithNode() : line->lastRun();
// 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.
while (true) {
@@ -963,10 +963,10 @@
LayoutIntegration::LineIterator line;
if (auto run = visiblePosition.inlineRunAndOffset().run) {
- line = run.line().previous();
+ line = run->line()->previous();
// We want to skip zero height boxes.
// This could happen in case it is a LegacyRootInlineBox with trailing floats.
- if (!line || !line->logicalHeight() || !line.firstRun())
+ if (!line || !line->logicalHeight() || !line->firstRun())
line = { };
}
@@ -983,7 +983,7 @@
if (line) {
// FIXME: Can be wrong for multi-column layout and with transforms.
auto pointInLine = absoluteLineDirectionPointToLocalPointInBlock(line, lineDirectionPoint);
- auto& renderer = line.closestRunForPoint(pointInLine, isEditablePosition(p))->renderer();
+ auto& renderer = line->closestRunForPoint(pointInLine, isEditablePosition(p))->renderer();
Node* node = renderer.node();
if (node && editingIgnoresContent(*node))
return positionInParentBeforeNode(node);
@@ -1013,10 +1013,10 @@
LayoutIntegration::LineIterator line;
if (auto run = visiblePosition.inlineRunAndOffset().run) {
- line = run.line().next();
+ line = run->line()->next();
// We want to skip zero height boxes.
// This could happen in case it is a LegacyRootInlineBox with trailing floats.
- if (!line || !line->logicalHeight() || !line.firstRun())
+ if (!line || !line->logicalHeight() || !line->firstRun())
line = { };
}
@@ -1036,7 +1036,7 @@
if (line) {
// FIXME: Can be wrong for multi-column layout and with transforms.
auto pointInLine = absoluteLineDirectionPointToLocalPointInBlock(line, lineDirectionPoint);
- auto& renderer = line.closestRunForPoint(pointInLine, isEditablePosition(p))->renderer();
+ auto& renderer = line->closestRunForPoint(pointInLine, isEditablePosition(p))->renderer();
Node* node = renderer.node();
if (node && editingIgnoresContent(*node))
return positionInParentBeforeNode(node);
Modified: trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp (282657 => 282658)
--- trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp 2021-09-17 12:30:03 UTC (rev 282657)
+++ trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp 2021-09-17 13:24:01 UTC (rev 282658)
@@ -707,7 +707,7 @@
auto skipToNextSoftLineBreakPosition = [&] {
for (; currentLine; currentLine.traverseNext()) {
- auto lastRun = currentLine.lastRun();
+ auto lastRun = currentLine->lastRun();
ASSERT(lastRun);
auto& renderer = lastRun->renderer();
auto lineEndsWithBR = is<RenderLineBreak>(renderer) && !downcast<RenderLineBreak>(renderer).isWBR();
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineIterator.cpp (282657 => 282658)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineIterator.cpp 2021-09-17 12:30:03 UTC (rev 282657)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineIterator.cpp 2021-09-17 13:24:01 UTC (rev 282658)
@@ -38,6 +38,11 @@
{
}
+LineIterator::LineIterator(const PathLine& line)
+ : m_line(line)
+{
+}
+
bool LineIterator::atEnd() const
{
return WTF::switchOn(m_line.m_pathVariant, [](auto& path) {
@@ -45,16 +50,6 @@
});
}
-LineIterator LineIterator::next() const
-{
- return LineIterator(*this).traverseNext();
-}
-
-LineIterator LineIterator::previous() const
-{
- return LineIterator(*this).traversePrevious();
-}
-
LineIterator& LineIterator::traverseNext()
{
WTF::switchOn(m_line.m_pathVariant, [](auto& path) {
@@ -76,31 +71,65 @@
return m_line.m_pathVariant == other.m_line.m_pathVariant;
}
-RunIterator LineIterator::firstRun() const
+LineIterator firstLineFor(const RenderBlockFlow& flow)
{
- return m_line.firstRun();
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+ if (auto* lineLayout = flow.modernLineLayout())
+ return lineLayout->firstLine();
+#endif
+
+ return { LineIteratorLegacyPath { flow.firstRootBox() } };
}
-RunIterator LineIterator::lastRun() const
+LineIterator lastLineFor(const RenderBlockFlow& flow)
{
- return m_line.lastRun();
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+ if (auto* lineLayout = flow.modernLineLayout())
+ return lineLayout->lastLine();
+#endif
+
+ return { LineIteratorLegacyPath { flow.lastRootBox() } };
}
-RunIterator LineIterator::logicalStartRun() const
+LineIterator PathLine::next() const
{
- return WTF::switchOn(m_line.m_pathVariant, [](auto& path) -> RunIterator {
+ return LineIterator(*this).traverseNext();
+}
+
+LineIterator PathLine::previous() const
+{
+ return LineIterator(*this).traversePrevious();
+}
+
+RunIterator PathLine::firstRun() const
+{
+ return WTF::switchOn(m_pathVariant, [](auto& path) -> RunIterator {
+ return { path.firstRun() };
+ });
+}
+
+RunIterator PathLine::lastRun() const
+{
+ return WTF::switchOn(m_pathVariant, [](auto& path) -> RunIterator {
+ return { path.lastRun() };
+ });
+}
+
+RunIterator PathLine::logicalStartRun() const
+{
+ return WTF::switchOn(m_pathVariant, [](auto& path) -> RunIterator {
return { path.logicalStartRun() };
});
}
-RunIterator LineIterator::logicalEndRun() const
+RunIterator PathLine::logicalEndRun() const
{
- return WTF::switchOn(m_line.m_pathVariant, [](auto& path) -> RunIterator {
+ return WTF::switchOn(m_pathVariant, [](auto& path) -> RunIterator {
return { path.logicalEndRun() };
});
}
-RunIterator LineIterator::logicalStartRunWithNode() const
+RunIterator PathLine::logicalStartRunWithNode() const
{
for (auto run = logicalStartRun(); run; run.traverseNextOnLineInLogicalOrder()) {
if (run->renderer().node())
@@ -109,7 +138,7 @@
return { };
}
-RunIterator LineIterator::logicalEndRunWithNode() const
+RunIterator PathLine::logicalEndRunWithNode() const
{
for (auto run = logicalEndRun(); run; run.traversePreviousOnLineInLogicalOrder()) {
if (run->renderer().node())
@@ -118,35 +147,13 @@
return { };
}
-LineIterator firstLineFor(const RenderBlockFlow& flow)
+RunIterator PathLine::closestRunForPoint(const IntPoint& pointInContents, bool editableOnly) const
{
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
- if (auto* lineLayout = flow.modernLineLayout())
- return lineLayout->firstLine();
-#endif
-
- return { LineIteratorLegacyPath { flow.firstRootBox() } };
+ return closestRunForLogicalLeftPosition(isHorizontal() ? pointInContents.x() : pointInContents.y(), editableOnly);
}
-LineIterator lastLineFor(const RenderBlockFlow& flow)
+RunIterator PathLine::closestRunForLogicalLeftPosition(int leftPosition, bool editableOnly) const
{
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
- if (auto* lineLayout = flow.modernLineLayout())
- return lineLayout->lastLine();
-#endif
-
- return { LineIteratorLegacyPath { flow.lastRootBox() } };
-}
-
-RunIterator LineIterator::closestRunForPoint(const IntPoint& pointInContents, bool editableOnly)
-{
- if (atEnd())
- return { };
- return closestRunForLogicalLeftPosition(m_line.isHorizontal() ? pointInContents.x() : pointInContents.y(), editableOnly);
-}
-
-RunIterator LineIterator::closestRunForLogicalLeftPosition(int leftPosition, bool editableOnly)
-{
auto isEditable = [&](auto run)
{
return run && run->renderer().node() && run->renderer().node()->hasEditableStyle();
@@ -157,9 +164,9 @@
if (firstRun != lastRun) {
if (firstRun->isLineBreak())
- firstRun = firstRun.nextOnLineIgnoringLineBreak();
+ firstRun = firstRun->nextOnLineIgnoringLineBreak();
else if (lastRun->isLineBreak())
- lastRun = lastRun.previousOnLineIgnoringLineBreak();
+ lastRun = lastRun->previousOnLineIgnoringLineBreak();
}
if (firstRun == lastRun && (!editableOnly || isEditable(firstRun)))
@@ -183,20 +190,6 @@
return closestRun;
}
-RunIterator PathLine::firstRun() const
-{
- return WTF::switchOn(m_pathVariant, [](auto& path) -> RunIterator {
- return { path.firstRun() };
- });
-}
-
-RunIterator PathLine::lastRun() const
-{
- return WTF::switchOn(m_pathVariant, [](auto& path) -> RunIterator {
- return { path.lastRun() };
- });
-}
-
int PathLine::blockDirectionPointInLine() const
{
return !containingBlock().style().isFlippedBlocksWritingMode() ? std::max(top(), selectionTop()) : std::min(bottom(), selectionBottom());
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineIterator.h (282657 => 282658)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineIterator.h 2021-09-17 12:30:03 UTC (rev 282657)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineIterator.h 2021-09-17 13:24:01 UTC (rev 282658)
@@ -77,10 +77,23 @@
const RenderBlockFlow& containingBlock() const;
const LegacyRootInlineBox* legacyRootInlineBox() const;
-private:
+ bool isFirst() const;
+
RunIterator firstRun() const;
RunIterator lastRun() const;
+ LineIterator next() const;
+ LineIterator previous() const;
+
+ RunIterator closestRunForPoint(const IntPoint& pointInContents, bool editableOnly) const;
+ RunIterator closestRunForLogicalLeftPosition(int position, bool editableOnly = false) const;
+
+ RunIterator logicalStartRun() const;
+ RunIterator logicalEndRun() const;
+ RunIterator logicalStartRunWithNode() const;
+ RunIterator logicalEndRunWithNode() const;
+
+private:
friend class LineIterator;
PathVariant m_pathVariant;
@@ -91,16 +104,12 @@
LineIterator() : m_line(LineIteratorLegacyPath { nullptr }) { };
LineIterator(const LegacyRootInlineBox* rootInlineBox) : m_line(LineIteratorLegacyPath { rootInlineBox }) { };
LineIterator(PathLine::PathVariant&&);
+ LineIterator(const PathLine&);
LineIterator& operator++() { return traverseNext(); }
LineIterator& traverseNext();
LineIterator& traversePrevious();
- LineIterator next() const;
- LineIterator previous() const;
-
- bool isFirst() const { return !previous(); }
-
explicit operator bool() const { return !atEnd(); }
bool operator==(const LineIterator&) const;
@@ -114,17 +123,6 @@
bool atEnd() const;
- RunIterator firstRun() const;
- RunIterator lastRun() const;
-
- RunIterator closestRunForPoint(const IntPoint& pointInContents, bool editableOnly);
- RunIterator closestRunForLogicalLeftPosition(int position, bool editableOnly = false);
-
- RunIterator logicalStartRun() const;
- RunIterator logicalEndRun() const;
- RunIterator logicalStartRunWithNode() const;
- RunIterator logicalEndRunWithNode() const;
-
private:
PathLine m_line;
};
@@ -254,6 +252,11 @@
});
}
+inline bool PathLine::isFirst() const
+{
+ return !previous();
}
+
}
+}
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIterator.cpp (282657 => 282658)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIterator.cpp 2021-09-17 12:30:03 UTC (rev 282657)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIterator.cpp 2021-09-17 13:24:01 UTC (rev 282658)
@@ -41,6 +41,11 @@
{
}
+RunIterator::RunIterator(const PathRun& run)
+ : m_run(run)
+{
+}
+
bool RunIterator::operator==(const RunIterator& other) const
{
return m_run.m_pathVariant == other.m_run.m_pathVariant;
@@ -53,31 +58,26 @@
});
}
-RunIterator RunIterator::nextOnLine() const
+RunIterator PathRun::nextOnLine() const
{
return RunIterator(*this).traverseNextOnLine();
}
-RunIterator RunIterator::previousOnLine() const
+RunIterator PathRun::previousOnLine() const
{
return RunIterator(*this).traversePreviousOnLine();
}
-RunIterator RunIterator::nextOnLineIgnoringLineBreak() const
+RunIterator PathRun::nextOnLineIgnoringLineBreak() const
{
return RunIterator(*this).traverseNextOnLineIgnoringLineBreak();
}
-RunIterator RunIterator::previousOnLineIgnoringLineBreak() const
+RunIterator PathRun::previousOnLineIgnoringLineBreak() const
{
return RunIterator(*this).traversePreviousOnLineIgnoringLineBreak();
}
-LineIterator RunIterator::line() const
-{
- return m_run.line();
-}
-
LineIterator PathRun::line() const
{
return WTF::switchOn(m_pathVariant, [](const RunIteratorLegacyPath& path) {
@@ -93,9 +93,19 @@
const RenderStyle& PathRun::style() const
{
- return line().isFirst() ? renderer().firstLineStyle() : renderer().style();
+ return line()->isFirst() ? renderer().firstLineStyle() : renderer().style();
}
+TextRunIterator PathTextRun::nextTextRun() const
+{
+ return TextRunIterator(*this).traverseNextTextRun();
+}
+
+TextRunIterator PathTextRun::nextTextRunInTextOrder() const
+{
+ return TextRunIterator(*this).traverseNextTextRunInTextOrder();
+}
+
RenderObject::HighlightState PathRun::selectionState() const
{
if (isText()) {
@@ -111,6 +121,11 @@
{
}
+TextRunIterator::TextRunIterator(const PathRun& run)
+ : RunIterator(run)
+{
+}
+
TextRunIterator& TextRunIterator::traverseNextTextRun()
{
WTF::switchOn(m_run.m_pathVariant, [](auto& path) {
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIterator.h (282657 => 282658)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIterator.h 2021-09-17 12:30:03 UTC (rev 282657)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIterator.h 2021-09-17 13:24:01 UTC (rev 282658)
@@ -40,6 +40,7 @@
namespace LayoutIntegration {
class LineIterator;
+class RunIterator;
class TextRunIterator;
struct EndIterator { };
@@ -87,12 +88,17 @@
// For intermediate porting steps only.
LegacyInlineBox* legacyInlineBox() const;
+ RunIterator nextOnLine() const;
+ RunIterator previousOnLine() const;
+ RunIterator nextOnLineIgnoringLineBreak() const;
+ RunIterator previousOnLineIgnoringLineBreak() const;
+
+ LineIterator line() const;
+
protected:
friend class RunIterator;
friend class TextRunIterator;
- LineIterator line() const;
-
// To help with debugging.
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
const RunIteratorModernPath& modernPath() const;
@@ -121,6 +127,9 @@
const RenderText& renderer() const { return downcast<RenderText>(PathRun::renderer()); }
LegacyInlineTextBox* legacyInlineBox() const { return downcast<LegacyInlineTextBox>(PathRun::legacyInlineBox()); }
+
+ TextRunIterator nextTextRun() const;
+ TextRunIterator nextTextRunInTextOrder() const;
};
class RunIterator {
@@ -127,6 +136,7 @@
public:
RunIterator() : m_run(RunIteratorLegacyPath { nullptr, { } }) { };
RunIterator(PathRun::PathVariant&&);
+ RunIterator(const PathRun&);
explicit operator bool() const { return !atEnd(); }
@@ -141,11 +151,6 @@
bool atEnd() const;
- RunIterator nextOnLine() const;
- RunIterator previousOnLine() const;
- RunIterator nextOnLineIgnoringLineBreak() const;
- RunIterator previousOnLineIgnoringLineBreak() const;
-
RunIterator& traverseNextOnLine();
RunIterator& traversePreviousOnLine();
RunIterator& traverseNextOnLineIgnoringLineBreak();
@@ -153,8 +158,6 @@
RunIterator& traverseNextOnLineInLogicalOrder();
RunIterator& traversePreviousOnLineInLogicalOrder();
- LineIterator line() const;
-
protected:
PathRun m_run;
};
@@ -163,6 +166,7 @@
public:
TextRunIterator() { }
TextRunIterator(PathRun::PathVariant&&);
+ TextRunIterator(const PathRun&);
TextRunIterator& operator++() { return traverseNextTextRun(); }
@@ -172,9 +176,6 @@
TextRunIterator& traverseNextTextRun();
TextRunIterator& traverseNextTextRunInTextOrder();
- TextRunIterator nextTextRun() const { return TextRunIterator(*this).traverseNextTextRun(); }
- TextRunIterator nextTextRunInTextOrder() const { return TextRunIterator(*this).traverseNextTextRunInTextOrder(); }
-
private:
RunIterator& traverseNextOnLine() = delete;
RunIterator& traversePreviousOnLine() = delete;
Modified: trunk/Source/WebCore/rendering/CaretRectComputation.cpp (282657 => 282658)
--- trunk/Source/WebCore/rendering/CaretRectComputation.cpp 2021-09-17 12:30:03 UTC (rev 282657)
+++ trunk/Source/WebCore/rendering/CaretRectComputation.cpp 2021-09-17 13:24:01 UTC (rev 282658)
@@ -172,7 +172,7 @@
return { };
auto& textRun = downcast<LayoutIntegration::TextRunIterator>(runAndOffset.run);
- auto line = textRun.line();
+ auto line = textRun->line();
float position = textRun->positionForOffset(runAndOffset.offset);
return computeCaretRectForLinePosition(line, position, caretRectMode);
@@ -185,7 +185,7 @@
if (!runAndOffset.run)
return { };
- auto line = runAndOffset.run.line();
+ auto line = runAndOffset.run->line();
return computeCaretRectForLinePosition(line, line->contentLogicalLeft(), caretRectMode);
}
@@ -227,7 +227,7 @@
rect.move(LayoutSize(renderer.width() - caretWidth, 0_lu));
if (runAndOffset.run) {
- auto line = runAndOffset.run.line();
+ auto line = runAndOffset.run->line();
LayoutUnit top = line->top();
rect.setY(top);
rect.setHeight(line->bottom() - top);
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (282657 => 282658)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2021-09-17 12:30:03 UTC (rev 282657)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2021-09-17 13:24:01 UTC (rev 282658)
@@ -3516,10 +3516,10 @@
if (localPoint.y() < currentBottom)
return nullptr;
- auto next = current.next();
+ auto next = current->next();
float nextTop = next->y();
if (localPoint.y() < nextTop) {
- auto run = current.closestRunForLogicalLeftPosition(localPoint.x());
+ auto run = current->closestRunForLogicalLeftPosition(localPoint.x());
if (run && is<RenderText>(run->renderer()))
return const_cast<RenderText*>(&downcast<RenderText>(run->renderer()));
}
@@ -3547,7 +3547,7 @@
if (fragment && line->legacyRootInlineBox() && line->legacyRootInlineBox()->containingFragment() != fragment)
continue;
- if (!line.firstRun())
+ if (!line->firstRun())
continue;
if (!firstLineWithChildren)
firstLineWithChildren = line;
@@ -3561,8 +3561,8 @@
// check if this root line box is located at this y coordinate
if (pointInLogicalContents.y() < line->selectionBottom() || (blocksAreFlipped && pointInLogicalContents.y() == line->selectionBottom())) {
if (linesAreFlipped) {
- auto nextLineWithChildren = line.next();
- while (nextLineWithChildren && !nextLineWithChildren.firstRun())
+ auto nextLineWithChildren = line->next();
+ while (nextLineWithChildren && !nextLineWithChildren->firstRun())
nextLineWithChildren.traverseNext();
if (nextLineWithChildren && nextLineWithChildren->legacyRootInlineBox() && nextLineWithChildren->legacyRootInlineBox()->isFirstAfterPageBreak()
@@ -3569,7 +3569,7 @@
&& (pointInLogicalContents.y() > nextLineWithChildren->lineBoxTop() || (!blocksAreFlipped && pointInLogicalContents.y() == nextLineWithChildren->lineBoxTop())))
continue;
}
- closestRun = line.closestRunForLogicalLeftPosition(pointInLogicalContents.x());
+ closestRun = line->closestRunForLogicalLeftPosition(pointInLogicalContents.x());
if (closestRun)
break;
}
@@ -3579,7 +3579,7 @@
if (!moveCaretToBoundary && !closestRun && lastLineWithChildren) {
// y coordinate is below last root line box, pretend we hit it
- closestRun = lastLineWithChildren.closestRunForLogicalLeftPosition(pointInLogicalContents.x());
+ closestRun = lastLineWithChildren->closestRunForLogicalLeftPosition(pointInLogicalContents.x());
}
if (closestRun) {
@@ -3587,9 +3587,9 @@
LayoutUnit firstLineWithChildrenTop = std::min(firstLineWithChildren->selectionTopForHitTesting(), LayoutUnit(firstLineWithChildren->top()));
if (pointInLogicalContents.y() < firstLineWithChildrenTop
|| (blocksAreFlipped && pointInLogicalContents.y() == firstLineWithChildrenTop)) {
- auto run = firstLineWithChildren.firstRun();
+ auto run = firstLineWithChildren->firstRun();
if (run->isLineBreak()) {
- if (auto next = run.nextOnLineIgnoringLineBreak())
+ if (auto next = run->nextOnLineIgnoringLineBreak())
run = next;
}
// y coordinate is above first root line box, so return the start of the first
@@ -3598,7 +3598,7 @@
}
// pass the box a top position that is inside it
- LayoutPoint point(pointInLogicalContents.x(), closestRun.line()->blockDirectionPointInLine());
+ LayoutPoint point(pointInLogicalContents.x(), closestRun->line()->blockDirectionPointInLine());
if (!isHorizontalWritingMode())
point = point.transposedPoint();
if (closestRun->renderer().isReplaced())
@@ -3609,7 +3609,7 @@
if (lastLineWithChildren) {
// We hit this case for Mac behavior when the Y coordinate is below the last box.
ASSERT(moveCaretToBoundary);
- if (auto logicallyLastRun = lastLineWithChildren.logicalEndRunWithNode())
+ if (auto logicallyLastRun = lastLineWithChildren->logicalEndRunWithNode())
return positionForRun(*this, logicallyLastRun, false);
}
Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (282657 => 282658)
--- trunk/Source/WebCore/rendering/RenderElement.cpp 2021-09-17 12:30:03 UTC (rev 282657)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp 2021-09-17 13:24:01 UTC (rev 282658)
@@ -1655,7 +1655,7 @@
if (is<RenderText>(*o)) {
auto& textRenderer = downcast<RenderText>(*o);
if (auto run = LayoutIntegration::firstTextRunFor(textRenderer))
- point.move(textRenderer.linesBoundingBox().x(), run.line()->top());
+ point.move(textRenderer.linesBoundingBox().x(), run->line()->top());
} else if (is<RenderBox>(*o))
point.moveBy(downcast<RenderBox>(*o).location());
point = o->container()->localToAbsolute(point, UseTransforms, &insideFixed);
Modified: trunk/Source/WebCore/rendering/RenderImage.cpp (282657 => 282658)
--- trunk/Source/WebCore/rendering/RenderImage.cpp 2021-09-17 12:30:03 UTC (rev 282657)
+++ trunk/Source/WebCore/rendering/RenderImage.cpp 2021-09-17 13:24:01 UTC (rev 282658)
@@ -106,11 +106,11 @@
lineExtentRect.setHeight(containingBlock->height());
}
} else {
- auto line = run.line();
+ auto line = run->line();
LayoutUnit selectionTop = !containingBlock->style().isFlippedBlocksWritingMode() ? line->selectionTop() - logicalTop() : logicalBottom() - line->selectionBottom();
imageRect = IntRect(0, selectionTop, logicalWidth(), line->selectionHeight());
- isFirstOnLine = !run.previousOnLine();
- isLastOnLine = !run.nextOnLine();
+ isFirstOnLine = !run->previousOnLine();
+ isLastOnLine = !run->nextOnLine();
LogicalSelectionOffsetCaches cache(*containingBlock);
LayoutUnit leftOffset = containingBlock->logicalLeftSelectionOffset(*containingBlock, LayoutUnit(run->logicalTop()), cache);
LayoutUnit rightOffset = containingBlock->logicalRightSelectionOffset(*containingBlock, LayoutUnit(run->logicalTop()), cache);
Modified: trunk/Source/WebCore/rendering/RenderLineBreak.cpp (282657 => 282658)
--- trunk/Source/WebCore/rendering/RenderLineBreak.cpp 2021-09-17 12:30:03 UTC (rev 282657)
+++ trunk/Source/WebCore/rendering/RenderLineBreak.cpp 2021-09-17 13:24:01 UTC (rev 282658)
@@ -184,7 +184,7 @@
if (!run)
return;
- auto line = run.line();
+ auto line = run->line();
auto lineSelectionRect = line->selectionRect();
LayoutRect rect = IntRect(run->logicalLeft(), lineSelectionRect.y(), 0, lineSelectionRect.height());
@@ -214,8 +214,8 @@
extentsRect = localToAbsoluteQuad(FloatRect(extentsRect)).enclosingBoundingBox();
if (!run->isHorizontal())
extentsRect = extentsRect.transposedRect();
- bool isFirstOnLine = !run.previousOnLine();
- bool isLastOnLine = !run.nextOnLine();
+ bool isFirstOnLine = !run->previousOnLine();
+ bool isLastOnLine = !run->nextOnLine();
if (containingBlock->isRubyBase() || containingBlock->isRubyText())
isLastOnLine = !containingBlock->containingBlock()->inlineBoxWrapper()->nextOnLineExists();
Modified: trunk/Source/WebCore/rendering/RenderReplaced.cpp (282657 => 282658)
--- trunk/Source/WebCore/rendering/RenderReplaced.cpp 2021-09-17 12:30:03 UTC (rev 282657)
+++ trunk/Source/WebCore/rendering/RenderReplaced.cpp 2021-09-17 13:24:01 UTC (rev 282658)
@@ -690,7 +690,7 @@
{
auto [top, bottom] = [&] {
if (auto run = LayoutIntegration::runFor(*this)) {
- auto line = run.line();
+ auto line = run->line();
return std::make_pair(line->selectionTopForHitTesting(), line->selectionBottom());
}
return std::make_pair(logicalTop(), logicalBottom());
Modified: trunk/Source/WebCore/rendering/RenderText.cpp (282657 => 282658)
--- trunk/Source/WebCore/rendering/RenderText.cpp 2021-09-17 12:30:03 UTC (rev 282657)
+++ trunk/Source/WebCore/rendering/RenderText.cpp 2021-09-17 13:24:01 UTC (rev 282658)
@@ -337,11 +337,11 @@
continue;
}
- if (run.line()->legacyRootInlineBox() && run.line()->legacyRootInlineBox()->isFirstAfterPageBreak()) {
+ if (run->line()->legacyRootInlineBox() && run->line()->legacyRootInlineBox()->isFirstAfterPageBreak()) {
if (run->isHorizontal())
- rect.shiftYEdgeTo(run.line()->lineBoxTop());
+ rect.shiftYEdgeTo(run->line()->lineBoxTop());
else
- rect.shiftXEdgeTo(run.line()->lineBoxTop());
+ rect.shiftXEdgeTo(run->line()->lineBoxTop());
}
RenderBlock* containingBlock = this->containingBlock();
@@ -360,8 +360,8 @@
extentsRect = localToAbsoluteQuad(FloatRect(extentsRect)).enclosingBoundingBox();
if (!run->isHorizontal())
extentsRect = extentsRect.transposedRect();
- bool isFirstOnLine = !run.previousOnLine();
- bool isLastOnLine = !run.nextOnLine();
+ bool isFirstOnLine = !run->previousOnLine();
+ bool isLastOnLine = !run->nextOnLine();
if (containingBlock->isRubyBase() || containingBlock->isRubyText())
isLastOnLine = !containingBlock->containingBlock()->inlineBoxWrapper()->nextOnLineExists();
@@ -531,7 +531,7 @@
// 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 <= textRun->logicalLeft()) {
- shouldAffinityBeDownstream = !textRun.previousOnLine() ? UpstreamIfPositionIsNotAtStart : AlwaysDownstream;
+ shouldAffinityBeDownstream = !textRun->previousOnLine() ? UpstreamIfPositionIsNotAtStart : AlwaysDownstream;
return true;
}
@@ -546,10 +546,10 @@
// box is first on line
// and the x coordinate is to the left of the first text box left edge
- if (!textRun.previousOnLineIgnoringLineBreak() && pointLineDirection < textRun->logicalLeft())
+ if (!textRun->previousOnLineIgnoringLineBreak() && pointLineDirection < textRun->logicalLeft())
return true;
- if (!textRun.nextOnLineIgnoringLineBreak()) {
+ if (!textRun->nextOnLineIgnoringLineBreak()) {
// box is last on line
// and the x coordinate is to the right of the last text box right edge
// generate VisiblePosition, use Affinity::Upstream affinity if possible
@@ -586,7 +586,7 @@
if (positionIsAtStartOfBox == run->isLeftToRightDirection()) {
// offset is on the left edge
- auto previousRun = run.previousOnLineIgnoringLineBreak();
+ auto previousRun = run->previousOnLineIgnoringLineBreak();
if ((previousRun && previousRun->bidiLevel() == run->bidiLevel())
|| run->renderer().containingBlock()->style().direction() == run->direction()) // FIXME: left on 12CBA
return createVisiblePositionForBox(run, run->leftmostCaretOffset(), shouldAffinityBeDownstream);
@@ -605,7 +605,7 @@
if (!previousRun || previousRun->bidiLevel() < run->bidiLevel()) {
// e.g. left of D in aDC12BAb
LayoutIntegration::RunIterator rightmostRun = run;
- for (auto nextRun = run.nextOnLineIgnoringLineBreak(); nextRun; nextRun.traverseNextOnLineIgnoringLineBreak()) {
+ for (auto nextRun = run->nextOnLineIgnoringLineBreak(); nextRun; nextRun.traverseNextOnLineIgnoringLineBreak()) {
if (nextRun->bidiLevel() < run->bidiLevel())
break;
rightmostRun = nextRun;
@@ -617,7 +617,7 @@
return createVisiblePositionForBox(run, run->rightmostCaretOffset(), shouldAffinityBeDownstream);
}
- auto nextRun = run.nextOnLineIgnoringLineBreak();
+ auto nextRun = run->nextOnLineIgnoringLineBreak();
if ((nextRun && nextRun->bidiLevel() == run->bidiLevel())
|| run->renderer().containingBlock()->style().direction() == run->direction())
return createVisiblePositionForBox(run, run->rightmostCaretOffset(), shouldAffinityBeDownstream);
@@ -638,7 +638,7 @@
if (!nextRun || nextRun->bidiLevel() < run->bidiLevel()) {
// e.g. right of A in aDC12BAb
LayoutIntegration::RunIterator leftmostRun = run;
- for (auto previousRun = run.previousOnLineIgnoringLineBreak(); previousRun; previousRun.traversePreviousOnLineIgnoringLineBreak()) {
+ for (auto previousRun = run->previousOnLineIgnoringLineBreak(); previousRun; previousRun.traversePreviousOnLineIgnoringLineBreak()) {
if (previousRun->bidiLevel() < run->bidiLevel())
break;
leftmostRun = previousRun;
@@ -665,14 +665,14 @@
LayoutIntegration::TextRunIterator lastRun;
for (auto run = firstRun; run; run.traverseNextTextRun()) {
- if (run->isLineBreak() && !run.previousOnLine() && run.nextOnLine() && !run.nextOnLine()->isLineBreak())
+ if (run->isLineBreak() && !run->previousOnLine() && run->nextOnLine() && !run->nextOnLine()->isLineBreak())
run.traverseNextTextRun();
- auto line = run.line();
+ auto line = run->line();
LayoutUnit top = std::min(line->selectionTopForHitTesting(), line->top());
if (pointBlockDirection > top || (!blocksAreFlipped && pointBlockDirection == top)) {
LayoutUnit bottom = line->selectionBottom();
- if (auto nextLine = line.next())
+ if (auto nextLine = line->next())
bottom = std::min(bottom, nextLine->top());
if (pointBlockDirection < bottom || (blocksAreFlipped && pointBlockDirection == bottom)) {
Modified: trunk/Source/WebCore/style/InlineTextBoxStyle.cpp (282657 => 282658)
--- trunk/Source/WebCore/style/InlineTextBoxStyle.cpp 2021-09-17 12:30:03 UTC (rev 282657)
+++ trunk/Source/WebCore/style/InlineTextBoxStyle.cpp 2021-09-17 13:24:01 UTC (rev 282658)
@@ -51,7 +51,7 @@
static void minLogicalTopForTextDecorationLine(const LayoutIntegration::LineIterator& line, float& minLogicalTop, const RenderElement* decorationRenderer, OptionSet<TextDecoration> textDecoration)
{
- for (auto run = line.firstRun(); run; run.traverseNextOnLine()) {
+ for (auto run = line->firstRun(); run; run.traverseNextOnLine()) {
if (run->renderer().isOutOfFlowPositioned())
continue; // Positioned placeholders don't affect calculations.
@@ -68,7 +68,7 @@
static void maxLogicalBottomForTextDecorationLine(const LayoutIntegration::LineIterator& line, float& maxLogicalBottom, const RenderElement* decorationRenderer, OptionSet<TextDecoration> textDecoration)
{
- for (auto run = line.firstRun(); run; run.traverseNextOnLine()) {
+ for (auto run = line->firstRun(); run; run.traverseNextOnLine()) {
if (run->renderer().isOutOfFlowPositioned())
continue; // Positioned placeholders don't affect calculations.
@@ -119,7 +119,7 @@
auto resolvedUnderlinePosition = underlinePosition;
if (resolvedUnderlinePosition == TextUnderlinePosition::Auto && underlineOffset.isAuto()) {
if (textRun)
- resolvedUnderlinePosition = textRun.line()->baselineType() == IdeographicBaseline ? TextUnderlinePosition::Under : TextUnderlinePosition::Auto;
+ resolvedUnderlinePosition = textRun->line()->baselineType() == IdeographicBaseline ? TextUnderlinePosition::Under : TextUnderlinePosition::Auto;
else
resolvedUnderlinePosition = TextUnderlinePosition::Auto;
}
@@ -134,8 +134,8 @@
case TextUnderlinePosition::Under: {
ASSERT(textRun);
// Position underline relative to the bottom edge of the lowest element's content box.
- auto line = textRun.line();
- auto* decorationRenderer = enclosingRendererWithTextDecoration(textRun->renderer(), TextDecoration::Underline, line.isFirst());
+ auto line = textRun->line();
+ auto* decorationRenderer = enclosingRendererWithTextDecoration(textRun->renderer(), TextDecoration::Underline, line->isFirst());
float offset;
if (textRun->renderer().style().isFlippedLinesWritingMode()) {