This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 27829 - [Shadow]: Update ShadowRoot to have elementsFromPoint and caretPositionFromPoint
Summary: [Shadow]: Update ShadowRoot to have elementsFromPoint and caretPositionFromPoint
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - Component Model (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Hayato Ito
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 14978
  Show dependency treegraph
 
Reported: 2015-01-14 05:22 UTC by Philip Rogers
Modified: 2015-04-15 06:39 UTC (History)
3 users (show)

See Also:


Attachments

Description Philip Rogers 2015-01-14 05:22:35 UTC
cssom-view now has the following extensions to Document[1]:
partial interface Document {
  Element? elementFromPoint(double x, double y);
  sequence<Element> elementsFromPoint(double x, double y);
  CaretPosition? caretPositionFromPoint(double x, double y);
};

Only elementFromPoint is currently defined on ShadowRoot. The best way forward would be to define this in cssom but, until then, can we add the following methods to ShadowRoot?
  sequence<Element> elementsFromPoint(double x, double y);
  CaretPosition? caretPositionFromPoint(double x, double y);

They could be defined in roughly the same way as elementFromPoint.

[1] http://dev.w3.org/csswg/cssom-view/#dom-document-elementfrompoint
Comment 1 Hayato Ito 2015-01-15 03:37:50 UTC
Agreed. Sounds the spec needs to reflect the change of cssom-view.
Comment 2 Hayato Ito 2015-01-15 06:09:41 UTC
Instead of defining these in Shadow Root as well as in Document, I've started to feel that it'd be better that we have the common interface between Document and Shadow Root.


e.g.

interface NodeTreeRoot {
  Element? elementFromPoint(double x, double y);
  sequence<Element> elementsFromPoint(double x, double y);
  CaretPosition? caretPositionFromPoint(double x, double y);
  Selection? getSelection ();
  readonly    attribute Element?       activeElement;
  readonly    attribute StyleSheetList styleSheets;
};

Document implements NodeTreeRoot;
ShadowRoot implements NodeTreeRoot;
Comment 3 Philip Rogers 2015-01-22 23:34:06 UTC
@Hayato, that sounds reasonable to me. Can we make it so? :)
Comment 4 Hayato Ito 2015-01-28 08:41:10 UTC
(In reply to Philip Rogers from comment #3)
> @Hayato, that sounds reasonable to me. Can we make it so? :)

Yeah, we can do it, however, we have to rewrite each behavior of each API so that it also considers shadow trees as well as the document.

That's not so difficult, but let me put this on my task queue for now.
Comment 5 Hayato Ito 2015-02-02 05:26:05 UTC
Make ShadowRoot have elementsFromPoints and caretPositionFromPoint tentatively at: 
https://github.com/w3c/webcomponents/commit/3df488859776f0f1cd4a17b5c564cf6165584cb9

In the long term, we should have the common interface between Document and ShadowRoot.
Comment 6 Hayato Ito 2015-02-02 05:30:45 UTC
I'm aware that these are tentative definitions.
However, it would serve the most of our purposes for a while, I hope.
Comment 7 Hayato Ito 2015-04-15 06:39:03 UTC
Let me close this bug.

I've filed a bug for comment #2 as 
https://www.w3.org/Bugs/Public/show_bug.cgi?id=28493