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

On Tue, Jul 2, 2013 at 2:05 AM, Cameron McCormack <cam@mcc.id.au> wrote:
> John Daggett wrote:
>>
>> Based on a brief discussion with Cam regarding the new [MapClass]
>> thingy in WebIDL, I put together this first attempt at the sort of
>> CSSFontFeatureValuesRule definition Tab was asking for:
>>
>>    [MapClass(DOMString, long)]
>>    interface FontFeatureMapSingle {
>>      long get(DOMString valueName);
>>      boolean has(DOMString valueName);
>>      void set(DOMString valueName, long value);
>>      boolean delete(DOMString valueName);
>>    }
>>
>>    [MapClass(DOMString, sequence<long>)]
>>    interface FontFeatureMapMulti {
>>      sequence<long>  get(DOMString valueName);
>>      boolean has(DOMString valueName);
>>      void set(DOMString valueName, sequence<long>  values);
>>      boolean delete(DOMString valueName);
>>    }
>
>
> I don't think we need the custom versions of has, set and delete.  The
> default versions of these should be fine.

You don't even need to define get(), do you?  The default operation of
that (defined in terms of the map entries) should be sufficient.

>> The 'styleset' and 'character-variant' values for
>> 'font-variant-alternates' take *multiple* values, while the other
>> values only use a single value.  Thus the map associated with each of
>> these values reflects that.
>
> (I think either that, or having a single FontFeatureMap that takes (long or
> sequence<long>) values and does checking in prose, would be fine.)

Agreed.  This would also just plain be more convenient, as it means
the multi-value ones can be set to a single value without having to
wrap it in an array.

(However, that depends on defining set() manually then, right?)

>> The error handling here is a bit tricky (dodgy?).  For the
>> 'character-variant' value only two values are permitted, so what
>> should happen with 'rule.characterVariant.set("blah", [1, 2, 3])'?
>
> I think it should throw in prose.  Maybe InvalidAccessError is the closest
> exception type for this kind of error.

Agreed.

~TJ

Received on Tuesday, 2 July 2013 15:53:28 UTC