Closed Bug 1442017 Opened 5 years ago Closed 5 years ago
[wpt-sync] Sync PR 9720 - [css-typed-om] Implement serialization for CSSUnsupported
Style Values .
Sync web-platform-tests PR 9720 into mozilla-central (this bug is closed when the sync is complete). PR: https://github.com/w3c/web-platform-tests/pull/9720 Details from upstream follow. Darren Shen wrote: > [css-typed-om] Implement serialization for CSSUnsupportedStyleValues. > > This patch implements serialization for CSSUnsupportedStyleValue. > The spec requires that: > > - CSSStyleValues that are parsed from string should serialize to the > given string. > - CSSStyleValues that are obtained from CSSOM should serialize according > to  (although this is mostly the same as CSSOM serialization). > > To implement both, we put a String on CSSStyleValue (the base class) > to store its serialization. This is only used by the subclass > CSSUnsupportedStyleValue. When we create a CSSUnsupportedStyleValue, > we set the serialization correctly depending on if it's from a string > or CSSOM. CSSUnsupportedStyleValue.toString() just outputs the stored > string. > > It turns out that the string on CSSStyleValue can completely replace > its CSSValue. Instead of wrapping a CSSValue, which is fragile when > passed around arbitrarily, we simply parse the stored string whenever > we need to convert to a CSSValue. This actually was the original > design, but we changed it because we thought styleMap.set cannot > invoke parsing. Since we resolved to not expose styleMap.set to > worklets, we are allowed to parse and this is a much more robust > solution. > > Serialization for shorthands requires different logic depending on > if it's a computed shorthand or a specified shorthand. This meant > that we had to create a new method for getting the serialization > and override it for different property maps. > > We don't need CSSUnsupportedShorthandValue anymore, since we can > can just use CSSUnsupportedStyleValue. > >  https://drafts.css-houdini.org/css-typed-om-1/#cssom-serialization > > Bug: 816722 > Change-Id: Ia236f72467e414a2eb380f00ddb196db06f8d8b6 > Reviewed-on: https://chromium-review.googlesource.com/940283 > WPT-Export-Revision: 578e4b8314fdfec7420eb4c0c90d085af1f51656
5 years ago
Component: web-platform-tests → DOM: CSS Object Model
Product: Testing → Core
Pushed to try (stability) https://treeherder.mozilla.org/#/jobs?repo=try&revision=997beedefdb90641f6f845424671debe7772fafc
Ran 7 tests and 23 subtests OK : 7 FAIL : 23 New tests that have failures or other problems: /css/css-typed-om/stylevalue-objects/parse-invalid.html CSSStyleValue.parse() with invalid value for shorthand property throws TypeError: FAIL /css/css-typed-om/stylevalue-objects/parse.html CSSStyleValue.parse() with a valid shorthand property returns a CSSStyleValue: FAIL /css/css-typed-om/stylevalue-objects/parseAll-invalid.html CSSStyleValue.parseAll() with invalid value for shorthand property throws TypeError: FAIL /css/css-typed-om/stylevalue-objects/parseAll.html CSSStyleValue.parseAll() with a valid shorthand property returns a CSSStyleValue: FAIL /css/css-typed-om/stylevalue-serialization/cssStyleValue-cssom.html CSSStyleValue from computed CSSOM serializes correctly: FAIL CSSStyleValue from specified CSSOM serializes correctly: FAIL Shorthand CSSStyleValue from computed CSSOM serializes correctly: FAIL Shorthand CSSStyleValue from inline CSSOM serializes correctly: FAIL /css/css-typed-om/stylevalue-serialization/cssStyleValue-string.html CSSStyleValue parsed from string serializes to given string: FAIL Shorthand CSSStyleValue parsed from string serializes to given string: FAIL /css/css-typed-om/the-stylepropertymap/properties/background.html 'background' property: FAIL
Pushed by firstname.lastname@example.org: https://hg.mozilla.org/integration/mozilla-inbound/rev/1a80f55ab76c [wpt PR 9720] - [css-typed-om] Implement serialization for CSSUnsupportedStyleValues., a=testonly
You need to log in before you can comment on or make changes to this bug.