Title: [156097] trunk
Revision
156097
Author
[email protected]
Date
2013-09-19 07:41:36 -0700 (Thu, 19 Sep 2013)

Log Message

[CSS Masking/Background] Position property should be ignored when using repeat: space
https://bugs.webkit.org/show_bug.cgi?id=120623

Source/WebCore:

The background/mask-position should be ignored when using repeat: space,
unless there is not enough space for two copies of the image. In that case,
only one image is placed and background/mask-position determines its position.

Patch by Andrei Parvu <[email protected]> on 2013-09-19
Reviewed by Dirk Schulze.

Test: css3/masking/mask-repeat-one-copy.html

* rendering/RenderBoxModelObject.cpp: Ignored position property if space value is positive, set no-repeat otherwise.
(WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):

LayoutTests:

Patch by Andrei Parvu <[email protected]> on 2013-09-19
Reviewed by Dirk Schulze.

* css3/masking/mask-repeat-one-copy-expected.html:
* css3/masking/mask-repeat-one-copy.html: Only one copy of the mask should be drawn, and background position should determine its position.
* css3/masking/mask-repeat-space-padding.html: Added a mask-position which should be ignored.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (156096 => 156097)


--- trunk/LayoutTests/ChangeLog	2013-09-19 14:39:56 UTC (rev 156096)
+++ trunk/LayoutTests/ChangeLog	2013-09-19 14:41:36 UTC (rev 156097)
@@ -1,3 +1,14 @@
+2013-09-19  Andrei Parvu  <[email protected]>
+
+        [CSS Masking/Background] Position property should be ignored when using repeat: space
+        https://bugs.webkit.org/show_bug.cgi?id=120623
+
+        Reviewed by Dirk Schulze.
+
+        * css3/masking/mask-repeat-one-copy-expected.html:
+        * css3/masking/mask-repeat-one-copy.html: Only one copy of the mask should be drawn, and background position should determine its position.
+        * css3/masking/mask-repeat-space-padding.html: Added a mask-position which should be ignored.
+
 2013-09-19  Michał Pakuła vel Rutka  <[email protected]>
 
         Unreviewed EFL gardening.

Copied: trunk/LayoutTests/css3/masking/mask-repeat-one-copy-expected.html (from rev 156096, trunk/LayoutTests/css3/masking/mask-repeat-space-padding.html) (0 => 156097)


--- trunk/LayoutTests/css3/masking/mask-repeat-one-copy-expected.html	                        (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-repeat-one-copy-expected.html	2013-09-19 14:41:36 UTC (rev 156097)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html lang="en">
+    <head>
+        <style>
+            #back {
+                width: 600px;
+                height: 500px;
+                background-color: green;
+            }
+            #front {
+                width: 400px;
+                height: 300px;
+                background-color: red;
+                border: 50px solid blue;
+                padding: 50px;
+                -webkit-mask-image: url("resources/circle.png");
+                -webkit-mask-size: 400px 300px;
+                -webkit-mask-repeat: no-repeat;
+                -webkit-mask-origin: padding-box;
+                -webkit-mask-position: 100px 100px;
+                -webkit-mask-clip: padding-box;
+            }
+        </style>
+    </head>
+
+    <body>
+        <div id="back">
+            <div id="front" />
+        </div>
+    </body>
+</html>
+

Copied: trunk/LayoutTests/css3/masking/mask-repeat-one-copy.html (from rev 156096, trunk/LayoutTests/css3/masking/mask-repeat-space-padding.html) (0 => 156097)


--- trunk/LayoutTests/css3/masking/mask-repeat-one-copy.html	                        (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-repeat-one-copy.html	2013-09-19 14:41:36 UTC (rev 156097)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html lang="en">
+    <head>
+        <style>
+            #back {
+                width: 600px;
+                height: 500px;
+                background-color: green;
+            }
+            #front {
+                width: 400px;
+                height: 300px;
+                background-color: red;
+                border: 50px solid blue;
+                padding: 50px;
+                -webkit-mask-image: url("resources/circle.png");
+                -webkit-mask-size: 400px 300px;
+                -webkit-mask-repeat: space;
+                -webkit-mask-origin: padding-box;
+                -webkit-mask-position: 100px 100px;
+                -webkit-mask-clip: padding-box;
+            }
+        </style>
+    </head>
+
+    <body>
+        <div id="back">
+            <div id="front" />
+        </div>
+    </body>
+</html>
+

Modified: trunk/LayoutTests/css3/masking/mask-repeat-space-padding.html (156096 => 156097)


