WebCore:
authorhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Jun 2008 21:19:46 +0000 (21:19 +0000)
committerhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Jun 2008 21:19:46 +0000 (21:19 +0000)
2008-06-20  David Hyatt  <hyatt@apple.com>

        Make sure CSS variables work inside the inline style attribute.

        Reviewed by Beth

        Added fast/css/variables/inline-style-test.html

        * css/CSSMutableStyleDeclaration.cpp:
        (WebCore::CSSMutableStyleDeclaration::removeProperty):
        (WebCore::CSSMutableStyleDeclaration::addParsedProperties):

LayoutTests:

2008-06-20  David Hyatt  <hyatt@apple.com>

        Make sure CSS variables work inside the inline style attribute.

        Reviewed by Beth

        * fast/css/variables/inline-style-test.html: Added.
        * platform/mac/fast/css/variables/inline-style-test-expected.checksum: Added.
        * platform/mac/fast/css/variables/inline-style-test-expected.png: Added.
        * platform/mac/fast/css/variables/inline-style-test-expected.txt: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/css/variables/inline-style-test.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/css/variables/inline-style-test-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/css/variables/inline-style-test-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/css/variables/inline-style-test-expected.txt [new file with mode: 0644]
WebCore/ChangeLog
WebCore/css/CSSMutableStyleDeclaration.cpp

index 8b537c2..4b8544e 100644 (file)
@@ -1,5 +1,16 @@
 2008-06-20  David Hyatt  <hyatt@apple.com>
 
+        Make sure CSS variables work inside the inline style attribute.
+
+        Reviewed by Beth
+
+        * fast/css/variables/inline-style-test.html: Added.
+        * platform/mac/fast/css/variables/inline-style-test-expected.checksum: Added.
+        * platform/mac/fast/css/variables/inline-style-test-expected.png: Added.
+        * platform/mac/fast/css/variables/inline-style-test-expected.txt: Added.
+
+2008-06-20  David Hyatt  <hyatt@apple.com>
+
         Add tests of the DOM APIs for addition, removal and iteration.
 
         Reviewed by Sam
diff --git a/LayoutTests/fast/css/variables/inline-style-test.html b/LayoutTests/fast/css/variables/inline-style-test.html
new file mode 100644 (file)
index 0000000..3fcf64e
--- /dev/null
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+<head>
+<style>
+@-webkit-variables {
+    foreground: green;
+    background: rgb(255, 255, 255);
+}
+
+body {
+    background-color: red;
+}
+</style>
+</head>
+<body style="color: -webkit-var(foreground); background-color: -webkit-var(background);">
+This text should be green on a white background.  There should be no red visible.
+</body>
+</html>
+
diff --git a/LayoutTests/platform/mac/fast/css/variables/inline-style-test-expected.checksum b/LayoutTests/platform/mac/fast/css/variables/inline-style-test-expected.checksum
new file mode 100644 (file)
index 0000000..034a2cf
--- /dev/null
@@ -0,0 +1 @@
+020fc0c8512570b74bb6c6b0912af27d
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/css/variables/inline-style-test-expected.png b/LayoutTests/platform/mac/fast/css/variables/inline-style-test-expected.png
new file mode 100644 (file)
index 0000000..32cbdba
Binary files /dev/null and b/LayoutTests/platform/mac/fast/css/variables/inline-style-test-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/css/variables/inline-style-test-expected.txt b/LayoutTests/platform/mac/fast/css/variables/inline-style-test-expected.txt
new file mode 100644 (file)
index 0000000..277ab9b
--- /dev/null
@@ -0,0 +1,10 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x34
+  RenderBlock {HTML} at (0,0) size 800x34
+    RenderBody {BODY} at (8,8) size 784x18 [color=#008000] [bgcolor=#FFFFFF]
+      RenderText {#text} at (0,0) size 511x18
+        text run at (0,0) width 316: "This text should be green on a white background. "
+        text run at (316,0) width 195: "There should be no red visible."
+      RenderText {#text} at (0,0) size 0x0
+      RenderText {#text} at (0,0) size 0x0
index 3409692..89c0200 100644 (file)
@@ -1,5 +1,17 @@
 2008-06-20  David Hyatt  <hyatt@apple.com>
 
+        Make sure CSS variables work inside the inline style attribute.
+
+        Reviewed by Beth
+
+        Added fast/css/variables/inline-style-test.html
+
+        * css/CSSMutableStyleDeclaration.cpp:
+        (WebCore::CSSMutableStyleDeclaration::removeProperty):
+        (WebCore::CSSMutableStyleDeclaration::addParsedProperties):
+
+2008-06-20  David Hyatt  <hyatt@apple.com>
+
         Add support for the CSSVariablesRule and CSSVariablesDeclaration DOM APIs.  These allow querying of
         variables names and values, as well as iteration, setting and removal.
 
index 5979112..a54edd9 100644 (file)
@@ -515,6 +515,8 @@ String CSSMutableStyleDeclaration::removeProperty(int propertyID, bool notifyCha
         if (propertyID == (*it).m_id) {
             if (returnText)
                 value = (*it).value()->cssText();
+            if ((*it).value()->isVariableDependentValue())
+                m_variableDependentValueCount--;
             m_values.remove(it);
             if (notifyChanged)
                 setChanged();
@@ -643,7 +645,7 @@ void CSSMutableStyleDeclaration::parseDeclaration(const String& styleDeclaration
     setChanged();
 }
 
-void CSSMutableStyleDeclaration::addParsedProperties(const CSSProperty * const * properties, int numProperties)
+void CSSMutableStyleDeclaration::addParsedProperties(const CSSProperty* const* properties, int numProperties)
 {
     for (int i = 0; i < numProperties; ++i) {
         // Only add properties that have no !important counterpart present
@@ -651,6 +653,8 @@ void CSSMutableStyleDeclaration::addParsedProperties(const CSSProperty * const *
             removeProperty(properties[i]->id(), false);
             ASSERT(properties[i]);
             m_values.append(*properties[i]);
+            if (properties[i]->value()->isVariableDependentValue())
+                m_variableDependentValueCount++;
         }
     }
     // FIXME: This probably should have a call to setChanged() if something changed. We may also wish to add