Title: [102913] trunk
Revision
102913
Author
[email protected]
Date
2011-12-15 03:21:48 -0800 (Thu, 15 Dec 2011)

Log Message

[v8] Expose the "filter" property in V8CSSStyleDeclaration
https://bugs.webkit.org/show_bug.cgi?id=73426

Source/WebCore:

Reviewed by Adam Barth.

Test: fast/css/style-enumerate-properties.html

The "filter" CSS property used to be masked to be compliant with JSC, but JSC has supported
this property for quite a while.

* bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp:
(WebCore::hasCSSPropertyNamePrefix): clean up WTF prefixes
(WebCore::cssPropertyInfo): remove the "wasFilter" flag
(WebCore::V8CSSStyleDeclaration::namedPropertyEnumerator): remove the "filter" check
(WebCore::V8CSSStyleDeclaration::namedPropertyGetter): return the "filter" value as v8String

LayoutTests:

The original version of this test should have landed in r102578 but was lost
during the "revert-reland" cycle.

Reviewed by Adam Barth.

* fast/css/style-enumerate-properties-expected.txt: Added.
* fast/css/style-enumerate-properties.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (102912 => 102913)


--- trunk/LayoutTests/ChangeLog	2011-12-15 10:58:13 UTC (rev 102912)
+++ trunk/LayoutTests/ChangeLog	2011-12-15 11:21:48 UTC (rev 102913)
@@ -1,3 +1,16 @@
+2011-12-15  Alexander Pavlov  <[email protected]>
+
+        [v8] Expose the "filter" property in V8CSSStyleDeclaration
+        https://bugs.webkit.org/show_bug.cgi?id=73426
+
+        The original version of this test should have landed in r102578 but was lost
+        during the "revert-reland" cycle.
+
+        Reviewed by Adam Barth.
+
+        * fast/css/style-enumerate-properties-expected.txt: Added.
+        * fast/css/style-enumerate-properties.html: Added.
+
 2011-12-15  Vsevolod Vlasov  <[email protected]>
 
         Unreviewed revert of r102696 ([Navigation Timing] Use monotonicallyIncreasingTime() instead of currentTime()).

Added: trunk/LayoutTests/fast/css/style-enumerate-properties-expected.txt (0 => 102913)


--- trunk/LayoutTests/fast/css/style-enumerate-properties-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/style-enumerate-properties-expected.txt	2011-12-15 11:21:48 UTC (rev 102913)
@@ -0,0 +1,15 @@
+This test makes sure that CSSStyleDeclaration enumerates _javascript_ properties for defined and non-defined CSS properties, indexed properties, and properties defined on the prototype. See Bug 23946.
+PASS document.body.style.length is 2
+PASS '0' in document.body.style is true
+PASS '1' in document.body.style is true
+PASS 'textDecoration' in document.body.style is true
+PASS 'borderTopColor' in document.body.style is true
+PASS 'border' in document.body.style is true
+PASS 'font' in document.body.style is true
+PASS 'cssText' in document.body.style is true
+PASS 'getPropertyCSSValue' in document.body.style is true
+PASS The CSS property order is correct
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/css/style-enumerate-properties.html (0 => 102913)


--- trunk/LayoutTests/fast/css/style-enumerate-properties.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/style-enumerate-properties.html	2011-12-15 11:21:48 UTC (rev 102913)
@@ -0,0 +1,52 @@
+<head>
+    <script src=""
+    <script>
+        if (window.layoutTestController)
+            layoutTestController.dumpAsText();
+
+
+    </script>
+</head>
+<body style="text-decoration: underline; border-top-color: green">
+    <div id="description">This test makes sure that CSSStyleDeclaration enumerates _javascript_ properties for defined and non-defined CSS properties, indexed properties, and properties defined on the prototype. See <a href="" 23946</a>.</div>
+    <div id="console"></div>
+    <script>
+        shouldBe("document.body.style.length", "2");
+        shouldBeTrue("'0' in document.body.style");
+        shouldBeTrue("'1' in document.body.style");
+        shouldBeTrue("'textDecoration' in document.body.style");
+        shouldBeTrue("'borderTopColor' in document.body.style");
+        shouldBeTrue("'border' in document.body.style");
+        shouldBeTrue("'font' in document.body.style");
+        shouldBeTrue("'cssText' in document.body.style");
+        shouldBeTrue("'getPropertyCSSValue' in document.body.style");
+
+        // Test CSS property order.
+        var started;
+        var cssPropertyCount = 0;
+        var previous;
+        var seenFilter;
+        for (var p in document.body.style) {
+            if (p === "alignmentBaseline")
+                started = true;
+            if (!started)
+                continue;
+            if (p === "filter")
+                seenFilter = true;
+            if (previous && previous >= p) {
+                testFailed("Invalid CSS-mapped property order: '" + p + "' after '" + previous + "'");
+                break;
+            }
+            if (++cssPropertyCount <= 100)
+                previous = p;
+            else {
+                if (seenFilter)
+                    testPassed("The CSS property order is correct");
+                else
+                    testFailed("The 'filter' property was not enumerated");
+                break;
+            }
+        }
+    </script>
+    <script src=""
+</body>

Modified: trunk/Source/WebCore/ChangeLog (102912 => 102913)


--- trunk/Source/WebCore/ChangeLog	2011-12-15 10:58:13 UTC (rev 102912)
+++ trunk/Source/WebCore/ChangeLog	2011-12-15 11:21:48 UTC (rev 102913)
@@ -1,3 +1,21 @@
+2011-12-15  Alexander Pavlov  <[email protected]>
+
+        [v8] Expose the "filter" property in V8CSSStyleDeclaration
+        https://bugs.webkit.org/show_bug.cgi?id=73426
+
+        Reviewed by Adam Barth.
+
+        Test: fast/css/style-enumerate-properties.html
+
+        The "filter" CSS property used to be masked to be compliant with JSC, but JSC has supported
+        this property for quite a while.
+
+        * bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp:
+        (WebCore::hasCSSPropertyNamePrefix): clean up WTF prefixes
+        (WebCore::cssPropertyInfo): remove the "wasFilter" flag
+        (WebCore::V8CSSStyleDeclaration::namedPropertyEnumerator): remove the "filter" check
+        (WebCore::V8CSSStyleDeclaration::namedPropertyGetter): return the "filter" value as v8String
+
 2011-12-15  Hajime Morrita  <[email protected]>
 
         Unreviewed build fix attempt for Chromium Mac.

Modified: trunk/Source/WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp (102912 => 102913)


--- trunk/Source/WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp	2011-12-15 10:58:13 UTC (rev 102912)
+++ trunk/Source/WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp	2011-12-15 11:21:48 UTC (rev 102913)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007-2009 Google Inc. All rights reserved.
+ * Copyright (C) 2007-2011 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -66,17 +66,17 @@
 #ifndef NDEBUG
     ASSERT(*prefix);
     for (const char* p = prefix; *p; ++p)
-        ASSERT(WTF::isASCIILower(*p));
+        ASSERT(isASCIILower(*p));
     ASSERT(propertyName.length());
 #endif
 
-    if (WTF::toASCIILower(propertyName[0]) != prefix[0])
+    if (toASCIILower(propertyName[0]) != prefix[0])
         return false;
 
     unsigned length = propertyName.length();
     for (unsigned i = 1; i < length; ++i) {
         if (!prefix[i])
-            return WTF::isASCIIUpper(propertyName[i]);
+            return isASCIIUpper(propertyName[i]);
         if (propertyName[i] != prefix[i])
             return false;
     }
@@ -87,7 +87,6 @@
 public:
     int propID;
     bool hadPixelOrPosPrefix;
-    bool wasFilter;
 };
 
 // When getting properties on CSSStyleDeclarations, the name used from
@@ -130,14 +129,14 @@
                 || hasCSSPropertyNamePrefix(propertyName, "khtml")
                 || hasCSSPropertyNamePrefix(propertyName, "apple"))
             builder.append('-');
-        else if (WTF::isASCIIUpper(propertyName[0]))
+        else if (isASCIIUpper(propertyName[0]))
             return 0;
 
-        builder.append(WTF::toASCIILower(propertyName[i++]));
+        builder.append(toASCIILower(propertyName[i++]));
 
         for (; i < length; ++i) {
             UChar c = propertyName[i];
-            if (!WTF::isASCIIUpper(c))
+            if (!isASCIIUpper(c))
                 builder.append(c);
             else
                 builder.append(makeString('-', toASCIILower(c)));
@@ -148,7 +147,6 @@
         if (propertyID) {
             propInfo = new CSSPropertyInfo();
             propInfo->hadPixelOrPosPrefix = hadPixelOrPosPrefix;
-            propInfo->wasFilter = (propName == "filter");
             propInfo->propID = propertyID;
             map.add(propertyName, propInfo);
         }
@@ -160,18 +158,11 @@
 {
     typedef Vector<String, numCSSProperties - 1> PreAllocatedPropertyVector;
     DEFINE_STATIC_LOCAL(PreAllocatedPropertyVector, propertyNames, ());
-    DEFINE_STATIC_LOCAL(String, filterString, ("filter"));
     static unsigned propertyNamesLength = 0;
 
     if (propertyNames.isEmpty()) {
-        for (int id = firstCSSProperty; id < firstCSSProperty + numCSSProperties; ++id) {
-            String jsPropertyName = getJSPropertyName(static_cast<CSSPropertyID>(id));
-            // The "filter" property is present in the list but should not be provided in the enumeration.
-            // See a comment in the V8CSSStyleDeclaration::namedPropertyGetter() implementation.
-            // FIXME: this should be removed (see bug 73426).
-            if (jsPropertyName != filterString)
-                propertyNames.append(jsPropertyName);
-        }
+        for (int id = firstCSSProperty; id < firstCSSProperty + numCSSProperties; ++id)
+            propertyNames.append(getJSPropertyName(static_cast<CSSPropertyID>(id)));
         sort(propertyNames.begin(), propertyNames.end(), codePointCompareLessThan);
         propertyNamesLength = propertyNames.size();
     }
@@ -221,11 +212,6 @@
     if (result.isNull())
         result = "";  // convert null to empty string.
 
-    // The 'filter' attribute is made undetectable in KJS/WebKit
-    // to avoid confusion with IE's filter extension.
-    if (propInfo->wasFilter)
-        return v8UndetectableString(result);
-
     return v8String(result);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to