WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
190977
'-webkit-user-select: all' is not respected in editable views
https://bugs.webkit.org/show_bug.cgi?id=190977
Summary
'-webkit-user-select: all' is not respected in editable views
Tim Horton
Reported
2018-10-26 16:18:32 PDT
'-webkit-user-select: all' is not respected in editable views
Attachments
Patch
(20.60 KB, patch)
2018-10-26 16:19 PDT
,
Tim Horton
no flags
Details
Formatted Diff
Diff
Archive of layout-test-results from ews100 for mac-sierra
(2.65 MB, application/zip)
2018-10-26 17:27 PDT
,
EWS Watchlist
no flags
Details
Archive of layout-test-results from ews107 for mac-sierra-wk2
(3.23 MB, application/zip)
2018-10-26 17:38 PDT
,
EWS Watchlist
no flags
Details
Archive of layout-test-results from ews200 for win-future
(13.08 MB, application/zip)
2018-10-26 18:05 PDT
,
EWS Watchlist
no flags
Details
Archive of layout-test-results from ews115 for mac-sierra
(3.32 MB, application/zip)
2018-10-26 18:23 PDT
,
EWS Watchlist
no flags
Details
Archive of layout-test-results from ews112 for mac-sierra
(3.32 MB, application/zip)
2018-10-26 20:22 PDT
,
EWS Watchlist
no flags
Details
Archive of layout-test-results from ews125 for ios-simulator-wk2
(2.88 MB, application/zip)
2018-10-26 21:43 PDT
,
EWS Watchlist
no flags
Details
Archive of layout-test-results from ews122 for ios-simulator-wk2
(2.90 MB, application/zip)
2018-10-26 23:38 PDT
,
EWS Watchlist
no flags
Details
Patch
(20.30 KB, patch)
2018-10-29 13:11 PDT
,
Tim Horton
no flags
Details
Formatted Diff
Diff
Updated for trunk
(18.32 KB, patch)
2019-04-12 21:04 PDT
,
Ryosuke Niwa
no flags
Details
Formatted Diff
Diff
Archive of layout-test-results from ews126 for ios-simulator-wk2
(17.13 MB, application/zip)
2019-04-12 23:11 PDT
,
EWS Watchlist
no flags
Details
Patch
(27.16 KB, patch)
2022-02-14 15:34 PST
,
Aditya Keerthi
no flags
Details
Formatted Diff
Diff
Patch
(27.17 KB, patch)
2022-02-14 16:08 PST
,
Aditya Keerthi
no flags
Details
Formatted Diff
Diff
Patch
(28.92 KB, patch)
2022-02-14 17:54 PST
,
Aditya Keerthi
no flags
Details
Formatted Diff
Diff
Patch
(35.38 KB, patch)
2022-02-14 20:53 PST
,
Aditya Keerthi
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(35.57 KB, patch)
2022-02-14 21:26 PST
,
Aditya Keerthi
wenson_hsieh
: review+
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch for landing
(35.98 KB, patch)
2022-02-15 15:17 PST
,
Aditya Keerthi
no flags
Details
Formatted Diff
Diff
Patch for landing
(37.10 KB, patch)
2022-02-15 20:46 PST
,
Aditya Keerthi
no flags
Details
Formatted Diff
Diff
Show Obsolete
(15)
View All
Add attachment
proposed patch, testcase, etc.
Tim Horton
Comment 1
2018-10-26 16:19:00 PDT
Created
attachment 353209
[details]
Patch
Tim Horton
Comment 2
2018-10-26 16:19:02 PDT
<
rdar://problem/34945944
>
EWS Watchlist
Comment 3
2018-10-26 17:27:49 PDT
Comment hidden (obsolete)
Comment on
attachment 353209
[details]
Patch
Attachment 353209
[details]
did not pass mac-ews (mac): Output:
https://webkit-queues.webkit.org/results/9743899
New failing tests: fast/selectors/read-only-read-write-style-update.html fast/selectors/read-only-read-write-designmode-basics.html fast/css/read-only-read-write-designmode-basics.html imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/readwrite-readonly.html
EWS Watchlist
Comment 4
2018-10-26 17:27:55 PDT
Comment hidden (obsolete)
Created
attachment 353211
[details]
Archive of layout-test-results from ews100 for mac-sierra The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews100 Port: mac-sierra Platform: Mac OS X 10.12.6
EWS Watchlist
Comment 5
2018-10-26 17:38:01 PDT
Comment hidden (obsolete)
Comment on
attachment 353209
[details]
Patch
Attachment 353209
[details]
did not pass mac-wk2-ews (mac-wk2): Output:
https://webkit-queues.webkit.org/results/9743918
New failing tests: fast/selectors/read-only-read-write-style-update.html fast/selectors/read-only-read-write-designmode-basics.html fast/css/read-only-read-write-designmode-basics.html imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/readwrite-readonly.html
EWS Watchlist
Comment 6
2018-10-26 17:38:04 PDT
Comment hidden (obsolete)
Created
attachment 353212
[details]
Archive of layout-test-results from ews107 for mac-sierra-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-sierra-wk2 Platform: Mac OS X 10.12.6
EWS Watchlist
Comment 7
2018-10-26 18:05:20 PDT
Comment hidden (obsolete)
Comment on
attachment 353209
[details]
Patch
Attachment 353209
[details]
did not pass win-ews (win): Output:
https://webkit-queues.webkit.org/results/9744022
New failing tests: fast/selectors/read-only-read-write-style-update.html fast/selectors/read-only-read-write-designmode-basics.html fast/css/read-only-read-write-designmode-basics.html
EWS Watchlist
Comment 8
2018-10-26 18:05:31 PDT
Comment hidden (obsolete)
Created
attachment 353214
[details]
Archive of layout-test-results from ews200 for win-future The attached test failures were seen while running run-webkit-tests on the win-ews. Bot: ews200 Port: win-future Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Tim Horton
Comment 9
2018-10-26 18:22:13 PDT
I guess I'll undo the designmode bit
EWS Watchlist
Comment 10
2018-10-26 18:23:41 PDT
Comment hidden (obsolete)
Comment on
attachment 353209
[details]
Patch
Attachment 353209
[details]
did not pass mac-debug-ews (mac): Output:
https://webkit-queues.webkit.org/results/9743986
New failing tests: fast/selectors/read-only-read-write-style-update.html fast/selectors/read-only-read-write-designmode-basics.html fast/css/read-only-read-write-designmode-basics.html imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/readwrite-readonly.html
EWS Watchlist
Comment 11
2018-10-26 18:23:43 PDT
Comment hidden (obsolete)
Created
attachment 353215
[details]
Archive of layout-test-results from ews115 for mac-sierra The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews115 Port: mac-sierra Platform: Mac OS X 10.12.6
EWS Watchlist
Comment 12
2018-10-26 20:22:27 PDT
Comment hidden (obsolete)
Comment on
attachment 353209
[details]
Patch
Attachment 353209
[details]
did not pass mac-debug-ews (mac): Output:
https://webkit-queues.webkit.org/results/9744724
New failing tests: fast/selectors/read-only-read-write-style-update.html fast/selectors/read-only-read-write-designmode-basics.html fast/css/read-only-read-write-designmode-basics.html imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/readwrite-readonly.html
EWS Watchlist
Comment 13
2018-10-26 20:22:29 PDT
Comment hidden (obsolete)
Created
attachment 353216
[details]
Archive of layout-test-results from ews112 for mac-sierra The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews112 Port: mac-sierra Platform: Mac OS X 10.12.6
EWS Watchlist
Comment 14
2018-10-26 21:43:41 PDT
Comment hidden (obsolete)
Comment on
attachment 353209
[details]
Patch
Attachment 353209
[details]
did not pass ios-sim-ews (ios-simulator-wk2): Output:
https://webkit-queues.webkit.org/results/9745172
New failing tests: fast/selectors/read-only-read-write-style-update.html fast/selectors/read-only-read-write-designmode-basics.html fast/css/read-only-read-write-designmode-basics.html
EWS Watchlist
Comment 15
2018-10-26 21:43:43 PDT
Comment hidden (obsolete)
Created
attachment 353220
[details]
Archive of layout-test-results from ews125 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews125 Port: ios-simulator-wk2 Platform: Mac OS X 10.13.6
EWS Watchlist
Comment 16
2018-10-26 23:38:51 PDT
Comment hidden (obsolete)
Comment on
attachment 353209
[details]
Patch
Attachment 353209
[details]
did not pass ios-sim-ews (ios-simulator-wk2): Output:
https://webkit-queues.webkit.org/results/9746179
New failing tests: fast/selectors/read-only-read-write-style-update.html fast/selectors/read-only-read-write-designmode-basics.html fast/css/read-only-read-write-designmode-basics.html
EWS Watchlist
Comment 17
2018-10-26 23:38:53 PDT
Comment hidden (obsolete)
Created
attachment 353224
[details]
Archive of layout-test-results from ews122 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews122 Port: ios-simulator-wk2 Platform: Mac OS X 10.13.6
Darin Adler
Comment 18
2018-10-26 23:46:24 PDT
Comment on
attachment 353209
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=353209&action=review
> Source/WebCore/dom/Node.cpp:778 > + bool documentIsEditable = document.frame() && document.frame()->page() && document.frame()->page()->isEditable(); > + if (is<HTMLDocument>(document)) > + documentIsEditable |= downcast<HTMLDocument>(document).inDesignMode();
This (and the existing code that this was moved from) is peculiar. The inDesignMode function is in Document. Maybe at the original time the code was written it was specific to HTMLDocument. I think we should remove the is<HTMLDocument> check and the downcast as well.
> Tools/DumpRenderTree/mac/UIScriptControllerMac.mm:203 > + WebView *webView = [mainFrame webView]; > + [webView setEditable:editable];
Not sure we really need a local variable here.
Ryosuke Niwa
Comment 19
2018-10-28 11:07:15 PDT
Comment on
attachment 353209
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=353209&action=review
> Source/WebCore/dom/Node.cpp:751 > + if (documentIsEditable) > + return Node::Editability::CanEditRichly; > +
This isn't right. It's totally possible to have -webkit-user-modify: read-only inside a design mode document. As done in editabilityFromContentEditableAttr, we need to wait until we get out of this loop. r- because of this and the test failures.
Tim Horton
Comment 20
2018-10-29 13:11:11 PDT
Created
attachment 353313
[details]
Patch
Tim Horton
Comment 21
2018-10-29 13:16:57 PDT
(In reply to Ryosuke Niwa from
comment #19
)
> Comment on
attachment 353209
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=353209&action=review
> > > Source/WebCore/dom/Node.cpp:751 > > + if (documentIsEditable) > > + return Node::Editability::CanEditRichly; > > + > > This isn't right. It's totally possible to have -webkit-user-modify: > read-only inside a design mode document.
But not inside an editable=YES web view. So like I promised in an earlier comment, I reverted the design-mode-related changes, which were unnecessary in the first place.
> As done in editabilityFromContentEditableAttr, we need to wait until we get > out of this loop.
I don't think that works? We need to bail here in the editable web view case, or we'll respect user-modify there (which defaults to read-only, and thus breaks editable=YES). I made documentIsEditable just about editable=YES, so it should be OK. We're just moving the editable check downstream, past the user-select checks, instead of affecting user-modify at all.
> r- because of this and the test failures.
Ryosuke Niwa
Comment 22
2018-11-05 19:15:32 PST
Comment on
attachment 353313
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=353313&action=review
r=me once the following amendments are made.
> Source/WebCore/html/HTMLElement.cpp:407 > if (auto* startElement = is<Element>(node) ? &downcast<Element>(node) : node.parentElement()) { > for (auto& element : lineageOfType<HTMLElement>(*startElement)) {
This loop has the same issue as computeEditabilityFromComputedStyle. You need to add a check for documentIsEditable before the switch. Also, please add a test (add a test where the web view is editable & there is a contenteditable=false content. Make sure that content is editable. We should also add a test for -webkit-user-modify at the same time too.
> Source/WebCore/html/HTMLElement.cpp:433 > - return editabilityFromContentEditableAttr(*this) != Editability::ReadOnly; > + return editabilityFromContentEditableAttr(*this, false) != Editability::ReadOnly;
Please add an enum class instead of using a boolean like this.
> LayoutTests/ChangeLog:10 > + * editing/selection/user-select-all-in-editable-view-expected.txt: Added. > + * editing/selection/user-select-all-in-editable-view.html: Added.
A better place to put more tests I'm asking you to add would be LayoutTests/editing/editability/ But I suppose these tests could stay here.
> LayoutTests/editing/selection/user-select-all-in-editable-view.html:4 > +<p id="description">This tests that moving the cursor inside a 'user-select: all' element expands the selection to the entire element. The cursor should not end up inside the 'user-select: all' element, but rather in the middle of "after".</p>
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. Otherwise, it's gonna be really hard to verify that it works in the browser later.
Ryosuke Niwa
Comment 23
2019-03-15 16:14:58 PDT
Can we land this patch??
Tim Horton
Comment 24
2019-03-15 16:32:30 PDT
(In reply to Ryosuke Niwa from
comment #23
)
> Can we land this patch??
Go for it!
Ryosuke Niwa
Comment 25
2019-04-12 21:04:03 PDT
Created
attachment 367376
[details]
Updated for trunk
Ryosuke Niwa
Comment 26
2019-04-12 21:04:33 PDT
The new patch still has the issues I pointed out earlier.
EWS Watchlist
Comment 27
2019-04-12 23:11:21 PDT
Comment on
attachment 367376
[details]
Updated for trunk
Attachment 367376
[details]
did not pass ios-sim-ews (ios-simulator-wk2): Output:
https://webkit-queues.webkit.org/results/11860969
New failing tests: editing/input/ios/rtl-keyboard-input-on-focus.html
EWS Watchlist
Comment 28
2019-04-12 23:11:24 PDT
Created
attachment 367379
[details]
Archive of layout-test-results from ews126 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews126 Port: ios-simulator-wk2 Platform: Mac OS X 10.13.6
Tim Nguyen (:ntim)
Comment 29
2021-10-20 03:17:35 PDT
***
Bug 72019
has been marked as a duplicate of this bug. ***
Aditya Keerthi
Comment 30
2022-02-14 15:34:40 PST
Created
attachment 451950
[details]
Patch
Aditya Keerthi
Comment 31
2022-02-14 15:35:02 PST
Comment on
attachment 451950
[details]
Patch Latest patch addresses review comments and adds additional tests.
Wenson Hsieh
Comment 32
2022-02-14 15:56:05 PST
Comment on
attachment 451950
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=451950&action=review
> Source/WebCore/dom/Node.cpp:796 > + auto& document = this->document();
This raw reference makes me a bit nervous, especially since we trigger a style update right below. But maybe it's okay here because the caller presumably keeps this node alive, which then keeps its document alive?
> Tools/ChangeLog:11 > + Remove TestRunner::setWebViewEditable as it is used.
Nit - do you mean "unused"?
Darin Adler
Comment 33
2022-02-14 15:57:23 PST
Comment on
attachment 451950
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=451950&action=review
>> Source/WebCore/dom/Node.cpp:796 >> + auto& document = this->document(); > > This raw reference makes me a bit nervous, especially since we trigger a style update right below. > > But maybe it's okay here because the caller presumably keeps this node alive, which then keeps its document alive?
No, you are right to be worried. Nodes can be moved between documents.
Aditya Keerthi
Comment 34
2022-02-14 16:08:20 PST
Created
attachment 451955
[details]
Patch
Aditya Keerthi
Comment 35
2022-02-14 16:09:18 PST
(In reply to Wenson Hsieh from
comment #32
)
> Comment on
attachment 451950
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=451950&action=review
> > > Source/WebCore/dom/Node.cpp:796 > > + auto& document = this->document(); > > This raw reference makes me a bit nervous, especially since we trigger a > style update right below. > > But maybe it's okay here because the caller presumably keeps this node > alive, which then keeps its document alive?
Made this a `Ref`.
> > Tools/ChangeLog:11 > > + Remove TestRunner::setWebViewEditable as it is used. > > Nit - do you mean "unused"?
Fixed.
Aditya Keerthi
Comment 36
2022-02-14 17:54:34 PST
Created
attachment 451973
[details]
Patch
Aditya Keerthi
Comment 37
2022-02-14 20:53:35 PST
Created
attachment 451989
[details]
Patch
Aditya Keerthi
Comment 38
2022-02-14 20:54:10 PST
Comment on
attachment 451989
[details]
Patch Attempting to implement UIScriptController hooks on GTK.
Aditya Keerthi
Comment 39
2022-02-14 21:26:53 PST
Created
attachment 451992
[details]
Patch
Wenson Hsieh
Comment 40
2022-02-15 12:09:28 PST
Comment on
attachment 451992
[details]
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).
Aditya Keerthi
Comment 41
2022-02-15 15:17:07 PST
Created
attachment 452099
[details]
Patch for landing
Aditya Keerthi
Comment 42
2022-02-15 15:18:46 PST
(In reply to Wenson Hsieh from
comment #40
)
> Comment on
attachment 451992
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=451992&action=review
Thanks for the 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".
Changed to `PageIsEditable`.
> > 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).
Updated all tests.
Aditya Keerthi
Comment 43
2022-02-15 20:46:05 PST
Created
attachment 452134
[details]
Patch for landing
EWS
Comment 44
2022-02-17 17:05:08 PST
Committed
r290098
(
247447@main
): <
https://commits.webkit.org/247447@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 452134
[details]
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug