2010-07-13 Andreas Kling <andreas.kling@nokia.com>
authorandreas.kling@nokia.com <andreas.kling@nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Jul 2010 11:04:53 +0000 (11:04 +0000)
committerandreas.kling@nokia.com <andreas.kling@nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Jul 2010 11:04:53 +0000 (11:04 +0000)
        Reviewed by Antti Koivisto.

        CSS3 background: Number of layers should be determined by background-image element count
        https://bugs.webkit.org/show_bug.cgi?id=41201

        Change FillLayer culling logic to discard all layers
        after the first one without an image set.

        Manual test: css3-background-layer-count.html

        * manual-tests/css3-background-layer-count.html: Added.
        * rendering/style/FillLayer.cpp:
        (WebCore::FillLayer::cullEmptyLayers):

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

WebCore/ChangeLog
WebCore/manual-tests/css3-background-layer-count.html [new file with mode: 0644]
WebCore/rendering/style/FillLayer.cpp

index c9afeaa..8c71d93 100644 (file)
@@ -1,3 +1,19 @@
+2010-07-13  Andreas Kling  <andreas.kling@nokia.com>
+
+        Reviewed by Antti Koivisto.
+
+        CSS3 background: Number of layers should be determined by background-image element count
+        https://bugs.webkit.org/show_bug.cgi?id=41201
+
+        Change FillLayer culling logic to discard all layers
+        after the first one without an image set.
+
+        Manual test: css3-background-layer-count.html
+
+        * manual-tests/css3-background-layer-count.html: Added.
+        * rendering/style/FillLayer.cpp:
+        (WebCore::FillLayer::cullEmptyLayers):
+
 2010-07-07  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/manual-tests/css3-background-layer-count.html b/WebCore/manual-tests/css3-background-layer-count.html
new file mode 100644 (file)
index 0000000..fc21fd7
--- /dev/null
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>CSS Test: Number of background properties greater than number of background images</title>
+        <style type="text/css">
+            div
+            {
+                margin: 10px;
+                width: 250px;
+                height: 250px;
+                border: thick solid black;
+            }
+            #test
+            {
+                background-image: url("resources/non-animated.gif"), url("resources/non-animated.gif"), url("resources/non-animated.gif");
+                background-position: right bottom, right top, left bottom, left center, right center;
+                background-repeat: no-repeat, no-repeat, repeat-x, repeat, repeat-y;
+            }
+            #reference
+            {
+                background-image: url("resources/non-animated.gif"), url("resources/non-animated.gif"), url("resources/non-animated.gif");
+                background-position: right bottom, right top, left bottom;
+                background-repeat: no-repeat, no-repeat, repeat-x;
+            }
+        </style>
+    </head>
+    <body>
+        <p>Test passes if the contents of the black boxes look exactly the same.</p>
+        <table>
+            <td>
+                <div id="test"></div>
+            </td>
+            <td>
+                <div id="reference"></div>
+            </td>
+        </table>
+    </body>
+</html>
index 59f3bb2..5808f3b 100644 (file)
@@ -243,15 +243,27 @@ void FillLayer::fillUnsetProperties()
 
 void FillLayer::cullEmptyLayers()
 {
+    // CSS3 background layering: the number of background layers is determined
+    // by the number of values in the 'background-image' property.
+    // http://www.w3.org/TR/css3-background/#layering
+
     FillLayer* next;
     for (FillLayer* p = this; p; p = next) {
         next = p->m_next;
-        if (next && !next->isImageSet() &&
-            !next->isXPositionSet() && !next->isYPositionSet() &&
-            !next->isAttachmentSet() && !next->isClipSet() &&
-            !next->isCompositeSet() && !next->isOriginSet() &&
-            !next->isRepeatXSet() && !next->isRepeatYSet()
-            && !next->isSizeSet()) {
+        if (!next)
+            break;
+
+        bool anyAttributeSet = next->isXPositionSet()
+            || next->isYPositionSet()
+            || next->isAttachmentSet()
+            || next->isClipSet()
+            || next->isCompositeSet()
+            || next->isOriginSet()
+            || next->isRepeatXSet()
+            || next->isRepeatYSet()
+            || next->isSizeSet();
+
+        if (!next->isImageSet() || !anyAttributeSet) {
             delete next;
             p->m_next = 0;
             break;