LayoutTests:
authorthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Dec 2005 00:40:56 +0000 (00:40 +0000)
committerthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Dec 2005 00:40:56 +0000 (00:40 +0000)
        Reviewed by Hyatt.

        Test case for our CSS shorthand serialization.

        * fast/dom/css-shortHands-expected.checksum: Added.
        * fast/dom/css-shortHands-expected.png: Added.
        * fast/dom/css-shortHands-expected.txt: Added.
        * fast/dom/css-shortHands.html: Added.

WebCore:

        Reviewed by Dave Hyatt.

        Test: fast/dom/css-shortHands.html

        First cut at leaving off implicit values in shorthand properties.
        Need to account for multipl backgrounds and "border" later.

        * khtml/css/css_valueimpl.cpp:
        (DOM::CSSMutableStyleDeclarationImpl::get4Values):
        (DOM::CSSMutableStyleDeclarationImpl::getShortHandValue):

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

LayoutTests/ChangeLog
LayoutTests/fast/dom/css-shortHands-expected.checksum [new file with mode: 0644]
LayoutTests/fast/dom/css-shortHands-expected.png [new file with mode: 0644]
LayoutTests/fast/dom/css-shortHands-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/css-shortHands.html [new file with mode: 0644]
WebCore/ChangeLog-2005-12-19
WebCore/khtml/css/css_valueimpl.cpp

index 8183042e36b169ea182d0f6165682c8f286bcf06..e072afde6f7838d51449a2f3177212375ac89b32 100644 (file)
@@ -1,3 +1,14 @@
+2005-12-13  Timothy Hatcher  <timothy@apple.com>
+
+        Reviewed by Hyatt.
+
+        Test case for our CSS shorthand serialization.
+
+        * fast/dom/css-shortHands-expected.checksum: Added.
+        * fast/dom/css-shortHands-expected.png: Added.
+        * fast/dom/css-shortHands-expected.txt: Added.
+        * fast/dom/css-shortHands.html: Added.
+
 2005-12-13  Anders Carlsson  <andersca@mac.com>
 
         Reviewed by Darin.
diff --git a/LayoutTests/fast/dom/css-shortHands-expected.checksum b/LayoutTests/fast/dom/css-shortHands-expected.checksum
new file mode 100644 (file)
index 0000000..78a2a8d
--- /dev/null
@@ -0,0 +1 @@
+6f74d902253de3da4002005d2e89078c
\ No newline at end of file
diff --git a/LayoutTests/fast/dom/css-shortHands-expected.png b/LayoutTests/fast/dom/css-shortHands-expected.png
new file mode 100644 (file)
index 0000000..e7c28fd
Binary files /dev/null and b/LayoutTests/fast/dom/css-shortHands-expected.png differ
diff --git a/LayoutTests/fast/dom/css-shortHands-expected.txt b/LayoutTests/fast/dom/css-shortHands-expected.txt
new file mode 100644 (file)
index 0000000..ddf32ce
--- /dev/null
@@ -0,0 +1,19 @@
+layer at (0,0) size 800x600
+  RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x579
+      RenderBlock {PRE} at (0,0) size 784x180
+        RenderText {TEXT} at (0,0) size 120x180
+          text run at (0,0) width 24: "1px"
+          text run at (0,15) width 56: "1px 2px"
+          text run at (0,30) width 88: "1px 2px 3px"
+          text run at (0,45) width 120: "1px 2px 3px 4px"
+          text run at (0,60) width 24: "1px"
+          text run at (0,75) width 56: "1px 2px"
+          text run at (0,90) width 88: "1px 2px 3px"
+          text run at (0,105) width 120: "1px 2px 3px 4px"
+          text run at (0,120) width 24: "red"
+          text run at (0,135) width 24: "red"
+          text run at (0,150) width 24: "red"
+          text run at (0,165) width 24: "red"
diff --git a/LayoutTests/fast/dom/css-shortHands.html b/LayoutTests/fast/dom/css-shortHands.html
new file mode 100644 (file)
index 0000000..faace46
--- /dev/null
@@ -0,0 +1,39 @@
+<html>
+<head>
+<style>
+div { margin: 1px; }
+div { margin: 1px 2px; }
+div { margin: 1px 2px 3px; }
+div { margin: 1px 2px 3px 4px; }
+
+div { padding: 1px; }
+div { padding: 1px 2px; }
+div { padding: 1px 2px 3px; }
+div { padding: 1px 2px 3px 4px; }
+
+div { border-top: red; }
+div { border-bottom: red; }
+div { border-left: red; }
+div { border-right: red; }
+</style>
+</head>
+<body>
+<pre id="result"></pre>
+<script>
+var styleSheet = document.styleSheets.item(0);
+var s = "";
+for (var i = 0; i < styleSheet.cssRules.length; i++) {
+       var rule = styleSheet.cssRules[i];
+       var prop = null;
+       if (i < 4) prop = "margin";
+       else if (i >= 4 && i < 8) prop = "padding";
+       else if (i == 8) prop = "border-top";
+       else if (i == 9) prop = "border-bottom";
+       else if (i == 10) prop = "border-left";
+       else if (i == 11) prop = "border-right";
+       s += rule.style.getPropertyValue(prop) + "\n";
+}
+document.getElementById("result").innerText = s;
+</script>
+</body>
+</html>
index beed39331f734d0d6473b6230aaeb6aad9dc9e41..7734454b67b5bbe305bf76ec04a6b05b5bfb5b4f 100644 (file)
@@ -1,3 +1,16 @@
+2005-12-13  Timothy Hatcher  <timothy@apple.com>
+
+        Reviewed by Dave Hyatt.
+
+        Test: fast/dom/css-shortHands.html
+
+        First cut at leaving off implicit values in shorthand properties.
+        Need to account for multipl backgrounds and "border" later.
+
+        * khtml/css/css_valueimpl.cpp:
+        (DOM::CSSMutableStyleDeclarationImpl::get4Values):
+        (DOM::CSSMutableStyleDeclarationImpl::getShortHandValue):
+
 2005-12-13  Anders Carlsson  <andersca@mac.com>
 
         * ChangeLog: Add titles to the recent bugzilla bugs.
