<h1>CSS Round Display Level 1</h1>
<pre class='metadata'>
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/
Previous Version: https://www.w3.org/TR/2015/WD-motion-1-20150409/
Group: csswg
Link Defaults: css-shapes-1 (type) <basic-shape>, css-transforms-1 (property) transform/transform-origin
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, w3cid 54503
Editor: Jihye Hong, LG Electronics, jh.hong@lge.com, w3cid 79168
Former Editor: Soonbo Han, LG Electronics, soonbo.han@lge.com
Abstract: Motion paths allow authors to animate any graphical object along an author specified path.
</pre>

<pre class="anchors">
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: defs
</pre>

<h2 id="introduction">Introduction</h2>
<p>
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.
<br>
Nowadays, devices come in varied shapes of the displays.
It needs to consider the shape of the display when implementing web pages on devices.
However, current web standards lack some features to support the devices as follows:
<ol>
    <li>Lack of the capability to detect the shape of a display</li>
    <li>Lack of layout mechanisms suitable for the shape of a display</li>
</ol>
In order to facilitate the use of the web especially on a round display, there could be some features to support it.
</p>
<p>
The 'device-radius' 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, 'device-radius' informs the web page of the property regarding the shape of the display.
<br><br>
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.
<br><br>
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.
<br><br>
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
</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>

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.

<h3 id="shape-media-feature">The 'shape' 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.

<pre class='descdef mq'>
    Name: shape
    Type: discrete
    For: @media
    Value: rect | round
</pre>

<p class="note">
Note: To define a 'discrete' type media feature, the feature is evaluated in a boolean context.
</p>

The 'shape' media feature describes the general shape of the targeted display area of the output device. It accepts the following values:

    <dl dfn-type=value dfn-for="@media/shape">
        <dt><dfn>rect</dfn>
        <dd>
            The shape is an axis aligned rectangle or square, or a similar shape for which the traditional designs are appropriate.

        <dt><dfn>round</dfn>
        <dd>
            The shape is rounded or a similar shape to the circle such as an oval, an ellipse for which distinctively rounded designs are appropriate.
    </dl>

<div class='example'>
    The example below shows how a web page looks in the different shapes of displays. 
    This is a simple clock written in HTML without 'shape'.

    <pre class="lang-html">
    &lt;!DOCTYPE html>
    &lt;html>
    &lt;head>
        &lt;link rel="stylesheet" href="rectangle.css" />
    &lt;/head>
    &lt;body>
        &lt;div id="clockLayer">
            &lt;div id="clockLayer">
                &lt;div id="date">2015/02/28 (SAT)&lt;/div>
                &lt;div id="time">10:11&lt;/div>
                &lt;div id="weather">&lt;img src="cloudy.png" />&lt;/div>
            &lt;/div>
        &lt;/div>
    &lt;/body>
    &lt;/html>
    </pre>

    <div class="figure">
        <div style="height: 350px">
            <div style="float: left; width: 250px;">
                <img alt="An image of a rectangle clock within a rectangle display" src="images/device_radius_clock_a.png">
                <p>(A) Rectangle Display</p>
            </div>
            <div style="float: right; width: 250px;">
                <img alt="An image of a round clock within a rectangle display" src="images/device_radius_clock_b.png">
                <p>(B) Round Display</p>
            </div>
        </div>
        <figcaption>
            Devices where the 'shape' media feature is applicable
        </figcaption>
    </div>

    On the other hand, the example below shows how the ‘shape’ media feature works in the different shapes of displays. This is the same as the code above except for media queries usage. The shape media feature can be used as follows:
    <pre class="lang-html">
    &lt;!-- index.html -->
    &lt;head>
        &lt;link media="screen and (shape: rect)" rel="stylesheet" href="rectangle.css" />
        &lt;link media="screen and (shape: round)" rel="stylesheet" href="round.css" />
    &lt;/head>
    </pre>

    If this example code is loaded in a round display, 'round.css' will be applied by the media queries mechanism.

    <div class="figure">
        <div style="height: 350px">
            <div style="float: left; width: 250px;">
                <img alt="An image of a rectangle clock within a rectangle display" src="images/device_radius_clock_a.png">
                <p>(A) Rectangle Display<br>(w/ <code>shape: rect</code>)</p>
            </div>
            <div style="float: right; width: 250px;">
                <img alt="An image of a round clock within a round display" src="images/device_radius_clock_c.png">
                <p>(B) Round Display<br>(w/ <code>shape: round</code>)</p>
            </div>
        </div>
        <figcaption>
            Devices where the 'shape' media feature is applicable
        </figcaption>
    </div>
