Bug 149591

Summary: relatedNode should be retargeted respecting slots
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: UI EventsAssignee: Ryosuke Niwa <rniwa>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, esprehn+autocc, kangil.han, kling, koivisto, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 148695    
Attachments:
Description Flags
Implements retargeting of relatedNode
none
Patch for landing none

Description Ryosuke Niwa 2015-09-27 22:22:52 PDT
Re-implement the event retargeting for shadow DOM.
Comment 1 Ryosuke Niwa 2015-09-28 00:29:41 PDT
Created attachment 262003 [details]
Implements retargeting of relatedNode
Comment 2 Radar WebKit Bug Importer 2015-09-28 00:31:49 PDT
<rdar://problem/22875812>
Comment 3 Antti Koivisto 2015-09-28 11:10:46 PDT
Comment on attachment 262003 [details]
Implements retargeting of relatedNode

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

r=me, looks like the best solution for this.

It would be nice if we didn't need to do anything this convoluted but I suppose it is unavoidable with the current spec.

> Source/WebCore/dom/EventDispatcher.cpp:514
> +        if (&currentTreeScope->documentScope() != &targetTreeScope.documentScope()) {
> +            m_inDifferentTree = true;

m_inDifferentDocumentScope might be a more accurate name.
Comment 4 Ryosuke Niwa 2015-09-28 11:13:32 PDT
Comment on attachment 262003 [details]
Implements retargeting of relatedNode

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

>> Source/WebCore/dom/EventDispatcher.cpp:514
>> +            m_inDifferentTree = true;
> 
> m_inDifferentDocumentScope might be a more accurate name.

This flag is also here below where we detect that one is in the document and the other one isn't.

> Source/WebCore/dom/EventDispatcher.cpp:519
> +            m_inDifferentTree = true;

Here. We still have to do some work to get out of the shadow DOM but we can avoid all subsequent works.
Comment 5 Antti Koivisto 2015-09-28 12:02:43 PDT
It is not clear what the "tree" is in m_inDifferentTree. It apparently doesn't mean different shadow tree so I thought adding "Document" there would clarify things.
Comment 6 Ryosuke Niwa 2015-09-28 13:05:49 PDT
(In reply to comment #5)
> It is not clear what the "tree" is in m_inDifferentTree. It apparently
> doesn't mean different shadow tree so I thought adding "Document" there
> would clarify things.

They're not necessarily in two different documents. They could have the same owner document but one inside the document and another outside the document.

How about m_hasDifferentTreeRoot?
Comment 7 Ryosuke Niwa 2015-09-28 14:17:31 PDT
Created attachment 262018 [details]
Patch for landing
Comment 8 WebKit Commit Bot 2015-09-28 15:11:33 PDT
Comment on attachment 262018 [details]
Patch for landing

Clearing flags on attachment: 262018

Committed r190288: <http://trac.webkit.org/changeset/190288>
Comment 9 WebKit Commit Bot 2015-09-28 15:11:37 PDT
All reviewed patches have been landed.  Closing bug.