-
Notifications
You must be signed in to change notification settings - Fork 639
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css-fonts] CSSFontFaceRule does not seem Web compatible #825
Comments
(That test has a separate issue where family == 'sample' works on Chrome and Edge, but family == '"sample"' is needed on Firefox, with double quoting). |
So, is this just a copy paste error in the Fonts 3 spec? If style was CSSStyleDeclaration while family, src, etc were DOMString that would make sense to me, the old one for backwards compat and the new ones for convenience. |
This was no error, it was an intentional "let's fix this better" effort by jdaggett years ago that never panned out. Old 2.1 spec gave CSSFontFaceRule a .style property, which worked identically to style rules, but jdaggett tried to fix it to just put the valid descriptors directly on the CSSFontFaceRule, like we do with other at-rules. However, no browser ever picked up the change, including Firefox, which John was nominally in charge of (for the relevant section). :/ This needs to be reverted to match reality, unless browsers actually think they can change their implementation. (I'm pretty sure Chrome's position is that we probably can't.) |
I still hope to push forward this change. Could we keep a The currently state doesn't make much sense to me. |
We definitely can't break existing code, which treats it as a CSSStyleDeclaration (using cssText and getPropertyValue()). Given this constraint, I'm not sure that we can do this. |
Fix #16165. Also, it turns out that the CSSFontFaceRule IDL specified in the css-fonts spec is not web-compatible. Instead browsers implement a .style attribute like in CSSStyleRule: w3c/csswg-drafts#825 This in turn requires preserving data about which descriptors were set or not (distinguishing unset from set to a value that happens to be the initial value), so this commit also makes every field `Option<_>`.
Make the parser accept @font-face rules without font-family or src. Fix #16165. Also, it turns out that the CSSFontFaceRule IDL specified in the css-fonts spec is not web-compatible. Instead browsers implement a .style attribute like in CSSStyleRule: w3c/csswg-drafts#825 This in turn requires preserving data about which descriptors were set or not (distinguishing unset from set to a value that happens to be the initial value), so this commit also makes every field `Option<_>`.
Fix #16165. Also, it turns out that the CSSFontFaceRule IDL specified in the css-fonts spec is not web-compatible. Instead browsers implement a .style attribute like in CSSStyleRule: w3c/csswg-drafts#825 This in turn requires preserving data about which descriptors were set or not (distinguishing unset from set to a value that happens to be the initial value), so this commit also makes every field `Option<_>`.
Make the parser accept @font-face rules without font-family or src. Fix #16165. Also, it turns out that the CSSFontFaceRule IDL specified in the css-fonts spec is not web-compatible. Instead browsers implement a .style attribute like in CSSStyleRule: w3c/csswg-drafts#825 This in turn requires preserving data about which descriptors were set or not (distinguishing unset from set to a value that happens to be the initial value), so this commit also makes every field `Option<_>`. <!-- 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/16224) <!-- Reviewable:end -->
Make the parser accept @font-face rules without font-family or src. Fix #16165. Also, it turns out that the CSSFontFaceRule IDL specified in the css-fonts spec is not web-compatible. Instead browsers implement a .style attribute like in CSSStyleRule: w3c/csswg-drafts#825 This in turn requires preserving data about which descriptors were set or not (distinguishing unset from set to a value that happens to be the initial value), so this commit also makes every field `Option<_>`. <!-- 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/16224) <!-- Reviewable:end -->
We probably need to keep |
Ah, |
@upsuper Do you mean something that has all the same methods and attributes as |
Because WebKit and Blink have already been using the new definition for |
Make the parser accept @font-face rules without font-family or src. Fix #16165. Also, it turns out that the CSSFontFaceRule IDL specified in the css-fonts spec is not web-compatible. Instead browsers implement a .style attribute like in CSSStyleRule: w3c/csswg-drafts#825 This in turn requires preserving data about which descriptors were set or not (distinguishing unset from set to a value that happens to be the initial value), so this commit also makes every field `Option<_>`. <!-- 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/16224) <!-- Reviewable:end -->
… font-family or src (from servo:valid-fontface); r=upsuper Fix #16165. Also, it turns out that the CSSFontFaceRule IDL specified in the css-fonts spec is not web-compatible. Instead browsers implement a .style attribute like in CSSStyleRule: w3c/csswg-drafts#825 This in turn requires preserving data about which descriptors were set or not (distinguishing unset from set to a value that happens to be the initial value), so this commit also makes every field `Option<_>`. Source-Repo: https://github.com/servo/servo Source-Revision: fac0d17fd6edf996876d6e6379e48ef4f9cb43d6 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 53db8dcde3e41e82100219b37ef20b2bc76b9f6b
… font-family or src (from servo:valid-fontface); r=upsuper Fix #16165. Also, it turns out that the CSSFontFaceRule IDL specified in the css-fonts spec is not web-compatible. Instead browsers implement a .style attribute like in CSSStyleRule: w3c/csswg-drafts#825 This in turn requires preserving data about which descriptors were set or not (distinguishing unset from set to a value that happens to be the initial value), so this commit also makes every field `Option<_>`. Source-Repo: https://github.com/servo/servo Source-Revision: fac0d17fd6edf996876d6e6379e48ef4f9cb43d6
… font-family or src (from servo:valid-fontface); r=upsuper Fix #16165. Also, it turns out that the CSSFontFaceRule IDL specified in the css-fonts spec is not web-compatible. Instead browsers implement a .style attribute like in CSSStyleRule: w3c/csswg-drafts#825 This in turn requires preserving data about which descriptors were set or not (distinguishing unset from set to a value that happens to be the initial value), so this commit also makes every field `Option<_>`. Source-Repo: https://github.com/servo/servo Source-Revision: fac0d17fd6edf996876d6e6379e48ef4f9cb43d6
I just filed https://bugs.chromium.org/p/chromium/issues/detail?id=709013 for addressing this mismatch between Blink and the spec. I mentioned in the descriptions that all engines still seem to match the old spec, and also that we have a use counter: Preserving the |
Agreed; there seems to be consensus on that point. If we wanted to do that, the feature should be moved to css4-fonts. If we don't, is it sufficient to drop the feature and leave it to DOM 2 Style? |
https://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSFontFaceRule is not maintained and I'd consider it a bug if that were the only spec defining |
If we’re keeping the .style attribute, then there's no reason to add descriptor attributes. Indeed, redundancy should be eliminated. |
Why isn't this a part of CSS OM? @zcorpan Okay, https://drafts.csswg.org/cssom/ says
related, #728 |
I think that the CSSOM spec defines interfaces for rules in CSS 2, and later specs that introduce new at-rules define their own OM. For example: https://drafts.csswg.org/css-conditional/#apis |
Which is fine too, I just wanted some clarity on
|
I think that the conclusion from this thread is that css-fonts should specify a |
Fix servo#16165. Also, it turns out that the CSSFontFaceRule IDL specified in the css-fonts spec is not web-compatible. Instead browsers implement a .style attribute like in CSSStyleRule: w3c/csswg-drafts#825 This in turn requires preserving data about which descriptors were set or not (distinguishing unset from set to a value that happens to be the initial value), so this commit also makes every field `Option<_>`.
I think we need a resolution before I can do anything here. Agenda+. |
So Gecko doesn't implement the merging of CSS2Properties into CSSStyleDecleration, and the declaration block for @font-face rules doesn't implement CSS2Properties. See testcase. So I think it's reasonable to think that putting all of CSS2Properties into whatever represents the declaration-block for @font-face isn't needed for Web compatibility. |
(And I think the issue of not wanting all the bogus properties on CSSFontFaceRule.style was one of the reasons we haven't done that merge.) |
I added a few CSS Fonts 3 tests, including @font-face and @font-feature-settings to WPT. The @font-face test is just that the interface exists, the properties are not tested. Happy to add further tests for CSS Fonts 4 in that area, once we agree on this issue. |
@dbaron I'd be okay with a result that we unmerge the CSS2 properties from the CSSStyleDeclaration in general, and reuse that. It still means that I just really, really want the current "pretend all the descriptors are directly on the interface" specification to either go away or become reality. |
The CSS Working Group just discussed The full IRC log of that discussion<dael> Topic: CSSFontFaceRule does not seem Web compatible<dael> github: https://github.com//issues/825 <dael> Rossen_: This was added by ChrisL. <myles> https://www.w3.org/TR/2011/WD-cssom-20110712/#cssfontfacerule <dael> myles: This is aboutwhat happens in CSSOM if you pull out a rule that represents a FontFaceRule. There's an old spec that says this only has one rule that is a style declaration. <myles> https://drafts.csswg.org/css-fonts-4/#cssfontfacerule0 <dael> myles: This was updated to ^ which gets rid of the one style attribute and replaces with a bunch of strings. <dael> myles: Before you would get your rule in JS and say .style.getPropertyValue and in the new rule you say .faimly to get the string. <dael> myles: Every browser impl the old. There have been proposals of what to do. 1) revert, 2) have both 3) make a .style but have it be a new custom object with only some stuff and not all the g enerality of the style declaration. <dael> myles: This came up b/c I started making edits and I don't know what to do. <dael> myles: My opinion is since browsers are standardized that's what should go in spec. I imagine there are other thoughts. <tantek> +1 <dael> Rossen_: Most people engaged in this aren't on the call today. ChrisL, dbaron, TabAtkins are all not on the call. <dael> myles: We can push. I'll give the speech again next week. <dael> Rossen_: I'm sympathetic with your proposed opinion to standardize on one behavior. But I'd also like to hear from others that were in this conversation. <dael> myles: That's fine. |
The CSS Working Group just discussed
The full IRC log of that discussion<dbaron> Topic: CSSFontFaceRule isn't web-compatible<myles_> https://github.com//issues/825 <astearns> github: https://github.com//issues/825 <fremy> myles_: cssom for the font-face rule <fremy> myles_: used to be CSSStyleDeclaration with the declarations inside <fremy> myles_: rule.style.getPropertyValue("font-family") <fremy> myles_: the spec was then changed <fremy> myles_: instead of having a style, you would have a bunch of strings <fremy> myles_: e.g. rule.family <fremy> myles_: no browser has made this change <fremy> myles_: there is existing code that use the old way <fremy> myles_: we don't want to break that code <fremy> myles_: option 1: rollback to old spec text <fremy> myles_: option 2: get browsers to support the new spec text <fremy> myles_: option 3: get browsers to support both <fremy> myles_: option 4: make the "style" property return new type of object that looks like CSSStyleDeclaration but is simpler <fremy> dbaron: in the old domstyle spec, cssstyledeclaration was simple <fremy> dbaron: the weird stuff was in css2properties <fremy> dbaron: so you could implement both, and most things did <fantasai> s/css2properties/css2properties, which had a property for every property in css <fremy> dbaron: that was then changed, and the two were merged <fremy> dbaron: so now the merge made it more difficult to implement <fremy> dbaron: we never implemented this merge <fremy> dbaron: (in gecko) <fremy> dbaron: my preferred proposal would then to be unmerge things <fantasai> dbaron: our implementation doesn't include all the other stuff in font face rules, just the 6 original get/set methods <fantasai> (that goes up a few lines) <fremy> dbaron: (and rollback to use cssstyledeclaration) <fremy> myles_: we still need to explain what happens when we set properties that do not exist in @font-face but do in general style <fremy> myles_: but I don't have a strong opinion in either ways <fremy> myles_: but I would rather rollback the spec, and maybe we can refine after <fremy> alan: so, instead of coming up with a perfect design, we rollback the improve iteratively <fremy> TabAtkins: we have copied the design in font-face <fremy> TabAtkins: and we have "style" property there <fremy> TabAtkins: so we cannot be consistent and keep style as CSSStyleDeclaration <fremy> myles_: life is terrible, who names these things ;) <fremy> dbaron: if other implementations are willing to remove css2props stuff, then it leaves less questions to be answered <fremy> myles_: i dont think we ever implemented these two interfaces <fremy> alan: any other opinion? <fremy> TabAtkins: i suspect if gecko is doing it, i guess we could do it <fremy> myles_: merge allows rule.style["font-family"] and unmerge does not <fremy> dbaron: yes <fremy> myles_: webkit does not support this either <dbaron> s/rule.style["font-family"]/rule.style.fontFamily/ <gsnedders> I thought both of those were supported interoperably? <fremy> myles_: can we then try to resolve on rolling back to the unmerged version? <fremy> no objection <dbaron> gsnedders: rule is CSSFontFaceRule <fremy> RESOLVED: rollback to previous state with CSSStyleDeclaration and umerged interfaces <myles_> https://github.com//issues/1349 |
Some discussion after this noted that we'd probably need to re-introduce the style property into the fonts-3 interface. |
Yeah, in more detail the edits are:
|
CSSStyleDeclaration is defined in another spec, so another issue should be raised for it. Do you know where to file it, @tabatkins? |
Yeah, file it against CSSOM. The (1) in my list is still against the Fonts spec, tho, so this should probably be open. |
15de56b completes (1), right? |
Yeah. |
…font-family or src (from servo:valid-fontface); r=upsuper Fix #16165. Also, it turns out that the CSSFontFaceRule IDL specified in the css-fonts spec is not web-compatible. Instead browsers implement a .style attribute like in CSSStyleRule: w3c/csswg-drafts#825 This in turn requires preserving data about which descriptors were set or not (distinguishing unset from set to a value that happens to be the initial value), so this commit also makes every field `Option<_>`. Source-Repo: https://github.com/servo/servo Source-Revision: fac0d17fd6edf996876d6e6379e48ef4f9cb43d6 UltraBlame original commit: 73493ced03e5a8cf5a62302e02de20024938f626
…font-family or src (from servo:valid-fontface); r=upsuper Fix #16165. Also, it turns out that the CSSFontFaceRule IDL specified in the css-fonts spec is not web-compatible. Instead browsers implement a .style attribute like in CSSStyleRule: w3c/csswg-drafts#825 This in turn requires preserving data about which descriptors were set or not (distinguishing unset from set to a value that happens to be the initial value), so this commit also makes every field `Option<_>`. Source-Repo: https://github.com/servo/servo Source-Revision: fac0d17fd6edf996876d6e6379e48ef4f9cb43d6 UltraBlame original commit: 73493ced03e5a8cf5a62302e02de20024938f626
…font-family or src (from servo:valid-fontface); r=upsuper Fix #16165. Also, it turns out that the CSSFontFaceRule IDL specified in the css-fonts spec is not web-compatible. Instead browsers implement a .style attribute like in CSSStyleRule: w3c/csswg-drafts#825 This in turn requires preserving data about which descriptors were set or not (distinguishing unset from set to a value that happens to be the initial value), so this commit also makes every field `Option<_>`. Source-Repo: https://github.com/servo/servo Source-Revision: fac0d17fd6edf996876d6e6379e48ef4f9cb43d6 UltraBlame original commit: 73493ced03e5a8cf5a62302e02de20024938f626
CSSFontFaceRule has a style property, introduced in DOM Level 2 Style.
DOM 2 Style says style property is of type CSSStyleDeclaration
https://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/css.html#CSS-CSSFontFaceRule
https://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/css.html#CSS-CSSStyleDeclaration
while CSS3 Fonts says style property is of type DOMString.
https://drafts.csswg.org/css-fonts/Fonts.html#om-fontface
Informal testing indicates that in browsers (tested Firefox 51, Chrome 57, Edge 14) the style property is an object, per Dom 2 Style. It isn't a DOMString and it is not clear how Web compatible it would be to change the type of the property.
Quick test http://codepen.io/svgeesus/pen/ZBZbbv
The text was updated successfully, but these errors were encountered: