Bug 170743 - shadowRoot.elementFromPoint() is not scoped
Summary: shadowRoot.elementFromPoint() is not scoped
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: Safari 10
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ali Juma
URL: http://jsbin.com/nogoyay/3/edit?html,...
Keywords: InRadar
Depends on:
Reported: 2017-04-11 12:12 PDT by Daniel Freedman
Modified: 2017-07-12 14:56 PDT (History)
9 users (show)

See Also:

Patch (8.34 KB, patch)
2017-07-10 13:24 PDT, Ali Juma
rniwa: review-
rniwa: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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
Comment 2 Ali Juma 2017-07-10 13:24:50 PDT
Created attachment 315017 [details]
Comment 3 Ryosuke Niwa 2017-07-12 14:53:19 PDT
Comment on attachment 315017 [details]

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]

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]

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.