RESOLVED FIXED 157611
indexForVisiblePosition should use the root editable element as the scope
https://bugs.webkit.org/show_bug.cgi?id=157611
Summary indexForVisiblePosition should use the root editable element as the scope
Ryosuke Niwa
Reported 2016-05-11 22:45:08 PDT
We should be using the highest editing host as the scope in indexForVisiblePosition when it's called inside an editable region. This is blocking the work to make VoiceOver work with undo/redo after the rewrite in the bug 153361.
Attachments
Cleanup (7.12 KB, patch)
2016-05-11 22:53 PDT, Ryosuke Niwa
no flags
Removed redundant assertion (7.04 KB, patch)
2016-05-11 22:54 PDT, Ryosuke Niwa
darin: review+
Radar WebKit Bug Importer
Comment 1 2016-05-11 22:45:48 PDT
Ryosuke Niwa
Comment 2 2016-05-11 22:53:41 PDT
Ryosuke Niwa
Comment 3 2016-05-11 22:54:34 PDT
Created attachment 278701 [details] Removed redundant assertion
Darin Adler
Comment 4 2016-05-12 09:17:54 PDT
Comment on attachment 278701 [details] Removed redundant assertion View in context: https://bugs.webkit.org/attachment.cgi?id=278701&action=review > Source/WebCore/editing/ApplyBlockElementCommand.cpp:100 > + // Workaround the fact indexForVisiblePosition can return a larger index due to TextIterator The verb is two word: "work around". The noun is "workaround". Here we are using it as a verb. > Source/WebCore/editing/ApplyBlockElementCommand.cpp:102 > + // FIXME: Add a new TextIterator beavhior to suppress this behavior. Spelling error here in the first "behavior". I find the two uses of the word "behavior" here confusing, so I would use the identifier TextIteratorBehavior to be clearer. > Source/WebCore/editing/htmlediting.cpp:1137 > + Document& document = *position.document(); auto& perhaps > Source/WebCore/editing/htmlediting.cpp:1141 > + scope = downcast<ContainerNode>(editableRoot); If this is a safe cast, then why does highestEditableRoot return a Node* and not a ContanerNode*? > Source/WebCore/editing/htmlediting.cpp:1149 > + RefPtr<Range> range = Range::create(document, firstPositionInNode(scope.get()), position.parentAnchoredEquivalent()); Should use auto here instead of RefPtr<Range>. I believe this will make range be a Ref instead of a RefPtr.
Ryosuke Niwa
Comment 5 2016-05-12 12:50:02 PDT
Comment on attachment 278701 [details] Removed redundant assertion View in context: https://bugs.webkit.org/attachment.cgi?id=278701&action=review Thanks for the review >> Source/WebCore/editing/htmlediting.cpp:1141 >> + scope = downcast<ContainerNode>(editableRoot); > > If this is a safe cast, then why does highestEditableRoot return a Node* and not a ContanerNode*? We should probably change highestEditableRoot to return a ContainerNode* later.
Ryosuke Niwa
Comment 6 2016-05-12 12:50:22 PDT
Note You need to log in before you can comment on or make changes to this bug.