Skip to content

Commit 4466705

Browse files
committed
[css-position] Move the <position> definition into V&U, eliminate the 3-value forms, per WG resolution.
1 parent 528a2a6 commit 4466705

2 files changed

Lines changed: 81 additions & 6 deletions

File tree

css-values-3/Overview.bs

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,8 +1385,45 @@ Images: the <<image>> type</h3>
13851385
<h3 id="position">
13861386
2D Positioning: the <<position>> type</h3>
13871387

1388-
The <<position>> data type is defined in [[!CSS3BG]].
1389-
UAs that support CSS Backgrounds &amp; Borders Level 3 or its successor must interpret <<position>> as defined therein.
1388+
The <dfn><<position>></dfn> value specifies the position of a object area (e.g. background image)
1389+
inside a positioning area (e.g. background positioning area).
1390+
It is interpreted as specified for 'background-position'. [[!CSS3-BACKGROUNDS]]
1391+
1392+
<pre class=prod>
1393+
<<position>> = [
1394+
[ left | center | right ] || [ top | center | bottom ]
1395+
|
1396+
[ left | center | right | <<length-percentage>> ]
1397+
[ top | center | bottom | <<length-percentage>> ]?
1398+
|
1399+
[ [ left | right ] <<length-percentage>> ] &amp;&amp;
1400+
[ [ top | bottom ] <<length-percentage>> ]
1401+
]
1402+
</pre>
1403+
1404+
Note: The 'background-position' property also accepts a three-value syntax.
1405+
This has been disallowed generically because it creates parsing ambiguities
1406+
when combined with other length or percentage components in a property value.
1407+
1408+
The canonical order when serializing is
1409+
the horizontal component followed by the vertical component.
1410+
1411+
When specified in a grammar alongside other keywords, <<length>>s, or <<percentage>>s,
1412+
<<position>> is <em>greedily</em> parsed;
1413+
it consumes as many components as possible.
1414+
1415+
<div class=example>
1416+
For example,
1417+
'transform-origin' defines a 3D position
1418+
as (effectively) ''<<position>> <<length>>?''.
1419+
A value such as ''left 50px''
1420+
will be parsed as a 2-value <<position>>,
1421+
with an omitted z-component;
1422+
on the other hand,
1423+
a value such as ''top 50px''
1424+
will be parsed as a single-value <<position>>
1425+
followed by a <<length>>.
1426+
</div>
13901427

13911428
<h2 id="functional-notations">
13921429
Functional Notations</h2>
@@ -2040,12 +2077,13 @@ Acknowledgments</h2>
20402077
<h2 class="no-num" id="changes">
20412078
Changes</h2>
20422079

2043-
20442080
Changes since the <a href="https://www.w3.org/TR/2016/CR-css-values-3-20160929/">29 September 2016 Candidate Recommendation</a> are:
20452081

20462082
<ul>
2047-
<li>Inlined definition of <<position>> and removed three-value syntax
2083+
<li>Inlined the <<position>> definition and dropped the three-value syntaxes
20482084
to allow for unambiguous combination in complex grammars.
2085+
This effectively removes that syntax from 'object-position',
2086+
but allows <<position>> to be re-used e.g. in [[CSS-TRANSFORMS]] for 3D positions.
20492087
(See <a href="https://lists.w3.org/Archives/Public/www-style/2017Feb/0052.html">discussion</a>.)
20502088
</ul>
20512089

css-values/Overview.bs

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,8 +1444,45 @@ Images: the <<image>> type</h3>
14441444
<h3 id="position">
14451445
2D Positioning: the <<position>> type</h3>
14461446

1447-
The <<position>> data type is defined in [[!CSS3BG]].
1448-
UAs that support CSS Backgrounds &amp; Borders Level 3 or its successor must interpret <<position>> as defined therein.
1447+
The <dfn><<position>></dfn> value specifies the position of a object area (e.g. background image)
1448+
inside a positioning area (e.g. background positioning area).
1449+
It is interpreted as specified for 'background-position'. [[!CSS3-BACKGROUNDS]]
1450+
1451+
<pre class=prod>
1452+
<<position>> = [
1453+
[ left | center | right ] || [ top | center | bottom ]
1454+
|
1455+
[ left | center | right | <<length-percentage>> ]
1456+
[ top | center | bottom | <<length-percentage>> ]?
1457+
|
1458+
[ [ left | right ] <<length-percentage>> ] &amp;&amp;
1459+
[ [ top | bottom ] <<length-percentage>> ]
1460+
]
1461+
</pre>
1462+
1463+
Note: The 'background-position' property also accepts a three-value syntax.
1464+
This has been disallowed generically because it creates parsing ambiguities
1465+
when combined with other length or percentage components in a property value.
1466+
1467+
The canonical order when serializing is
1468+
the horizontal component followed by the vertical component.
1469+
1470+
When specified in a grammar alongside other keywords, <<length>>s, or <<percentage>>s,
1471+
<<position>> is <em>greedily</em> parsed;
1472+
it consumes as many components as possible.
1473+
1474+
<div class=example>
1475+
For example,
1476+
'transform-origin' defines a 3D position
1477+
as (effectively) ''<<position>> <<length>>?''.
1478+
A value such as ''left 50px''
1479+
will be parsed as a 2-value <<position>>,
1480+
with an omitted z-component;
1481+
on the other hand,
1482+
a value such as ''top 50px''
1483+
will be parsed as a single-value <<position>>
1484+
followed by a <<length>>.
1485+
</div>
14491486

14501487
<h2 id="functional-notations">
14511488
Functional Notations</h2>

0 commit comments

Comments
 (0)