index 1c7d03025be8bb8c4cf7550df2cfbce73b689ede..24f4962954b89f383067d468234a59a04bba05f2 100644 (file)
@@ -312,16 +312,17 @@ DOMString CSSMutableStyleDeclarationImpl::getPropertyValue( int propertyID ) con
 DOMString CSSMutableStyleDeclarationImpl::get4Values( const int* properties ) const
 {
     DOMString res;
-    for ( int i = 0 ; i < 4 ; ++i ) {
-        CSSValueImpl* value = getPropertyCSSValue( properties[i] );
-        if ( !value ) { // apparently all 4 properties must be specified.
-            return DOMString();
+    for (int i = 0; i < 4; ++i) {
+        if (!isPropertyImplicit(properties[i])) {
+            CSSValueImpl* value = getPropertyCSSValue(properties[i]);
+            if (!value) // apparently all 4 properties must be specified.
+                return DOMString();
+            value->ref();
+            if (!res.isNull())
+                res += " ";
+            res += value->cssText();
+            value->deref();
         }
-        value->ref();
-        if ( i > 0 )
-            res += " ";
-        res += value->cssText();
-        value->deref();
     }
     return res;
 }
@@ -329,14 +330,16 @@ DOMString CSSMutableStyleDeclarationImpl::get4Values( const int* properties ) co
 DOMString CSSMutableStyleDeclarationImpl::getShortHandValue( const int* properties, int number ) const
 {
     DOMString res;
-    for ( int i = 0 ; i < number ; ++i ) {
-        CSSValueImpl* value = getPropertyCSSValue( properties[i] );
-        if ( value ) { // TODO provide default value if !value
-            value->ref();
-            if ( !res.isNull() )
-                res += " ";
-            res += value->cssText();
-            value->deref();
+    for (int i = 0; i < number; ++i) {
+        if (!isPropertyImplicit(properties[i])) {
+            CSSValueImpl* value = getPropertyCSSValue(properties[i]);
+            if (value) { // TODO provide default value if !value
+                value->ref();
+                if (!res.isNull())
+                    res += " ";
+                res += value->cssText();
+                value->deref();
+            }
         }
     }
     return res;