background-size:0 shows as 1px instead of invisible
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Jun 2012 23:08:09 +0000 (23:08 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Jun 2012 23:08:09 +0000 (23:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=86942

Patch by Joe Thomas <joethomas@motorola.com> 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:

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

12 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/backgrounds/size/zero.html
LayoutTests/fast/backgrounds/zero-background-size-expected.html [new file with mode: 0644]
LayoutTests/fast/backgrounds/zero-background-size.html [new file with mode: 0644]
LayoutTests/platform/chromium/TestExpectations
LayoutTests/platform/efl/TestExpectations
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/mac/fast/backgrounds/size/zero-expected.png
LayoutTests/platform/mac/fast/backgrounds/size/zero-expected.txt
LayoutTests/platform/qt/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBoxModelObject.cpp

index 6500f52..b75dec6 100644 (file)
@@ -1,3 +1,24 @@
+2012-06-26  Joe Thomas  <joethomas@motorola.com>
+
+        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  <rniwa@webkit.org>
 
         Fix a test after r121286.
index 281494d..d5a6830 100644 (file)
@@ -5,9 +5,9 @@
     Test for <i><a href="http://bugs.webkit.org/show_bug.cgi?id=15750">REGRESSION(r27173): 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>
diff --git a/LayoutTests/fast/backgrounds/zero-background-size-expected.html b/LayoutTests/fast/backgrounds/zero-background-size-expected.html
new file mode 100644 (file)
index 0000000..516b42e
--- /dev/null
@@ -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>
diff --git a/LayoutTests/fast/backgrounds/zero-background-size.html b/LayoutTests/fast/backgrounds/zero-background-size.html
new file mode 100644 (file)
index 0000000..555b16a
--- /dev/null
@@ -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>
index 9cad67a..f165e2f 100644 (file)
@@ -3729,6 +3729,9 @@ BUGCR132898 : http/tests/websocket/tests/hybi/workers/close.html = TEXT
 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
 
index e7d9b4b..508cae5 100644 (file)
@@ -700,6 +700,9 @@ BUGWK86722 SKIP : fast/images/paletted-png-with-color-profile.html = PASS
 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
 
index b9ffed1..5a11e3b 100644 (file)
@@ -1234,6 +1234,9 @@ BUGWK51027 RELEASE : plugins/refcount-leaks.html = TEXT
 
 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
index 92b8f15..f1c1f62 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/backgrounds/size/zero-expected.png and b/LayoutTests/platform/mac/fast/backgrounds/size/zero-expected.png differ
index 1ceff43..85a4e24 100644 (file)
@@ -15,8 +15,8 @@ layer at (0,0) size 800x600
         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)]
index 4760254..5dc35a5 100644 (file)
@@ -91,6 +91,9 @@ BUGWK85405 SKIP: tables/mozilla/bugs/bug10296-1.html = TEXT
 // 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
 
index cabb3d7..2a6a372 100755 (executable)
@@ -1,3 +1,19 @@
+2012-06-26  Joe Thomas  <joethomas@motorola.com>
+
+        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  <adamk@chromium.org>
 
         [v8] Clean up generated Dictionary-handling code
index b77438d..a35a206 100644 (file)
@@ -1070,7 +1070,7 @@ IntSize RenderBoxModelObject::calculateFillTileSize(const FillLayer* fillLayer,
                 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.