Skip to content

Commit 53f771a

Browse files
committed
visualWordPosition should operate on a clean tree
https://bugs.webkit.org/show_bug.cgi?id=229744 <rdar://80684065> Reviewed by Antti Koivisto. This function expects the tree to not be mutated while walking the inline runs. * editing/VisibleUnits.cpp: (WebCore::visualWordPosition): Canonical link: https://commits.webkit.org/241179@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281847 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 1c1b4e5 commit 53f771a

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

Source/WebCore/ChangeLog

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
2021-09-01 Alan Bujtas <zalan@apple.com>
2+
3+
visualWordPosition should operate on a clean tree
4+
https://bugs.webkit.org/show_bug.cgi?id=229744
5+
<rdar://80684065>
6+
7+
Reviewed by Antti Koivisto.
8+
9+
This function expects the tree to not be mutated while walking the inline runs.
10+
11+
* editing/VisibleUnits.cpp:
12+
(WebCore::visualWordPosition):
13+
114
2021-09-01 Myles C. Maxfield <mmaxfield@apple.com>
215

316
document.fonts.size needs to update style so it doesn't return stale values

Source/WebCore/editing/VisibleUnits.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,11 @@ enum CursorMovementDirection { MoveLeft, MoveRight };
309309
static VisiblePosition visualWordPosition(const VisiblePosition& visiblePosition, CursorMovementDirection direction,
310310
bool skipsSpaceWhenMovingRight)
311311
{
312-
if (visiblePosition.isNull())
312+
if (visiblePosition.isNull() || !visiblePosition.deepEquivalent().document())
313313
return VisiblePosition();
314314

315+
visiblePosition.deepEquivalent().document()->updateLayoutIgnorePendingStylesheets();
316+
315317
TextDirection blockDirection = directionOfEnclosingBlock(visiblePosition.deepEquivalent());
316318
LayoutIntegration::RunIterator previouslyVisitedRun;
317319
VisiblePosition current = visiblePosition;

0 commit comments

Comments
 (0)