Skip to content

Commit 4f8c4af

Browse files
committed
Clarify that round() returns nonzero positive integers; mark round() vs ceil() as issue.
1 parent dac5b85 commit 4f8c4af

2 files changed

Lines changed: 39 additions & 4 deletions

File tree

css3-background/Overview.html

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222

2323
<h1>CSS Backgrounds and Borders Module Level 3</h1>
2424

25-
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 07 October
26-
2009</h2>
25+
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 7 October 2009</h2>
2726

2827
<dl>
2928
<dt>This version:
@@ -1452,9 +1451,29 @@ <h3 id=the-background-size><span class=secno>3.9 </span>The &lsquo;<code
14521451
<var>W</var> is the width of the background positioning area, then the
14531452
rounded width <var>X'</var> = <var>W</var> / round(<var>W</var> /
14541453
<var>X</var>) where round() is a function that returns the nearest
1455-
natural number.
1454+
natural number (integer greater than zero).
14561455
</blockquote>
14571456

1457+
<p class=issue>This will round to the nearest whole number of tiles, which
1458+
keeps closer to the intended size and, in the case where one dimension is
1459+
fixed (e.g. in &lsquo;<code class=property><a
1460+
href="#border-image">border-image</a></code>&rsquo;), keeps the image
1461+
closer to the intended aspect ratio. This is almost certainly the best
1462+
solution for vector images and high-resolution raster images. However, if
1463+
the given image is a low-resolution raster image, it will require
1464+
interpolating pixels, which can look bad. See <a
1465+
href="http://www.bradclicks.com/cssplay/border-image/round-test1.html">Rounding
1466+
Extremes</a> for illustrations. The workaround is to specify a
1467+
higher-resolution image (e.g. by shrinking with &lsquo;<code
1468+
class=property><a
1469+
href="#background-size">background-size</a></code>&rsquo; or &lsquo;<code
1470+
class=property><a
1471+
href="#border-image-width">border-image-width</a></code>&rsquo;). Possible
1472+
spec solutions include introducing a separate keyword that always scales
1473+
down, or to change the algorithm so that we force scaling down when
1474+
interpolation would be required for scaling up. The CSSWG is looking for
1475+
feedback on this issue.
1476+
14581477
<p>If &lsquo;<code class=property><a
14591478
href="#background-repeat">background-repeat</a></code>&rsquo; is
14601479
&lsquo;<code class=css>round</code>&rsquo; for one dimension only and if

css3-background/Overview.src.html

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1009,9 +1009,25 @@ <h3 id="the-background-size">The 'background-size' property</h3>
10091009
and <var>W</var> is the width of the background positioning area,
10101010
then the rounded width
10111011
<var>X'</var> = <var>W</var> / round(<var>W</var> / <var>X</var>)
1012-
where round() is a function that returns the nearest natural number.
1012+
where round() is a function that returns the nearest natural number
1013+
(integer greater than zero).
10131014
</blockquote>
10141015

1016+
<p class="issue">This will round to the nearest whole number of tiles,
1017+
which keeps closer to the intended size and, in the case where one
1018+
dimension is fixed (e.g. in 'border-image'), keeps the image closer to
1019+
the intended aspect ratio. This is almost certainly the best solution
1020+
for vector images and high-resolution raster images. However, if the
1021+
given image is a low-resolution raster image, it will require interpolating
1022+
pixels, which can look bad. See
1023+
<a href="http://www.bradclicks.com/cssplay/border-image/round-test1.html">Rounding Extremes</a>
1024+
for illustrations. The workaround is to specify a higher-resolution image
1025+
(e.g. by shrinking with 'background-size' or 'border-image-width').
1026+
Possible spec solutions include introducing a separate keyword that always
1027+
scales down, or to change the algorithm so that we force scaling down when
1028+
interpolation would be required for scaling up. The CSSWG is looking for
1029+
feedback on this issue.</p>
1030+
10151031
<p>If 'background-repeat' is ''round'' for one dimension only and if
10161032
'background-size' is ''auto'' for the other dimension, then there is a third
10171033
step: that other dimension is scaled so that the original aspect ratio

0 commit comments

Comments
 (0)