Open Bug 1058408 Opened 10 years ago Updated 1 month ago

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

Categories

(Core :: CSS Parsing and Computation, defect)

defect

Tracking

()

People

(Reporter: jtd, Unassigned)

References

(Blocks 3 open bugs, )

Details

(Keywords: dev-doc-needed, parity-chrome, parity-safari)

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

The bug assignee didn't login in Bugzilla in the last 7 months, so the assignee is being reset.

Assignee: jd.bugzilla → nobody
Severity: normal → S3

Jonathan, are you planning to add this? I am working on font-variant-alternates in Chromium and it'd be useful to implement parsing tests based on this.

(In reply to Dominik Röttsches (drott) from comment #8)

Jonathan, are you planning to add this? I am working on font-variant-alternates in Chromium and it'd be useful to implement parsing tests based on this.

In principle, I'd like us to do it; but I don't know of any current plans/timescale for when it might happen, sorry.

(I believe we do have some tests in place, but they test by comparing with a reference rendering, not via the OM.)

Duplicate of this bug: 1906625

Here's a simple testcase from dupe bug 1906625, which shows that we just report undefined for various attributes that should in fact be present:
https://bug1906625.bmoattachments.org/attachment.cgi?id=9413136

(Chrome/Safari show the actual values of these attributes, taken from the @font-face {...} rule defined in CSS.)

You need to log in before you can comment on or make changes to this bug.