Skip to content

Commit e7f35c8

Browse files
committed
[css-logical-props] Catch-up Commit
* Add issue explaining status * Remove some issues * Indicate float/clear uses inline-* prefixes per Tokyo F2F resolution. * Rename offset-* to inset-* (and define shorthand) to avoid conflict with motion module per astearns' suggestion. * Add an introduction and clean up a bit some prose * Add text-orientation to the list of dependencies * Spec mapping for CSSOM APIs per WG resolution (more details in CSSOM) * Change 4-value mapping to put inline-start before inline-end per WG resolution & Grid Layout
1 parent 13d148e commit e7f35c8

1 file changed

Lines changed: 112 additions & 45 deletions

File tree

css-logical-props/Overview.bs

Lines changed: 112 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,75 @@ Link Defaults: css21 (property) width/height/min-width/min-height/max-width/max-
1818
<h1 id="intro">
1919
Introduction</h1>
2020

21-
See [[!CSS3-WRITING-MODES]] <a href="https://www.w3.org/TR/css-writing-modes-3/#abstract-layout">Abstract Layout</a>
22-
for details on how to map between logical and physical terms.
21+
Note: See [[!CSS3-WRITING-MODES]] for a proper introduction to writing modes;
22+
this module assumes familiarity with its terminology.
23+
24+
Because different writing systems are written in different directions,
25+
a variety of <a>writing modes</a> exist:
26+
left to right, top to bottom;
27+
right to left, top to bottom;
28+
bottom to top, right to left;
29+
etc.
30+
logical concepts like the “start” of a page or line
31+
map differently to physical concepts like the “top” of a line or “left edge” of a paragraph.
32+
Some aspects of a layout are actually relative to the writing directions,
33+
and thus will vary when the page is translated to a different system;
34+
others are inherently relative to the page's physical orientation.
35+
36+
<div class="example">
37+
For example,
38+
lists, headings, and paragraphs are typically left-aligned in English;
39+
but actually they are start-aligned, because in Arabic the same constructs are right-aligned,
40+
and a multilingual document will need to accommodate both writing systems accordingly.
41+
However the drop shadows on buttons on a page must remain consistent throughout,
42+
so their offset will be chosen based on visual considerations and physical directions,
43+
and not vary by writing system.
44+
</div>
45+
46+
Since CSS was originally designed with only physical coordinates in its controls,
47+
this module introduces logical equivalents
48+
so that declarations in a CSS style sheet can be expressed
49+
in <a>flow-relative</a> terms.
50+
It defines the mapping and cascading of equivalent properties,
51+
some new properties and values equivalent to those in CSS2.1,
52+
and the principles used to derive their syntaxes.
53+
Future CSS specifications are expected to incorporate both sets of coordinates
54+
in their property and value definitions,
55+
so this module will not track the introduction of <a>flow-relative</a> variants
56+
of newer CSS features.
57+
58+
<a href="http://www.w3.org/TR/css-writing-modes/">CSS Writing Modes</a><a href="https://www.w3.org/TR/css-writing-modes-3/#abstract-layout">Abstract Layout</a> section
59+
defines how to map between logical and physical terms.
2360
This mapping controls the interpretation of logical keywords and properties.
2461

