Title: [121296] trunk
Revision
121296
Author
[email protected]
Date
2012-06-26 16:08:09 -0700 (Tue, 26 Jun 2012)

Log Message

background-size:0 shows as 1px instead of invisible
https://bugs.webkit.org/show_bug.cgi?id=86942

Patch by Joe Thomas <[email protected]> on 2012-06-26
Reviewed by Eric Seidel.

As per the specification http://www.w3.org/TR/css3-background/#background-size, if the background image's width or height resolves to zero,
this causes the image not to be displayed. The effect should be the same as if it had been a transparent image.
This is also mentioned in http://www.w3.org/TR/2002/WD-css3-background-20020802/#background-size.

Source/WebCore:

Test: fast/backgrounds/zero-background-size.html

* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::calculateFillTileSize):

LayoutTests:

* fast/backgrounds/size/zero.html:
* fast/backgrounds/zero-background-size-expected.html: Added.
* fast/backgrounds/zero-background-size.html: Added.
* platform/chromium/TestExpectations:
* platform/efl/TestExpectations:
* platform/gtk/TestExpectations:
* platform/mac/fast/backgrounds/size/zero-expected.png:
* platform/mac/fast/backgrounds/size/zero-expected.txt:
* platform/qt/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (121295 => 121296)


--- trunk/LayoutTests/ChangeLog	2012-06-26 23:02:00 UTC (rev 121295)
+++ trunk/LayoutTests/ChangeLog	2012-06-26 23:08:09 UTC (rev 121296)
@@ -1,3 +1,24 @@
+2012-06-26  Joe Thomas  <[email protected]>
+
+        background-size:0 shows as 1px instead of invisible
+        https://bugs.webkit.org/show_bug.cgi?id=86942
+
+        Reviewed by Eric Seidel.
+
+        As per the specification http://www.w3.org/TR/css3-background/#background-size, if the background image's width or height resolves to zero,
+        this causes the image not to be displayed. The effect should be the same as if it had been a transparent image.
+        This is also mentioned in http://www.w3.org/TR/2002/WD-css3-background-20020802/#background-size.
+
+        * fast/backgrounds/size/zero.html:
+        * fast/backgrounds/zero-background-size-expected.html: Added.
+        * fast/backgrounds/zero-background-size.html: Added.
+        * platform/chromium/TestExpectations:
+        * platform/efl/TestExpectations:
+        * platform/gtk/TestExpectations:
+        * platform/mac/fast/backgrounds/size/zero-expected.png:
+        * platform/mac/fast/backgrounds/size/zero-expected.txt:
+        * platform/qt/TestExpectations:
+
 2012-06-26  Ryosuke Niwa  <[email protected]>
 
         Fix a test after r121286.

Modified: trunk/LayoutTests/fast/backgrounds/size/zero.html (121295 => 121296)


--- trunk/LayoutTests/fast/backgrounds/size/zero.html	2012-06-26 23:02:00 UTC (rev 121295)
+++ trunk/LayoutTests/fast/backgrounds/size/zero.html	2012-06-26 23:08:09 UTC (rev 121296)
@@ -5,9 +5,9 @@
     Test for <i><a href="" Web Inspector freezes beneath Image::drawPattern()</a> Bug</i>.
 </p>
 <p>
-    There should be four blue squares with black borders. WebKit should not hang or assert.
+    There should be four empty squares with black borders. WebKit should not hang or assert.
 </p>
-<div style="-webkit-background-size: 0 0;"></div>
-<div style="-webkit-background-size: 0 32px;"></div>
-<div style="-webkit-background-size: 2px 0;"></div>
-<div style="-webkit-background-size: auto 8px;"></div>
+<div style="background-size: 0 0;"></div>
+<div style="background-size: 0 32px;"></div>
+<div style="background-size: 2px 0;"></div>
+<div style="background-size: auto 8px;"></div>

Added: trunk/LayoutTests/fast/backgrounds/zero-background-size-expected.html (0 => 121296)


