Skip to content

Commit 8611f8d

Browse files
committed
extract cssom-values from cssom
1 parent f9bd411 commit 8611f8d

12 files changed

Lines changed: 1454 additions & 460 deletions

cssom-values/Makefile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
2+
ANOLIS = anolis
3+
PYTHON = python
4+
5+
XREFS = data/xrefs/css/cssom-values.json
6+
EDFILE = Overview.html
7+
TRFILE = TR/Overview.html
8+
9+
all: $(EDFILE)
10+
11+
Overview.src.html: cssom-values-source cssom-values-generate.py ../cssom/cssattrs.py
12+
export PYTHONPATH=$(PYTHONPATH):../cssom; $(PYTHON) cssom-values-generate.py
13+
14+
$(XREFS): Overview.src.html Makefile
15+
$(ANOLIS) --dump-xrefs=$@ $< /tmp/spec; $(RM) /tmp/spec
16+
17+
$(EDFILE): Overview.src.html $(XREFS) Makefile
18+
$(ANOLIS) --output-encoding=utf-8 --omit-optional-tags --quote-attr-values \
19+
--w3c-compat --enable=xspecxref --enable=refs --w3c-shortname="cssom-values" \
20+
--force-html4-id --filter=".publish" $< $@
21+
22+
draft: $(EDFILE)
23+
24+
$(TRFILE): Overview.src.html $(XREFS) Makefile
25+
$(ANOLIS) --output-encoding=utf-8 --omit-optional-tags --quote-attr-values \
26+
--w3c-compat --enable=xspecxref --enable=refs --w3c-shortname="cssom-values" \
27+
--force-html4-id --filter=".dontpublish" --pubdate="$(PUBDATE)" --w3c-status=WD $< $@
28+
29+
publish: $(TRFILE)
30+
31+
clean::
32+
$(RM) $(EDFILE)
33+
$(RM) Overview.src.html
34+
echo '{ "definitions": {}, "url": "http://dvcs.w3.org/hg/csswg/raw-file/tip/cssom-values/Overview.html#" }' > $(XREFS)
35+
36+

cssom-values/Overview.html

Lines changed: 476 additions & 0 deletions
Large diffs are not rendered by default.

cssom-values/Overview.src.html

Lines changed: 448 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# GENERATE CSSOM
2+
3+
from cssattrs import cssidlattributes
4+
5+
def property_from_attribute(attribute):
6+
output = ""
7+
if attribute == "cssFloat":
8+
return "float"
9+
for char in attribute:
10+
if char.isupper():
11+
output += "-"
12+
output += char.lower()
13+
else:
14+
output += char
15+
return output
16+
17+
def generate_propertyidl():
18+
value = ""
19+
for attribute in cssidlattributes.split("\n"):
20+
value += " readonly attribute CSSPropertyValue <span data-anolis-spec=cssom data-anolis-xref=\"dom-CSSStyleDeclaration-" + attribute + "\">" + attribute + "</span>;\n"
21+
return value
22+
23+
def generate_spec():
24+
source = open("./cssom-values-source", "r").read()
25+
26+
source = source.replace("<!--CSSOM-DECLARATIONVALUEIDL-->\n", generate_propertyidl())
27+
28+
file = open("./Overview.src.html", "w")
29+
file.write(source)
30+
file.close()
31+
32+
if __name__ == '__main__':
33+
generate_spec()

cssom-values/cssom-values-source

