@@ -260,6 +260,10 @@ <h2 class="no-num no-toc" id=contents>Table of contents</h2>
260260 < ul class =toc >
261261 < li > < a href ="#sizing-terms "> < span class =secno > 5.1. </ span > Object-Sizing
262262 Terminology</ a >
263+ < ul class =toc >
264+ < li > < a href ="#specified-and-default-sizes "> < span class =secno > 5.1.1.
265+ </ span > Specified and Default Object Sizes</ a >
266+ </ ul >
263267
264268 < li > < a href ="#object-negotiation "> < span class =secno > 5.2. </ span >
265269 CSS⇋Object Negotiation</ a >
@@ -1845,12 +1849,15 @@ <h3 id=sizing-terms><span class=secno>5.1. </span> Object-Sizing
18451849
18461850 < dt > < dfn id =specified-size > specified size</ dfn >
18471851
1848- < dd > The specified size of an object is given by CSS, such as through the
1849- ‘< code class =property > width</ code > ’ and ‘ < code
1850- class =property > height</ code > ’ or ‘< code
1852+ < dd > The specified size of an object is a set of constraints given by CSS,
1853+ such as through the ‘< code class =property > width</ code > ’ and
1854+ ‘ < code class =property > height</ code > ’ or ‘< code
18511855 class =property > background-size</ code > ’ properties. The specified
1852- size can be a definite width and height, a set of constraints, or a
1853- combination thereof.
1856+ size may be a width and/or a height, or alternately a "cover" or
1857+ "contain" constraint. Additionally, the specified size may have a
1858+ horizontal or vertical "rounding" constraint. A < a > later section</ a > of
1859+ this spec defines how the specified size is determined for various
1860+ contexts.
18541861
18551862 < dt > < dfn id =concrete-object-size > concrete object size</ dfn >
18561863
@@ -1869,57 +1876,114 @@ <h3 id=sizing-terms><span class=secno>5.1. </span> Object-Sizing
18691876 href ="#concrete-object-size "> < i > concrete object size</ i > </ a > when both
18701877 the < a href ="#intrinsic-dimensions "> < i > intrinsic dimensions</ i > </ a > and
18711878 < a href ="#specified-size "> < i > specified size</ i > </ a > are missing
1872- dimensions. It varies based on the context in which that the image is
1873- being laid out.</ p >
1874-
1875- < p > The following list defines the < a
1876- href ="#default-object-size "> < i > default object size</ i > </ a > of properties
1877- and contexts that appear in CSS 2.1, plus ‘< code
1878- class =property > border-image</ code > ’ from CSS 3 Backgrounds &
1879- Borders. Newer modules that accept an ‘< a href ="#image-type "> < code
1880- class =css > <image> </ code > </ a > ’ component value in a new context
1881- must define the < a href ="#default-object-size "> < i > default object
1882- size</ i > </ a > in that context. This list is normative, but it is not
1883- intended to contradict anything stated in CSS2.1 or CSS3 Backgrounds
1884- & Borders.</ p >
1885-
1886- < dl >
1887- < dt > ‘< code class =property > background-image</ code > ’
1888-
1889- < dd > The < a href ="#default-object-size "> < i > default object size</ i > </ a > is
1890- the size of the element's < a
1891- href ="http://www.w3.org/TR/css3-background/#background-positioning-area "> background
1892- positioning area</ a > . < a href ="#CSS3BG "
1893- rel =biblioentry > [CSS3BG]<!--{{CSS3BG}}--> </ a >
1894-
1895- < dt > ‘< code class =property > list-style-image</ code > ’
1896-
1897- < dd > The < a href ="#default-object-size "> < i > default object size</ i > </ a > is
1898- a 1em square. < a href ="#CSS21 "
1899- rel =biblioentry > [CSS21]<!--{{!CSS21}}--> </ a >
1900-
1901- < dt > ‘< code class =property > border-image</ code > ’
1902-
1903- < dd > The < a href ="#default-object-size "> < i > default object size</ i > </ a > is
1904- the size of the element's < a
1905- href ="http://www.w3.org/TR/css3-background/#border-image-area "> border
1906- image area</ a > . < a href ="#CSS3BG "
1907- rel =biblioentry > [CSS3BG]<!--{{CSS3BG}}--> </ a >
1879+ dimensions. A < a > later section</ a > of this spec defines how the default
1880+ object size is determined for various contexts.</ p >
1881+ </ dl >
19081882
1909- < dt > ‘< code class =property > cursor</ code > ’
1883+ < h4 id =specified-and-default-sizes > < span class =secno > 5.1.1. </ span >
1884+ Specified and Default Object Sizes</ h4 >
1885+
1886+ < p > When sizing an object using the < a
1887+ href ="#default-sizing-algorithm "> < i > default sizing algorithm</ i > </ a > , the
1888+ < a href ="#specified-size "> < i > specified size</ i > </ a > and < a
1889+ href ="#default-object-size "> < i > default object size</ i > </ a > can vary based
1890+ on the context of the object and various CSS properties. This section
1891+ defines these for the various contexts in which an ‘< a
1892+ href ="#image-type "> < code class =css > <image> </ code > </ a > ’ component
1893+ value can appear in CSS 2.1 and CSS3 Backgrounds & Borders. Newer
1894+ modules that accept an ‘< a href ="#image-type "> < code
1895+ class =css > <image> </ code > </ a > ’ component value in a new context
1896+ must define the < a href ="#specified-size "> < i > specified size</ i > </ a > and < a
1897+ href ="#default-object-size "> < i > default object size</ i > </ a > in that
1898+ context.
1899+
1900+ < p class =note > This section is normative, but is not intended to contradict
1901+ anything stated in CSS2.1 or CSS3 Backgrounds & Borders. Any
1902+ contradiction should be taken as an error in this spec and reported.
19101903
1911- < dd > The < a href ="#default-object-size "> < i > default object size</ i > </ a > is
1912- a UA-defined size that should be based on the size of a typical cursor
1913- on the UA's operating system. < a href ="#CSS21 "
1914- rel =biblioentry > [CSS21]<!--{{!CSS21}}--> </ a >
1904+ < dl >
1905+ < dt > ‘< code class =property > background-image</ code > ’
19151906
1916- < dt > replaced elements
1907+ < dd >
1908+ < p > If ‘< code class =property > background-size</ code > ’ is
1909+ ‘< code class =css > cover</ code > ’ or ‘< code
1910+ class =css > contain</ code > ’, the < a
1911+ href ="#specified-size "> < i > specified size</ i > </ a > has a "cover" or
1912+ "contain" constraint, respectively. Otherwise, if ‘< code
1913+ class =property > background-size</ code > ’ specifies a
1914+ non-‘< code class =css > auto</ code > ’ width and/or height, the
1915+ < a href ="#specified-size "> < i > specified size</ i > </ a > is that width and/or
1916+ height. If ‘< code class =property > background-repeat</ code > ’
1917+ is ‘< code class =css > round</ code > ’ in either dimension, the
1918+ < a href ="#specified-size "> < i > specified size</ i > </ a > also has a rounding
1919+ constraint in that dimension.</ p >
1920+
1921+ < p > The < a href ="#default-object-size "> < i > default object size</ i > </ a > is
1922+ the < a
1923+ href ="http://www.w3.org/TR/css3-background/#background-positioning-area "> background
1924+ positioning area</ a > . < a href ="#CSS3BG "
1925+ rel =biblioentry > [CSS3BG]<!--{{CSS3BG}}--> </ a > </ p >
1926+
1927+ < dt > ‘< code class =property > list-style-image</ code > ’
1928+
1929+ < dd > The < a href ="#specified-size "> < i > specified size</ i > </ a > has no
1930+ constraints. The < a href ="#default-object-size "> < i > default object
1931+ size</ i > </ a > is a 1em square.
1932+
1933+ < dt > ‘< code class =property > border-image</ code > ’
19171934
1918- < dd > The < a href ="#default-object-size "> < i > default object size</ i > </ a > is
1919- a the largest rectangle that has a 2:1 width:height ratio, is no larger
1920- than 300px width and 150px height, and has a width that fits in the
1921- device. < a href ="#CSS21 " rel =biblioentry > [CSS21]<!--{{!CSS21}}--> </ a >
1922- </ dl >
1935+ < dd >
1936+ < p > When initially sizing an image (before slicing it), the < a
1937+ href ="#specified-size "> < i > specified size</ i > </ a > has no constraints, and
1938+ the < a href ="#default-object-size "> < i > default object size</ i > </ a > is the
1939+ < a href ="http://www.w3.org/TR/css3-background/#border-image-area "> border
1940+ image area</ a > . < a href ="#CSS3BG "
1941+ rel =biblioentry > [CSS3BG]<!--{{CSS3BG}}--> </ a > .</ p >
1942+
1943+ < p > When sizing the slices, the top and bottom slices' < a
1944+ href ="#specified-size "> < i > specified size</ i > </ a > s have a height equal to
1945+ the top/bottom ‘< code
1946+ class =property > border-image-width</ code > ’, the left and right
1947+ slices' < a href ="#specified-size "> < i > specified size</ i > </ a > s have a
1948+ width equal to the left/right ‘< code
1949+ class =property > border-image-width</ code > ’, and the corner slices'
1950+ < a href ="#specified-size "> < i > specified size</ i > </ a > s have widths and
1951+ heights equal to the ‘< code
1952+ class =property > border-image-width</ code > ’ for the two sides
1953+ they're a part of. If the first keyword of ‘< code
1954+ class =property > border-image-repeat</ code > ’ is ‘< code
1955+ class =css > round</ code > ’, the top and bottom slices' < a
1956+ href ="#specified-size "> < i > specified size</ i > </ a > s have a horizontal
1957+ rounding constraint. If the second keyword of ‘< code
1958+ class =property > border-image-repeat</ code > ’ is ‘< code
1959+ class =css > round</ code > ’, the left and right slices' < i > specifies
1960+ size</ i > s have a vertical rounding constraint.</ p >
1961+
1962+ < p > The middle slice is sized specially to match the width of the
1963+ top/bottom slices and the height of the left/right slices, and so is not
1964+ covered by this sizing algorithm.</ p >
1965+
1966+ < p > The < a href ="#default-object-size "> < i > default object size</ i > </ a > for
1967+ each slice is the size of the border image area part they are associated
1968+ with.</ p >
1969+
1970+ < dt > ‘< code class =property > cursor</ code > ’
1971+
1972+ < dd > The < a href ="#specified-size "> < i > specified size</ i > </ a > has no
1973+ constraints. The < a href ="#default-object-size "> < i > default object
1974+ size</ i > </ a > is a UA-defined size that should be based on the size of a
1975+ typical cursor on the UA's operating system. < a href ="#CSS21 "
1976+ rel =biblioentry > [CSS21]<!--{{!CSS21}}--> </ a >
1977+
1978+ < dt > replaced elements
1979+
1980+ < dd > The < a href ="#specified-size "> < i > specified size</ i > </ a > is defined by
1981+ ‘< a href ="#object-fit0 "> < code
1982+ class =property > object-fit</ code > </ a > ’. The < a
1983+ href ="#default-object-size "> < i > default object size</ i > </ a > is the largest
1984+ rectangle that has a 2:1 width:height ratio, is no larger than 300px
1985+ width and 150px height, and has a width that fits in the device. < a
1986+ href ="#CSS21 " rel =biblioentry > [CSS21]<!--{{!CSS21}}--> </ a > .
19231987 </ dl >
19241988 <!-- ====================================================================== -->
19251989
@@ -1966,7 +2030,8 @@ <h3 id=default-sizing><span class=secno>5.3. </span> Default Concrete
19662030
19672031 < p > In the absence of more specific rules, an object's < a
19682032 href ="#intrinsic-dimensions "> < i > intrinsic dimensions</ i > </ a > are resolved
1969- to a < a href ="#concrete-object-size "> < i > concrete object size</ i > </ a > as
2033+ to a < a href ="#concrete-object-size "> < i > concrete object size</ i > </ a > with
2034+ the < dfn id =default-sizing-algorithm > default sizing algorithm</ dfn > , as
19702035 follows:
19712036
19722037 < ul >
@@ -1996,10 +2061,25 @@ <h3 id=default-sizing><span class=secno>5.3. </span> Default Concrete
19962061 from the < a href ="#default-object-size "> < i > default object size</ i > </ a > .
19972062 </ ol >
19982063
1999- < li > If the < a href ="#specified-size "> < i > specified size</ i > </ a > has neither
2000- a definite width nor height, and has no additional contraints, the
2001- dimensions of the < a href ="#concrete-object-size "> < i > concrete object
2002- size</ i > </ a > are calculated as follows:
2064+ < li > If the < a href ="#specified-size "> < i > specified size</ i > </ a > is a
2065+ "contain" constraint and the object has an intrinsic aspect ratio, the < a
2066+ href ="#concrete-object-size "> < i > concrete object size</ i > </ a > is the
2067+ largest rectangle with that aspect ratio that completely fits within the
2068+ < a href ="#default-object-size "> < i > default object size</ i > </ a > . If the
2069+ object doesnt' have an intrinsic aspec tratio, the < a
2070+ href ="#concrete-object-size "> < i > concrete object size</ i > </ a > is the < a
2071+ href ="#default-object-size "> < i > default object size</ i > </ a > .
2072+
2073+ < li > If the < a href ="#specified-size "> < i > specified size</ i > </ a > is a
2074+ "cover" constraint and the object has an intrinsic aspect ratio, the < a
2075+ href ="#concrete-object-size "> < i > concrete object size</ i > </ a > is the
2076+ smallest rectangle with that aspect ratio that can completely cover
2077+ within the < a href ="#default-object-size "> < i > default object size</ i > </ a > .
2078+ If the object doesnt' have an intrinsic aspec tratio, the < a
2079+ href ="#concrete-object-size "> < i > concrete object size</ i > </ a > is the < a
2080+ href ="#default-object-size "> < i > default object size</ i > </ a > .
2081+
2082+ < li > Otherwise:
20032083 < ol >
20042084 < li > If the object has only an < i > intrinsic aspect ratio</ i > , the < a
20052085 href ="#concrete-object-size "> < i > concrete object size</ i > </ a > must have
@@ -2019,18 +2099,33 @@ <h3 id=default-sizing><span class=secno>5.3. </span> Default Concrete
20192099 </ ol >
20202100 </ ul >
20212101
2022- < p > If the < a href ="#specified-size "> < i > specified size</ i > </ a > has
2023- additional constraints, the < a href ="#concrete-object-size "> < i > concrete
2024- object size</ i > </ a > must be sized to satisfy those constraints. For
2025- example, the ‘< code class =property > min-width</ code > ’,
2026- ‘< code class =property > min-height</ code > ’, ‘< code
2027- class =property > max-width</ code > ’, and ‘< code
2028- class =property > max-height</ code > ’properties specify slightly more
2029- complex handling for sizing replaced elements, and ‘< code
2030- class =css > background-repeat: round</ code > ’ can further adjust the
2031- size calculated by ‘< code
2032- class =property > background-size</ code > ’ so that the image fits a
2033- whole number of times into the background positioning area.</ p >
2102+ < p > If the < a href ="#specified-size "> < i > specified size</ i > </ a > has a
2103+ horizontal or vertical rounding constraint and the < a
2104+ href ="#concrete-object-size "> < i > concrete object size</ i > </ a > in that
2105+ dimension is non-zero, the < a href ="#concrete-object-size "> < i > concrete
2106+ object size</ i > </ a > is then adjusted in that dimension so that it fits a
2107+ whole number of times into the < a href ="#default-object-size "> < i > default
2108+ object size</ i > </ a > , as follows:
2109+
2110+ < blockquote >
2111+ < p > If < var > X</ var > is the size of the < a
2112+ href ="#concrete-object-size "> < i > concrete object size</ i > </ a > in the given
2113+ dimension and < var > W</ var > is the size of the < a
2114+ href ="#default-object-size "> < i > default object size</ i > </ a > in the same
2115+ dimension, the < a href ="#concrete-object-size "> < i > concrete object
2116+ size</ i > </ a > in that dimension is changed to < var > X'</ var > = < var > W</ var >
2117+ / round(< var > W</ var > / < var > X</ var > ), where round() is a function that
2118+ returns the nearest natural number.
2119+ </ blockquote >
2120+
2121+ < p > Then, if the object has an intrinsic aspect ratio and the < a
2122+ href ="#specified-size "> < i > specified size</ i > </ a > had a horizontal rounding
2123+ constraint but no height, the height of the < a
2124+ href ="#concrete-object-size "> < i > concrete object size</ i > </ a > is adjust so
2125+ that the < a href ="#concrete-object-size "> < i > concrete object size</ i > </ a >
2126+ has the same aspect ratio as the object's intrinsic aspect ratio (and
2127+ analogously for a < a href ="#specified-size "> < i > specified size</ i > </ a > with
2128+ a vertical rounding constraint but no width).</ p >
20342129 <!-- ====================================================================== -->
20352130
20362131 < h3 id =object-fit > < span class =secno > 5.4. </ span > Sizing Objects: the
@@ -2913,6 +3008,9 @@ <h2 class=no-num id=index>Index</h2>
29133008 < li > default object size, < a href ="#default-object-size "
29143009 title ="default object size "> < strong > 5.1.</ strong > </ a >
29153010
3011+ < li > default sizing algorithm, < a href ="#default-sizing-algorithm "
3012+ title ="default sizing algorithm "> < strong > 5.3.</ strong > </ a >
3013+
29163014 < li > ‘< code class =css > dpcm</ code > ’, < a href ="#dpcm "
29173015 title ="''dpcm'' "> < strong > 2.</ strong > </ a >
29183016
0 commit comments