Open Bug 1058408 Opened 5 years ago Updated 9 months ago

support final OM interfaces to @font-face and @font-feature-values rules

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set

Tracking

()

People

(Reporter: jtd, Assigned: jtd)

References

(Blocks 3 open bugs)

Details

(Keywords: dev-doc-needed)

The final version of the OM interfaces for @font-face and @font-feature-values rules differ from the present Gecko interfaces:

http://www.w3.org/TR/css3-fonts/#object-model

@font-face: 

interface CSSFontFaceRule : CSSRule {
  attribute DOMString family;
  attribute DOMString src;
  attribute DOMString style;
  attribute DOMString weight;
  attribute DOMString stretch;
  attribute DOMString unicodeRange;
  attribute DOMString variant;
  attribute DOMString featureSettings;
}

@font-feature-values:

interface CSSFontFeatureValuesRule : CSSRule {
  attribute DOMString fontFamily;
  readonly attribute CSSFontFeatureValuesMap annotation;
  readonly attribute CSSFontFeatureValuesMap ornaments;
  readonly attribute CSSFontFeatureValuesMap stylistic;
  readonly attribute CSSFontFeatureValuesMap swash;
  readonly attribute CSSFontFeatureValuesMap characterVariant;
  readonly attribute CSSFontFeatureValuesMap styleset;
}

[MapClass(DOMString, sequence<unsigned long>)]
interface CSSFontFeatureValuesMap {
  void set(DOMString featureValueName,
           (unsigned long or sequence<unsigned long>) values);
}

The MapClass is a tabbism that got negative feedback from js folks so we probably need to convert that into what we actually want to support.
Assignee: nobody → jdaggett
Tab notes that Chrome/Webkit still use the old style rule OM model from CSS2:

https://lists.w3.org/Archives/Public/www-style/2015Sep/0055.html
Test for simple @font-face rule OM modifications:
http://people.mozilla.org/~jdaggett/tests/fontfaceruleomtest.html
David, I'm going to go ahead and work on the implementation of this. This specifically means moving from the existing problematic "style rule within an @-rule" OM model for @font-face rules to something that roughly corresponds with the FontFace interface:

https://drafts.csswg.org/css-fonts/#cssfontfacerule
https://drafts.csswg.org/css-font-loading/#fontface-interface

This will eliminate the problem of having to add new @font-face descriptors to the CSS2Properties interface.

Just wanted to confirm that you are comfortable with this change. If you have any concern/issues, please note them.
Flags: needinfo?(dbaron)
Definitely seems good to untie it from CSS2Properties.

I'm a little worried about the compatibility of getting rid of the .style indirection.  Might it be necessary to continue supporting .style (maybe even with .style being a pointer back to the same object) for compatibility?
Flags: needinfo?(dbaron)
Yeah, that's a good question. Modifying attributes seems to only be functional in Safari, both Chrome and Firefox don't update the font matching correctly. So I can't see authors really using this interface in its current state. I think this might be something to simply implement and see if anyone reports bugs on. If need be, we can add something to deal with the .style case.
The CSSFontFaceRule object model changes seem to have been dropped from the spec, but there is still an interesting  CSSFontFeatureValuesRule interface in css-fonts-4.
Blocks: css-fonts-4
No longer blocks: css-fonts-3
Blocks: 1529054
You need to log in before you can comment on or make changes to this bug.