[webkit-reviews] review granted: [Bug 237242] Invoking "Markup Image" should preserve the existing selection range : [Attachment 453350] Fix watchOS build

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Feb 27 11:07:01 PST 2022


Darin Adler <darin at apple.com> has granted Wenson Hsieh
<wenson_hsieh at apple.com>'s request for review:
Bug 237242: Invoking "Markup Image" should preserve the existing selection
range
https://bugs.webkit.org/show_bug.cgi?id=237242

Attachment 453350: Fix watchOS build

https://bugs.webkit.org/attachment.cgi?id=453350&action=review




--- Comment #3 from Darin Adler <darin at apple.com> ---
Comment on attachment 453350
  --> https://bugs.webkit.org/attachment.cgi?id=453350
Fix watchOS build

View in context: https://bugs.webkit.org/attachment.cgi?id=453350&action=review

> Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm:494
> +    RefPtr<Element> selectionHost = originalSelection.rootEditableElement()
?: document->body();

Should be able to just write RefPtr here, not RefPtr<Element>.

> Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm:518
> +	   auto newSelectionRange =
resolveCharacterRange(makeRangeSelectingNodeContents(*selectionHost),
*rangeToRestore, iteratorOptions);

Seems like this will do the wrong thing if the replacement doesn’t have the
same number of characters as the selection beforehand. We may need some other
form of selection preservation to handle interesting cases well.


More information about the webkit-reviews mailing list