Bug 170743

Summary: shadowRoot.elementFromPoint() is not scoped
Product: WebKit Reporter: Daniel Freedman <dfreedm>
Component: DOMAssignee: Ali Juma <ajuma>
Status: NEW ---    
Severity: Normal CC: ajuma, buildbot, cdumez, commit-queue, dbates, esprehn+autocc, kangil.han, rniwa, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 10   
Hardware: Unspecified   
OS: Unspecified   
URL: http://jsbin.com/nogoyay/3/edit?html,console,output
Attachments:
Description Flags
Patch rniwa: review-, rniwa: commit-queue-

Description Daniel Freedman 2017-04-11 12:12:21 PDT
ShadowRoot.elementFromPoint(x, y) should be scoped to the ShadowRoot, but appears to return elements outside of the ShadowRoot.

In this example, the empty ShadowRoot should return `null` for all calls to `elementFromPoint`, but it returns `document.documentElement`

Example: http://jsbin.com/nogoyay/3/edit?html,console,output

Expected: false

Actual: true
Comment 1 Radar WebKit Bug Importer 2017-04-11 22:39:13 PDT
<rdar://problem/31573184>
Comment 2 Ali Juma 2017-07-10 13:24:50 PDT
Created attachment 315017 [details]
Patch
Comment 3 Ryosuke Niwa 2017-07-12 14:53:19 PDT
Comment on attachment 315017 [details]
Patch

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

> Source/WebCore/ChangeLog:12
> +        No new tests, extended existing test.

Need a link to the spec. We can't make this change until the discussion in https://github.com/w3c/csswg-drafts/issues/556 concludes.
Comment 4 Ryosuke Niwa 2017-07-12 14:54:30 PDT
Comment on attachment 315017 [details]
Patch

Actually, never mind. Clearly, returning a node inside another shadow tree is problematic.
Comment 5 Ryosuke Niwa 2017-07-12 14:55:40 PDT
Comment on attachment 315017 [details]
Patch

wait a minute, sorry, this still doesn't make sense. we should be re-targeting the node to the current scope so this is a bug in retargetToScope.