--- trunk/LayoutTests/fast/backgrounds/zero-background-size-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/backgrounds/zero-background-size-expected.html	2012-06-26 23:08:09 UTC (rev 121296)
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML>
+<html>
+<style type="text/css">
+div {
+    width: 200px;
+    height: 200px;
+}
+</style>
+<div></div>
+<div></div>
+<div></div>
+<div></div>
+<div></div>
+<div></div>
+<div></div>
+<div></div>
+</html>

Added: trunk/LayoutTests/fast/backgrounds/zero-background-size.html (0 => 121296)


--- trunk/LayoutTests/fast/backgrounds/zero-background-size.html	                        (rev 0)
+++ trunk/LayoutTests/fast/backgrounds/zero-background-size.html	2012-06-26 23:08:09 UTC (rev 121296)
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML>
+<html>
+<style type="text/css">
+div {
+    width: 200px;
+    height: 200px;
+}
+</style>
+<div style="background: url('./resources/dot.png') center / 0px 50px repeat-x"></div>
+<div style="background: url('./resources/dot.png') center / 50px 0px repeat-x"></div>
+<div style="background: url('./resources/dot.png') center / 0px repeat-x"></div>
+<div style="background: url('./resources/dot.png') center / 0px 0px repeat-x"></div>
+<div style="background: url('./resources/dot.png') center / 0% 50% repeat-x"></div>
+<div style="background: url('./resources/dot.png') center / 50% 0% repeat-x"></div>
+<div style="background: url('./resources/dot.png') center / 0% repeat-x"></div>
+<div style="background: url('./resources/dot.png') center / 0% 0% repeat-x"></div>
+</html>

Modified: trunk/LayoutTests/platform/chromium/TestExpectations (121295 => 121296)


--- trunk/LayoutTests/platform/chromium/TestExpectations	2012-06-26 23:02:00 UTC (rev 121295)
+++ trunk/LayoutTests/platform/chromium/TestExpectations	2012-06-26 23:08:09 UTC (rev 121296)
@@ -3729,6 +3729,9 @@
 BUGWK89166 : http/tests/messaging/cross-domain-message-event-dispatch.html = TEXT
 BUGWK89167 : media/track/track-cue-rendering-snap-to-lines-not-set.html = TEXT
 
+// Needs Rebaseline after bug 86942
+BUGWK86942 : fast/backgrounds/size/zero.html = IMAGE+TEXT
+
 // Timing out on some Windows bots
 BUGWK89510 WIN : gamepad/gamepad-polling-access.html = PASS TIMEOUT
 

Modified: trunk/LayoutTests/platform/efl/TestExpectations (121295 => 121296)


--- trunk/LayoutTests/platform/efl/TestExpectations	2012-06-26 23:02:00 UTC (rev 121295)
+++ trunk/LayoutTests/platform/efl/TestExpectations	2012-06-26 23:08:09 UTC (rev 121296)
@@ -700,6 +700,9 @@
 BUGWK88729 SKIP : userscripts/window-onerror-for-isolated-world-1.html = PASS
 BUGWK88729 SKIP : userscripts/window-onerror-for-isolated-world-2.html = PASS
 
+// Needs Rebaseline after bug 86942
+BUGWK86942 : fast/backgrounds/size/zero.html = IMAGE+TEXT
+
 // Needs rebaseline after the bots cycle.
 BUG_OJAN : tables/mozilla/bugs/bug131020.html = TEXT IMAGE IMAGE+TEXT
 

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (121295 => 121296)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2012-06-26 23:02:00 UTC (rev 121295)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2012-06-26 23:08:09 UTC (rev 121296)
@@ -1234,6 +1234,9 @@
 
 BUGWK57346 : fast/text/justify-ideograph-leading-expansion.html = TEXT
 