</div>

<p class="note">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''
</p>
<p class="note">Note: For other shapes, such as polygons, we need to extend the media features 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>

<h2 id="extending-viewport-rule">Extending the @viewport rule</h2>
<h3 id="viewport-fit-descriptor">The 'viewport-fit' descriptor</h3>

'viewport-fit' can set the size of the initial viewport [[css-device-adapt]].

<pre class=descdef>
    Name: viewport-fit
    For: @viewport
    Value: auto | contain | cover
    Initial: auto
    Percentages: N/A
    Computed value: as specified
</pre>

The initial viewport is 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, some part of the page is clipped.

<div class=figure>
    <img alt="An image of the clipped area between the viewport bounding box and the device's border" style="width: 250px" src="images/viewport_clipped_area.png">
    <figcaption>
        Clipped area
    </figcaption>
</div>

'viewport-fit' can control the clipped area by setting the size of the initial viewport as changing with the size of the window or viewing area.

Values have the following meanings:

<dl dfn-type=value dfn-for=viewport-fit>
    <dt><var>'auto'</var></dt>
    <dd>
        This value doesn’t affect the initial viewport, and the whole web page is viewable. UA can do anything it wants for the reader to view the web page easily.
    </dd>

    <dt><dfn>contain</dfn></dt>
    <dd>
        The initial viewport is the largest rectangle which is inscribed in the display of the device. With this value, 'border-boundary: display' and 'shape-inside: display' have no effect. UA can paint the area which is outside the contained viewport for ‘contain’.
    </dd>

    <dt><dfn>cover</dfn></dt>
    <dd>
        The initial viewport is the circumscribed rectangle of the physical screen of the device.
    </dd>
</dl>

When setting the size of the bounding box for the viewport on the non-rectangular display, we have to consider the factors like below:

<ul>
    <li>Clipped area which is caused because the area of the viewport bounding box is larger than the area of the display</li>
    <li>Gap between the bounding box for the viewport and the area of the display</li>
</ul>
    
The author can decide which factor is more critical than another. 
If it have to be guaranteed that any part of the web page isn’t hidden, avoiding clipping is more important than having a gap between the bounding box of the viewport and the border of the screen. If the author doesn’t want web pages to be small for the readability, then it would be better to set ‘viewport-fit’ as ‘cover’ and to implement pages with considering the clipped parts.

<div class='example'>

    This example shows the size of the bounding box for the viewport specified with 'viewport-fit' on the rounded display.
    
    When the 'viewport-fit' is specified with contain, the initial viewport is applied to the largest inscribed rectangle of the display.

    <pre class="lang-css">
    @viewport (viewport-fit: contain) {
        /* CSS for the rectangular design */
    }      
    </pre>

    <div class=figure>
        <img src="images/viewport_fit_contain.png" alt="An image about the viewport applied to the bounding box specified with 'viewport-fit: contain'" style="width: 300px; text-align: center"/>
        <figcaption>
            With '<code>viewport-fit: contain</code>'
        </figcaption>
    </div>

    When cover is given to the 'viewport-fit', the initial viewport is applied to the circumscribed rectangle of the display.

    <pre class="lang-css">
    @viewport (viewport-fit: cover) {
        /* CSS for the rectangular design */
    }
    </pre>

    <div class=figure>
        <img src="images/viewport_fit_cover.png" alt="An image about the viewport applied to the bounding box specified with 'viewport-fit: cover'" style="width: 300px; text-align: center"/>
        <figcaption>
            With '<code>viewport-fit: cover</code>'
        </figcaption>
    </div>    
</div>

<h2 id="aligning-content">Aligning content along the display border</h2>
<h3 id="shape-inside-property">The 'shape-inside' property</h3>

