getPropertyValue for -webkit-margin-collapse returns null, should compute the shortha...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Feb 2013 06:14:15 +0000 (06:14 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Feb 2013 06:14:15 +0000 (06:14 +0000)
https://bugs.webkit.org/show_bug.cgi?id=110903

Patch by Uday Kiran <udaykiran@motorola.com> on 2013-02-26
Reviewed by Alexander Pavlov.

Source/WebCore:

getPropertyValue("-webkit-margin-collapse") should compute shorthand value
when -webkit-margin-collapse is specified in CSS.

Test: fast/css/getPropertyValue-webkit-margin-collapse.html

* css/StylePropertySet.cpp:
(WebCore::StylePropertySet::getPropertyValue):

LayoutTests:

Added test for getPropertyValue("-webkit-margin-collapse").

* fast/css/getPropertyValue-webkit-margin-collapse-expected.txt: Added.
* fast/css/getPropertyValue-webkit-margin-collapse.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/css/getPropertyValue-webkit-margin-collapse-expected.txt [new file with mode: 0644]
LayoutTests/fast/css/getPropertyValue-webkit-margin-collapse.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/StylePropertySet.cpp

index 0a1ac21..c340e5e 100644 (file)
@@ -1,5 +1,17 @@
 2013-02-26  Uday Kiran  <udaykiran@motorola.com>
 
+        getPropertyValue for -webkit-margin-collapse returns null, should compute the shorthand value
+        https://bugs.webkit.org/show_bug.cgi?id=110903
+
+        Reviewed by Alexander Pavlov.
+
+        Added test for getPropertyValue("-webkit-margin-collapse").
+
+        * fast/css/getPropertyValue-webkit-margin-collapse-expected.txt: Added.
+        * fast/css/getPropertyValue-webkit-margin-collapse.html: Added.
+
+2013-02-26  Uday Kiran  <udaykiran@motorola.com>
+
         getPropertyValue for -webkit-marquee returns null, should compute the shorthand value
         https://bugs.webkit.org/show_bug.cgi?id=110816
 
diff --git a/LayoutTests/fast/css/getPropertyValue-webkit-margin-collapse-expected.txt b/LayoutTests/fast/css/getPropertyValue-webkit-margin-collapse-expected.txt
new file mode 100644 (file)
index 0000000..9029e21
--- /dev/null
@@ -0,0 +1,16 @@
+Bug 110903: getPropertyValue for -webkit-margin-collapse returns null, should compute the shorthand value
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS webkitMarginCollapseValue("margin-collapse1") is 'collapse separate'
+PASS webkitMarginCollapseValue("margin-collapse2") is 'discard discard'
+PASS webkitMarginCollapseValue("margin-collapse3") is 'discard separate'
+NOTE: 'foo' is an illegal CSS value for '-webkit-margin-collapse'.
+PASS webkitMarginCollapseValue("margin-collapse4") is null
+NOTE: If only few longhand properties are specified, getPropertyValue for shorthand property returns null.
+PASS webkitMarginCollapseValue("margin-collapse5") is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+    
diff --git a/LayoutTests/fast/css/getPropertyValue-webkit-margin-collapse.html b/LayoutTests/fast/css/getPropertyValue-webkit-margin-collapse.html
new file mode 100644 (file)
index 0000000..17f2ed8
--- /dev/null
@@ -0,0 +1,42 @@
+<!DOCTYPE HTML>
+</html>
+  <head>
+    <title>-webkit-margin-collapse shorthand getPropertyValue test</title>
+    <style>
+      .test {
+        display: inline-block;
+        width: 5em;
+        height: 10em;
+      }
+    </style>
+    <script src="../js/resources/js-test-pre.js"></script>
+    <script>
+      if (window.testRunner)
+        testRunner.dumpAsText();
+    </script>
+  </head>
+  <body>
+    <div id="margin-collapse1" class="test" style="-webkit-margin-collapse: collapse separate;"></div>
+    <div id="margin-collapse2" class="test" style="-webkit-margin-collapse: discard;"></div>
+    <div id="margin-collapse3" class="test" style="-webkit-margin-before-collapse: discard; -webkit-margin-after-collapse: separate;"></div>
+    <div id="margin-collapse4" class="test" style="-webkit-margin-collapse: foo;"></div>
+    <div id="margin-collapse5" class="test" style="-webkit-margin-before-collapse: collapse;"></div>
+    <script>
+      description("<a href=\"https://bugs.webkit.org/show_bug.cgi?id=110903\">Bug 110903: getPropertyValue for -webkit-margin-collapse returns null, should compute the shorthand value</a>");
+
+      function webkitMarginCollapseValue(id) {
+        var element = document.getElementById(id);
+        return element.style.getPropertyValue("-webkit-margin-collapse");
+      }
+
+      shouldBe('webkitMarginCollapseValue("margin-collapse1")', "'collapse separate'");
+      shouldBe('webkitMarginCollapseValue("margin-collapse2")', "'discard discard'");
+      shouldBe('webkitMarginCollapseValue("margin-collapse3")', "'discard separate'");
+      debug("NOTE: 'foo' is an illegal CSS value for '-webkit-margin-collapse'.");
+      shouldBe('webkitMarginCollapseValue("margin-collapse4")', "null");
+      debug("NOTE: If only few longhand properties are specified, getPropertyValue for shorthand property returns null.")
+      shouldBe('webkitMarginCollapseValue("margin-collapse5")', "null");
+    </script>
+    <script src="../js/resources/js-test-post.js"></script>
+  </body>
+</html>
index b518c20..5771c4e 100644 (file)
@@ -1,5 +1,20 @@
 2013-02-26  Uday Kiran  <udaykiran@motorola.com>
 
+        getPropertyValue for -webkit-margin-collapse returns null, should compute the shorthand value
+        https://bugs.webkit.org/show_bug.cgi?id=110903
+
+        Reviewed by Alexander Pavlov.
+
+        getPropertyValue("-webkit-margin-collapse") should compute shorthand value
+        when -webkit-margin-collapse is specified in CSS.
+
+        Test: fast/css/getPropertyValue-webkit-margin-collapse.html
+
+        * css/StylePropertySet.cpp:
+        (WebCore::StylePropertySet::getPropertyValue):
+
+2013-02-26  Uday Kiran  <udaykiran@motorola.com>
+
         getPropertyValue for -webkit-marquee returns null, should compute the shorthand value
         https://bugs.webkit.org/show_bug.cgi?id=110816
 
index 363ecf9..ea92053 100644 (file)
@@ -168,6 +168,8 @@ String StylePropertySet::getPropertyValue(CSSPropertyID propertyID) const
         return fontValue();
     case CSSPropertyMargin:
         return get4Values(marginShorthand());
+    case CSSPropertyWebkitMarginCollapse:
+        return getShorthandValue(webkitMarginCollapseShorthand());
     case CSSPropertyOverflow:
         return getCommonValue(overflowShorthand());
     case CSSPropertyPadding: