Bug 120668 - [CSS Background] repeat: round should round the number of tiles to the nearest natural number
Summary: [CSS Background] repeat: round should round the number of tiles to the neares...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
: 122857 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-09-04 01:42 PDT by Andrei Parvu
Modified: 2013-10-15 14:48 PDT (History)
9 users (show)

See Also:


Attachments
Patch (13.28 KB, patch)
2013-09-04 02:07 PDT, Andrei Parvu
no flags Details | Formatted Diff | Diff
Patch (13.24 KB, patch)
2013-09-17 03:35 PDT, Andrei Parvu
no flags Details | Formatted Diff | Diff
Patch (13.21 KB, patch)
2013-09-17 23:50 PDT, Andrei Parvu
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from webkit-ews-08 for mac-mountainlion (634.51 KB, application/zip)
2013-09-18 00:56 PDT, Build Bot
no flags Details
Patch (13.30 KB, patch)
2013-09-23 23:29 PDT, Andrei Parvu
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrei Parvu 2013-09-04 01:42:40 PDT
According to the spec [1] repeat: round should round the number of tiles of an image to the nearest natural number greater than 0.

[1] - http://www.w3.org/TR/css3-background/#background-size
Comment 1 Andrei Parvu 2013-09-04 02:07:26 PDT
Created attachment 210439 [details]
Patch
Comment 2 Andrei Parvu 2013-09-17 03:35:20 PDT
Created attachment 211880 [details]
Patch
Comment 3 Darin Adler 2013-09-17 08:55:08 PDT
Comment on attachment 211880 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=211880&action=review

> Source/WebCore/rendering/RenderBoxModelObject.cpp:1129
> +        int nrTiles = static_cast<int>(round((float)positioningAreaSize.width() / fillTileSize.width()));

I believe the round function takes, and returns, a double. So casting to float and then calling round doesn't make good sense. If we want to use float, then it should be roundf, or if we want to stay with double, we should cast to double, not float.
Comment 4 Darin Adler 2013-09-17 08:56:29 PDT
Comment on attachment 211880 [details]
Patch

I’d like to see test cases right on the boundary, demonstrating the rounding behavior. So things just below and just above the place where we round in two different directions. Something that would fail if we used the wrong rounding function.
Comment 5 Andrei Parvu 2013-09-17 23:45:20 PDT
(In reply to comment #4)
> (From update of attachment 211880 [details])
> I’d like to see test cases right on the boundary, demonstrating the rounding behavior. So things just below and just above the place where we round in two different directions. Something that would fail if we used the wrong rounding function.

Thanks for the comments, Darin!

Actually, the tests handle this: if we use ceil instead of round, mask-repeat-round-auto1.html, mask-repeat-round-auto2.html, mask-repeat-round-border.html and mask-repeat-round-content.html fail. If we use floor instead of round mask-repeat-round-padding.html fails.

Regarding the round function, we can use lroundf, which takes a float and also does the conversion to long - I'll upload a patch for this.
Comment 6 Andrei Parvu 2013-09-17 23:50:00 PDT
Created attachment 211975 [details]
Patch
Comment 7 Build Bot 2013-09-18 00:56:30 PDT
Comment on attachment 211975 [details]
Patch

Attachment 211975 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/1886361

New failing tests:
svg/batik/text/smallFonts.svg
Comment 8 Build Bot 2013-09-18 00:56:32 PDT
Created attachment 211980 [details]
Archive of layout-test-results from webkit-ews-08 for mac-mountainlion

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: webkit-ews-08  Port: mac-mountainlion  Platform: Mac OS X 10.8.5
Comment 9 Andrei Parvu 2013-09-23 23:29:35 PDT
Created attachment 212430 [details]
Patch
Comment 10 WebKit Commit Bot 2013-09-24 00:46:01 PDT
Comment on attachment 212430 [details]
Patch

Clearing flags on attachment: 212430

Committed r156322: <http://trac.webkit.org/changeset/156322>
Comment 11 WebKit Commit Bot 2013-09-24 00:46:03 PDT
All reviewed patches have been landed.  Closing bug.
Comment 12 Dean Jackson 2013-10-15 14:48:30 PDT
*** Bug 122857 has been marked as a duplicate of this bug. ***