--- trunk/LayoutTests/css3/masking/mask-repeat-space-padding.html	2013-09-19 14:39:56 UTC (rev 156096)
+++ trunk/LayoutTests/css3/masking/mask-repeat-space-padding.html	2013-09-19 14:41:36 UTC (rev 156097)
@@ -17,6 +17,7 @@
                 -webkit-mask-size: 153px 127px;
                 -webkit-mask-repeat: space;
                 -webkit-mask-origin: padding-box;
+                -webkit-mask-position: 150px 150px; /* This should be igonored because of repeat: space */
                 -webkit-mask-clip: padding-box;
             }
         </style>

Modified: trunk/Source/WebCore/ChangeLog (156096 => 156097)


--- trunk/Source/WebCore/ChangeLog	2013-09-19 14:39:56 UTC (rev 156096)
+++ trunk/Source/WebCore/ChangeLog	2013-09-19 14:41:36 UTC (rev 156097)
@@ -1,3 +1,19 @@
+2013-09-19  Andrei Parvu  <[email protected]>
+
+        [CSS Masking/Background] Position property should be ignored when using repeat: space
+        https://bugs.webkit.org/show_bug.cgi?id=120623
+
+        The background/mask-position should be ignored when using repeat: space,
+        unless there is not enough space for two copies of the image. In that case,
+        only one image is placed and background/mask-position determines its position.
+
+        Reviewed by Dirk Schulze.
+
+        Test: css3/masking/mask-repeat-one-copy.html
+
+        * rendering/RenderBoxModelObject.cpp: Ignored position property if space value is positive, set no-repeat otherwise.
+        (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
+
 2013-09-19  Andreas Kling  <[email protected]>
 
         CTTE: EllipsisBox::renderer() should return RenderBlock&.

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (156096 => 156097)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2013-09-19 14:39:56 UTC (rev 156096)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2013-09-19 14:41:36 UTC (rev 156097)
@@ -1037,7 +1037,7 @@
 static inline int getSpace(int areaSize, int tileSize)
 {
     int numberOfTiles = areaSize / tileSize;
-    int space = 0;
+    int space = -1;
 
     if (numberOfTiles > 1)
         space = roundedLayoutUnit((float)(areaSize - numberOfTiles * tileSize) / (numberOfTiles - 1));
@@ -1157,9 +1157,14 @@
         int space = getSpace(positioningAreaSize.width(), geometry.tileSize().width());
         int actualWidth = geometry.tileSize().width() + space;
 
-        geometry.setSpaceSize(FloatSize(space, 0));
-        geometry.setPhaseX(actualWidth ? actualWidth - roundToInt(computedXPosition + left) % actualWidth : 0);
-    } else if (backgroundRepeatX == NoRepeatFill) {
+        if (space >= 0) {
+            computedXPosition = minimumValueForLength(Length(), availableWidth, &view(), true);
+            geometry.setSpaceSize(FloatSize(space, 0));
+            geometry.setPhaseX(actualWidth ? actualWidth - roundToInt(computedXPosition + left) % actualWidth : 0);
+        } else
+            backgroundRepeatX = NoRepeatFill;
+    }
+    if (backgroundRepeatX == NoRepeatFill) {
         int xOffset = fillLayer->backgroundXOrigin() == RightEdge ? availableWidth - computedXPosition : computedXPosition;
         geometry.setNoRepeatX(left + xOffset);
         geometry.setSpaceSize(FloatSize(0, geometry.spaceSize().height()));
@@ -1172,9 +1177,14 @@
         int space = getSpace(positioningAreaSize.height(), geometry.tileSize().height());
         int actualHeight = geometry.tileSize().height() + space;
 
-        geometry.setSpaceSize(FloatSize(geometry.spaceSize().width(), space));
-        geometry.setPhaseY(actualHeight ? actualHeight - roundToInt(computedYPosition + top) % actualHeight : 0);
-    } else if (backgroundRepeatY == NoRepeatFill) {
+        if (space >= 0) {
+            computedYPosition = minimumValueForLength(Length(), availableHeight, &view(), true);
+            geometry.setSpaceSize(FloatSize(geometry.spaceSize().width(), space));
+            geometry.setPhaseY(actualHeight ? actualHeight - roundToInt(computedYPosition + top) % actualHeight : 0);
+        } else
+            backgroundRepeatY = NoRepeatFill;
+    }
+    if (backgroundRepeatY == NoRepeatFill) {
         int yOffset = fillLayer->backgroundYOrigin() == BottomEdge ? availableHeight - computedYPosition : computedYPosition;
         geometry.setNoRepeatY(top + yOffset);
         geometry.setSpaceSize(FloatSize(geometry.spaceSize().width(), 0));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to