mirror of
https://github.com/servo/servo.git
synced 2025-08-11 08:25:32 +01:00
script: Implement DocumentOrShadowDOM.adoptedStylesheet
with FrozenArray
(#38163)
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>
This commit is contained in:
parent
d2e5137201
commit
f523445fc3
24 changed files with 434 additions and 139 deletions
1
tests/wpt/meta/__dir__.ini
vendored
1
tests/wpt/meta/__dir__.ini
vendored
|
@ -1,4 +1,5 @@
|
|||
prefs: [
|
||||
"dom_adoptedstylesheet_enabled:true",
|
||||
"dom_indexeddb_enabled:true",
|
||||
"dom_serviceworker_enabled:true",
|
||||
"dom_testutils_enabled:true",
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
[layer-replaceSync-clears-stale.html]
|
||||
[replaceSync clears stale layer statements]
|
||||
expected: FAIL
|
|
@ -1,4 +0,0 @@
|
|||
[CSSStyleSheet-constructable-concat.html]
|
||||
expected: TIMEOUT
|
||||
[adoptedStyleSheets should allow .concat on empty starting values]
|
||||
expected: FAIL
|
|
@ -1,9 +0,0 @@
|
|||
[CSSStyleSheet-constructable-invalidation.html]
|
||||
[mutating constructed CSSStyleSheet applied to root invalidates styles]
|
||||
expected: FAIL
|
||||
|
||||
[mutating constructed CSSStyleSheet applied to shadowdom invalidates styles]
|
||||
expected: FAIL
|
||||
|
||||
[mutating dependent constructed CSSStyleSheet applied to shadowdom invalidates styles]
|
||||
expected: FAIL
|
|
@ -1,7 +1,4 @@
|
|||
[CSSStyleSheet-constructable.html]
|
||||
[document.adoptedStyleSheets should initially have length 0.]
|
||||
expected: FAIL
|
||||
|
||||
[new CSSStyleSheet produces empty CSSStyleSheet]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -17,12 +14,6 @@
|
|||
[Re-attaching shadow host with adopted stylesheets work]
|
||||
expected: FAIL
|
||||
|
||||
[Attaching a shadow root that already has adopted stylesheets work]
|
||||
expected: FAIL
|
||||
|
||||
[Re-attaching shadow host and updating attributes work]
|
||||
expected: FAIL
|
||||
|
||||
[Changes to constructed stylesheets through CSSOM is reflected]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -35,12 +26,6 @@
|
|||
[Stylesheet constructed on iframe cannot be used in the main Document]
|
||||
expected: FAIL
|
||||
|
||||
[Adding non-constructed stylesheet to AdoptedStyleSheets is not allowed when the owner document of the stylesheet is in the same document tree as the AdoptedStyleSheets]
|
||||
expected: FAIL
|
||||
|
||||
[Adding non-constructed stylesheet to AdoptedStyleSheets is not allowed when the owner document of the stylesheet and the AdoptedStyleSheets are in different document trees]
|
||||
expected: FAIL
|
||||
|
||||
[CSSStyleSheet.replaceSync correctly updates the style of its adopters synchronously]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
[adoptedstylesheets-modify-array-and-sheet.html]
|
||||
[Add the two sheets. Text should be red.]
|
||||
expected: FAIL
|
||||
|
||||
[Flip the two sheet. Still red.]
|
||||
expected: FAIL
|
||||
|
||||
[Modify the color declaration. Should now be green.]
|
||||
expected: FAIL
|
|
@ -4,6 +4,3 @@
|
|||
|
||||
[shadowRoot.adoptedStyleSheets should allow mutation in-place]
|
||||
expected: FAIL
|
||||
|
||||
[adoptedStyleSheets should return true for isArray()]
|
||||
expected: FAIL
|
||||
|
|
12
tests/wpt/meta/css/cssom/idlharness.html.ini
vendored
12
tests/wpt/meta/css/cssom/idlharness.html.ini
vendored
|
@ -395,18 +395,6 @@
|
|||
[CSSStyleSheet interface: calling replace(USVString) on sheet with too few arguments must throw TypeError]
|
||||
expected: FAIL
|
||||
|
||||
[Document interface: attribute adoptedStyleSheets]
|
||||
expected: FAIL
|
||||
|
||||
[Document interface: document must inherit property "adoptedStyleSheets" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[Document interface: new Document() must inherit property "adoptedStyleSheets" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[ShadowRoot interface: attribute adoptedStyleSheets]
|
||||
expected: FAIL
|
||||
|
||||
[CSSImportRule interface: attribute supportsText]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
[observable-array-no-leak-of-internals.window.html]
|
||||
[ObservableArray's internals won't leak]
|
||||
expected: FAIL
|
Loading…
Add table
Add a link
Reference in a new issue