Bug 200144 - Moving right by word boundary right before an object element followed by a br element hangs
Summary: Moving right by word boundary right before an object element followed by a br...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ryosuke Niwa
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-07-25 16:39 PDT by Ryosuke Niwa
Modified: 2019-07-26 16:38 PDT (History)
6 users (show)

See Also:


Attachments
Demo (326 bytes, text/html)
2019-07-25 16:39 PDT, Ryosuke Niwa
no flags Details
Fixes the hang (12.61 KB, patch)
2019-07-25 17:25 PDT, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
Added a change log (14.13 KB, patch)
2019-07-25 18:42 PDT, Ryosuke Niwa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2019-07-25 16:39:04 PDT
Created attachment 374922 [details]
Demo

Moving to the right by word boundary immediately before a word boundary causes a hang.

<rdar://problem/53285794>
Comment 1 Ryosuke Niwa 2019-07-25 17:25:05 PDT
Created attachment 374928 [details]
Fixes the hang
Comment 2 Ryosuke Niwa 2019-07-25 17:26:03 PDT
Is 
שלום
עולם
the right way to say "hello world" in Hebrew?
Comment 3 Ryosuke Niwa 2019-07-25 18:28:40 PDT
Some analysis:

7/24/19, 8:10 PM Ryosuke Niwa:
We’re stuck in wordBreakIteratorForMinOffsetBoundary with previousBox pointing to the inline box of the object, and previousBox->renderer() being at the br element after the object element.

7/24/19, 8:19 PM Ryosuke Niwa:
So the problem here is that previousTextOrLineBreakBox never returns a box for the line consisting only of the object element.

7/24/19, 8:22 PM Ryosuke Niwa:
Ugh… scratch that. We’re returning the line box for the object element.

7/24/19, 8:35 PM Ryosuke Niwa:
Okay, in logicallyPreviousBox(~, br’s inline box, previousBoxInDifferentLine=true, ~), previousTextOrLineBreakBox doesn’t return the inline box for the object element, and previousTextOrLineBreakBox finds nothing since there is no more inline box left above the object element in this block flow.

7/25/19, 3:07 PM Ryosuke Niwa:
Hm… so there is something confusing happening here. We’re trying to find the previous position at the beginning of “world” which appears object & br elements. The previous box is that of br element but VisiblePosition points to the beginning of “world”. As a result, when we get to previousRootInlineBoxCandidatePosition, we think previousNode, which is object element and br element are in different lines (which is correct). So, we’d return the position after the object element from previousRootInlineBoxCandidatePosition. Then previousRoot is pointing at the root inline box of the line which contains the object & br elements. Now, previousTextOrLineBreakBox is called with this root box with box=0, resulting in the inlinebox for BR to be returned. We’re back to where we were.
Comment 4 Ryosuke Niwa 2019-07-25 18:42:15 PDT
Created attachment 374929 [details]
Added a change log
Comment 5 Ryosuke Niwa 2019-07-26 16:38:17 PDT
Comment on attachment 374929 [details]
Added a change log

Clearing flags on attachment: 374929

Committed r247881: <https://trac.webkit.org/changeset/247881>
Comment 6 Ryosuke Niwa 2019-07-26 16:38:19 PDT
All reviewed patches have been landed.  Closing bug.