[webkit-reviews] review granted: [Bug 190977] '-webkit-user-select: all' is not respected in editable views : [Attachment 451992] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Feb 15 12:09:28 PST 2022


Wenson Hsieh <wenson_hsieh at apple.com> has granted Aditya Keerthi
<akeerthi at apple.com>'s request for review:
Bug 190977: '-webkit-user-select: all' is not respected in editable views
https://bugs.webkit.org/show_bug.cgi?id=190977

Attachment 451992: Patch

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




--- Comment #40 from Wenson Hsieh <wenson_hsieh at apple.com> ---
Comment on attachment 451992
  --> https://bugs.webkit.org/attachment.cgi?id=451992
Patch

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

> Source/WebCore/dom/Node.cpp:797
> +    auto documentIsEditable = document->page() &&
document->page()->isEditable() ? DocumentIsEditable::Yes :
DocumentIsEditable::No;

`DocumentIsEditable` seems okay to me, but I think a name like `PageIsEditable`
would be a bit more explicit, since this concept of "full web view editability"
is scoped to the entire Page/WebPage rather than Document. I think it might
also help to disambiguate it from the case where `document.designMode` is "on".

> LayoutTests/editing/editability/user-select-all-in-editable-view.html:17
> +	   var selection = window.getSelection();
> +	   selection.setBaseAndExtent(container, 0, container, 0);

Nit - I think this comment should still be addressed:

> Please add an instruction on how to run this test manually in the browser.
> e.g. you can execute setBaseAndExtent outside testRunner / UI helper check.

While this test won't work in Safari due to requiring `-_setEditable:YES` on
the web view, someone who's running the test manually could still run it
manually using the Editable web view mode of MiniBrowser to exercise the
behavior.
I think we can wrap this in an async function block and do something like:

…

if (window.testRunner && testRunner.runUIScript)
    await UIHelper.setWebViewEditable(true);

const selection = window.getSelection();
selection.setPosition(container, 0);

…

(with a note in the description paragraph above reminding the user to test in
an editable web view if they're going to test manually).


More information about the webkit-reviews mailing list