62+
<div class="issue">
63+
<strong>Things That Are Unstable</strong>
64+
Since implementation of parts of this module is effectively required for shipping an implementation of CSS Writing Modes on the Web
65+
(in order to correctly implement the default HTML styles),
66+
The CSSWG resolved that although the draft is not very stable overall,
67+
the requisite features in
68+
<a href="#logical-controls"></a> and <a href="#logical-box-props"></a>
69+
are approved for shipping.
70+
However, there are a number of unstable features in this draft
71+
(which are not required for implementing the HTML default style sheet, incidentally),
72+
and these are:
73+
<ul>
74+
<li><del>The 'float' and 'clear' keywords,
75+
because it is not yet clear what the upcoming 2-dimensional syntax of 'float' will be.</del>
76+
(This has been resolved as of April 2017.)
77+
<li>The 'inset-*' properties,
78+
because the name of the prefix is undecided.
79+
(It used to be 'offset-*', but ended up conflicting with another CSS feature.)
80+
<li>The ''logical'' keyword on shorthands,
81+
because the name of the keyword may change or it may be replaced by some other syntactic marker.
82+
<li>The 'background-image-transform' and 'border-image-transform' properties,
83+
because they have, as far as the editor is aware,
84+
received no review from anyone and may or may not be well-designed.
85+
</ul>
86+
Comments and suggestions are welcome on these issues.
87+
Please file them in GitHub, tweet them to @csswg, or send them to www-style@w3.org.
88+
</div>
89+
2590
<h2 id="logical-controls">
2691
Logical Directional Values: ''block-start'', ''block-end'', ''inline-start', ''inline-end''</h2>
2792

@@ -45,7 +110,7 @@ Logical Values for the 'caption-side' Property</h3>
45110
New values: block-start | block-end | inline-start | inline-end
46111
</pre>
47112

48-
The 'caption-side' property is 1-dimensional in CSS2.1,
113+
Note: The 'caption-side' property is 1-dimensional in CSS2.1,
49114
but was 2-dimensional in CSS2.0,
50115
(and presumably will be 2-dimensional again in the next update to CSS tables).
51116
It therefore accepts the full set of logical directions.
@@ -61,7 +126,9 @@ Logical Values for the 'float' and 'clear' Properties</h3>
61126
New values: inline-start | inline-end
62127
</pre>
63128

64-
Issue: Is this a 2-directional property? Should these just be ''start''/''end''?
129+
Note: These properties are 1-dimensional in CSS2,
130+
but are planned to be expanded to two dimensions,
131+
and therefore are given unabbreviated <a>flow-relative</a> keywords.
65132

66133
<h3 id="text-align">
67134
Logical Values for the 'text-align' Property</h3>
@@ -73,9 +140,6 @@ Logical Values for the 'text-align' Property</h3>
73140

74141
These values are normatively defined in [[!CSS3TEXT]].
75142

76-
<p class="issue">
77-
float needs coordination with GCPM where it defines page floats
78-
79143
<h3 id="resize">
80144
Logical Values for the 'resize' Property</h3>
81145

@@ -144,14 +208,14 @@ Logical Box Model Properties
144208
the specified values of the parallel physical properties,
145209
but the logical and physical properties share computed values.
146210
Which pairs of properties share computed values
147-
depends on the computed values of
148-
'writing-mode' and 'direction'.
211+
depends on the element’s computed values of
212+
'writing-mode', 'direction', and 'text-orientation'.
149213
For a summary of these dependencies, see
150214
<a href="https://drafts.csswg.org/css-writing-modes/#logical-to-physical">Abstract-to-Physical Mappings</a>
151215
in [[!CSS3-WRITING-MODES]].
152216

153-
A computed value that has logical and physical properties
154-
is determined by applying the CSS cascade to declarations of both.
217+
A computed value that has logical and physical properties as input
218+
is determined by applying the CSS cascade to declarations of both.t
155219
Overriding is not determined by whether a declaration is logical or physical,
156220
but only by the rules of the CSS cascade [[!CSS3-CASCADE]].
157221

