Skip to content

Commit 2e8c502

Browse files
emiliosvgeesus
authored andcommitted
[cssom] [css-fonts] [css-page] Sort out properties and descriptors.
This is intended to address #5649.
1 parent 33402a8 commit 2e8c502

File tree

3 files changed

+86
-26
lines changed

3 files changed

+86
-26
lines changed

css-animations-1/Overview.bs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ IDL Definition</h4>
10521052
[Exposed=Window]
10531053
interface CSSKeyframeRule : CSSRule {
10541054
attribute CSSOMString keyText;
1055-
[SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
1055+
[SameObject, PutForwards=cssText] readonly attribute CSSStyleProperties style;
10561056
};
10571057
</pre>
10581058

@@ -1074,7 +1074,7 @@ Attributes</h4>
10741074

10751075
<dt><dfn>style</dfn>
10761076
<dd>
1077-
Must return a {{CSSStyleDeclaration}} object for the
1077+
Must return a {{CSSStyleProperties}} object for the
10781078
keyframe rule, with the following properties:
10791079

10801080
<dl>

css-fonts-4/Overview.bs

+31-1
Original file line numberDiff line numberDiff line change
@@ -8224,9 +8224,39 @@ The <code id="cssfontfacerule2">CSSFontFaceRule</code> interface</h3>
82248224
The <dfn id="cssfontfacerule-interface">CSSFontFaceRule</dfn> interface represents a <<@font-face>> rule.
82258225

82268226
<pre class="idl">
8227+
[Exposed=Window]
8228+
interface CSSFontFaceDescriptors : CSSStyleDeclaration {
8229+
attribute [LegacyNullToEmptyString] CSSOMString src;
8230+
attribute [LegacyNullToEmptyString] CSSOMString fontFamily;
8231+
attribute [LegacyNullToEmptyString] CSSOMString font-family;
8232+
attribute [LegacyNullToEmptyString] CSSOMString fontStyle;
8233+
attribute [LegacyNullToEmptyString] CSSOMString font-style;
8234+
attribute [LegacyNullToEmptyString] CSSOMString fontWeight;
8235+
attribute [LegacyNullToEmptyString] CSSOMString fontStretch;
8236+
attribute [LegacyNullToEmptyString] CSSOMString font-stretch;
8237+
attribute [LegacyNullToEmptyString] CSSOMString unicodeRange;
8238+
attribute [LegacyNullToEmptyString] CSSOMString unicode-range;
8239+
attribute [LegacyNullToEmptyString] CSSOMString fontFeatureSettings;
8240+
attribute [LegacyNullToEmptyString] CSSOMString font-feature-settings;
8241+
attribute [LegacyNullToEmptyString] CSSOMString fontVariationSettings;
8242+
attribute [LegacyNullToEmptyString] CSSOMString font-variation-settings;
8243+
attribute [LegacyNullToEmptyString] CSSOMString fontNamedInstance;
8244+
attribute [LegacyNullToEmptyString] CSSOMString font-named-instance;
8245+
attribute [LegacyNullToEmptyString] CSSOMString fontDisplay;
8246+
attribute [LegacyNullToEmptyString] CSSOMString font-display;
8247+
attribute [LegacyNullToEmptyString] CSSOMString fontLanguageOverride;
8248+
attribute [LegacyNullToEmptyString] CSSOMString font-language-override;
8249+
attribute [LegacyNullToEmptyString] CSSOMString ascentOverride;
8250+
attribute [LegacyNullToEmptyString] CSSOMString ascent-override;
8251+
attribute [LegacyNullToEmptyString] CSSOMString descentOverride;
8252+
attribute [LegacyNullToEmptyString] CSSOMString descent-override;
8253+
attribute [LegacyNullToEmptyString] CSSOMString lineGapOverride;
8254+
attribute [LegacyNullToEmptyString] CSSOMString line-gap-override;
8255+
};
8256+
82278257
[Exposed=Window]
82288258
interface CSSFontFaceRule : CSSRule {
8229-
readonly attribute CSSStyleDeclaration style;
8259+
readonly attribute CSSFontFaceDescriptors style;
82308260
};
82318261
</pre>
82328262

cssom-1/Overview.bs

+53-23
Original file line numberDiff line numberDiff line change
@@ -2000,7 +2000,7 @@ The <code>CSSStyleRule</code> interface represents a style rule.
20002000
[Exposed=Window]
20012001
interface CSSStyleRule : CSSGroupingRule {
20022002
attribute CSSOMString selectorText;
2003-
[SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
2003+
[SameObject, PutForwards=cssText] readonly attribute CSSStyleProperties style;
20042004
};
20052005
</pre>
20062006

@@ -2013,11 +2013,13 @@ On setting the {{CSSStyleRule/selectorText}} attribute these steps must be run:
20132013
<li>Otherwise, if the algorithm returns a null value, do nothing.
20142014
</ol>
20152015

2016-
The <dfn attribute for=CSSStyleRule>style</dfn> attribute must return a <code>CSSStyleDeclaration</code> object for the style rule, with the
2016+
The <dfn attribute for=CSSStyleRule>style</dfn> attribute must return a <code>CSSStyleProperties</code> object for the style rule, with the
20172017
following properties:
20182018
<dl>
20192019
<dt><a for="CSSStyleDeclaration">computed flag</a>
20202020
<dd>Unset.
2021+
<dt><a for="CSSStyleDeclaration">readonly flag</a>
2022+
<dd>Unset.
20212023
<dt><a for="CSSStyleDeclaration">declarations</a>
20222024
<dd>The declared declarations in the rule, in <a>specified order</a>.
20232025
<dt><a for="CSSStyleDeclaration">parent CSS rule</a>
@@ -2106,14 +2108,30 @@ Issue: Need to define the rules for
21062108
<dfn export>serialize a list of CSS page selectors</dfn>.
21072109

21082110
<pre class=idl>
2111+
[Exposed=Window]
2112+
interface CSSPageDescriptors : CSSStyleDeclaration {
2113+
attribute [LegacyNullToEmptyString] CSSOMString margin;
2114+
attribute [LegacyNullToEmptyString] CSSOMString marginTop;
2115+
attribute [LegacyNullToEmptyString] CSSOMString marginRight;
2116+
attribute [LegacyNullToEmptyString] CSSOMString marginBottom;
2117+
attribute [LegacyNullToEmptyString] CSSOMString marginLeft;
2118+
attribute [LegacyNullToEmptyString] CSSOMString margin-top;
2119+
attribute [LegacyNullToEmptyString] CSSOMString margin-right;
2120+
attribute [LegacyNullToEmptyString] CSSOMString margin-bottom;
2121+
attribute [LegacyNullToEmptyString] CSSOMString margin-left;
2122+
attribute [LegacyNullToEmptyString] CSSOMString size;
2123+
attribute [LegacyNullToEmptyString] CSSOMString marks;
2124+
attribute [LegacyNullToEmptyString] CSSOMString bleed;
2125+
};
2126+
21092127
[Exposed=Window]
21102128
interface CSSPageRule : CSSGroupingRule {
21112129
attribute CSSOMString selectorText;
2112-
[SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
2130+
[SameObject, PutForwards=cssText] readonly attribute CSSPageDescriptors style;
21132131
};
21142132
</pre>
21152133

2116-
The <dfn attribute for=CSSGroupingRule>selectorText</dfn> attribute, on getting, must return the result of
2134+
The <dfn attribute for=CSSPageRule>selectorText</dfn> attribute, on getting, must return the result of
21172135
<a lt="serialize a list of CSS page selectors">serializing</a> the associated <a>list of CSS page selectors</a>.
21182136
On setting the {{CSSPageRule/selectorText}} attribute these steps must be run:
21192137
<ol>
@@ -2122,13 +2140,15 @@ On setting the {{CSSPageRule/selectorText}} attribute these steps must be run:
21222140
<li>Otherwise, if the algorithm returns a null value, do nothing.
21232141
</ol>
21242142

2125-
The <dfn attribute for=CSSGroupingRule>style</dfn> attribute must return a <code>CSSStyleDeclaration</code> object for the
2143+
The <dfn attribute for=CSSPageRule>style</dfn> attribute must return a <code>CSSPageDescriptors</code> object for the
21262144
<code>@page</code> at-rule, with the following properties:
21272145
<dl>
21282146
<dt><a for="CSSStyleDeclaration">computed flag</a>
21292147
<dd>Unset.
2148+
<dt><a for="CSSStyleDeclaration">readonly flag</a>
2149+
<dd>Unset.
21302150
<dt><a for="CSSStyleDeclaration">declarations</a>
2131-
<dd>The declared declarations in the rule, in <a>specified order</a>.
2151+
<dd>The declared descriptors in the rule, in <a>specified order</a>.
21322152
<dt><a for="CSSStyleDeclaration">parent CSS rule</a>
21332153
<dd>The <a>context object</a>.
21342154
<dt><a for="CSSStyleDeclaration">owner node</a>
@@ -2145,18 +2165,20 @@ The <code>CSSMarginRule</code> interface represents a margin at-rule (e.g. <code
21452165
[Exposed=Window]
21462166
interface CSSMarginRule : CSSRule {
21472167
readonly attribute CSSOMString name;
2148-
[SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
2168+
[SameObject, PutForwards=cssText] readonly attribute CSSMarginDescriptors style;
21492169
};
21502170
</pre>
21512171

21522172
The <dfn attribute for=CSSMarginRule>name</dfn> attribute must return the name of the margin at-rule. The <code>@</code> character is not
21532173
included in the name. [[!CSS3SYN]]
21542174

2155-
The <dfn attribute for=CSSMarginRule>style</dfn> attribute must return a <code>CSSStyleDeclaration</code> object for the
2175+
The <dfn attribute for=CSSMarginRule>style</dfn> attribute must return a <code>CSSMarginDescriptors</code> object for the
21562176
margin at-rule, with the following properties:
21572177
<dl>
21582178
<dt><a for="CSSStyleDeclaration">computed flag</a>
21592179
<dd>Unset.
2180+
<dt><a for="CSSStyleDeclaration">readonly flag</a>
2181+
<dd>Unset.
21602182
<dt><a for="CSSStyleDeclaration">declarations</a>
21612183
<dd>The declared declarations in the rule, in <a>specified order</a>.
21622184
<dt><a for="CSSStyleDeclaration">parent CSS rule</a>
@@ -2217,6 +2239,9 @@ the DOM a <a>CSS declaration block</a> is a
22172239
<dd>Set if the object is a computed style declaration, rather than a specified
22182240
style. Unless otherwise stated it is unset.
22192241

2242+
<dt><dfn>readonly flag</dfn>
2243+
<dd>Set if the object is not modifiable.</dd>
2244+
22202245
<dt><dfn>declarations</dfn>
22212246
<dd>The <a>CSS declarations</a> associated with the object.
22222247

@@ -2373,6 +2398,10 @@ interface CSSStyleDeclaration {
23732398
[CEReactions] undefined setProperty(CSSOMString property, [LegacyNullToEmptyString] CSSOMString value, optional [LegacyNullToEmptyString] CSSOMString priority = "");
23742399
[CEReactions] CSSOMString removeProperty(CSSOMString property);
23752400
readonly attribute CSSRule? parentRule;
2401+
};
2402+
2403+
[Exposed=Window]
2404+
interface CSSStyleProperties : CSSStyleDeclaration {
23762405
[CEReactions] attribute [LegacyNullToEmptyString] CSSOMString cssFloat;
23772406
};
23782407
</pre>
@@ -2388,7 +2417,7 @@ Getting the <dfn attribute for="CSSStyleDeclaration">cssText</dfn> attribute mus
23882417

23892418
Setting the {{CSSStyleDeclaration/cssText}} attribute must run these steps:
23902419
<ol>
2391-
<li>If the <a for="CSSStyleDeclaration">computed flag</a> is set,
2420+
<li>If the <a for="CSSStyleDeclaration">readonly flag</a> is set,
23922421
then <a>throw</a> a {{NoModificationAllowedError}} exception.
23932422
<li>Empty the <a for="CSSStyleDeclaration">declarations</a>.
23942423
<li><a lt="Parse a CSS declaration block">Parse</a> the given value and, if the return value is not the empty list, insert the items in the list
@@ -2454,7 +2483,7 @@ value would be "<code>important</code>".</div>
24542483

24552484
The <dfn method for=CSSStyleDeclaration>setProperty(<var>property</var>, <var>value</var>, <var>priority</var>)</dfn> method must run these steps:
24562485
<ol>
2457-
<li>If the <a for="CSSStyleDeclaration">computed flag</a> is set,
2486+
<li>If the <a for="CSSStyleDeclaration">readonly flag</a> is set,
24582487
then <a>throw</a> a {{NoModificationAllowedError}} exception.
24592488
<li>If <var>property</var> is not a <a>custom property</a>, follow these substeps:
24602489
<ol>
@@ -2569,7 +2598,7 @@ use different algorithms as long as the constraints above hold.
25692598

25702599
The <dfn method for=CSSStyleDeclaration>removeProperty(<var>property</var>)</dfn> method must run these steps:
25712600
<ol>
2572-
<li>If the <a for="CSSStyleDeclaration">computed flag</a> is set,
2601+
<li>If the <a for="CSSStyleDeclaration">readonly flag</a> is set,
25732602
then <a>throw</a> a {{NoModificationAllowedError}} exception.
25742603
<li>If <var>property</var> is not a <a>custom property</a>,
25752604
let <var>property</var> be <var>property</var> <a lt="ASCII lowercase">converted to ASCII lowercase</a>.
@@ -2592,7 +2621,7 @@ The <dfn method for=CSSStyleDeclaration>removeProperty(<var>property</var>)</dfn
25922621
The <dfn attribute for=CSSStyleDeclaration>parentRule</dfn> attribute must return the
25932622
<a for="CSSStyleDeclaration">parent CSS rule</a>.
25942623

2595-
The <dfn attribute for=CSSStyleDeclaration>cssFloat</dfn>
2624+
The <dfn attribute for=CSSStyleProperties>cssFloat</dfn>
25962625
attribute, on getting, must return the result of invoking
25972626
{{CSSStyleDeclaration/getPropertyValue()}} with
25982627
<code>float</code> as argument. On setting, the attribute must invoke
@@ -2606,17 +2635,17 @@ is obtained by running the <a>CSS property to IDL attribute</a> algorithm for
26062635
<var>property</var>.
26072636

26082637
<pre class="idl extract">
2609-
partial interface CSSStyleDeclaration {
2638+
partial interface CSSStyleProperties {
26102639
[CEReactions] attribute [LegacyNullToEmptyString] CSSOMString _<var>camel_cased_attribute</var>;
26112640
};
26122641
</pre>
26132642

2614-
The <a attribute for=CSSStyleDeclaration><var>camel-cased attribute</var></a> attribute, on getting, must return the
2643+
The <a attribute for=CSSStyleProperties><var>camel-cased attribute</var></a> attribute, on getting, must return the
26152644
result of invoking {{CSSStyleDeclaration/getPropertyValue()}} with the
26162645
argument being the result of running the <a>IDL attribute to CSS property</a>
26172646
algorithm for <var>camel-cased attribute</var>.
26182647

2619-
Setting the <a attribute for=CSSStyleDeclaration><var>camel-cased attribute</var></a> attribute must invoke
2648+
Setting the <a attribute for=CSSStyleProperties><var>camel-cased attribute</var></a> attribute must invoke
26202649
{{CSSStyleDeclaration/setProperty()}} with the
26212650
first argument being the result of running the <a>IDL attribute to CSS property</a>
26222651
algorithm for <var>camel-cased attribute</var>, as second argument the given value, and no third argument. Any
@@ -2630,12 +2659,12 @@ with the string <code>-webkit-</code>, the following partial interface applies w
26302659
algorithm for <var>property</var>, with the <i>lowercase first</i> flag set.
26312660

26322661
<pre class="idl extract">
2633-
partial interface CSSStyleDeclaration {
2662+
partial interface CSSStyleProperties {
26342663
[CEReactions] attribute [LegacyNullToEmptyString] CSSOMString _<var>webkit_cased_attribute</var>;
26352664
};
26362665
</pre>
26372666

2638-
The <dfn attribute for=CSSStyleDeclaration><var>webkit-cased attribute</var></dfn> attribute, on
2667+
The <dfn attribute for=CSSStyleProperties><var>webkit-cased attribute</var></dfn> attribute, on
26392668
getting, must return the result of invoking {{CSSStyleDeclaration/getPropertyValue()}} with the
26402669
argument being the result of running the <a>IDL attribute to CSS property</a> algorithm for
26412670
<var>webkit-cased attribute</var>, with the <i>dash prefix</i> flag set.
@@ -2655,16 +2684,16 @@ except for properties that have no "<code>-</code>" (U+002D) in the property nam
26552684
the following partial interface applies where <var>dashed attribute</var> is <var>property</var>.
26562685

26572686
<pre class="idl extract">
2658-
partial interface CSSStyleDeclaration {
2687+
partial interface CSSStyleProperties {
26592688
[CEReactions] attribute [LegacyNullToEmptyString] CSSOMString _<var>dashed_attribute</var>;
26602689
};
26612690
</pre>
26622691

2663-
The <dfn attribute for=CSSStyleDeclaration><var>dashed attribute</var></dfn> attribute, on getting, must return the
2692+
The <dfn attribute for=CSSStyleProperties><var>dashed attribute</var></dfn> attribute, on getting, must return the
26642693
result of invoking {{CSSStyleDeclaration/getPropertyValue()}} with the
26652694
argument being <var>dashed attribute</var>.
26662695

2667-
Setting the <a attribute for=CSSStyleDeclaration><var>dashed attribute</var></a> attribute must invoke
2696+
Setting the <a attribute for=CSSStyleProperties><var>dashed attribute</var></a> attribute must invoke
26682697
{{CSSStyleDeclaration/setProperty()}} with the
26692698
first argument being <var>dashed attribute</var>, as second argument the given value, and no third argument. Any
26702699
exceptions thrown must be re-thrown.
@@ -2976,7 +3005,7 @@ interface mixin ElementCSSInlineStyle {
29763005
</pre>
29773006

29783007
The <dfn attribute for=ElementCSSInlineStyle>style</dfn> attribute must return a <a>CSS declaration block</a> object whose
2979-
<a for="CSSStyleDeclaration">computed flag</a> is unset, whose <a for="CSSStyleDeclaration">parent CSS rule</a> is null, and
3008+
<a for="CSSStyleDeclaration">readonly flag</a> is unset, whose <a for="CSSStyleDeclaration">parent CSS rule</a> is null, and
29803009
whose <a for="CSSStyleDeclaration">owner node</a> is the <a>context object</a>.
29813010

29823011
If the user agent supports HTML, the following IDL applies: [[HTML]]
@@ -3043,18 +3072,19 @@ steps:
30433072
<a href="https://github.com/w3c/csswg-drafts/issues/4947">#4947</a>.
30443073

30453074
<li>
3046-
Return a live <a>CSS declaration block</a> with the following properties:
3075+
Return a live <a>CSSStyleProperties</a> object with the following properties:
30473076
<dl>
30483077
<dt><a for="CSSStyleDeclaration">computed flag</a>
30493078
<dd>Set.
3079+
<dt><a for="CSSStyleDeclaration">readonly flag</a>
3080+
<dd>Set.
30503081
<dt><a for="CSSStyleDeclaration">declarations</a>
30513082
<dd><var>decls</var>.
30523083
<dt><a for="CSSStyleDeclaration">parent CSS rule</a>
30533084
<dd>Null.
30543085
<dt><a for="CSSStyleDeclaration">owner node</a>
30553086
<dd><var>obj</var>.
30563087
</dl>
3057-
30583088
</ol>
30593089

30603090
<p class=warning>The {{Window/getComputedStyle()}} method exposes information from <a lt="CSS style sheet">CSS style

0 commit comments

Comments
 (0)