CSS Shapes [[CSS-SHAPES-1]] define the 'shape-inside' property that aligns contents along the edge of a possibly non-rectangular wrapping area. Web authors may use this feature to fit contents inside a round display. However, it can be challenging to specify the wrapping area to be identical to the shape of a display. To address such cases, 'shape-inside' is extended with a new value named '<code>display</code>', such an element having this value will have its content (or contained elements) aligned along the display border automatically.

<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
    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>'. Without using Media Queries, contents can be aligned within the display edge automatically.

<div class='example'>
    <pre class="lang-html">
    &lt;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; }
    &lt;/style>
    &lt;div id="container">
        &lt;p>
            Some inline content
            &lt;img id="green-box" src="green-box.jpg" />
            with a float left and float right, in a
            &lt;img id="blue-box" src="blue-box.jpg" />
            simple box with a circle shape-inside.
        &lt;/p>
    &lt;/div>
    </pre>
    <br />

    <div class=figure>
        <div style="height: 400px;">
            <div style="float: left; width: 300px;">
                <img alt="A layout of web contents without shape-inside:display" style="width: 230px" src="images/shape_inside_watch_a.png">
                <p>(A) Without '<code>shape-inside</code>'</p>
            </div>
            <div style="float: right; width: 300px;">
                <img alt="A layout of web contents with shape-inside: display" style="width: 230px" src="images/shape_inside_watch_b.png">
                <p>(B) With '<code>shape-inside: display</code>'</p>
            </div>
        </div>
        <figcaption>
            Align the content along the display border
        </figcaption>
    </div>
</div>

This property is specially useful for complex shapes (e.g. curved, stelliform, polygonal), that wouldn't be covered by <<basic-shape>> (i.e. circle() or ellipse()), allowing web authors to conveniently align contents with the display edge.

When a containing block is placed on one end of the display and the containing block has 'shape-inside: display', the descendant blocks of the containing block are basically put on the overlapping region between the containing block and the display area. The overlapping region's shape is mostly complicated shape, so it's difficult to define the shape using previous method like basic-shape. The figure 4 describes these circumstances as follows.

<div class=figure>
    <img alt="An image of two examples to show the principle of shape-inside: display" style="width: 500px" src="images/shape_inside_a.png">
    <figcaption>
        Align the content along the display border
    </figcaption>
</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>

We add the 'border-boundary' property to set a boundary constraint that affects the borders of an element.

<pre class='propdef'>
    Name: border-boundary
    Applies to: all elements
    Value: none | parent | display
    Initial: none
    Inherited: yes
</pre>

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.

<div class='example'>
The example below shows how the 'border-boundary' property works on drawing borders. The result is shown in Figure 5B.
    <pre class="lang-html">
    &lt;style>
        #container {
            border-boundary: display;
        }
        #redBox {
            border: 5px red solid;
        }
        #greenBox {
            border: 5px green solid;
        }
        #blueBox {
            border: 5px blue solid;
        }
    &lt;/style>
    &lt;div id="container">
        &lt;div id="redBox">&lt;/div>
        &lt;div id="greenBox">&lt;/div>
        &lt;div id="blueBox">&lt;/div>
    &lt;/div>
    </pre>
    <br />

    <div class=figure>
        <div style="height: 300px;">
            <div style="float: left; width: 300px;">
                <img alt="An image of circle drawing border lines without border-boundary: display" style="width: 200px" src="images/border_boundary_a.png">
                <p>(A) Without '<code>border-boundary</code>'</p>
            </div>
            <div style="float: right; width: 300px;">
                <img alt="An image of circle drawing border lines with border-boundary: display" style="width: 200px" src="images/border_boundary_b.png">
                <p>(B) With '<code>border-boundary: display</code>'</p>
            </div>
        </div>
        <figcaption>
            Align the content along the display border
        </figcaption>
    </div>

</div>

<p class="note">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.
</p>

<h2 id="positioning-content">Content positioning using polar coordinate system</h2>

<p>
Polar coordinate system is a two-dimensional coordinate system that describes the position of a point in a plane with a distance from a reference point and an angle from a reference direction. Elements could be placed along a circle or concentric circles, and the polar coordinate system is 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 the center point within the containing element and an angle from the Y-axis.

