[CSS Background] repeat: round should round the number of tiles to the nearest natura...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Sep 2013 07:47:10 +0000 (07:47 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Sep 2013 07:47:10 +0000 (07:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=120668

Source/WebCore:

Patch by Andrei Parvu <parvu@adobe.com> on 2013-09-24
Reviewed by Darin Adler.

Tests already available in css3/masking and css3/background

* rendering/RenderBoxModelObject.cpp: Rounded the number of tiles to the nearest natural number.
(WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):

LayoutTests:

Changed the sizes of the images/masks in the tests to be compliant with the new behaviour.

Patch by Andrei Parvu <parvu@adobe.com> on 2013-09-24
Reviewed by Darin Adler.

* css3/background/background-repeat-round-auto1-expected.html:
* css3/background/background-repeat-round-auto2-expected.html:
* css3/background/background-repeat-round-border-expected.html:
* css3/background/background-repeat-round-content-expected.html:
* css3/background/background-repeat-round-padding-expected.html:
* css3/background/background-repeat-round-padding.html:
* css3/masking/mask-repeat-round-auto1-expected.html:
* css3/masking/mask-repeat-round-auto2-expected.html:
* css3/masking/mask-repeat-round-border-expected.html:
* css3/masking/mask-repeat-round-content-expected.html:
* css3/masking/mask-repeat-round-padding-expected.html:
* css3/masking/mask-repeat-round-padding.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@156322 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 files changed:
LayoutTests/ChangeLog
LayoutTests/css3/background/background-repeat-round-auto1-expected.html
LayoutTests/css3/background/background-repeat-round-auto2-expected.html
LayoutTests/css3/background/background-repeat-round-border-expected.html
LayoutTests/css3/background/background-repeat-round-content-expected.html
LayoutTests/css3/background/background-repeat-round-padding-expected.html
LayoutTests/css3/background/background-repeat-round-padding.html
LayoutTests/css3/masking/mask-repeat-round-auto1-expected.html
LayoutTests/css3/masking/mask-repeat-round-auto2-expected.html
LayoutTests/css3/masking/mask-repeat-round-border-expected.html
LayoutTests/css3/masking/mask-repeat-round-content-expected.html
LayoutTests/css3/masking/mask-repeat-round-padding-expected.html
LayoutTests/css3/masking/mask-repeat-round-padding.html
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBoxModelObject.cpp

index 5d93be96e0623683dac30ed3c55089f9393eed9e..8450d2c84bee6283c208a666a47ac52140845e55 100644 (file)
@@ -1,3 +1,25 @@
+2013-09-24  Andrei Parvu  <parvu@adobe.com>
+
+        [CSS Background] repeat: round should round the number of tiles to the nearest natural number
+        https://bugs.webkit.org/show_bug.cgi?id=120668
+
+        Changed the sizes of the images/masks in the tests to be compliant with the new behaviour.
+
+        Reviewed by Darin Adler.
+
+        * css3/background/background-repeat-round-auto1-expected.html:
+        * css3/background/background-repeat-round-auto2-expected.html:
+        * css3/background/background-repeat-round-border-expected.html:
+        * css3/background/background-repeat-round-content-expected.html:
+        * css3/background/background-repeat-round-padding-expected.html:
+        * css3/background/background-repeat-round-padding.html:
+        * css3/masking/mask-repeat-round-auto1-expected.html:
+        * css3/masking/mask-repeat-round-auto2-expected.html:
+        * css3/masking/mask-repeat-round-border-expected.html:
+        * css3/masking/mask-repeat-round-content-expected.html:
+        * css3/masking/mask-repeat-round-padding-expected.html:
+        * css3/masking/mask-repeat-round-padding.html:
+
 2013-09-23  Gurpreet Kaur  <k.gurpreet@samsung.com>
 
         CSS Unit vh, vw, vmin and vmax in box-shadow are not applied.
index e8db136f6ca5af8c05062b1504d28de7fbad1b80..c1e93978c996f46a73a695b66d3e8e5a2ac3959b 100644 (file)
@@ -9,7 +9,7 @@
                 padding: 50px;
                 border: 50px solid transparent;
                 background-image: url(resources/circle.png);
-                background-size: 100px 79px;
+                background-size: 111px 88px;
                 background-repeat: repeat;
                 background-origin: border-box;
                 background-clip: border-box;
index 53c96f377ded0ebd6f705c7e06ba2075d8aab7b1..529b0f858d1b0bfa760e15a4585f4467d5d91f17 100644 (file)
@@ -9,7 +9,7 @@
                 padding: 50px;
                 border: 50px solid transparent;
                 background-image: url(resources/circle.png);
-                background-size: 106px 85px;
+                background-size: 124px 100px;
                 background-repeat: repeat;
                 background-origin: border-box;
                 background-clip: border-box;
index 684bacb05f26e32e4542e227800b551130735a46..84b6d1eb214cc6485ddeff50323ba73298783788 100644 (file)
@@ -9,7 +9,7 @@
                 padding: 50px;
                 border: 50px solid transparent;
                 background-image: url(resources/circle.png);
-                background-size: 100px 75px;
+                background-size: 111px 85px;
                 background-repeat: repeat;
                 background-origin: border-box;
                 background-clip: border-box;
index ca73dcfba86e4c47304e0333978b5434033a670c..e3bc5483a6ffe899e1daf2627c8f38b3fc852b5a 100644 (file)
@@ -9,7 +9,7 @@
                 padding: 50px;
                 border: 50px solid transparent;
                 background-image: url(resources/circle.png);
-                background-size: 66px 40px;
+                background-size: 72px 40px;
                 background-repeat: repeat;
                 background-origin: content-box;
                 background-clip: content-box;
index 6df73ee655abaad0ebfdfab21c25eb1b2fc7e0cb..3e7032335e006b1436394c7df2d9fa9bba144bd3 100644 (file)
@@ -9,7 +9,7 @@
                 padding: 50px;
                 border: 50px solid transparent;
                 background-image: url(resources/circle.png);
-                background-size: 100px 83px;
+                background-size: 90px 83px;
                 background-repeat: repeat;
                 background-origin: padding-box;
                 background-clip: padding-box;
index eed43cefe7b013c2597e9c1629205955bb4b6d13..0fb0ff09bb042feae9c2191dba2f0b7be39adbb0 100644 (file)
@@ -9,7 +9,7 @@
                 padding: 50px;
                 border: 50px solid transparent;
                 background-image: url(resources/circle.png);
-                background-size: 100px 93px;
+                background-size: 93px 87px;
                 background-repeat: round;
                 background-origin: padding-box;
                 background-clip: padding-box;
index 4e8a6fcae01f9901b112da28df1bd9745c59ae1f..6cb020b6fc36ebaf5143224eeae4a33e045af056 100644 (file)
@@ -14,7 +14,7 @@
                 border: 50px solid blue;
                 padding: 50px;
                 -webkit-mask-image: url(resources/circle.png);
-                -webkit-mask-size: 100px 79px;
+                -webkit-mask-size: 111px 88px;
                 -webkit-mask-repeat: repeat;
                 -webkit-mask-origin: border-box;
                 -webkit-mask-clip: border-box;
index ffaed2d0ad7c9e5286bc6b5c57599f87b6559eee..dce5cdd6d2fcf9fb58f6147c78e29f6e964bd160 100644 (file)
@@ -14,7 +14,7 @@
                 border: 50px solid blue;
                 padding: 50px;
                 -webkit-mask-image: url(resources/circle.png);
-                -webkit-mask-size: 106px 85px;
+                -webkit-mask-size: 124px 100px;
                 -webkit-mask-repeat: repeat;
                 -webkit-mask-origin: border-box;
                 -webkit-mask-clip: border-box;
index b09cad575a0de2a84c9a5fee5b961f81925ab4b8..bb5711368d07a9bb81409706b69cea23304e58bf 100644 (file)
@@ -14,7 +14,7 @@
                 border: 50px solid blue;
                 padding: 50px;
                 -webkit-mask-image: url(resources/circle.png);
-                -webkit-mask-size: 100px 75px;
+                -webkit-mask-size: 111px 85px;
                 -webkit-mask-repeat: repeat;
                 -webkit-mask-origin: border-box;
                 -webkit-mask-clip: border-box;
index 01482babb1ac5b3683a5bc6124319453dfb9dd79..63b10d230da28ad255168b3441034675dc19fb9f 100644 (file)
@@ -14,7 +14,7 @@
                 border: 50px solid blue;
                 padding: 50px;
                 -webkit-mask-image: url(resources/circle.png);
-                -webkit-mask-size: 66px 40px;
+                -webkit-mask-size: 72px 40px;
                 -webkit-mask-repeat: repeat;
                 -webkit-mask-origin: content-box;
                 -webkit-mask-clip: content-box;
index 1f421bd9524155dc421db74fa57379fb612377d3..bc7f5f29b3510545868f8393cde2dabdcb60250c 100644 (file)
@@ -14,7 +14,7 @@
                 border: 50px solid blue;
                 padding: 50px;
                 -webkit-mask-image: url(resources/circle.png);
-                -webkit-mask-size: 100px 83px;
+                -webkit-mask-size: 90px 83px;
                 -webkit-mask-repeat: repeat;
                 -webkit-mask-origin: padding-box;
                 -webkit-mask-clip: padding-box;
index 1225bd27145e858b0a9d09abf70174b34bd6ef72..133eaced06e159b1f098c0801f248f5ca4002a4e 100644 (file)
@@ -14,7 +14,7 @@
                 border: 50px solid blue;
                 padding: 50px;
                 -webkit-mask-image: url(resources/circle.png);
-                -webkit-mask-size: 100px 93px;
+                -webkit-mask-size: 93px 87px;
                 -webkit-mask-repeat: round;
                 -webkit-mask-origin: padding-box;
                 -webkit-mask-clip: padding-box;
index ed08187c3778cef812c001b09401f215f72c7023..d26d76b159e3d96b89d79b9017b1e4c790963b3f 100644 (file)
@@ -1,3 +1,15 @@
+2013-09-24  Andrei Parvu  <parvu@adobe.com>
+
+        [CSS Background] repeat: round should round the number of tiles to the nearest natural number
+        https://bugs.webkit.org/show_bug.cgi?id=120668
+
+        Reviewed by Darin Adler.
+
+        Tests already available in css3/masking and css3/background
+
+        * rendering/RenderBoxModelObject.cpp: Rounded the number of tiles to the nearest natural number.
+        (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
+
 2013-09-24  Ryuan Choi  <ryuan.choi@samsung.com>
 
         Remove ScrollView::platformInit() and ScrollView::platformDestroy()
index 345c7be1d1147e4782988b93c7b8978d0cc08163..caa7b2e39ea6ab5fe803a9b95af728ed470161ac 100644 (file)
@@ -1122,7 +1122,9 @@ void RenderBoxModelObject::calculateBackgroundImageGeometry(const RenderLayerMod
 
     LayoutUnit computedXPosition = minimumValueForLength(fillLayer->xPosition(), availableWidth, true);
     if (backgroundRepeatX == RoundFill && positioningAreaSize.width() > 0 && fillTileSize.width() > 0) {
-        int nrTiles = ceil((double)positioningAreaSize.width() / fillTileSize.width());
+        long nrTiles = lroundf((float)positioningAreaSize.width() / fillTileSize.width());
+        if (!nrTiles)
+            nrTiles = 1;
 
         if (fillLayer->size().size.height().isAuto() && backgroundRepeatY != RoundFill)
             fillTileSize.setHeight(fillTileSize.height() * positioningAreaSize.width() / (nrTiles * fillTileSize.width()));
@@ -1135,7 +1137,9 @@ void RenderBoxModelObject::calculateBackgroundImageGeometry(const RenderLayerMod
 
     LayoutUnit computedYPosition = minimumValueForLength(fillLayer->yPosition(), availableHeight, true);
     if (backgroundRepeatY == RoundFill && positioningAreaSize.height() > 0 && fillTileSize.height() > 0) {
-        int nrTiles = ceil((double)positioningAreaSize.height() / fillTileSize.height());
+        long nrTiles = lroundf((float)positioningAreaSize.height() / fillTileSize.height());
+        if (!nrTiles)
+            nrTiles = 1;
 
         if (fillLayer->size().size.width().isAuto() && backgroundRepeatX != RoundFill)
             fillTileSize.setWidth(fillTileSize.width() * positioningAreaSize.height() / (nrTiles * fillTileSize.height()));