diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2019-04-29 08:38:50 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-29 08:38:50 -0400 |
commit | 799490a02e9bea575bf34c39f045ef0883539f05 (patch) | |
tree | 278cada683564db36997cf3f96c92513b89c3096 /components/script/dom/webidls | |
parent | d58ea974baff1b51a43d2e2bf4b287ff11991a8d (diff) | |
parent | 37e88e77cdf00e3555599dd4004d03548bd95dcf (diff) | |
download | servo-799490a02e9bea575bf34c39f045ef0883539f05.tar.gz servo-799490a02e9bea575bf34c39f045ef0883539f05.zip |
Auto merge of #22743 - ferjm:shadowdom, r=emilio
Partial ShadowDOM support
This is just an early WIP, not to take it very seriously yet.
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [x] These changes fix #22719
- [x] There are tests for these changes
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22743)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/webidls')
-rw-r--r-- | components/script/dom/webidls/Document.webidl | 14 | ||||
-rw-r--r-- | components/script/dom/webidls/DocumentOrShadowRoot.webidl | 18 | ||||
-rw-r--r-- | components/script/dom/webidls/Element.webidl | 2 | ||||
-rw-r--r-- | components/script/dom/webidls/Node.webidl | 8 | ||||
-rw-r--r-- | components/script/dom/webidls/ShadowRoot.webidl | 17 |
5 files changed, 45 insertions, 14 deletions
diff --git a/components/script/dom/webidls/Document.webidl b/components/script/dom/webidls/Document.webidl index ccc3d339377..85c3362f42e 100644 --- a/components/script/dom/webidls/Document.webidl +++ b/components/script/dom/webidls/Document.webidl @@ -132,7 +132,6 @@ partial /*sealed*/ interface Document { // user interaction readonly attribute Window?/*Proxy?*/ defaultView; - readonly attribute Element? activeElement; boolean hasFocus(); // [CEReactions] // attribute DOMString designMode; @@ -199,17 +198,6 @@ partial interface Document { TouchList createTouchList(Touch... touches); }; -// https://drafts.csswg.org/cssom-view/#dom-document-elementfrompoint -partial interface Document { - Element? elementFromPoint(double x, double y); - sequence<Element> elementsFromPoint(double x, double y); -}; - -// https://drafts.csswg.org/cssom/#extensions-to-the-document-interface -partial interface Document { - [SameObject] readonly attribute StyleSheetList styleSheets; -}; - // https://fullscreen.spec.whatwg.org/#api partial interface Document { [LenientSetter] readonly attribute boolean fullscreenEnabled; @@ -221,3 +209,5 @@ partial interface Document { attribute EventHandler onfullscreenchange; attribute EventHandler onfullscreenerror; }; + +Document implements DocumentOrShadowRoot; diff --git a/components/script/dom/webidls/DocumentOrShadowRoot.webidl b/components/script/dom/webidls/DocumentOrShadowRoot.webidl new file mode 100644 index 00000000000..b5a1a1d0cee --- /dev/null +++ b/components/script/dom/webidls/DocumentOrShadowRoot.webidl @@ -0,0 +1,18 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ +/* + * The origin of this IDL file is + * https://dom.spec.whatwg.org/#documentorshadowroot + * https://w3c.github.io/webcomponents/spec/shadow/#extensions-to-the-documentorshadowroot-mixin + */ + +[NoInterfaceObject] +interface DocumentOrShadowRoot { + // Selection? getSelection(); + Element? elementFromPoint (double x, double y); + sequence<Element> elementsFromPoint (double x, double y); + // CaretPosition? caretPositionFromPoint (double x, double y); + readonly attribute Element? activeElement; + readonly attribute StyleSheetList styleSheets; +}; diff --git a/components/script/dom/webidls/Element.webidl b/components/script/dom/webidls/Element.webidl index b7de03ac344..af14f81b373 100644 --- a/components/script/dom/webidls/Element.webidl +++ b/components/script/dom/webidls/Element.webidl @@ -81,6 +81,8 @@ interface Element : Node { void insertAdjacentText(DOMString where_, DOMString data); [CEReactions, Throws] void insertAdjacentHTML(DOMString position, DOMString html); + + [Throws, Pref="dom.shadowdom.enabled"] ShadowRoot attachShadow(); }; // http://dev.w3.org/csswg/cssom-view/#extensions-to-the-element-interface diff --git a/components/script/dom/webidls/Node.webidl b/components/script/dom/webidls/Node.webidl index cddb776e416..9433e96efa2 100644 --- a/components/script/dom/webidls/Node.webidl +++ b/components/script/dom/webidls/Node.webidl @@ -32,7 +32,7 @@ interface Node : EventTarget { readonly attribute Document? ownerDocument; [Pure] - Node getRootNode(); + Node getRootNode(optional GetRootNodeOptions options); [Pure] readonly attribute Node? parentNode; @@ -58,7 +58,7 @@ interface Node : EventTarget { [CEReactions] void normalize(); - [CEReactions] + [CEReactions, Throws] Node cloneNode(optional boolean deep = false); [Pure] boolean isEqualNode(Node? node); @@ -92,3 +92,7 @@ interface Node : EventTarget { [CEReactions, Throws] Node removeChild(Node child); }; + +dictionary GetRootNodeOptions { + boolean composed = false; +}; diff --git a/components/script/dom/webidls/ShadowRoot.webidl b/components/script/dom/webidls/ShadowRoot.webidl new file mode 100644 index 00000000000..711d4f853bd --- /dev/null +++ b/components/script/dom/webidls/ShadowRoot.webidl @@ -0,0 +1,17 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ +/* + * The origin of this IDL file is: + * https://dom.spec.whatwg.org/#interface-shadowroot + */ + +[Exposed=Window] +interface ShadowRoot : DocumentFragment { + readonly attribute ShadowRootMode mode; + readonly attribute Element host; +}; + +enum ShadowRootMode { "open", "closed"}; + +ShadowRoot implements DocumentOrShadowRoot; |