The conventional coordinates used in web is the Cartesian coordinate system, but using 'polar-distance' or 'polar-angle' enables positioning an element in the polar coordinate system. The 'polar-angle' and 'polar-distance' properties specify the angular value and distance of an element from the origin in polar coordinates.

</p>

<div class='example'>
This example shows a way to align elements within the polar coordinate system.
<pre>&lt;body>

  &lt;div id="circle1" style="position: absolute; polar-angle: 0deg; polar-distance: 50%">&lt;/div>
  &lt;div id="circle2" style="position: absolute; polar-angle: 90deg; polar-distance: 20%">&lt;/div>
  &lt;div id="circle3" style="position: absolute; polar-angle: 225deg; polar-distance: 100%">&lt;/div>
&lt;/body>
</pre>
<div style="width: 400px; text-align: center">
	<img alt="An image of three elements positioned to polar coordinates" src="images/polar_a.png" style="width: 200px; border: 1px #AAA solid; text-align: center"/>
	<p class="caption">An example of polar positioning</p>
</div>
</div>

<p>
In conventional coordinate system used for positioning an element in a containing block, the offset of the element is applied depending on the edges of the element’s containing block.

In comparison, the default origin of polar coordinates is positioned at the center point of a containing block. The position for the origin point can be set by 'polar-origin'.
</p>

<h3 id="polar-angle-property">The 'polar-angle' property</h3>
The 'polar-angle' property specifies the angle from the Y-axis.
<pre class='propdef'>
    Name: polar-angle
    Applies to: all elements
    Value: <<angle>>
    Initial: 0
    Inherited: no
    Percentages: N/A
	Animatable: as <a href="https://www.w3.org/TR/css3-transitions/#animatable-types">angle</a>
</pre>

<p class="note">
Note: In polar coordinate system, a pole is the reference point and points are described as been a certain distance from it, as also a certain angle from the polar axis. In mathematical theory, the polar axis is commonly defined as the positive direction of the x-axis, but we consider the polar axis as the positive direction of the y-axis position as other CSS specifications usually do. Therefore, when the 'polar-angle'  value  of an element is 0, the element is positioned on the y-axis. If the angle value of an element increases in the positive direction from 0, the element moves clockwise. The method to determine a direction using 'polar-angle' works the same way in [[css-values-3]], <<angle>> value.
</p>


<h3 id="polar-distance-property">The 'polar-distance' property</h3>
The 'polar-distance' property determines how far elements are positioned from the origin of polar coordinates.
<pre class='propdef'>
    Name: polar-distance
    Applies to: all elements
    Value: [ <<length>> | <<percentage>> <<size>>? ] && contain?
    Initial: 0
    Inherited: no
    Percentages: relative to distance from the origin of polar coordinates to edge of containing block
    Animatable: as <a href="https://www.w3.org/TR/css3-transitions/#animtype-lpcalc">length, percentage, or calc</a>
</pre>
<p>
The 'polar-distance' specifies the distance between the origin of polar coordinates and the anchor point of the element.
<br><br>
Values have the following meanings:
<dl>
<dt><var>&lt;length&gt;</var></dt>
<dd>
Gives a fixed length between the origin of polar coordinates and the anchor point of element.
</dd>
</dl>

<dl>
<dt><var>&lt;percentage&gt;</var></dt>
<dd>
Is relative to the distance between the origin of polar coordinates and the point of contact which is made by the edge of containing block and the gradient-line from the origin of polar coordinates. The value of the gradient of the line is polar angle value.
</dd>
</dl>

<dl>
<dt><var>&lt;size&gt;</var></dt>
<dd>
Decides a point used for measuring the distance from the origin point.


It is defined as

&nbsp;<b>&lt;size&gt;</b> = [ closest-side | closest-corner | farthest-side | farthest-corner ]

If omitted it defaults to <var>closest-side</var>.
When the <b>&lt;size&gt;</b> is used with <b>&lt;percentage&gt;</b>, the calculated value of 'polar-distance' is constant regardless of the value of 'polar-angle'.

