Level: 1 Status: ED Work Status: Exploring ED: https://drafts.csswg.org/css-round-display/ Shortname: css-round-display TR: https://www.w3.org/TR/css-round-display-1/ Group: csswg Previous Version: https://www.w3.org/TR/2016/WD-css-round-display-1-20161222/ Previous Version: https://www.w3.org/TR/2016/WD-css-round-display-1-20160301/ Previous Version: https://www.w3.org/TR/2015/WD-css-round-display-1-20150922/ Editor: Hyojin Song, LG Electronics, hyojin22.song@lge.com Editor: Jihye Hong, LG Electronics, jh.hong@lge.com Editor: Soonbo Han (until June 2015), LG Electronics, soonbo.han@lge.com Link Defaults: css-shapes-1 (type)Link Defaults: css-transforms-1 (property) transform Link Defaults: css-transforms-1 (property) transform-origin Abstract: This document describes CSS extensions to support a round display. The extensions help web authors to build a web page suitable for a round display.
url: https://svgwg.org/svg2-draft/shapes.html#TermShapeElement; type: dfn; spec: SVG2; text: shape element url: https://www.w3.org/TR/SVG11/struct.html#DefsElement; spec: SVG11; type: element; text: defsIntroduction {#introduction} ================================================== Conventionally, web pages have been shown through a rectangular screen such as PC, tablet, and smart phone. 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.
The 'shape' media feature is added to Media Queries.
Current user agents are not capable of detecting the shape of a display so that authors cannot apply various layouts for a round display. To resolve the issue, 'shape' informs the web page of the property regarding the shape of the display.
To apply the shape of a display to content area, we extend the 'shape-inside' property of CSS Shapes. The position of the element which is overflowed from the display is adjusted inside the display when using this property even if the authors don’t know the exact shape of the display.
We also add the 'border-boundary' property to CSS Borders. The borders of the element can be drawn along the edge of the display even if the element is overflowed.
For the better web design suitable for a round display, we introduce polar positioning.
In conventional positioning method, the Cartesian coordinates, elements are positioned by offsets in x-axis and y-axis. But, we suggest a method to position elements with specifying the distance and angle from the origin point of coordinates.
This module provides features such as:
* Detecting the rounded display
* Aligning contents in the display’s shape
* Drawing borders along the display’s edge
* Positioning elements in polar coordinates
Terminology {#terminology}
==================================================
This specification follows the CSS property definition conventions from [[!CSS21]].
The detailed description of Media Queries is defined in [[MEDIAQUERIES-4]]
The detailed description of CSS Shapes is defined in [[CSS-SHAPES-1]]
The detailed description of Borders is defined in [[CSS3-BORDER]]
The detailed description of Positioned Layout is defined in [[CSS3-POSITIONING]]
Detecting the shape of the display {#extending-media-queries}
==================================================
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 'shape' media feature to support various types of displays.
This will allow web authors to apply different styles to a web page on the rounded display.
Name: shape Type: discrete For: @media Value: rect | roundDescribes the general shape of the targeted display area of the output device. It accepts the following values:
<!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>
(A) Rectangle Display
(B) Round Display
<!-- index.html --> <head> <link media="screen and (shape: rect)" rel="stylesheet" href="rectangle.css" /> <link media="screen and (shape: round)" rel="stylesheet" href="round.css" /> </head>If the clock application is loaded in a round display, 'round.css' which is the design for the round display will be applied by the Media Queries mechanism.
(A) Rectangle Display
(when 'shape: rect' returns ''true'')
(B) Round Display
(when 'shape: round' returns ''true'')
Note: So far, the only standard APIs of Operating System which exposes
information about the display's shape is
''isScreenRound()'' API
in Android.
''isScreenRound()'' API
returns a boolean that says round or not.
Refered the semantics of this API, when isScreenRound() returns ''true'', ''shape: round'' should evaluate
to ''true''
and ''shape: rect'' should evaluate to ''false'' when isScreenRound() returns ''false''.
'shape' is dealing with 2 shapes, but it can be extended if there are the needs about
configuring other shapes from the developers.
Note: There are cases when the UA may know the shape even in the absence of OS APIs. For example, when rendering to PDF, the shape is known to be a rectangle, so 'shape: rect' evaluates to ''true'' while ''shape: round'' to ''false''
Extending the @viewport rule {#extending-viewport-rule} ==================================================Name: viewport-fit For: @viewport Value: auto | contain | cover Initial: auto Percentages: N/A Media: visual, continuous Computed value: as specifiedThe initial layout viewport seen through the physical screen of the device. On rounded screen, the part of the page that’s currently shown on-screen is round but the viewport is rectangular. Because of this, depending on the size of the viewport, some part of the page may be clipped.
Note: With this value, 'border-boundary: display' and 'shape-inside: display' have no effect.
@viewport (viewport-fit: contain) { /* CSS for the rectangular design */ }
viewport-fit: contain
'
@viewport { viewport-fit: cover; } @media (shape: round){ /* styles for the round design */ } @media (shape: rect){ /* styles for the rectangular design */ }
viewport-fit: cover
'
display
', such an element having this value will have its content (or contained elements) aligned along the display border automatically.
spec:css21; type:type; text:
Name: shape-inside Applies to: block-level elements Value: auto | outside-shape | [ <The example below shows how the 'shape-inside' property works when it is set to '> || shape-box ] | < > | display
Initial: auto Inherited: no Media: visual Computed value: computed lengths for <>, the absolute URI for < >, otherwise as specified Animatable: as specified for < >, otherwise no
display
'.
Without using Media Queries, contents can be aligned within the display edge automatically.
<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>
(A) Without 'shape-inside
'
(B) With 'shape-inside: display
'
What if content overflows? Clipping or scrolling?
Drawing borders around the display border {#drawing-borders} ==================================================Name: border-boundary Applies to: all elements Value: none | parent | display Initial: none Inherited: yes Media: visualWhen the 'border-boundary' property on an element is set to '
parent
', 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 'display
', additional borders could be drawn where the element's area and the borders of screen are met. The default value is 'none
', imposing no boundary constraint on the borders.
<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>
(A) Without 'border-boundary
'
(B) With 'border-boundary: display
'
Note: If the value of 'border-boundary' is parent or display, border lines of the element are actually just a visual effect. It triggers a layout for rendering in a general way, but in the above cases (border-boundary: parent|display), the layout doesn't occur and it only draws the border lines inward from the containing block's borders. With this situation, the borders might hide contents around the display edge.
Use Cases {#usecases} ================================================== Use cases are described on these. Changes {#changes} ==================================================