+// Needs Rebaseline after bug 86942
+BUGWK86942 : fast/backgrounds/size/zero.html = TEXT
+
 BUGWK83800 : plugins/get-url-with-blank-target.html = TEXT
 
 BUGWK84037 : fast/text/international/spaces-combined-in-vertical-text.html = TEXT

Modified: trunk/LayoutTests/platform/mac/fast/backgrounds/size/zero-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/mac/fast/backgrounds/size/zero-expected.txt (121295 => 121296)


--- trunk/LayoutTests/platform/mac/fast/backgrounds/size/zero-expected.txt	2012-06-26 23:02:00 UTC (rev 121295)
+++ trunk/LayoutTests/platform/mac/fast/backgrounds/size/zero-expected.txt	2012-06-26 23:08:09 UTC (rev 121296)
@@ -15,8 +15,8 @@
         RenderText {#text} at (580,0) size 4x18
           text run at (580,0) width 4: "."
       RenderBlock {P} at (0,34) size 784x18
-        RenderText {#text} at (0,0) size 558x18
-          text run at (0,0) width 558: "There should be four blue squares with black borders. WebKit should not hang or assert."
+        RenderText {#text} at (0,0) size 570x18
+          text run at (0,0) width 570: "There should be four empty squares with black borders. WebKit should not hang or assert."
       RenderBlock {DIV} at (8,68) size 106x106 [border: (3px solid #000000)]
       RenderBlock {DIV} at (8,182) size 106x106 [border: (3px solid #000000)]
       RenderBlock {DIV} at (8,296) size 106x106 [border: (3px solid #000000)]

Modified: trunk/LayoutTests/platform/qt/TestExpectations (121295 => 121296)


--- trunk/LayoutTests/platform/qt/TestExpectations	2012-06-26 23:02:00 UTC (rev 121295)
+++ trunk/LayoutTests/platform/qt/TestExpectations	2012-06-26 23:08:09 UTC (rev 121296)
@@ -91,6 +91,9 @@
 // Paletted PNG with ICC color profiles not working.
 BUGWK86722 SKIP : fast/images/paletted-png-with-color-profile.html = PASS
 
+// Needs Rebaseline after bug 86942
+BUGWK86942 : fast/backgrounds/size/zero.html = TEXT
+
 // Needs rebaseline after the bots cycle.
 BUG_OJAN : tables/mozilla/bugs/bug131020.html = PASS TEXT IMAGE IMAGE+TEXT
 

Modified: trunk/Source/WebCore/ChangeLog (121295 => 121296)


--- trunk/Source/WebCore/ChangeLog	2012-06-26 23:02:00 UTC (rev 121295)
+++ trunk/Source/WebCore/ChangeLog	2012-06-26 23:08:09 UTC (rev 121296)
@@ -1,3 +1,19 @@
+2012-06-26  Joe Thomas  <[email protected]>
+
+        background-size:0 shows as 1px instead of invisible
+        https://bugs.webkit.org/show_bug.cgi?id=86942
+
+        Reviewed by Eric Seidel.
+
+        As per the specification http://www.w3.org/TR/css3-background/#background-size, if the background image's width or height resolves to zero,
+        this causes the image not to be displayed. The effect should be the same as if it had been a transparent image.
+        This is also mentioned in http://www.w3.org/TR/2002/WD-css3-background-20020802/#background-size.
+
+        Test: fast/backgrounds/zero-background-size.html
+
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::calculateFillTileSize):
+
 2012-06-26  Adam Klein  <[email protected]>
 
         [v8] Clean up generated Dictionary-handling code

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (121295 => 121296)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2012-06-26 23:02:00 UTC (rev 121295)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2012-06-26 23:08:09 UTC (rev 121296)
@@ -1070,7 +1070,7 @@
                 h = imageIntrinsicSize.height();
             }
             
-            return IntSize(max(1, w), max(1, h));
+            return IntSize(max(0, w), max(0, h));
         }
         case SizeNone: {
             // If both values are ‘auto’ then the intrinsic width and/or height of the image should be used, if any.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to