<dl>
<dt><var>closest-side</var></dt>
<dd>
The distance is measured between the origin and the closest side of the box from it.
</dd>
<dt><var>closest-corner</var></dt>
<dd>
The distance is measured between the origin and the closest corner of the box from it.
</dd>
<dt><var>farthest-side</var></dt>
<dd>
The distance is measured between the origin and the farthest side of the box from it.
</dd>
<dt><var>farthest-corner</var></dt>
<dd>
The distance is measured between the origin and the farthest corner of the box from it.
</dd>
</dl>
<p class='note'>
Note: When the origin of polar coordinates is at one of the corners of the containing block, the closest side takes the edge which meets with the origin. Even if the offset given by <<length>> or <<percentage>> changes, the position of the element specified with 'closest-side' is the same.
</p>
</dd>
</dl>

<dl>
<dt><var>contain</var></dt>
<dd>
Adjust 'polar-distance' value of the positioned element which overflows shape of the containing block.
The main purpose of this value is avoiding overflow when positioning elements.
When overflowing occurs, the distance between the point of origin of polar coordinates and the anchor point of the element is reduced,
until there are 2 contact points or less between edge of shape of containing block and content block of the element.
</dd>
</dl>
</p>

<div class='example'>
When elements are defined like below,

<pre>
	&lt;div style="position: absolute; width: 40px; height: 30px;">
		&lt;div id = “circle1” style="position: absolute; width: 4px; height: 4px;">&lt;/div>
		&lt;div id = “circle2” style="position: absolute; width: 4px; height: 4px;">&lt;/div>
	&lt;/div>
</pre>

<p>
Specifying different &lt;size&gt; value for the same &lt;percentage&gt; value makes a difference in the positions of the elements.
</p>

The style below is for the (A),
<pre>&lt;style>

	#circle1 {
		polar-origin: 10px 15px;
		polar-angle: 0deg;
		polar-distance: 100% closest-side;
	}
	#circle2 {
		polar-origin: 10px 15px;
		polar-angle: 90deg;
		polar-distance: 100% closest-side;
	}
&lt;/style>
</pre>

And the next definition is for the (B)
<pre>&lt;style>

	#circle1 {
		polar-origin: 10px 15px;
		polar-angle: 0deg;
		polar-distance: 100% closest-corner;
	}
	#circle2 {
		polar-origin: 10px 15px;
		polar-angle: 90deg;
		polar-distance: 100% closest-corner;
	}
&lt;/style>
</pre>

<br />
<div style="width: 700px; text-align:center">
    <div style="float: left; width: 350px;">
		<img alt="An example of polar-distance with closest-side"
			style="width: 300px" src="images/polar_distance_percentage_a.png">
		<p>(A) With <code>closest-side</code></p>
	</div>
    <div style="float: left; width: 350px; ">
		<img alt="An example of polar-distance with closest-corner"
			style="width: 300px" src="images/polar_distance_percentage_b.png">
		<p>(B) With <code>closest-corner</code></p>
	</div>
</div>
<div style="width: 700px">
    <p class="caption">Using &lt;size> with &lt;percentage> for polar-distance</p>
</div>

</div>

<div class='example'>
Here are some examples.
The first example shows positioning elements with polar-distance not using extent keyword value. Some parts of elements are outside the boundary of the containing block's shape:

<pre>&lt;body>

  &lt;div style="position: absolute; polar-angle: 45deg; polar-distance: 100%">&lt;/div>
  &lt;div style="position: absolute; polar-angle: 180deg; polar-distance: 100%">&lt;/div>
&lt;/body>
</pre>
<div style="width: 500px; text-align: center">
	<img src="images/polar_distance_a.png" alt="An image about elements positioned by polar-distance without contain" style="width: 350px;"/>
</div>

In the second example, 'contain', the extent keyword value is added to the polar-distance value of each element to avoid overflowing.

<pre>&lt;body>

  &lt;div style="position: absolute; polar-angle: 45deg; polar-distance: 100% contain">&lt;/div>
  &lt;div style="position: absolute; polar-angle: 180deg; polar-distance: 100% contain">&lt;/div>
&lt;/body>
</pre>
<div style="width: 500px; text-align: center">
	<img src="images/polar_distance_b.png" alt="An image about elements positioned by polar-distance with contain" style="width: 350px;"/>
</div>
</div>

