mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Spec: https://drafts.csswg.org/cssom/#dom-documentorshadowroot-adoptedstylesheets Implement `DocumentOrShadowDOM.adoptedStylesheet`. Due to `ObservableArray` being a massive issue on its own, it will be as it was a `FrozenArray` at first. This approach is similar to how Gecko implement adopted stylesheet. See https://phabricator.services.mozilla.com/D144547#change-IXyOzxxFn8sU. All of the changes will be gated behind a preference `dom_adoptedstylesheet_enabled`. Adopted stylesheet is implemented by adding the setter and getter of it. While the getter works like a normal attribute getter, the setter need to consider the inner working of document and shadow root StylesheetSet, specifically the ordering and the invalidations. Particularly for setter, we will clear all of the adopted stylesheet within the StylesheetSet and readd them. Possible optimization exist, but the focus should be directed to implementing `ObservableArray`. More context about the implementations https://hackmd.io/vtJAn4UyS_O0Idvk5dCO_w. Testing: Existing WPT Coverage Fixes: https://github.com/servo/servo/issues/37561 --------- Signed-off-by: Jo Steven Novaryo <jo.steven.novaryo@huawei.com>
23 lines
979 B
Text
23 lines
979 B
Text
/* 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
|
|
*/
|
|
|
|
interface mixin 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;
|
|
};
|
|
|
|
partial interface mixin DocumentOrShadowRoot {
|
|
// TODO(37902): Use ObservableArray Array when available
|
|
[Pref="dom_adoptedstylesheet_enabled", SetterThrows]
|
|
attribute /* ObservableArray<CSSStyleSheet> */ any adoptedStyleSheets;
|
|
};
|