Implement Position::upstream and Position::downstream with line layout iterator
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Sep 2019 15:41:43 +0000 (15:41 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Sep 2019 15:41:43 +0000 (15:41 +0000)
commitde1fdbb1e11515877124d61a25b31e99e45a0296
treea541f45e96ccfcecb8603c1ad019232bc4485855
parent1837f21b29ee529bc58142cc91310db7c2f034c2
Implement Position::upstream and Position::downstream with line layout iterator
https://bugs.webkit.org/show_bug.cgi?id=202043

Reviewed by Zalan Bujtas.

These can eventually work without switching to lineboxes.

* dom/Position.cpp:
(WebCore::Position::upstream const):
(WebCore::Position::downstream const):

Factor the loops into TextBox::isLastOnLine function.

* rendering/line/LineLayoutInterfaceTextBoxes.cpp:
(WebCore::LineLayoutInterface::TextBox::isLastOnLine const):

Looking into root boxes is a much more efficient way to figure this out.

(WebCore::LineLayoutInterface::TextBox::isLast const):
(WebCore::LineLayoutInterface::TextBoxIterator::ComplexPath::nextInlineTextBoxInTextOrder const):
(WebCore::LineLayoutInterface::TextBoxIterator::traverseNextInTextOrder):
* rendering/line/LineLayoutInterfaceTextBoxes.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250132 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/dom/Position.cpp
Source/WebCore/rendering/line/LineLayoutInterfaceTextBoxes.cpp
Source/WebCore/rendering/line/LineLayoutInterfaceTextBoxes.h