Bug 87343 - selectstart event won't be fired in Shadow DOM when SelectAll is executed.
Summary: selectstart event won't be fired in Shadow DOM when SelectAll is executed.
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Web Components Team
URL:
Keywords:
: 106528 (view as bug list)
Depends on:
Blocks: 59805 87230 91821
  Show dependency treegraph
 
Reported: 2012-05-23 23:14 PDT by Shinya Kawanaka
Modified: 2019-10-04 22:51 PDT (History)
10 users (show)

See Also:


Attachments
Patch (6.84 KB, patch)
2013-01-09 23:15 PST, Shinya Kawanaka
no flags Details | Formatted Diff | Diff
Patch (7.11 KB, patch)
2013-01-10 20:37 PST, Shinya Kawanaka
rniwa: review+
commit-queue: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Shinya Kawanaka 2012-05-23 23:14:33 PDT
When a node is in Shadow DOM, document.execCommand('SelectAll') won't fire selectstart to the node in Shadow DOM.
Comment 1 Shinya Kawanaka 2012-05-24 00:22:40 PDT
This might be hard to fix... because of Bug 52195.
Comment 2 Shinya Kawanaka 2013-01-09 22:26:32 PST
*** Bug 106528 has been marked as a duplicate of this bug. ***
Comment 3 Shinya Kawanaka 2013-01-09 22:27:43 PST
When containing ShadowRoot is UserAgentShadowRoot, we should fire selectstart on host element. Otherwise, we should fire selectstart from the target element, I think.
Comment 4 Shinya Kawanaka 2013-01-09 23:15:08 PST
Created attachment 182072 [details]
Patch
Comment 5 Dimitri Glazkov (Google) 2013-01-10 09:40:04 PST
Comment on attachment 182072 [details]
Patch

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

Can you explain the reasoning here a bit more? It seems that we shouldn't have such distinctions between UA and author shadow roots.

> LayoutTests/fast/dom/shadow/selectstart-expected.txt:1
> +selectstart should be fired in a user selects elements in ShadowDOM, but it should not be propageted to host element. When selecting text in an input element, selectstart should be fired on the input element.

propagated.
Comment 6 Shinya Kawanaka 2013-01-10 18:45:12 PST
(In reply to comment #5)
> (From update of attachment 182072 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=182072&action=review
> 
> Can you explain the reasoning here a bit more? It seems that we shouldn't have such distinctions between UA and author shadow roots.
> 
> > LayoutTests/fast/dom/shadow/selectstart-expected.txt:1
> > +selectstart should be fired in a user selects elements in ShadowDOM, but it should not be propageted to host element. When selecting text in an input element, selectstart should be fired on the input element.
> 
> propagated.

I'll update the ChangeLog soon. But let me summarize my thought here.

The main point is that 'selectstart' should be fired when selection started, however it cannot cross the ShadowDOM boundary.

Let's consider <input> element. When text is selected, selectstart should be fired. However, on what? If it's fired in inner element of <input>, user cannot detect selectstart is fired. So it should be fired on <input> element itself.

But we cannot always fire selectstart event on host element. When we have a content-editable element in Shadow DOM, selecting text on it should fire selectstart on the element itself.

So I think we have to distinguish UA ShadowRoot from Author ShadowRoot here.

If we have a more good way to do this, please tell me. I didn't come up with one.
Comment 7 Shinya Kawanaka 2013-01-10 20:37:32 PST
Created attachment 182256 [details]
Patch
Comment 8 WebKit Commit Bot 2013-04-10 19:40:24 PDT
Comment on attachment 182256 [details]
Patch

Rejecting attachment 182256 [details] from commit-queue.

Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-commit-queue.appspot.com', '--bot-id=webkit-cq-03', 'apply-attachment', '--no-update', '--non-interactive', 182256, '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit

Last 500 characters of output:
at 1612 (offset 21 lines).
Hunk #3 FAILED at 1640.
1 out of 3 hunks FAILED -- saving rejects to file Source/WebCore/editing/FrameSelection.cpp.rej
patching file LayoutTests/ChangeLog
Hunk #1 succeeded at 1 with fuzz 3.
patching file LayoutTests/fast/dom/shadow/selectstart-expected.txt
patching file LayoutTests/fast/dom/shadow/selectstart.html

Failed to run "[u'/Volumes/Data/EWS/WebKit/Tools/Scripts/svn-apply', '--force', '--reviewer', 'Ryosuke Niwa']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit

Full output: http://webkit-commit-queue.appspot.com/results/17631068
Comment 9 Ryosuke Niwa 2019-10-04 22:51:27 PDT
selectstart works in v1 implementation. LayoutTests/fast/shadow-dom/trusted-event-scoped-flags.html tests this.