<h3 id="polar-origin-property">The 'polar-origin' property</h3>
<p>
The 'polar-origin' property establishes the point of origin for coordinate system. It sets the horizontal and vertical representative point at which the offset values of the element is applied.
<br>

</p>
<pre class='propdef'>
    Name: polar-origin
    Applies to: all elements
    Value: auto | <<position>>
    Initial: auto
    Inherited: no
    Percentages: Refer to the size of containing block
	Animatable: as <a href="https://www.w3.org/TR/css3-transitions/#animtype-lpcalc">length, percentage, or calc</a>
</pre>
<p>
	Values are defined as follows:
	
	<dl>
	<dt><var>auto</var></dt>
	<dd>
	Computes to <var>center</var> if 'polar-origin' is used in polar coordinates. But it computes as the box model layout in Cartesian coordinates.
	<br>
	In polar coordinates, there are many use cases specifying the position of the origin at the center point of the containing block. Therefore an element is positioned to the horizontally and vertically center in the area of the containing block when auto value is given to the 'polar-origin'.
	But if it is used in conventional coordinate system, the origin of coordinate system is at the upper left corner of the containing block by default. For example, 'top' and 'left' are used for positioning the element, auto value makes the same result of giving 'top left' as the value of 'polar-origin'.
	</dd>
	</dl>
	
	<dl>
	<dt><<position>></dt>
	<dd>
	Values of <<position>> are defined like below:
		<dl>
		<dt><var>&lt;percentage&gt;</var></dt>
		<dd>
		A percentage for the horizontal offset is relative to the width of the containing block. A percentage for the vertical offset is relative to height of the containing block.
		</dd>
		</dl>

		<dl>
		<dt><var>&lt;length&gt;</var></dt>
		<dd>
		A length value gives a fixed length as the offset. The value for the horizontal and vertical offset represent an offset from the top left corner of the containing block.
		</dd>
		</dl>

		<dl>
		<dt><var>top</var></dt>
		<dd>
		Computes to 0% for the vertical position.
		</dd>
		</dl>

		<dl>
		<dt><var>right</var></dt>
		<dd>
		Computes to 100% for the horizontal position.
		</dd>
		</dl>

		<dl>
		<dt><var>bottom</var></dt>
		<dd>
		Computes to 100% for the vertical position.
		</dd>
		</dl>

		<dl>
		<dt><var>left</var></dt>
		<dd>
		Computes to 0% for the horizontal position.
		</dd>
		</dl>

		<dl>
		<dt><var>center</var></dt>
		<dd>
		Computes to 50% (left 50%) for the horizontal position if the horizontal position is not otherwise specified, or 50% (top 50%) for the vertical position if it is.
		</dd>
		</dl>
	</dd>
	</dl>
</p>

<div class='example'>
This example shows how auto value of polar-origin is calculated differently depending on which coordinate system elements are positioned in.

<pre>
	#item1 {
		polar-origin: auto;
		polar-distance: 10px;
		polar-angle: 90deg;
	}
</pre>
<div style="width: 600px; text-align: center">
	<img src="images/polar_origin_a.png" alt="An image about interpreting auto of polar-origin in polar coordinates" style="width: 300px; text-align: center"/>
	<p class="caption">"polar-origin: auto" is the same result with "polar-origin: center"</p>
</div>
<br>
<pre>
	#item2 {
		polar-origin: auto;
		left: 10px;
	}
</pre>
<div style="width: 600px; text-align: center">
	<img src="images/polar_origin_b.png" alt="An image about interpreting auto of polar-origin in Cartesian coordinates" style="width: 350px; text-align: center"/>
	<p class="caption">"polar-origin: auto" is the same result with "polar-origin: top left"</p>
</div>

</div>

<p class="issue">
As it’s available to specify the point of origin for polar coordinates, properties such as 'margin', 'padding' would work different from the conventional coordinate system. We need different approaches to define those properties which are related to layout.
</p>

<p class="issue">
When 'polar-origin' is not <code>auto</code>, it needs to be decided whether 'top', 'right', 'bottom', and 'left' properties are ignored or interpreted somehow.
</p>


<h3 id="polar-anchor-property">The 'polar-anchor' property</h3>
<p>
The 'polar-anchor' property sets an anchor point of the element. The anchor point specifies a position which is a representative point of the element. The anchor point could be set as any point within a content area of the element rather than being positioned to the upper left corner of the element by CSS box model.

