@@ -10,6 +10,7 @@ Editor: Shane Stephens, shanestephens@google.com
1010Editor : Daniel Glazman, daniel.glazman@disruptive-innovations.com
1111Editor : Elliot Sprehn, esprehn@chromium.org
1212Editor : Greg Whitworth, gwhit@microsoft.com
13+ Ignored Terms : boolean, Animatable, Map
1314</pre>
1415
1516Introduction
@@ -26,21 +27,90 @@ dictionary PropertyDescriptor {
2627 DOMString initialValue;
2728};
2829
29- partial interface Document {
30+ partial interface CSS {
3031 void registerProperty(PropertyDescriptor descriptor);
32+ void unregisterProperty(DOMString name);
3133};
3234</pre>
3335
36+ Issue: CSS? Document?
3437
38+ : <dfn dict-member for=PropertyDescriptor>name</dfn>
39+ :: The name of the custom property being defined. This must begin with a double dash ('--' ).
40+
41+ : <dfn dict-member for=PropertyDescriptor>syntax</dfn>
42+ :: A string representing how this custom property is parsed. Only
43+ simple type references are supported.
44+
45+ Note: for example, the syntax string could be '<length>' or '<number>' .
46+
47+ Note: in future levels we anticipate supporting more sophisticated parse strings, e.g.
48+ '<length> || <number>'
49+
50+ : <dfn dict-member for=PropertyDescriptor>inherits</dfn>
51+ :: True if this custom property should inherit down the DOM tree; False otherwise.
52+
53+ : <dfn dict-member for=PropertyDescriptor>initialValue</dfn>
54+ :: The initial value of this custom property.
55+
56+ When a custom property is registered with a given type, its computed value is defined
57+ fully by the type selected. Furthermore, the property will interpolate in a manner
58+ defined for that type by [[css3-animations]] .
59+
60+ TODO: Actually work out whether we need to describe computation per type
61+ here, or whether we can crib from another spec.
62+
63+ If {{registerProperty()}} is called with a descriptor name that matches an already registered property,
64+ then an exception is thrown and the re-registration fails.
65+
66+ Properties can be unregistered using {{unregisterProperty()}} . If this function is called with a name
67+ that doesn't match an existing property then an exception is thrown.
68+
69+ Calls to both {{registerProperty()}} and {{unregisterProperty()}} trigger a reparse of all parsed CSS.
3570
3671The apply hook
3772==============
3873
74+ <pre class='idl'>
3975
40- <div class='notes'>
76+ interface StyleWriter {
77+ // affordances for writing to used values, but only those in outputProperties
78+ };
79+
80+ callback ApplyCallback = void (Animatable element, StyleWriter writer, Map<DOMString, any> computedValues);
4181
42- syntax: is a string, doesn't accept anything for V1 except '<a single type here>' (e.g. <length> ).
43- Specifically: <length> , <color> , <number> , <angle> , <url> , <image> , <position> , <transform>
82+ dictionary ApplyDescriptor {
83+ ApplyCallback applyHook;
84+ sequence<DOMString>? inputProperties;
85+ sequence<DOMString> outputProperties;
86+ };
87+
88+ partial interface CSS {
89+ long registerApplyHook(ApplyDescriptor apply);
90+ void unregisterApplyHook(long hookID);
91+ };
92+ </pre>
93+
94+ Issue: CSS? Document?
95+
96+
97+ : <dfn dict-member for=ApplyDescriptor>inputProperties</dfn>
98+ :: If this value is not null, then the apply function is only called for elements or
99+ pseudoelements on which the listed properties all have non-initial values.
100+
101+ : <dfn dict-member for=ApplyDescriptor>outputProperties</dfn>
102+ :: This value defines the properties for which the apply function can modify the used
103+ value.
104+
105+ If a {{registerApplyHook()}} call is made with a list of outputProperties that contains
106+ properties that have already been registered for output, then an exception is thrown and
107+ the call fails.
108+
109+
110+ <pre class='note'>
111+
112+ syntax: is a string, doesn't accept anything for V1 except '<a single type here>' (e.g. <length>).
113+ Specifically: <length>, <color>, <number>, <angle>, <url>, <image>, <position>, <transform>
44114type: not needed for V1 (because it's derived from syntax).
45115animation: not needed for V1 (because it's derived from syntax).
46116
@@ -49,15 +119,15 @@ Limitation: can't have percentages without a computation hook.
49119Does invalidation go here?
50120
51121What does this give us:
52- (1) the ability to feed typed information to custom paint/layout
53- (2) the ability to animate custom properties
122+ 1. the ability to feed typed information to custom paint/layout
123+ 2. the ability to animate custom properties
54124
55125Things that are missing:
56- (1) there's no way to define a custom computation - i.e. we can take '33em' to '330px' in the standard way, but
126+ 1. there's no way to define a custom computation - i.e. we can take '33em' to '330px' in the standard way, but
57127 we can't convert '33em' to something special.
58- (2) there's no way to define custom animation. So we can't register for strings and define some crazy way
128+ 2. there's no way to define custom animation. So we can't register for strings and define some crazy way
59129 to animate them.
60- (3) there's no way (outside of direct var references or custom painters/layouters) for the custom properties
130+ 3. there's no way (outside of direct var references or custom painters/layouters) for the custom properties
61131 to impact layout or paint. This is 'applying the value' , and refers to manipulating the used value of
62132 other properties.
63133
@@ -151,4 +221,4 @@ registerProperty({
151221});
152222</script>
153223
154-
224+ </pre>
0 commit comments