Changeset 269153 in webkit
- Timestamp:
- Oct 29, 2020, 10:21:09 AM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 9 edited
-
ChangeLog (modified) (1 diff)
-
dom/Position.cpp (modified) (2 diffs)
-
editing/TextIterator.cpp (modified) (2 diffs)
-
editing/VisibleUnits.cpp (modified) (2 diffs)
-
layout/integration/LayoutIntegrationRunIterator.h (modified) (2 diffs)
-
layout/integration/LayoutIntegrationRunIteratorLegacyPath.h (modified) (1 diff)
-
layout/integration/LayoutIntegrationRunIteratorModernPath.h (modified) (2 diffs)
-
rendering/RenderBlockFlow.cpp (modified) (1 diff)
-
rendering/RenderText.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r269149 r269153 1 2020-10-29 Antti Koivisto <antti@apple.com> 2 3 [LFC][Integration] Rename text run localStart/EndOffset to start/end 4 https://bugs.webkit.org/show_bug.cgi?id=218344 5 6 Reviewed by Zalan Bujtas. 7 8 There is no danger of confusion and these are called just start/end elsewhere. 9 10 * dom/Position.cpp: 11 (WebCore::Position::upstream const): 12 (WebCore::Position::downstream const): 13 * editing/TextIterator.cpp: 14 (WebCore::TextIterator::handleTextRun): 15 * editing/VisibleUnits.cpp: 16 (WebCore::startPositionForLine): 17 (WebCore::endPositionForLine): 18 * layout/integration/LayoutIntegrationRunIterator.h: 19 (WebCore::LayoutIntegration::PathTextRun::start const): 20 (WebCore::LayoutIntegration::PathTextRun::end const): 21 (WebCore::LayoutIntegration::PathTextRun::localStartOffset const): Deleted. 22 (WebCore::LayoutIntegration::PathTextRun::localEndOffset const): Deleted. 23 * layout/integration/LayoutIntegrationRunIteratorLegacyPath.h: 24 (WebCore::LayoutIntegration::RunIteratorLegacyPath::start const): 25 (WebCore::LayoutIntegration::RunIteratorLegacyPath::end const): 26 (WebCore::LayoutIntegration::RunIteratorLegacyPath::localStartOffset const): Deleted. 27 (WebCore::LayoutIntegration::RunIteratorLegacyPath::localEndOffset const): Deleted. 28 * layout/integration/LayoutIntegrationRunIteratorModernPath.h: 29 (WebCore::LayoutIntegration::RunIteratorModernPath::minimumCaretOffset const): 30 (WebCore::LayoutIntegration::RunIteratorModernPath::maximumCaretOffset const): 31 (WebCore::LayoutIntegration::RunIteratorModernPath::start const): 32 (WebCore::LayoutIntegration::RunIteratorModernPath::end const): 33 (WebCore::LayoutIntegration::RunIteratorModernPath::localStartOffset const): Deleted. 34 (WebCore::LayoutIntegration::RunIteratorModernPath::localEndOffset const): Deleted. 35 * rendering/RenderBlockFlow.cpp: 36 (WebCore::positionForRun): 37 * rendering/RenderText.cpp: 38 (WebCore::createVisiblePositionAfterAdjustingOffsetForBiDi): 39 (WebCore::RenderText::positionForPoint): 40 (WebCore::RenderText::caretMinOffset const): 41 (WebCore::RenderText::caretMaxOffset const): 42 (WebCore::RenderText::countRenderedCharacterOffsetsUntil const): 43 (WebCore::containsOffset): 44 1 45 2020-10-29 Antti Koivisto <antti@apple.com> 2 46 -
trunk/Source/WebCore/dom/Position.cpp
r268598 r269153 752 752 unsigned textOffset = currentPosition.offsetInLeafNode(); 753 753 for (auto run = firstTextRun; run; run.traverseNextTextRunInTextOrder()) { 754 if (textOffset <= run-> localEndOffset()) {755 if (textOffset > run-> localStartOffset())754 if (textOffset <= run->end()) { 755 if (textOffset > run->start()) 756 756 return currentPosition; 757 757 continue; 758 758 } 759 759 760 if (textOffset == run-> localEndOffset() + 1 && run->isLastTextRunOnLine() && !run->isLastTextRun())760 if (textOffset == run->end() + 1 && run->isLastTextRunOnLine() && !run->isLastTextRun()) 761 761 return currentPosition; 762 762 } … … 855 855 unsigned textOffset = currentPosition.offsetInLeafNode(); 856 856 for (auto run = firstTextRun; run; run.traverseNextTextRunInTextOrder()) { 857 if (!run->length() && textOffset == run-> localStartOffset())857 if (!run->length() && textOffset == run->start()) 858 858 return currentPosition; 859 859 860 if (textOffset < run-> localEndOffset()) {861 if (textOffset >= run-> localStartOffset())860 if (textOffset < run->end()) { 861 if (textOffset >= run->start()) 862 862 return currentPosition; 863 863 continue; 864 864 } 865 865 866 if (textOffset == run-> localEndOffset() && run->isLastTextRunOnLine() && !run->isLastTextRun())866 if (textOffset == run->end() && run->isLastTextRunOnLine() && !run->isLastTextRun()) 867 867 return currentPosition; 868 868 } -
trunk/Source/WebCore/editing/TextIterator.cpp
r267734 r269153 614 614 unsigned end = (&textNode == m_endContainer) ? static_cast<unsigned>(m_endOffset) : UINT_MAX; 615 615 while (m_textRun) { 616 unsigned textRunStart = m_textRun-> localStartOffset();616 unsigned textRunStart = m_textRun->start(); 617 617 unsigned runStart = std::max(textRunStart, start); 618 618 … … 667 667 668 668 // Advance and return 669 unsigned nextRunStart = nextTextRun ? nextTextRun-> localStartOffset() : rendererText.length();669 unsigned nextRunStart = nextTextRun ? nextTextRun->start() : rendererText.length(); 670 670 if (nextRunStart > runEnd) 671 671 m_lastTextNodeEndedWithCollapsedSpace = true; // collapsed space between runs or at the end -
trunk/Source/WebCore/editing/VisibleUnits.cpp
r269041 r269153 812 812 } 813 813 814 return is<Text>(*startNode) ? Position(downcast<Text>(startNode), downcast<LayoutIntegration::PathTextRun>(*startRun). localStartOffset())814 return is<Text>(*startNode) ? Position(downcast<Text>(startNode), downcast<LayoutIntegration::PathTextRun>(*startRun).start()) 815 815 : positionBeforeNode(startNode); 816 816 } … … 892 892 else if (is<LayoutIntegration::PathTextRun>(*endRun) && is<Text>(*endNode)) { 893 893 auto& endTextRun = downcast<LayoutIntegration::PathTextRun>(*endRun); 894 int endOffset = endTextRun. localStartOffset();894 int endOffset = endTextRun.start(); 895 895 if (!endTextRun.isLineBreak()) 896 896 endOffset += endTextRun.length(); -
trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIterator.h
r268520 r269153 104 104 StringView text() const; 105 105 106 // These offsets are relative to the text renderer (not flow). 107 unsigned localStartOffset() const; 108 unsigned localEndOffset() const; 106 unsigned start() const; 107 unsigned end() const; 109 108 unsigned length() const; 110 109 … … 299 298 } 300 299 301 inline unsigned PathTextRun:: localStartOffset() const302 { 303 return WTF::switchOn(m_pathVariant, [](auto& path) { 304 return path. localStartOffset();305 }); 306 } 307 308 inline unsigned PathTextRun:: localEndOffset() const309 { 310 return WTF::switchOn(m_pathVariant, [](auto& path) { 311 return path. localEndOffset();300 inline unsigned PathTextRun::start() const 301 { 302 return WTF::switchOn(m_pathVariant, [](auto& path) { 303 return path.start(); 304 }); 305 } 306 307 inline unsigned PathTextRun::end() const 308 { 309 return WTF::switchOn(m_pathVariant, [](auto& path) { 310 return path.end(); 312 311 }); 313 312 } -
trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorLegacyPath.h
r268520 r269153 56 56 bool hasHyphen() const { return inlineTextBox()->hasHyphen(); } 57 57 StringView text() const { return StringView(inlineTextBox()->renderer().text()).substring(inlineTextBox()->start(), inlineTextBox()->len()); } 58 unsigned localStartOffset() const { return inlineTextBox()->start(); }59 unsigned localEndOffset() const { return inlineTextBox()->end(); }58 unsigned start() const { return inlineTextBox()->start(); } 59 unsigned end() const { return inlineTextBox()->end(); } 60 60 unsigned length() const { return inlineTextBox()->len(); } 61 61 -
trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorModernPath.h
r269146 r269153 56 56 bool isLineBreak() const { return run().isLineBreak(); } 57 57 58 unsigned minimumCaretOffset() const { return isText() ? localStartOffset() : 0; }59 unsigned maximumCaretOffset() const { return isText() ? localEndOffset() : 1; }58 unsigned minimumCaretOffset() const { return isText() ? start() : 0; } 59 unsigned maximumCaretOffset() const { return isText() ? end() : 1; } 60 60 61 61 unsigned char bidiLevel() const { return 0; } … … 63 63 bool hasHyphen() const { return run().textContent()->needsHyphen(); } 64 64 StringView text() const { return run().textContent()->content(); } 65 unsigned localStartOffset() const { return run().textContent()->start(); }66 unsigned localEndOffset() const { return run().textContent()->end(); }65 unsigned start() const { return run().textContent()->start(); } 66 unsigned end() const { return run().textContent()->end(); } 67 67 unsigned length() const { return run().textContent()->length(); } 68 68 -
trunk/Source/WebCore/rendering/RenderBlockFlow.cpp
r269149 r269153 3319 3319 3320 3320 auto& textRun = downcast<LayoutIntegration::TextRunIterator>(run); 3321 return makeDeprecatedLegacyPosition(textRun->renderer().nonPseudoNode(), start ? textRun-> localStartOffset() : textRun->localEndOffset());3321 return makeDeprecatedLegacyPosition(textRun->renderer().nonPseudoNode(), start ? textRun->start() : textRun->end()); 3322 3322 } 3323 3323 -
trunk/Source/WebCore/rendering/RenderText.cpp
r269149 r269153 516 516 517 517 if (offset && offset < run->length()) 518 return createVisiblePositionForBox(run, run-> localStartOffset() + offset, shouldAffinityBeDownstream);518 return createVisiblePositionForBox(run, run->start() + offset, shouldAffinityBeDownstream); 519 519 520 520 bool positionIsAtStartOfBox = !offset; … … 617 617 int half = run->rect().x() + run->logicalWidth() / 2; 618 618 auto affinity = point.x() < half ? Affinity::Downstream : Affinity::Upstream; 619 return createVisiblePosition(run->offsetForPosition(pointLineDirection) + run-> localStartOffset(), affinity);619 return createVisiblePosition(run->offsetForPosition(pointLineDirection) + run->start(), affinity); 620 620 } 621 621 #endif … … 630 630 ShouldAffinityBeDownstream shouldAffinityBeDownstream; 631 631 lineDirectionPointFitsInBox(pointLineDirection, lastRun, shouldAffinityBeDownstream); 632 return createVisiblePositionAfterAdjustingOffsetForBiDi(lastRun, lastRun->offsetForPosition(pointLineDirection) + lastRun-> localStartOffset(), shouldAffinityBeDownstream);632 return createVisiblePositionAfterAdjustingOffsetForBiDi(lastRun, lastRun->offsetForPosition(pointLineDirection) + lastRun->start(), shouldAffinityBeDownstream); 633 633 } 634 634 return createVisiblePosition(0, Affinity::Downstream); … … 1616 1616 return 0; 1617 1617 1618 int minOffset = first-> localStartOffset();1618 int minOffset = first->start(); 1619 1619 for (auto box = first; ++box;) 1620 minOffset = std::min<int>(minOffset, box-> localStartOffset());1620 minOffset = std::min<int>(minOffset, box->start()); 1621 1621 1622 1622 return minOffset; … … 1629 1629 return text().length(); 1630 1630 1631 int maxOffset = first-> localEndOffset();1631 int maxOffset = first->end(); 1632 1632 for (auto box = first; ++box;) 1633 maxOffset = std::max<int>(maxOffset, box-> localEndOffset());1633 maxOffset = std::max<int>(maxOffset, box->end()); 1634 1634 1635 1635 return maxOffset; … … 1640 1640 unsigned result = 0; 1641 1641 for (auto& run : LayoutIntegration::textRunsFor(*this)) { 1642 auto start = run. localStartOffset();1642 auto start = run.start(); 1643 1643 auto length = run.length(); 1644 1644 if (offset < start) … … 1657 1657 { 1658 1658 for (auto box = LayoutIntegration::firstTextRunInTextOrderFor(text); box; box.traverseNextTextRunInTextOrder()) { 1659 auto start = box-> localStartOffset();1659 auto start = box->start(); 1660 1660 if (offset < start) 1661 1661 return false; 1662 unsigned end = box-> localEndOffset();1662 unsigned end = box->end(); 1663 1663 if (offset >= start && offset <= end) { 1664 1664 if (offset == end && (type == OffsetType::Character || box->isLineBreak()))
Note:
See TracChangeset
for help on using the changeset viewer.