Diff
Modified: trunk/Source/WebCore/ChangeLog (269152 => 269153)
--- trunk/Source/WebCore/ChangeLog 2020-10-29 17:10:11 UTC (rev 269152)
+++ trunk/Source/WebCore/ChangeLog 2020-10-29 17:21:09 UTC (rev 269153)
@@ -1,5 +1,49 @@
2020-10-29 Antti Koivisto <[email protected]>
+ [LFC][Integration] Rename text run localStart/EndOffset to start/end
+ https://bugs.webkit.org/show_bug.cgi?id=218344
+
+ Reviewed by Zalan Bujtas.
+
+ There is no danger of confusion and these are called just start/end elsewhere.
+
+ * dom/Position.cpp:
+ (WebCore::Position::upstream const):
+ (WebCore::Position::downstream const):
+ * editing/TextIterator.cpp:
+ (WebCore::TextIterator::handleTextRun):
+ * editing/VisibleUnits.cpp:
+ (WebCore::startPositionForLine):
+ (WebCore::endPositionForLine):
+ * layout/integration/LayoutIntegrationRunIterator.h:
+ (WebCore::LayoutIntegration::PathTextRun::start const):
+ (WebCore::LayoutIntegration::PathTextRun::end const):
+ (WebCore::LayoutIntegration::PathTextRun::localStartOffset const): Deleted.
+ (WebCore::LayoutIntegration::PathTextRun::localEndOffset const): Deleted.
+ * layout/integration/LayoutIntegrationRunIteratorLegacyPath.h:
+ (WebCore::LayoutIntegration::RunIteratorLegacyPath::start const):
+ (WebCore::LayoutIntegration::RunIteratorLegacyPath::end const):
+ (WebCore::LayoutIntegration::RunIteratorLegacyPath::localStartOffset const): Deleted.
+ (WebCore::LayoutIntegration::RunIteratorLegacyPath::localEndOffset const): Deleted.
+ * layout/integration/LayoutIntegrationRunIteratorModernPath.h:
+ (WebCore::LayoutIntegration::RunIteratorModernPath::minimumCaretOffset const):
+ (WebCore::LayoutIntegration::RunIteratorModernPath::maximumCaretOffset const):
+ (WebCore::LayoutIntegration::RunIteratorModernPath::start const):
+ (WebCore::LayoutIntegration::RunIteratorModernPath::end const):
+ (WebCore::LayoutIntegration::RunIteratorModernPath::localStartOffset const): Deleted.
+ (WebCore::LayoutIntegration::RunIteratorModernPath::localEndOffset const): Deleted.
+ * rendering/RenderBlockFlow.cpp:
+ (WebCore::positionForRun):
+ * rendering/RenderText.cpp:
+ (WebCore::createVisiblePositionAfterAdjustingOffsetForBiDi):
+ (WebCore::RenderText::positionForPoint):
+ (WebCore::RenderText::caretMinOffset const):
+ (WebCore::RenderText::caretMaxOffset const):
+ (WebCore::RenderText::countRenderedCharacterOffsetsUntil const):
+ (WebCore::containsOffset):
+
+2020-10-29 Antti Koivisto <[email protected]>
+
[LFC][Integration] Rename top/bottomWithLeading to lineBoxTop/Bottom
https://bugs.webkit.org/show_bug.cgi?id=218340
Modified: trunk/Source/WebCore/dom/Position.cpp (269152 => 269153)
--- trunk/Source/WebCore/dom/Position.cpp 2020-10-29 17:10:11 UTC (rev 269152)
+++ trunk/Source/WebCore/dom/Position.cpp 2020-10-29 17:21:09 UTC (rev 269153)
@@ -751,13 +751,13 @@
unsigned textOffset = currentPosition.offsetInLeafNode();
for (auto run = firstTextRun; run; run.traverseNextTextRunInTextOrder()) {
- if (textOffset <= run->localEndOffset()) {
- if (textOffset > run->localStartOffset())
+ if (textOffset <= run->end()) {
+ if (textOffset > run->start())
return currentPosition;
continue;
}
- if (textOffset == run->localEndOffset() + 1 && run->isLastTextRunOnLine() && !run->isLastTextRun())
+ if (textOffset == run->end() + 1 && run->isLastTextRunOnLine() && !run->isLastTextRun())
return currentPosition;
}
}
@@ -854,16 +854,16 @@
unsigned textOffset = currentPosition.offsetInLeafNode();
for (auto run = firstTextRun; run; run.traverseNextTextRunInTextOrder()) {
- if (!run->length() && textOffset == run->localStartOffset())
+ if (!run->length() && textOffset == run->start())
return currentPosition;
- if (textOffset < run->localEndOffset()) {
- if (textOffset >= run->localStartOffset())
+ if (textOffset < run->end()) {
+ if (textOffset >= run->start())
return currentPosition;
continue;
}
- if (textOffset == run->localEndOffset() && run->isLastTextRunOnLine() && !run->isLastTextRun())
+ if (textOffset == run->end() && run->isLastTextRunOnLine() && !run->isLastTextRun())
return currentPosition;
}
}
Modified: trunk/Source/WebCore/editing/TextIterator.cpp (269152 => 269153)
--- trunk/Source/WebCore/editing/TextIterator.cpp 2020-10-29 17:10:11 UTC (rev 269152)
+++ trunk/Source/WebCore/editing/TextIterator.cpp 2020-10-29 17:21:09 UTC (rev 269153)
@@ -613,7 +613,7 @@
unsigned start = m_offset;
unsigned end = (&textNode == m_endContainer) ? static_cast<unsigned>(m_endOffset) : UINT_MAX;
while (m_textRun) {
- unsigned textRunStart = m_textRun->localStartOffset();
+ unsigned textRunStart = m_textRun->start();
unsigned runStart = std::max(textRunStart, start);
// Check for collapsed space at the start of this run.
@@ -666,7 +666,7 @@
return;
// Advance and return
- unsigned nextRunStart = nextTextRun ? nextTextRun->localStartOffset() : rendererText.length();
+ unsigned nextRunStart = nextTextRun ? nextTextRun->start() : rendererText.length();
if (nextRunStart > runEnd)
m_lastTextNodeEndedWithCollapsedSpace = true; // collapsed space between runs or at the end
m_textRun = nextTextRun;
Modified: trunk/Source/WebCore/editing/VisibleUnits.cpp (269152 => 269153)
--- trunk/Source/WebCore/editing/VisibleUnits.cpp 2020-10-29 17:10:11 UTC (rev 269152)
+++ trunk/Source/WebCore/editing/VisibleUnits.cpp 2020-10-29 17:21:09 UTC (rev 269153)
@@ -811,7 +811,7 @@
}
}
- return is<Text>(*startNode) ? Position(downcast<Text>(startNode), downcast<LayoutIntegration::PathTextRun>(*startRun).localStartOffset())
+ return is<Text>(*startNode) ? Position(downcast<Text>(startNode), downcast<LayoutIntegration::PathTextRun>(*startRun).start())
: positionBeforeNode(startNode);
}
@@ -891,7 +891,7 @@
pos = positionBeforeNode(endNode);
else if (is<LayoutIntegration::PathTextRun>(*endRun) && is<Text>(*endNode)) {
auto& endTextRun = downcast<LayoutIntegration::PathTextRun>(*endRun);
- int endOffset = endTextRun.localStartOffset();
+ int endOffset = endTextRun.start();
if (!endTextRun.isLineBreak())
endOffset += endTextRun.length();
pos = Position(downcast<Text>(endNode), endOffset);
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIterator.h (269152 => 269153)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIterator.h 2020-10-29 17:10:11 UTC (rev 269152)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIterator.h 2020-10-29 17:21:09 UTC (rev 269153)
@@ -103,9 +103,8 @@
bool hasHyphen() const;
StringView text() const;
- // These offsets are relative to the text renderer (not flow).
- unsigned localStartOffset() const;
- unsigned localEndOffset() const;
+ unsigned start() const;
+ unsigned end() const;
unsigned length() const;
unsigned offsetForPosition(float x) const;
@@ -298,17 +297,17 @@
});
}
-inline unsigned PathTextRun::localStartOffset() const
+inline unsigned PathTextRun::start() const
{
return WTF::switchOn(m_pathVariant, [](auto& path) {
- return path.localStartOffset();
+ return path.start();
});
}
-inline unsigned PathTextRun::localEndOffset() const
+inline unsigned PathTextRun::end() const
{
return WTF::switchOn(m_pathVariant, [](auto& path) {
- return path.localEndOffset();
+ return path.end();
});
}
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorLegacyPath.h (269152 => 269153)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorLegacyPath.h 2020-10-29 17:10:11 UTC (rev 269152)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorLegacyPath.h 2020-10-29 17:21:09 UTC (rev 269153)
@@ -55,8 +55,8 @@
bool hasHyphen() const { return inlineTextBox()->hasHyphen(); }
StringView text() const { return StringView(inlineTextBox()->renderer().text()).substring(inlineTextBox()->start(), inlineTextBox()->len()); }
- unsigned localStartOffset() const { return inlineTextBox()->start(); }
- unsigned localEndOffset() const { return inlineTextBox()->end(); }
+ unsigned start() const { return inlineTextBox()->start(); }
+ unsigned end() const { return inlineTextBox()->end(); }
unsigned length() const { return inlineTextBox()->len(); }
inline unsigned offsetForPosition(float x) const { return inlineTextBox()->offsetForPosition(x); }
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorModernPath.h (269152 => 269153)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorModernPath.h 2020-10-29 17:10:11 UTC (rev 269152)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorModernPath.h 2020-10-29 17:21:09 UTC (rev 269153)
@@ -55,15 +55,15 @@
bool dirOverride() const { return false; }
bool isLineBreak() const { return run().isLineBreak(); }
- unsigned minimumCaretOffset() const { return isText() ? localStartOffset() : 0; }
- unsigned maximumCaretOffset() const { return isText() ? localEndOffset() : 1; }
+ unsigned minimumCaretOffset() const { return isText() ? start() : 0; }
+ unsigned maximumCaretOffset() const { return isText() ? end() : 1; }
unsigned char bidiLevel() const { return 0; }
bool hasHyphen() const { return run().textContent()->needsHyphen(); }
StringView text() const { return run().textContent()->content(); }
- unsigned localStartOffset() const { return run().textContent()->start(); }
- unsigned localEndOffset() const { return run().textContent()->end(); }
+ unsigned start() const { return run().textContent()->start(); }
+ unsigned end() const { return run().textContent()->end(); }
unsigned length() const { return run().textContent()->length(); }
inline unsigned offsetForPosition(float x) const
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (269152 => 269153)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2020-10-29 17:10:11 UTC (rev 269152)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2020-10-29 17:21:09 UTC (rev 269153)
@@ -3318,7 +3318,7 @@
return makeDeprecatedLegacyPosition(run->renderer().nonPseudoNode(), start ? run->renderer().caretMinOffset() : run->renderer().caretMaxOffset());
auto& textRun = downcast<LayoutIntegration::TextRunIterator>(run);
- return makeDeprecatedLegacyPosition(textRun->renderer().nonPseudoNode(), start ? textRun->localStartOffset() : textRun->localEndOffset());
+ return makeDeprecatedLegacyPosition(textRun->renderer().nonPseudoNode(), start ? textRun->start() : textRun->end());
}
RenderText* RenderBlockFlow::findClosestTextAtAbsolutePoint(const FloatPoint& point)
Modified: trunk/Source/WebCore/rendering/RenderText.cpp (269152 => 269153)
--- trunk/Source/WebCore/rendering/RenderText.cpp 2020-10-29 17:10:11 UTC (rev 269152)
+++ trunk/Source/WebCore/rendering/RenderText.cpp 2020-10-29 17:21:09 UTC (rev 269153)
@@ -515,7 +515,7 @@
ASSERT(offset >= 0);
if (offset && offset < run->length())
- return createVisiblePositionForBox(run, run->localStartOffset() + offset, shouldAffinityBeDownstream);
+ return createVisiblePositionForBox(run, run->start() + offset, shouldAffinityBeDownstream);
bool positionIsAtStartOfBox = !offset;
if (positionIsAtStartOfBox == run->isLeftToRightDirection()) {
@@ -616,7 +616,7 @@
if (pointLineDirection != run->logicalLeft() && point.x() < run->rect().x() + run->logicalWidth()) {
int half = run->rect().x() + run->logicalWidth() / 2;
auto affinity = point.x() < half ? Affinity::Downstream : Affinity::Upstream;
- return createVisiblePosition(run->offsetForPosition(pointLineDirection) + run->localStartOffset(), affinity);
+ return createVisiblePosition(run->offsetForPosition(pointLineDirection) + run->start(), affinity);
}
#endif
if (lineDirectionPointFitsInBox(pointLineDirection, run, shouldAffinityBeDownstream))
@@ -629,7 +629,7 @@
if (lastRun) {
ShouldAffinityBeDownstream shouldAffinityBeDownstream;
lineDirectionPointFitsInBox(pointLineDirection, lastRun, shouldAffinityBeDownstream);
- return createVisiblePositionAfterAdjustingOffsetForBiDi(lastRun, lastRun->offsetForPosition(pointLineDirection) + lastRun->localStartOffset(), shouldAffinityBeDownstream);
+ return createVisiblePositionAfterAdjustingOffsetForBiDi(lastRun, lastRun->offsetForPosition(pointLineDirection) + lastRun->start(), shouldAffinityBeDownstream);
}
return createVisiblePosition(0, Affinity::Downstream);
}
@@ -1615,9 +1615,9 @@
if (!first)
return 0;
- int minOffset = first->localStartOffset();
+ int minOffset = first->start();
for (auto box = first; ++box;)
- minOffset = std::min<int>(minOffset, box->localStartOffset());
+ minOffset = std::min<int>(minOffset, box->start());
return minOffset;
}
@@ -1628,9 +1628,9 @@
if (!first)
return text().length();
- int maxOffset = first->localEndOffset();
+ int maxOffset = first->end();
for (auto box = first; ++box;)
- maxOffset = std::max<int>(maxOffset, box->localEndOffset());
+ maxOffset = std::max<int>(maxOffset, box->end());
return maxOffset;
}
@@ -1639,7 +1639,7 @@
{
unsigned result = 0;
for (auto& run : LayoutIntegration::textRunsFor(*this)) {
- auto start = run.localStartOffset();
+ auto start = run.start();
auto length = run.length();
if (offset < start)
return result;
@@ -1656,10 +1656,10 @@
static bool containsOffset(const RenderText& text, unsigned offset, OffsetType type)
{
for (auto box = LayoutIntegration::firstTextRunInTextOrderFor(text); box; box.traverseNextTextRunInTextOrder()) {
- auto start = box->localStartOffset();
+ auto start = box->start();
if (offset < start)
return false;
- unsigned end = box->localEndOffset();
+ unsigned end = box->end();
if (offset >= start && offset <= end) {
if (offset == end && (type == OffsetType::Character || box->isLineBreak()))
continue;