Repository navigation
script: Implement DocumentOrShadowDOM.adoptedStylesheet with FrozenArray - #38163
Conversation
|
🔨 Triggering try run (#16366690888) for Linux (WPT) |
|
Test results for linux-wpt from try job (#16366690888): Flaky unexpected result (11)
Stable unexpected results that are known to be intermittent (22)
Stable unexpected results (8)
|
|
|
08249d3 to
628030a
Compare
Signed-off-by: Jo Steven Novaryo <[email protected]>
Signed-off-by: Jo Steven Novaryo <[email protected]>
Signed-off-by: Jo Steven Novaryo <[email protected]>
Signed-off-by: Jo Steven Novaryo <[email protected]>
628030a to
f76e235
Compare
|
🔨 Triggering try run (#16370133621) for Linux (WPT) |
|
Test results for linux-wpt from try job (#16370133621): Flaky unexpected result (20)
Stable unexpected results that are known to be intermittent (20)
|
|
✨ Try run (#16370133621) succeeded. |
Signed-off-by: Jo Steven Novaryo <[email protected]>
19cf9bc to
3bfeb66
Compare
xiaochengh
left a comment
There was a problem hiding this comment.
Looks good in general! There are some more detailed comments.
| // The idea is that this case is rare, so we pay the price of removing the | ||
| // old sheet from the styles and append it later rather than the other way | ||
| // around. | ||
| owner.remove_stylesheet( |
There was a problem hiding this comment.
I don't think we should deduplicate sheets here. There are cases where:
- The sheet list is [A, B, A]
- We should keep both A. If we keep only one of them, the cascade result is wrong
There was a problem hiding this comment.
AFAIU the case is a little bit different. For this case, we are having two different Stylesheet parsed from a same Stylesheet.
Not sure what is the full implication, but Stylo is preventing us from having duplicate Stylesheet inside a StylesheetSet. I believe it would be fine as long as we are keeping the last occurrence duplicates here, which is what Gecko does.
There was a problem hiding this comment.
I just tried to replicate it with adoptedStylesheets. It seems that Blink is keeping the first one while Gecko is keeping the last one, and both are wrong.
- https://jsfiddle.net/d8hxyn5c/1/ Chrome is red, FF is green
- https://jsfiddle.net/d8hxyn5c/2/ Chrome is green, FF is red
So to make things correct, we must keep both.
There was a problem hiding this comment.
Not sure what is the full implication, but Stylo is preventing us from having duplicate Stylesheet inside a StylesheetSet.
Hmm, this sounds tricky. Let's file a bug to Stylo and add a TODO to this part then.
There was a problem hiding this comment.
Hmm, this sounds tricky. Let's file a bug to Stylo and add a TODO to this part then.
Added a TODO here. I am looking for relevant issues, as it was a design used by Gecko, it should be filed to Bugzilla as well.
The concern could be handled other PRs, step by step. As it was a preference gated feature.
Signed-off-by: Jo Steven Novaryo <[email protected]>
3fe0b08 to
0301d21
Compare
Signed-off-by: Jo Steven Novaryo <[email protected]>
0301d21 to
3e0c7fb
Compare
|
🔨 Triggering try run (#16413847402) for Linux (WPT) |
|
Test results for linux-wpt from try job (#16413847402): Flaky unexpected result (19)
Stable unexpected results that are known to be intermittent (19)
|
|
✨ Try run (#16413847402) succeeded. |
DocumentOrShadorDOM.adoptedStylesheet with FrozenArrayDocumentOrShadorDOM.adoptedStylesheet with FrozenArray
Signed-off-by: Jo Steven Novaryo <[email protected]>
DocumentOrShadorDOM.adoptedStylesheet with FrozenArrayDocumentOrShadowDOM.adoptedStylesheet with FrozenArray
Spec: https://drafts.csswg.org/cssom/#dom-documentorshadowroot-adoptedstylesheets
Implement
DocumentOrShadowDOM.adoptedStylesheet. Due toObservableArraybeing a massive issue on its own, it will be as it was aFrozenArrayat 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: #37561