Lines changed: 327 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,327 @@
1+
<!doctype html>
2+
<html lang="en-US">
3+
<head>
4+
<meta charset=utf-8>
5+
<title>CSSOM Values Module</title>
6+
<style type="text/css">
7+
pre.idl { border:solid thin; background:#eee; color:#000; padding:0.5em }
8+
pre.idl :link, pre.idl :visited { color:inherit; background:transparent }
9+
dfn { font-weight:bold; font-style:normal }
10+
.example { margin-left:1em; padding-left:1em; border-left:double; color:#222; background:#fcfcfc }
11+
.example table code { color:inherit }
12+
td, th { padding:.1em }
13+
.note { margin-left:2em; color:green; font-style:italic; font-weight:bold }
14+
p.note::before { content:"Note: " }
15+
.XXX { padding:.5em; border:solid red }
16+
p.XXX::before { content:"Issue: " }
17+
dl.switch { padding-left:2em }
18+
dl.switch > dt { text-indent:-1.5em }
19+
dl.switch > dt:before { content:'\21AA'; padding:0 0.5em 0 0; display:inline-block; width:1em; text-align:right; line-height:0.5em }
20+
code { color:orangered }
21+
code :link, code :visited { color:inherit }
22+
</style>
23+
<link rel="stylesheet" href="http://www.w3.org/StyleSheets/TR/W3C-[STATUS]">
24+
</head>
25+
<body class="draft">
26+
<div class="head">
27+
<!--logo-->
28+
29+
<h1 id="cssom-values">CSSOM Values Module</h1>
30+
31+
<h2 class="no-num no-toc" id="w3c-doctype">[LONGSTATUS] [DATE: 3 August 2002]</h2>
32+
33+
<dl>
34+
35+
<dt>This Version:</dt>
36+
<dd class=dontpublish><a href="http://dvcs.w3.org/hg/csswg/raw-file/tip/cssom-values/Overview.html">http://dvcs.w3.org/hg/csswg/raw-file/tip/cssom-values/Overview.html</a></dd>
37+
<dd class=publish><a href="[VERSION]">[VERSION]</a></dd>
38+
39+
<dt class=dontpublish>Participate:</dt>
40+
<dd class=dontpublish><a href="mailto:www-style@w3.org?subject==%5Bcssom-values%5D%20">www-style@w3.org</a> (<a href="http://lists.w3.org/Archives/Public/www-style/">archives</a>)
41+
<dd class=dontpublish><a href="https://www.w3.org/Bugs/Public/enter_bug.cgi?product=CSS&amp;component=CSSOM&20Values">File a bug</a>
42+
<dd class=dontpublish><a href="http://wiki.whatwg.org/wiki/IRC">IRC: #css on Freenode</a>
43+
44+
<dt class=publish>Latest Version:</dt>
45+
<dd class=publish><a href="[LATEST]">[LATEST]</a></dd>
46+
47+
<dt class=publish>Latest Editor's draft:</dt>
48+
<dd class=publish><a href="http://dvcs.w3.org/hg/csswg/raw-file/tip/cssom-values/Overview.html">http://dvcs.w3.org/hg/csswg/raw-file/tip/cssom-values/Overview.html</a></dd>
49+
50+
<dt class=dontpublish>Previous Version:</dt>
51+
52+
<dt>Editors:</dt>
53+
<dd><a href="http://www.w3.org/wiki/User:Gadams">Glenn Adams</a>
54+
(<a href="http://www.cox.com/">Cox Communications, Inc.</a>)
55+
&lt;<a href="mailto:glenn.adams@cox.com">glenn.adams@cox.com</a>&gt;</dd>
56+
<dd><a href="">Shane Stephens</a>
57+
(<a href="http://www.google.com/">Google, Inc.</a>)
58+
&lt;<a href="mailto:shans@google.com">shans@google.com</a>&gt;</dd>
59+
60+
</dl>
61+
62+
<p class="dontpublish copyright"><a rel=license href="http://creativecommons.org/publicdomain/zero/1.0/"><img src="http://i.creativecommons.org/p/zero/1.0/80x15.png" alt=CC0></a>
63+
To the extent possible under law, the editors have waived all copyright and
64+
related or neighboring rights to this work. In addition, as of
65+
[DATE: 01 Jan 1901], the editors have made this specification available
66+
under the <a rel=license href="http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0">Open
67+
Web Foundation Agreement, Version 1.0</a>.</p>
68+
<div class=publish><!--copyright--></div>
69+
70+
</div>
71+
72+
<hr class="top">
73+
74+
<h2 class="no-num no-toc" id="abstract">Abstract</h2>
75+
76+
<p>This CSSOM Values module defines APIs for accessing and manipulating CSS property
77+
values using object oriented value representations. These APIs are intended to replace
78+
the underimplemented and underutilized <code data-anolis-spec=dom2style>CSSValue</code> and related APIs defined by
79+
<span class=informative data-anolis-ref>DOM2STYLE</span>.</p>
80+
81+
82+
<h2 class="no-num no-toc" id="sotd">Status of this Document</h2>
83+
84+
<p><em>This section describes the status of this document at the time of
85+
its publication. Other documents may supersede this document. A list of
86+
current W3C publications and the latest revision of this technical report
87+
can be found in the
88+
<a href="http://www.w3.org/TR/">W3C technical reports index at http://www.w3.org/TR/.</a></em>
89+
90+
<p>This is the [DATE: 3 August 2002] [LONGSTATUS] of CSSOM. Please send
91+
comments to
92+
<a href="mailto:www-style@w3.org?subject=%5Bcssom%5D%20">www-style@w3.org</a>
93+
(<a href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
94+
with <samp>[cssom-values]</samp> at the start of the subject line.
95+
96+
97+
<!-- XXX include this text upon FPWD publishing
98+
<p>This is the [DATE] First Public Working Draft of CSSOM, produced by the
99+
<a href="http://www.w3.org/Style/CSS/members">CSS Working Group</a> (part
100+
of the <a href="http://www.w3.org/Style/">Style Activity</a>).
101+
-->
102+
<!--XXX remove "First Public" after initial publication -->
103+
104+
<p>This document was produced by a group operating under the
105+
<a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent Policy</a>.
106+
W3C maintains a
107+
<a href="http://www.w3.org/2004/01/pp-impl/32061/status" rel=disclosure>public list of any patent disclosures</a>
108+
made in connection with the deliverables of the group; that page also
109+
includes instructions for disclosing a patent. An individual who has
110+
actual knowledge of a patent which the individual believes contains
111+
<a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a>
112+
must disclose the information in accordance with
113+
<a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the W3C Patent Policy</a>.</p>
114+
115+
<p>Publication as a Working Draft does not imply endorsement by the W3C
116+
Membership. This is a draft document and may be updated, replaced or
117+
obsoleted by other documents at any time. It is inappropriate to cite this
118+
document as other than work in progress.</p>
119+
120+
<h2 class="no-num no-toc" id="toc">Table of Contents</h2>
121+
122+
<!--toc-->
123+
124+
<h2 id="introduction">Introduction</h2>
125+
126+
<p>This CSSOM Values module defines APIs for accessing and manipulating CSS property
127+
values using object oriented value representations.</p>
128+
129+
<h2>Conformance</h2>
130+
131+
<p>All diagrams, examples, and notes in this specification are
132+
non-normative, as are all sections explicitly marked non-normative.
133+
Everything else in this specification is normative.
134+
135+
<p>The key words "MUST", "MUST NOT", "REQUIRED", <!--"SHALL", "SHALL
136+
NOT",--> "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and
137+
"OPTIONAL" in the normative parts of this document are to be
138+
interpreted as described in RFC2119. For readability, these words do
139+
not appear in all uppercase letters in this specification.
140+
<span data-anolis-ref>RFC2119</span>
141+
142+
<p>Requirements phrased in the imperative as part of algorithms
143+
(such as "strip any leading space characters" or "return false and
144+
terminate these steps") are to be interpreted with the meaning of the
145+
key word ("must", "should", "may", etc) used in introducing the
146+
algorithm.
147+
148+
<p>Conformance requirements phrased as algorithms or specific steps
149+
may be implemented in any manner, so long as the end result is
150+
equivalent. (In particular, the algorithms defined in this
151+
specification are intended to be easy to follow, and not intended to
152+
be performant.)
153+
154+
<p>Unless otherwise stated, string comparisons are done in a
155+
<span data-anolis-spec=dom>case-sensitive</span> manner.
156+
157+
<h3 id="dependencies">Dependencies</h3>
158+
159+
<p>This specification relies upon the following underlying specifications:</p>
160+
161+
<dl>
162+
163+
<dt>CSSOM</dt>
164+
<dd><p>A <span>conforming user agent</span> must support the <span>CSS Object
165+
Model</span> <span data-anolis-ref>CSSOM</span>.</p>
166+
<p class="XXX">Narrow this dependency to specific features of CSSOM.</p>
167+
</dd>
168+
169+
</dl>
170+
171+
<h2>CSS Values</h2>
172+
173+
<h3>The <code title>CSSStyleDeclaration</code> Interface</h3>
174+
175+
<pre class="idl">partial interface <dfn>CSSStyleDeclaration</dfn> {
176+
readonly attribute <span>CSSStyleDeclarationValue</span> <span title="dom-CSSStyleDeclaration-values">values</span>;
177+
};</pre>
178+
179+
<h3>The <code title>CSSStyleDeclarationValue</code> Interface</h3>
180+
181+
<pre class="idl">interface <dfn>CSSStyleDeclarationValue</dfn> {
182+
// CSS Properties
183+
<!--CSSOM-DECLARATIONVALUEIDL-->
184+
};</pre>
185+
186+
<p class="XXX">The rough idea is that this interface exposes the full
187+
list of supported properties as well that each return a
188+
<code>CSSPropertyValue</code> object. That object can implement other
189+
objects depending on the property involved. E.g. for '<code>width</code>'
190+
the object would implement <code>CSSLengthComponentValue</code> and
191+
<code>CSSPercentageComponentValue</code>.</p>
192+
193+
<h3>The <code title>CSSPropertyValue</code> Interface</h3>
194+
195+
<pre class="idl">interface <dfn>CSSPropertyValue</dfn> {
196+
attribute DOMString <span title="dom-CSSPropertyValue-cssText">cssText</span>;
197+
};</pre>
198+
199+
<!--
200+
what does the CSSValue represent
201+
"map"
202+
"list"
203+
"space-list"
204+
"component"
205+
206+
if it is a CSSComponentValue
207+
208+
-->
209+
210+
<h3>The <code title>CSSPropertyValueList</code> Interface</h3>
211+
212+
<pre class="idl">[NoInterfaceObject] interface <dfn>CSSPropertyValueList</dfn> {
213+
readonly attribute <span>CSSValue</span>[] <span title="dom-CSSPropertyValue-list">list</span>;
214+
};</pre>
215+
216+
<p class="XXX">Ideally this attribute just returns a mutable array.</p>
217+
218+
<h3>The <code title>CSSMapValue</code> Interface</h3>
219+
220+
<pre class="idl">[NoInterfaceObject] interface <dfn>CSSMapValue</dfn> {
221+
getter <span>CSSValue</span> (DOMString <var title>name</var>);
222+
};</pre>
223+
<!-- see HTML5 DOMStringMap -->
224+
225+
<p class="XXX">This seems the simplest we can get away with.</p>
226+
227+
<h3>The <code title>CSSComponentValue</code> Interface</h3>
228+
229+
<pre class="idl">[NoInterfaceObject] interface <dfn>CSSComponentValue</dfn> {
230+
readonly attribute DOMString <span title="dom-CSSComponentValue-type">type</span>;
231+
attribute any <span title="dom-CSSComponentValue-value">value</span>;
232+
};</pre>
233+
234+
<p class="XXX">type returns "string", "keyword", "identifier", "color", "em", "ex", "px", "url".</p>
235+
236+
<h4>The <code title>CSSColorComponentValue</code> Interface</h4>
237+
238+
<pre class="idl">[NoInterfaceObject] interface <dfn>CSSColorComponentValue</dfn> {
239+
attribute short <span title="dom-CSSColorComponentValue-red">red</span>;
240+
attribute short <span title="dom-CSSColorComponentValue-green">green</span>;
241+
attribute short <span title="dom-CSSColorComponentValue-blue">blue</span>;
242+
attribute float <span title="dom-CSSColorComponentValue-alpha">alpha</span>;
243+
};</pre>
244+
245+
<p class="XXX">We can make this more complex later. This will probably move into the CSS Color Level 4.</p>
246+
247+
<h4>The <code title>CSSIdentifierComponentValue</code> Interface</h4>
248+
249+
<pre class="idl">[NoInterfaceObject] interface <dfn>CSSIdentifierComponentValue</dfn> {
250+
attribute DOMString <span title="dom-CSSStringComponentValue-identifier">identifier</span>;
251+
};</pre>
252+
253+
<h4>The <code title>CSSKeywordComponentValue</code> Interface</h4>
254+
255+
<pre class="idl">[NoInterfaceObject] interface <dfn>CSSKeywordComponentValue</dfn> {
256+
attribute DOMString <span title="dom-CSSStringComponentValue-keyword">keyword</span>;
257+
};</pre>
258+
259+
<h4>The <code title>CSSLengthComponentValue</code> Interface</h4>
260+
261+
<pre class="idl">[NoInterfaceObject] interface <dfn>CSSLengthComponentValue</dfn> {
262+
attribute float <span title="dom-CSSLengthComponentValue-em">em</span>;
263+
attribute float <span title="dom-CSSLengthComponentValue-ex">ex</span>;
264+
attribute float <span title="dom-CSSLengthComponentValue-px">px</span>;
265+
<span class="XXX">// figure out what to do with absolute lengths</span>
266+
};</pre>
267+
268+
<h4>The <code title>CSSPercentageComponentValue</code> Interface</h4>
269+
270+
<pre class="idl">[NoInterfaceObject] interface <dfn>CSSPercentageComponentValue</dfn> {
271+
attribute float <span title="dom-CSSPercentageComponentValue">percent</span>;
272+
};</pre>
273+
274+
<h4>The <code title>CSSStringComponentValue</code> Interface</h4>
275+
276+
<pre class="idl">[NoInterfaceObject] interface <dfn>CSSStringComponentValue</dfn> {
277+
attribute DOMString <span title="dom-CSSStringComponentValue-string">string</span>;
278+
};</pre>
279+
280+
<h4>The <code title>CSSURLComponentValue</code> Interface</h4>
281+
282+
<pre class="idl">[NoInterfaceObject] interface <dfn>CSSURLComponentValue</dfn> {
283+
attribute DOMString? <span title="dom-CSSURLComponentValue-url">url</span>;
284+
};</pre>
285+
286+
287+
288+
<h2 class=no-num>References</h2>
289+
<h3 class=no-num>Normative references</h3>
290+
<div id=anolis-references-normative></div>
291+
292+
<h3 class=no-num>Informative references</h3>
293+
<div id=anolis-references-informative></div>
294+
295+
296+
<h2 class="no-num" id="acknowledgments">Acknowledgments</h2>
297+
298+
<p>The editors would like to thank
299+
300+
Alexey Feldgendler,
301+
Bj&ouml;rn H&ouml;hrmann,
302+
Brian Kardell,
303+
Christian Krebs,
304+
Daniel Glazman,
305+
David Baron,
306+
<i>fantasai</i>,
307+
Hallvord R. M. Steen,
308+
Ian Hickson,
309+
John Daggett,
310+
Lachlan Hunt,
311+
Morten Stenshorne,
312+
Philip Taylor,
313+
Robert O'Callahan,
314+
Sjoerd Visscher,
315+
Simon Pieters,
316+
Sylvain Galineau,
317+
Tarquin Wilton-Jones, and
318+
Zack Weinberg
319+
320+
for contributing to this specification.</p>
321+
322+
<!-- XXX NOTES
323+
324+
-->
325+
</body>
326+
</html>
327+

0 commit comments

Comments
 (0)