Changes between Version 73 and Version 74 of WebKitIDL


Ignore:
Timestamp:
Jul 30, 2012 12:10:58 AM (12 years ago)
Author:
Vineet
Comment:

Support for [Clamp] extended attribute.

Legend:

Unmodified
Added
Removed
Modified
  • WebKitIDL

    v73 v74  
    6363 - [#ArrayClass ArrayClass(i)][[br]]
    6464 - [#OmitConstructor OmitConstructor, Immutable, MasqueradesAsUndefined, CustomGetOwnPropertySlot, ReplaceableConstructor, ExtendsDOMGlobalObject, IsIndex, V8DoNotCheckSignature, NumericIndexedGetter][[br]]
     65 - [#Clamp Clamp(a,p)][[br]]
    6566
    6667= Overview = #Overview
     
    18021803
    18031804Might be deprecated. Discussion is on-going.
     1805
     1806== [Clamp](a,p) == #Clamp
     1807
     1808 * [http://www.w3.org/TR/2012/CR-WebIDL-20120419/#Clamp The spec of Clamp]
     1809
     1810Summary: [Clamp] indicates that when an ECMAScript Number is converted to the IDL type, out of range values will be clamped to the range of valid values,
     1811rather than using the operators that use a modulo operation (ToInt32, ToUint32, etc.).
     1812
     1813Usage: The [Clamp] extended attribute MUST NOT appear on a read only attribute, or an attribute, operation argument or dictionary member
     1814that is not of an integer type. It also MUST NOT be used in conjunction with the [EnforceRange] extended attribute.
     1815
     1816[Clamp] can be specified on  writable attributes:
     1817
     1818{{{
     1819    interface XXX {
     1820        attribute [Clamp] unsigned short attributeName;
     1821    };
     1822}}}
     1823
     1824[Clamp] can be specified on  extended attributes on methods arguments:
     1825
     1826{{{
     1827    interface GraphicsContext {
     1828        void setColor(octet red, octet green, octet blue);
     1829        void setColorClamped([Clamp] octet red, [Clamp] octet green, [Clamp] octet blue);
     1830    };
     1831}}}
     1832
     1833Calling the non-[Clamp] version of setColor() uses ToUint8 to coerce the Numbers to octets.
     1834Hence calling context.setColor(-1, 255, 257); // Is equivalent to calling setColor(255, 255, 1).
     1835
     1836Calling the [Clamp] version of setColor() uses clampTo() to coerce the Numbers to octets.
     1837Hence calling context.setColor(-1, 255, 257); // Is equivalent to calling setColorClamped(0, 255, 255).