The value of 'polar-distance' is the distance between an anchor point and the origin point of coordinates.
</p>
<pre class='propdef'>
    Name: polar-anchor
    Applies to: all elements
    Value: <<position>>
    Initial: 50% 50%
    Inherited: no
    Percentages: relative to width and height of an element
	Animatable: as <<position>>
</pre>
<p>
Meanings of some keywords in <<position>> are different from those used in 'polar-origin' property.

<dl>
<dt><var>&lt;percentage&gt;</var></dt>
<dd>
A percentage for the horizontal offset is relative to width of content box area of the element. A percentage for the vertical offset is relative to height of content box area of the element. For example, with a value pair of '100%, 0%', an anchor point is on the upper right corner of the element.
</dd>
</dl>

<dl>
<dt><var>&lt;length&gt;</var></dt>
<dd>
A length value gives a length offset from the upper left corner of the element's content area.
</dd>
</dl>
</p>

<p>
Only with 'polar-angle' and 'polar-distance' to position elements, adjusting values of those properties for avoiding elements sticking out of the containing block is required. When the appropriate anchor point is given, there is no need to adjust 'polar-distance' value to avoid overflowing when positioning elements in the containing block.
</p>

<div class='example'>
This example shows an alignment of four elements with different anchor points positioned in a containing block.

<pre>&lt;style>

	#item1 {
		position: absolute;
		polar-angle: 45deg;
		polar-distance: 100%;
		polar-anchor: right top;
	}
	#item2 {
		position: absolute;
		polar-angle: 135deg;
		polar-distance: 100%;
		polar-anchor: right bottom;
	}
	#item3 {
		position: absolute;
		polar-angle: 225deg;
		polar-distance: 100%;
		polar-anchor: left bottom;
	}
	#item4 {
		position: absolute;
		polar-angle: 315deg;
		polar-distance: 100%;
		polar-anchor: left top;
	}
&lt;/style>
&lt;body>
	&lt;div id="item1">&lt;/div>
	&lt;div id="item2">&lt;/div>
	&lt;div id="item3">&lt;/div>
	&lt;div id="item4">&lt;/div>
&lt;/body>
</pre>
<div style="width: 400px; text-align: center">
	<img alt="An image of four elements with different anchor points positioned in a containing block" src="images/polar_anchor.png" style="width: 300px; text-align: center"/>
	<p class="caption">An example of 'polar-anchor'</p>
</div>
</div>
<p class="issue">
Is '<code>auto</code>' needed for value of 'polar-anchor'?
</p>

<p class="issue">
The alternative naming without the polar- prefix for 'polar-origin' and 'polar-anchor' is needed. When it becomes to use polar positioning regardless of the value of the position property, 'polar-origin' and 'polar-anchor' would be used independently from polar positioning.
</p>

<p class="issue">
How can the margin be applied to an element when <code>polar-origin: 50% 50%</code> and <code>polar-anchor: 50% 50%</code>?
<br>
Which would be a base point for applying it between the upper left corner or center of a containing block?
With the former, the position of the element changes when the value of the margin changes, while with the latter, the margin value doesn't affect the position of the element.
</p>

<p class="issue">
Can 'polar-anchor' be replaced by 'margin-top' and 'margin-left'?
<br>
There are several differences between 'polar-anchor' and 'margin-left' & 'margin-top'.<br>
In case of 'margin-left' & 'margin-top', percentages resolve to the width of the element itself.
but in case of 'polar-anchor', percentage resolves to the width and height of a containing block of the element.
</p>

<h3 id="2d-rotation-transform-function">2D Rotation Transform Function for self-rotating elements in polar coordinates</h3>
<p>
 When elements are positioned in polar coordinates, there are many usecases which show the elements rotated toward the origin of polar coordinates. In such cases, degree of rotation has to be specified in the 2d rotation function for each element. But when using the keyword value instead of the <<angle>> value, the calculation of accurate rotation degree may be omitted.
<br><br>