@@ -186,11 +250,9 @@ p {
186250
is after the declaration of 'margin-left'.
187251
</div>
188252

189-
<p class="issue">
190-
How do computed value APIs, e.g., getComputedStyle() work?
191-
Can they be used with either logical or physical properties,
192-
or only with the physical ones?
193-
</p>
253+
[[CSSOM!]] APIs that return computed values
254+
(such as <code>getComputedStyle()</code>)
255+
must return the same value for equivalent pairs of such properties.
194256

195257
<h3 id="logical-dimension-properties">
196258
Logical Height and Logical Width: the 'block-size' and 'inline-size' properties</h3>
@@ -239,7 +301,7 @@ Logical Height and Logical Width: the 'block-size' and 'inline-size' properties<
239301

240302
<h3 id="logical-prop">
241303
Logical Margins and Offsets:
242-
the margin- and offset- block-start/block-end/inline-start/inline-end properties</h3>
304+
the margin- and inset- block-start/block-end/inline-start/inline-end properties</h3>
243305

244306
<pre class="propdef">
245307
Name: margin-block-start, margin-block-end, margin-inline-start, margin-inline-end
@@ -252,14 +314,12 @@ the margin- and offset- block-start/block-end/inline-start/inline-end properties
252314
Computed value: the percentage as specified or the absolute length or auto (see text)
253315
</pre>
254316

255-
These properties correspond to the 'margin-top', 'margin-bottom',
256-
'margin-left', and 'margin-right' properties.
257-
The mapping depends on the element's 'writing-mode' and
258-
'direction'.
317+
These properties correspond to the 'margin-top', 'margin-bottom', 'margin-left', and 'margin-right' properties.
318+
The mapping depends on the element's 'writing-mode', 'direction', and 'text-orientation'.
259319

260320
<pre class="propdef">
261-
Name: offset-block-start, offset-block-end, offset-inline-start, offset-inline-end
262-
Value: <<'left'>>
321+
Name: inset-block-start, inset-block-end, inset-inline-start, inset-inline-end
322+
Value: <<'top'>>
263323
Initial: auto
264324
Applies to: positioned elements
265325
Inherited: no
@@ -268,9 +328,16 @@ the margin- and offset- block-start/block-end/inline-start/inline-end properties
268328
Computed value: same as box offsets: 'top', 'right', 'bottom', 'left' properties except that directions are logical
269329
</pre>
270330

271-
These properties correspond to the 'top', 'bottom', 'left', and 'right'
272-
properties. The mapping depends on the <em>parent element's</em>
273-
'writing-mode' and 'direction'.
331+
These properties correspond to the 'top', 'bottom', 'left', and 'right' properties.
332+
The mapping depends on the element's 'writing-mode', 'direction', and 'text-orientation'.
333+
334+
<pre class="propdef shorthand">
335+
Name: inset
336+
Value: <<'top'>>{1,4}
337+
</pre>
338+
339+
This <a>shorthand property</a> sets the 'top', 'right', 'bottom', and 'left' properties.
340+
Values are assigned to its <a>sub-properties</a> as for 'margin'.
274341

275342
<h3 id="border-padding">
276343
Logical Padding and Border: the padding- and border-<var>*</var>-
@@ -288,8 +355,8 @@ the margin- and offset- block-start/block-end/inline-start/inline-end properties
288355
</pre>
289356

290357
These properties correspond to the 'padding-top', 'padding-bottom',
291-
'padding-left', and 'padding-right' properties. The mapping depends on the
292-
element's 'writing-mode' and 'direction'.
358+
'padding-left', and 'padding-right' properties.
359+
The mapping depends on the element's 'writing-mode', 'direction', and 'text-orientation'.
293360

294361
<pre class="propdef">
295362
Name: border-block-start-width, border-block-end-width, border-inline-start-width, border-inline-end-width
@@ -303,8 +370,8 @@ the margin- and offset- block-start/block-end/inline-start/inline-end properties
303370
</pre>
304371

305372
These properties correspond to the 'border-top-width', 'border-bottom-width',
306-
'border-left-width', and 'border-right-width' properties. The mapping depends
307-
on the element's 'writing-mode' and 'direction'.
373+
'border-left-width', and 'border-right-width' properties.
374+
The mapping depends on the element's 'writing-mode', 'direction', and 'text-orientation'.
308375

309376
<pre class="propdef">
310377
Name: border-block-start-style, border-block-end-style, border-inline-start-style, border-inline-end-style
@@ -318,8 +385,8 @@ the margin- and offset- block-start/block-end/inline-start/inline-end properties
318385
</pre>
319386

320387
These properties correspond to the 'border-top-style', 'border-bottom-style',
321-
'border-left-style', and 'border-right-style' properties. The mapping depends
322-
on the element's 'writing-mode' and 'direction'.
388+
'border-left-style', and 'border-right-style' properties.
389+
The mapping depends on the element's 'writing-mode', 'direction', and 'text-orientation'.
323390

324391
<pre class="propdef">
325392
Name: border-block-start-color, border-block-end-color, border-inline-start-color, border-inline-end-color
@@ -333,8 +400,9 @@ the margin- and offset- block-start/block-end/inline-start/inline-end properties
333400
</pre>
334401

335402
These properties correspond to the 'border-top-color', 'border-bottom-color',
336-
'border-left-color', and 'border-right-color' properties. The mapping depends
337-
on the element's 'writing-mode' and 'direction'.
403+
'border-left-color', and 'border-right-color' properties.
404+
The mapping depends on the element's 'writing-mode', 'direction', and 'text-orientation'.
405+
338406

339407
<pre class="propdef">
340408
Name: border-block-start, border-block-end, border-inline-start, border-inline-end
@@ -348,22 +416,25 @@ the margin- and offset- block-start/block-end/inline-start/inline-end properties
348416
</pre>
349417

350418
These properties correspond to the 'border-top', 'border-bottom',
351-
'border-left', and 'border-right' properties. The mapping depends on the
352-
element's 'writing-mode' and 'direction'.
419+
'border-left', and 'border-right' properties.
420+
The mapping depends on the element's 'writing-mode', 'direction', and 'text-orientation'.
353421

354422
<h3 id="logical-shorthand-keyword">
355423
Shorthand Properties with <css>logical</css> Keyword</h3>
356424

357425
The shorthand properties for margin, padding, and border set values
358-
for physical properties by default. But authors can specify the <dfn value for="margin, padding, border-color, border-style, border-width">logical</dfn>
426+
for physical properties by default.
427+
But authors can specify the <dfn value for="margin, padding, border-color, border-style, border-width">logical</dfn>
359428
keyword at the beginning of the property value to indicate that the values
360429
map to the logical properties instead of the physical ones.
361430

362431
<p class="issue">
363432
other candidates of the keyword are: ''relative'', ''script'',
364433
''writing-mode'', ''beas'', or the value itself (e.g., ''vertical-lr-ltr'')
365434

366-
The following [[!CSS21]] shorthand properties accept the ''margin/logical'' keyword:
435+
The following [[!CSS21]] shorthand properties
436+
(and additionally the new 'inset' shorthand defined above)
437+
accept the ''margin/logical'' keyword:
367438
<ul>
368439
<li>'margin'</li>
369440
<li>'padding'</li>
@@ -388,14 +459,10 @@ Shorthand Properties with <css>logical</css> Keyword</h3>
388459
<li>If three values are set, the first is for block-start,
389460
the second is for inline-start and inline-end,
390461
and the third is for block-end.</li>
391-
<li>If four values are set, they apply to the block-start, inline-end, block-end, and inline-start
462+
<li>If four values are set, they apply to the block-start, inline-start, block-end, and inline-end
392463
sides in that order.</li>
393464
</ul>
394465

395-
<p class="issue">
396-
Should the shorthand also reset the physical properties to their initial
397-
values?
398-
399466
<div class="example">
400467
In the following example, the two rules are equivalent:
401468

@@ -405,9 +472,9 @@ Shorthand Properties with <css>logical</css> Keyword</h3>
405472
}
406473
blockquote {
407474
margin-block-start: 1em;
408-
margin-inline-end: 2em;
475+
margin-inline-start: 2em;
409476
margin-block-end: 3em;
410-
margin-inline-start: 4em;
477+
margin-inline-end: 4em;
411478
}
412479
</pre>
413480
</div>

0 commit comments

Comments
 (0)