-
Notifications
You must be signed in to change notification settings - Fork 790
Expand file tree
/
Copy pathOverview.bs
More file actions
executable file
·333 lines (308 loc) · 14.7 KB
/
Overview.bs
File metadata and controls
executable file
·333 lines (308 loc) · 14.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
<pre class='metadata'>
Title: CSS Round Display Level 1
Shortname: css-round-display
Group: csswg
Level: 1
Status: ED
ED: http://dev.w3.org/csswg/css-round-display/
Editor: Hyojin Song, LG Electronics, hyojin22.song@lge.com
Editor: Soonbo Han, LG Electronics, soonbo.han@lge.com
Abstract: This document describes CSS extensions to support a round display. It extends existing CSS features including Media Queries[[MEDIAQUERIES-4]], CSS Shapes[[CSS-SHAPES-1]], Borders[[CSS3-BORDER]], and Positioned Layout[[CSS3-POSITIONING]]. The extensions will help web authors to build a web page suitable for a round display.
</pre>
<h2 id="introduction">Introduction</h2>
<p>
Everything on the web is a rectangle. For example, the window content area in a web browser is a rectangle. Each HTML element follows the W3C box model and thus is also a rectangle. New devices with a round display are now emerging. The current web standards lack some features to support the devices as follows:
<ol>
<li>Lack of the capability to detect a round display</li>
<li>Lack of layout mechanisms suitable for a round display</li>
</ol>
In order to facilitate the use of the web on a round display, we need to rethink existing CSS features.
</p>
<p>
Current user agents are not capable of detecting the shape of a display so that authors cannot apply a different layout for a round display. To resolve the issue, we add the 'device-radius' media feature to Media Queries. The feature informs the web page of the property regarding the shape of the display.
</p>
<p>
To apply the shape of a display to content area, we extend the 'shape-inside' property of CSS Shapes. We also add the 'border-boundary' property to CSS Borders and introduce polar positioning for a better web design suitable for a round display.
</p>
<h2 id="terminology">Terminology</h2>
This specification follows the CSS property definition conventions from [[!CSS21]]. <br />
The detailed description of Media Queries is defined in [[MEDIAQUERIES-4]]<br />
The detailed description of CSS Shapes is defined in [[CSS-SHAPES-1]]<br />
The detailed description of Borders is defined in [[CSS3-BORDER]]<br />
The detailed description of Positioned Layout is defined in [[CSS3-POSITIONING]]<br />
<h2 id="extending-media-queries">Extending Media Queries for a round display</h2>
<p>
Media Queries [[MEDIAQUERIES-4]] define mechanisms to support media-dependent style sheets, tailored for different environments. We propose to extend Media Queries by adding the 'device-radius' media feature to support a round display. This will allow web authors to apply different styles to a web page on the rounded display.
</p>
<section>
<h3 id="device-radius-media-feature">The 'device-radius' media feature</h3>
To use different style sheets for a rectangle display and for a round display, media queries should support some properties to identify the display shape. The 'device-radius' media feature describes the property of rounded borders of a display.
<div class='example'>
This media query indicates that different style sheets will be applied depending on the display shape.
<pre>
<link media="screen and (max-device-radius: 49%)" rel="stylesheet" href="rectangle.css" />
<link media="screen and (min-device-radius: 50%)" rel="stylesheet" href="round.css" />
</pre>
<p>
By the mechanism of media queries, if the value of the 'device-radius' media feature is less than or equal to 49%, '<code>rectangle.css</code>' is applied. If it is 50%, '<code>round.css</code>' is applied.
</p>
</div>
<p>As in the '<code>border-radius</code>' property, the 'device-radius' media feature can describe various round shapes of displays, such as rectangle, regular circle, ellipse, and rectangle with round corners.
</p>
<pre class='descdef mq'>
Name: device-radius
Type: range
For: @media
Value: [ <<length>> | <<percentage>> ]
Percentage: Refer to corresponding dimension of the display
</pre>
<p class="note">
This media feature accepts optional '<code>min-</code>' or '<code>max-</code>' prefixes to express 'greater or equal to' and 'smaller or equal to' contstriants.
</p>
<p>
The example below shows how a web page looks in the different shape of displays.
</p>
<div class='example'>
Here is an example of a simple clock written in HTML (without 'device-radius'):
<pre><!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="rectangle.css" />
</head>
<body>
<div id="clockLayer">
<div id="clockLayer">
<div id="date">2015/02/28 (SAT)</div>
<div id="time">10:11</div>
<div id="weather"><img src="cloudy.png" /></div>
</div>
</div>
</body>
</html>
</pre>
</div>
<div style="width: 700px; height: 380px; text-align:center">
<div style="float: left; width: 350px;">
<img src="images/clock_a.png">
<p>(A) Rectangle Display</p>
</div>
<div style="float: left; ">
<img src="images/clock_c.png">
<p>(B) Round Display</p>
</div>
</div>
<div style="width: 700px">
<p class="caption">Devices where the 'device-radius' media feature is not applicable</p>
</div>
On the other hand, the example below shows how the 'device-radius' media feature works in the different shape of displays.
<div class='example'>
The HTML code of this example is the same as that of EXAMPLE 2 except of media queries usage. The 'device-radius' property can be used as follows:
<pre><!-- index.html -->
<head>
<link media="screen and (max-device-radius: 49%)" rel="stylesheet" href="rectangle.css" />
<link media="screen and (min-device-radius: 50%)" rel="stylesheet" href="round.css" />
</head>
</pre>
If this example code is loaded in a regular round display, '<code>round.css</code>' will be applied by the media queries mechanism. To render the clock properly, '<code>round.css</code>' could be written as follows.
<pre>
#clockLayer {
border-radius: 50%;
}
#clockInset {
border-radius: 50%;
}
#date {
text-align: center;
}
...
</pre>
</div>
<div style="width: 700px; height: 380px; text-align:center">
<div style="float: left; width: 350px;">
<img src="images/clock_a.png">
<p>(A) Rectangle Display<br>(w/ <code>device-radius: 0%</code>)</p>
</div>
<div style="float: left; ">
<img src="images/clock_b.png">
<p>(B) Round Display<br>(w/ <code>device-radius: 50%</code>)</p>
</div>
</div>
<div style="width: 700px">
<p class="caption">Devices where the 'device-radius' media feature is applicable</p>
</div>
<p class="note">If the shapes of displays are various, such as polygons, we need to extend the media features more with additional parameters. The current features have limitations to support the diversity beyond round shapes. How can we express star-shaped polygons? (E.g., SVG syntax, etc.) Of course, there is a trade-off between simplicity and expressiveness.
</p>
<p class="issue">
Using 'device-radius' with just a single value (e.g., device-radius: 50%) is enough (for simplicity)? Otherwise, do we need to support all possible values the same as 'border-radius'?
</p>
<h2 id="aligning-content">Aligning content along the display border</h2>
<h3 id="shape-inside-property">The 'shape-inside' property</h3>
<p>
CSS Shapes [[CSS-SHAPES]] define the 'shape-inside' property that aligns contents along a possibly non-rectangular wrapping area. Web authors may use this feature to fit contents inside a round display. However, it could sometimes be hard to specify the wrapping area identical to the shape of a display. Thus, we add a new value '<code>display</code>' to the 'shape-inside' property to facilitate it. When the 'shape-inside' property on an element is set to '<code>display</code>', its content (or contained element) is aligned along the display border automatically.
</p>
<pre class='link-defaults'>
spec:css21; type:type; text:<uri>
</pre>
<pre class='propdef'>
Name: shape-inside
Applies to: block-level elements
Value: auto | outside-shape | [ <<basic-shape>> || shape-box ] | <<image>> | <code>display</code>
Initial: auto
Inherited: no
Media: visual
Computed value: computed lengths for <<basic-shape>>, the absolute URI for <<uri>>, otherwise as specified
Animatable: as specified for <<basic-shape>>, otherwise no
</pre>
The example below shows how the 'shape-inside' property works when it is set to '<code>display</code>'.
<div class='example'>
<pre><style>
#container {
shape-inside: display;
// the same as circle(50% at 50%, 50%) in a regular round display
}
#green-box { float: left; }
#blue-box { float: right; }
</style>
<div id="container">
<p>
Some inline content
<img id="green-box" src="green-box.jpg" />
with a float left and float right, in a
<img id="blue-box" src="blue-box.jpg" />
simple box with a circle shape-inside.
</p>
</div>
</pre>
</div>
<div style="width: 500px; height: 380px; text-align:center">
<div style="float: left; width: 250px;">
<img style="width: 250px" src="images/watch_b.png">
<p>(A) Without '<code>shape-inside</code>'</p>
</div>
<div style="float: left; width: 250px;">
<img style="width: 250px" src="images/watch_c.png">
<p>(B) With '<code>shape-inside: display</code>'</p>
</div>
</div>
<div style="width: 500px">
<p class="caption">Align the content along the display border</p>
</div>
<div style="width: 500px;">
<img style="width: 500px" src="images/ex3.png">
<p class="caption">Align a part of the content along the display border</p>
</div>
<p class="issue">
What if content overflows? Clipping or scrolling?
</p>
<h2 id="drawing-borders">Drawing borders around the display border</h2>
<h3 id="border-boundary-property">The 'border-boundary' property</h3>
<p>
We add the 'border-boundary' property to set a boundary constraint that affects the borders of an element.
</p>
<pre class='propdef'>
Name: border-boundary
Applies to: all elements
Value: none | parent | <code>display</code>
Initial: none
Inherited: no
Media: visual
</pre>
<p>
When the 'border-boundary' property on an element is set to '<code>parent</code>', additional borders of the element could be drawn where the element's area and the borders of its parent are met. When it is set to '<code>display</code>', additional borders could be drawn where the element's area and the borders of screen are met. The default value is '<code>none</code>', imposing no boundary constraint on the borders.
</p>
<div class='example'>
The example below shows how the 'border-boundary' property works on drawing borders. The result is shown in Figure 5B.
<pre><style>
#container {
border-boundary: display;
}
#redBox {
border: 5px red solid;
}
#greenBox {
border: 5px green solid;
}
#blueBox {
border: 5px blue solid;
}
</style>
<div id="container">
<div id="redBox"></div>
<div id="greenBox"></div>
<div id="blueBox"></div>
</div>
</pre>
</div>
<div style="width: 600px; text-align:center">
<div style="float: left; width: 300px;">
<img style="width: 200px"src="images/border_b.png">
<p>(A) Without '<code>border-boundary</code>'</p>
</div>
<div style="float: left; width: 300px; ">
<img style="width: 200px" src="images/border_c.png">
<p>(B) With '<code>border-boundary: display</code>'</p>
</div>
</div>
<div style="width: 600px">
<p class="caption">Align the content along the display border</p>
</div>
<h2 id="positioning-content">Positioning content by using the polar coordinate system</h2>
<p>
Elements are often placed along a circle or concentric circles, and polar coordinates are useful to handle such cases. This section introduces polar positioning to support layout of elements in the polar coordinate system where the position of an element is determined by a distance from a fixed point within the containing element and an angle from a fixed direction. We add '<code>polar</code>' to the value of the 'position' property to support the polar coordinates of the children of an element. The 'polar-angle' and 'polar-distance' properties specify the position of an element (or a child).
</p>
<h3 id="position-property">The 'position' property</h3>
When the 'position' property on an element is set to '<code>polar</code>', its children use the polar coordinates.
<pre class='propdef'>
Name: position
Applies to: all elements
Value: static | relative | absolute | fixed | inherit | <code>polar</code>
Initial: static
Inherited: no
Media: visual
</pre>
<h3 id="polar-angle-property">The 'polar-angle' property</h3>
The 'polar-angle' property specifies the angle from the X-axis (or a fixed direction).
<pre class='propdef'>
Name: polar-angle
For: @media
Applies to: all elements (parents should have 'position: polar' property)
Value: [ <<length>> | <<percentage>> ]?
Initial: 0
Media: visual
Inherited: no
Percentages: relative to radius of circle
</pre>
<h3 id="polar-distance-property">The 'polar-distance' property</h3>
The 'polar-distance' property specifies the distance from the center of the parent (or a fixed point).
<pre class='propdef'>
Name: polar-distance
For: @media
Applies to: all elements (parents should have 'position: polar' property)
Value: [ <<length>> | <<percentage>> ]?
Initial: 0
Media: visual
Inherited: no
Percentages: relative to radius of circle
</pre>
<div class='example'>
This example shows a way to align elements within the polar coordinates system.
<pre><body style="position: polar;">
<div id="circle1" style="polar-angle: 0deg; polar-distance: 20%"></div>
<div id="circle2" style="polar-angle: 90deg; polar-distance: 50%"></div>
<div id="circle3" style="polar-angle: 225deg; polar-distance: 100%"></div>
</body>
</pre>
</div>
<div style="width: 400px; text-align: center">
<img src="images/polar.png" style="width: 200px; border: 1px #AAA solid; text-align: center"/>
<p class="caption">An example of polar positioning</p>
</div>
<p class="issue">
By default, the 'polar-distance' property specifies the distance from the origin (or the center) of the containing element to that of the contained element. The 'polar-angle' property specifies the angle from the X-axis to the center of the contained element.
</p>
<p class="issue">
What value does the percentage value of the 'polar-distance' property refer to? The width of the containing element, or what? One feasible solution is to use the distance between the origin and the point on the border at the angle given by the 'polar-angle' property from the X-axis.
</p>
<p class="issue">
Will an element (or a child) itself be rotated through the 'polar-angle' property?
</p>