W3C home > Mailing lists > Public > www-style@w3.org > June 2013

Re: [css3-fonts][cssom] CSSFontFeatureValuesRule vs. CSSKeyframesRule

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Thu, 27 Jun 2013 12:33:44 -0700
Message-ID: <CAAWBYDCctA6WrjmxeUC93ygs3ofA+Rs4gQ2WJeM2E9jamut-Ag@mail.gmail.com>
To: John Daggett <jdaggett@mozilla.com>
Cc: www-style list <www-style@w3.org>
On Thu, May 30, 2013 at 11:25 AM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
> Making things readable doesn't *necessarily* mean that it needs to
> expose thing via nested rules, of course.  In fact, slavishly
> reflecting the input syntax in the OM tree is often an anti-pattern -
> it's easy, but often has terrible usability.  I'd be happy to explore
> alternate ways of readably exposing the information.  For example, it
> could look something like (using pseudo-WebIDL, because I don't want
> to worry too hard about the right syntax for some of this):
>
> interface CSSFontFeatureValuesRule {
>   attribute Arraylike<DOMString> familyList; /* An array of family
> name strings. */
>   attribute Maplike<DOMString, DOMString> swash; /* A map of feature
> names -> feature values */
>   attribute Maplike<DOMString, DOMString> styleset; /* Ditto */
>   attribute Maplike<DOMString, DOMString> ornaments; /* Ditto */
>   ...
> }
>
> Where Arraylike<> is whatever the right way is to define an Array in
> WebIDL, and Maplike<> is the same but for Maps.  (I started a thread
> yesterday in public-webapps about defining something for "map-like"
> interfaces in webidl.)

Cameron just added [MapClass] to WebIDL
<http://dev.w3.org/2006/webapi/WebIDL/#MapClass>.  In light of this,
the IDL would look something like:

interface CSSFontFeatureValuesRule {
  attribute sequence<DOMString> familyList;
  attribute CSSFontFeatureValuesMap annotation;
  attribute CSSFontFeatureValuesMap characterVariant;
  attribute CSSFontFeatureValuesMap ornaments;
  attribute CSSFontFeatureValuesMap stylistic;
  attribute CSSFontFeatureValuesMap styleset;
  attribute CSSFontFeatureValuesMap swash;
}

[MapClass(DOMString, sequence<Number>)]
interface CSSFontFeatureValuesMap {
  CSSFontFeatureValuesMap set(DOMString featureName, sequence<Number> value);
  boolean delete(DOMString featureName);
}

Plus some prose:

* Define that the map entries for each CSSFontFeatureValuesMap are the
declaration names and values of the associated @foo blocks in that
@font-feature-values rule.
* Define that set/delete alter the set of feature names defined for
the given familyList.

The rest is taken care of for you by WebIDL automatically.

~TJ
Received on Thursday, 27 June 2013 19:34:35 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:12 UTC