<p>
The two-dimensional rotation function <code><a href="https://www.w3.org/TR/css3-transforms/#funcdef-rotate">'rotate(&lt;angle>)'</a></code> used in polar coordinates is extended as follows:
</p>
<dfn>
	<a href="https://www.w3.org/TR/css3-transforms/#funcdef-rotate">rotate()</a>
	= rotate( <<angle>> | polar-angle | polar-angle-reverse)
</dfn>


Values have the following meanings:
<dl>
	<dt><var>polar-angle</var></dt>
	<dd>
	Computes to the value of 'polar-angle' property.
	</dd>
</dl>

<dl>
	<dt><var>polar-angle-reverse</var></dt>
	<dd>
	Computes to the value of the 'polar-angle' property plus 180 degrees.
	</dd>
</dl>
</p>

<p class="note">
Note: polar-angle and polar-angle-reverse keywords resolve to angle values when determining the computed value of transform property.

It makes possible to define an animation such as transforming between rotate(0deg) and rotate(polar-angle).
If there is an animation using 'polar-angle' property, polar-angle value and polar-angle-reverse value track the changes in the value of the 'polar-angle' property.
</p>
<div class='example'>
This example shows how the keyword value works in the 2d rotation function.

<pre>&lt;style>

	#item1 {
		position: absolute;
		polar-angle: 0deg;
		polar-distance: 90%;
		transform: rotate(polar-angle);
	}
	#item2 {
		position: absolute;
		polar-angle: 45deg;
		polar-distance: 90%;
		transform: rotate(polar-angle);
	}
	#item3 {
		position: absolute;
		polar-angle: 135deg;
		polar-distance: 90%;
		transform: rotate(polar-angle-reverse);
	}
	#item4 {
		position: absolute;
		polar-angle: 180deg;
		polar-distance: 90%;
		transform: rotate(polar-angle-reverse);
	}
	#item5 {
		position: absolute;
		polar-angle: 225deg;
		polar-distance: 90%;
		transform: rotate(polar-angle-reverse);
	}
	#item6 {
		position: absolute;
		polar-angle: -45deg;
		polar-distance: 90%;
		transform: rotate(polar-angle);
	}
&lt;/style>
&lt;body>
	&lt;div id="item1">1&lt;/div>
	&lt;div id="item2">2&lt;/div>
	&lt;div id="item3">3&lt;/div>
	&lt;div id="item4">4&lt;/div>
	&lt;div id="item5">5&lt;/div>
	&lt;div id="item6">6&lt;/div>
&lt;/body>
</pre>
<div style="width: 500px; text-align: center">
	<img alt="An image of extended 2d rotate function" src="images/2d_rotate_function.png" style="width: 250px; text-align: center"/>
	<p class="caption">An example of the extension for 2d rotate function</p>
</div>
</div>

<h2 id="usecases">
Use Cases</h2>

	Use cases are described on
	<a href="https://wiki.csswg.org/ideas/round-display">these</a>.

<h2 id="changes">
Changes</h2>

<h3 id="changes_from_Sep_22_2015">
Changes from <a href="https://www.w3.org/TR/2015/WD-css-round-display-1-20150922/">September 22<sup>th</sup> 2015</a> version</h3>

	<ul>
		<li>Added 'polar-anchor'</li>
		<li>Added 'contain' for 'polar-distance' for avoiding the overflow issue.</li>
		<li>Added 'polar-origin'</li>
		<li>Added extension for 2d rotation function for polar coordinates</li>
		<li>Changed naming of keyword values for 2d rotation function</li>
		<li>Removed <code>polar</code> value of 'position'. Polar positioning applies to absolute/fixed/sticky/relative positioned elements</li>
		<li>Added auto value to 'polar-origin' and make it as initial value</li>
		<li>Added &lt;size> keywords to 'polar-distance'</li>
		<li>Added the Acknowledgements, Use cases, and Changes</li>
	</ul>

<h2 class="no-num" id="acks">
Acknowledgements</h2>
<p>
	This specification is made possible by input from Dong-Young Lee, Soonbo Han,
	Florian Rivoal, Joone Hur,
	Kang-Soo Seo, Sangjo Park, Woojun Jung, Chisoon Jeong, Yunbum Sung,
	Alan Stearns, Brad Kemper, and the CSS Working Group members.
	Thanks also to Adenilson Cavalcanti for editorial input.</p>
