Title: [269314] trunk
Revision
269314
Author
[email protected]
Date
2020-11-03 10:45:53 -0800 (Tue, 03 Nov 2020)

Log Message

Unreviewed, reverting r268564, r268957, and r268962.
https://bugs.webkit.org/show_bug.cgi?id=218525

Caused 9% binary size increase in WebCore

Reverted changesets:

"CSSStyleDeclaration breaks JS spec (properties not showing up
in Object.getOwnPropertyNames)"
https://bugs.webkit.org/show_bug.cgi?id=217623
https://trac.webkit.org/changeset/268564

"Remove support for 'pixel' and 'pos' CSSOM prefixes"
https://bugs.webkit.org/show_bug.cgi?id=119712
https://trac.webkit.org/changeset/268957

"Remove non-standard 'css'/'Css' prefixed properties on
CSSStyleDeclaration"
https://bugs.webkit.org/show_bug.cgi?id=218158
https://trac.webkit.org/changeset/268962

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (269313 => 269314)


--- trunk/LayoutTests/ChangeLog	2020-11-03 18:00:54 UTC (rev 269313)
+++ trunk/LayoutTests/ChangeLog	2020-11-03 18:45:53 UTC (rev 269314)
@@ -1,3 +1,26 @@
+2020-11-03  Commit Queue  <[email protected]>
+
+        Unreviewed, reverting r268564, r268957, and r268962.
+        https://bugs.webkit.org/show_bug.cgi?id=218525
+
+        Caused 9% binary size increase in WebCore
+
+        Reverted changesets:
+
+        "CSSStyleDeclaration breaks JS spec (properties not showing up
+        in Object.getOwnPropertyNames)"
+        https://bugs.webkit.org/show_bug.cgi?id=217623
+        https://trac.webkit.org/changeset/268564
+
+        "Remove support for 'pixel' and 'pos' CSSOM prefixes"
+        https://bugs.webkit.org/show_bug.cgi?id=119712
+        https://trac.webkit.org/changeset/268957
+
+        "Remove non-standard 'css'/'Css' prefixed properties on
+        CSSStyleDeclaration"
+        https://bugs.webkit.org/show_bug.cgi?id=218158
+        https://trac.webkit.org/changeset/268962
+
 2020-11-03  Hector Lopez  <[email protected]>
 
         Test expectation adjustment to cover internal testers

Modified: trunk/LayoutTests/fast/css/style-enumerate-properties-expected.txt (269313 => 269314)


--- trunk/LayoutTests/fast/css/style-enumerate-properties-expected.txt	2020-11-03 18:00:54 UTC (rev 269313)
+++ trunk/LayoutTests/fast/css/style-enumerate-properties-expected.txt	2020-11-03 18:45:53 UTC (rev 269314)
@@ -11,6 +11,7 @@
 PASS 'bogus-random-String' in document.body.style is false
 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

Modified: trunk/LayoutTests/fast/css/style-enumerate-properties.html (269313 => 269314)


--- trunk/LayoutTests/fast/css/style-enumerate-properties.html	2020-11-03 18:00:54 UTC (rev 269313)
+++ trunk/LayoutTests/fast/css/style-enumerate-properties.html	2020-11-03 18:45:53 UTC (rev 269314)
@@ -23,6 +23,33 @@
         shouldBeFalse("'bogus-random-String' 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 <= 400)
+                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/LayoutTests/fast/dom/CSSStyleDeclaration/css-properties-case-sensitive-expected.txt (269313 => 269314)


--- trunk/LayoutTests/fast/dom/CSSStyleDeclaration/css-properties-case-sensitive-expected.txt	2020-11-03 18:00:54 UTC (rev 269313)
+++ trunk/LayoutTests/fast/dom/CSSStyleDeclaration/css-properties-case-sensitive-expected.txt	2020-11-03 18:45:53 UTC (rev 269314)
@@ -3,8 +3,31 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+normal cases
+
 PASS element.style.zIndex is '1'
 PASS element.style.ZIndex is undefined.
+
+"css" prefix
+
+PASS element.style.cssZIndex is '1'
+PASS element.style.CssZIndex is '1'
+PASS element.style.CsszIndex is undefined.
+PASS element.style.csszIndex is undefined.
+
+"pixel" prefix
+
+PASS element.style.pixelZIndex is 1
+PASS element.style.PixelZIndex is 1
+PASS element.style.pixelzIndex is undefined.
+PASS element.style.PixelzIndex is undefined.
+
+"pos" prefix
+
+PASS element.style.posZIndex is 1
+PASS element.style.PosZIndex is 1
+PASS element.style.poszIndex is undefined.
+PASS element.style.PoszIndex is undefined.
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/dom/CSSStyleDeclaration/css-properties-case-sensitive.html (269313 => 269314)


--- trunk/LayoutTests/fast/dom/CSSStyleDeclaration/css-properties-case-sensitive.html	2020-11-03 18:00:54 UTC (rev 269313)
+++ trunk/LayoutTests/fast/dom/CSSStyleDeclaration/css-properties-case-sensitive.html	2020-11-03 18:45:53 UTC (rev 269314)
@@ -12,9 +12,38 @@
 var element = document.createElement('a');
 element.style.zIndex = 1;
 
+debug('normal cases');
+debug('');
+
 shouldBe("element.style.zIndex", "'1'");
 shouldBeUndefined("element.style.ZIndex");
 
+debug('');
+debug('"css" prefix');
+debug('');
+
+shouldBe("element.style.cssZIndex", "'1'");
+shouldBe("element.style.CssZIndex", "'1'");
+shouldBeUndefined("element.style.CsszIndex");
+shouldBeUndefined("element.style.csszIndex");
+
+debug('');
+debug('"pixel" prefix');
+debug('');
+
+shouldBe("element.style.pixelZIndex", "1");
+shouldBe("element.style.PixelZIndex", "1");
+shouldBeUndefined("element.style.pixelzIndex");
+shouldBeUndefined("element.style.PixelzIndex");
+
+debug('');
+debug('"pos" prefix');
+debug('');
+
+shouldBe("element.style.posZIndex", "1");
+shouldBe("element.style.PosZIndex", "1");
+shouldBeUndefined("element.style.poszIndex");
+shouldBeUndefined("element.style.PoszIndex");
 </script>
 <script src=""
 </body>

Modified: trunk/LayoutTests/fast/dom/CSSStyleDeclaration/cssstyledeclaration-properties-descriptor-expected.txt (269313 => 269314)


--- trunk/LayoutTests/fast/dom/CSSStyleDeclaration/cssstyledeclaration-properties-descriptor-expected.txt	2020-11-03 18:00:54 UTC (rev 269313)
+++ trunk/LayoutTests/fast/dom/CSSStyleDeclaration/cssstyledeclaration-properties-descriptor-expected.txt	2020-11-03 18:45:53 UTC (rev 269314)
@@ -3,8 +3,7 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS descriptor['get'] is an instance of Function
-PASS descriptor['set'] is an instance of Function
+PASS descriptor['writable'] is true
 PASS descriptor['enumerable'] is true
 PASS descriptor['configurable'] is true
 PASS successfullyParsed is true

Modified: trunk/LayoutTests/fast/dom/CSSStyleDeclaration/cssstyledeclaration-properties-descriptor.html (269313 => 269314)


--- trunk/LayoutTests/fast/dom/CSSStyleDeclaration/cssstyledeclaration-properties-descriptor.html	2020-11-03 18:00:54 UTC (rev 269313)
+++ trunk/LayoutTests/fast/dom/CSSStyleDeclaration/cssstyledeclaration-properties-descriptor.html	2020-11-03 18:45:53 UTC (rev 269314)
@@ -5,9 +5,8 @@
     <script>
         description("This tests the descriptor of CSSStyleDeclaration properties.");
 
-        var descriptor = Object.getOwnPropertyDescriptor(document.body.style.__proto__, 'color');
-        shouldBeType("descriptor['get']", "Function");
-        shouldBeType("descriptor['set']", "Function");
+        var descriptor = Object.getOwnPropertyDescriptor(document.body.style, 'color');
+        shouldBeTrue("descriptor['writable']");
         shouldBeTrue("descriptor['enumerable']");
         shouldBeTrue("descriptor['configurable']");
     </script>

Modified: trunk/LayoutTests/fast/dom/domListEnumeration-expected.txt (269313 => 269314)


--- trunk/LayoutTests/fast/dom/domListEnumeration-expected.txt	2020-11-03 18:00:54 UTC (rev 269313)
+++ trunk/LayoutTests/fast/dom/domListEnumeration-expected.txt	2020-11-03 18:45:53 UTC (rev 269314)
@@ -65,6 +65,14 @@
 PASS resultArray[2].i is '2'
 PASS resultArray[2].item is cssRuleList.item(2)
 
+[object CSSStyleDeclaration]
+PASS resultArray[0].i is '0'
+PASS resultArray[0].item is cssStyleDeclaration.item(0)
+PASS resultArray[1].i is '1'
+PASS resultArray[1].item is cssStyleDeclaration.item(1)
+PASS resultArray[2].i is '2'
+PASS resultArray[2].item is cssStyleDeclaration.item(2)
+
 [object CSSValueList]
 PASS resultArray.length is 10
 PASS resultArray[0].i is '0'

Modified: trunk/LayoutTests/fast/dom/domListEnumeration.html (269313 => 269314)


--- trunk/LayoutTests/fast/dom/domListEnumeration.html	2020-11-03 18:00:54 UTC (rev 269313)
+++ trunk/LayoutTests/fast/dom/domListEnumeration.html	2020-11-03 18:45:53 UTC (rev 269314)
@@ -177,6 +177,17 @@
 shouldBe("resultArray[2].i", "'2'");
 shouldBe("resultArray[2].item", "cssRuleList.item(2)");
 
+// CSSStyleDeclaration
+//debug(escapeHTML(document.getElementsByTagName('style')));
+var cssStyleDeclaration = document.styleSheets[2].cssRules[0].style;
+resultArray = iterateList(cssStyleDeclaration);
+shouldBe("resultArray[0].i", "'0'");
+shouldBe("resultArray[0].item", "cssStyleDeclaration.item(0)");
+shouldBe("resultArray[1].i", "'1'");
+shouldBe("resultArray[1].item", "cssStyleDeclaration.item(1)");
+shouldBe("resultArray[2].i", "'2'");
+shouldBe("resultArray[2].item", "cssStyleDeclaration.item(2)");
+
 // CSSValueList
 var cssValueList = window.getComputedStyle(document.getElementsByTagName('ol')[0]).getPropertyCSSValue('border-spacing');
 resultArray = iterateList(cssValueList);

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (269313 => 269314)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2020-11-03 18:00:54 UTC (rev 269313)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2020-11-03 18:45:53 UTC (rev 269314)
@@ -1,3 +1,26 @@
+2020-11-03  Commit Queue  <[email protected]>
+
+        Unreviewed, reverting r268564, r268957, and r268962.
+        https://bugs.webkit.org/show_bug.cgi?id=218525
+
+        Caused 9% binary size increase in WebCore
+
+        Reverted changesets:
+
+        "CSSStyleDeclaration breaks JS spec (properties not showing up
+        in Object.getOwnPropertyNames)"
+        https://bugs.webkit.org/show_bug.cgi?id=217623
+        https://trac.webkit.org/changeset/268564
+
+        "Remove support for 'pixel' and 'pos' CSSOM prefixes"
+        https://bugs.webkit.org/show_bug.cgi?id=119712
+        https://trac.webkit.org/changeset/268957
+
+        "Remove non-standard 'css'/'Css' prefixed properties on
+        CSSStyleDeclaration"
+        https://bugs.webkit.org/show_bug.cgi?id=218158
+        https://trac.webkit.org/changeset/268962
+
 2020-11-02  Diego Pino Garcia  <[email protected]>
 
         Update baselines of tests failing after WPT resync

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/cssstyledeclaration-properties-expected.txt (269313 => 269314)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/cssstyledeclaration-properties-expected.txt	2020-11-03 18:00:54 UTC (rev 269313)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/cssstyledeclaration-properties-expected.txt	2020-11-03 18:45:53 UTC (rev 269314)
@@ -1,3 +1,3 @@
 
-PASS CSS Test: CSSStyleDeclaration properties are defined as WebIDL attributes, not using getOwnPropertyNames()
+FAIL CSS Test: CSSStyleDeclaration properties are defined as WebIDL attributes, not using getOwnPropertyNames() assert_false: shouldn't have an own property for WebIDL attributes expected false got true
 

Modified: trunk/LayoutTests/js/dom/put-override-should-not-use-ic.html (269313 => 269314)


--- trunk/LayoutTests/js/dom/put-override-should-not-use-ic.html	2020-11-03 18:00:54 UTC (rev 269313)
+++ trunk/LayoutTests/js/dom/put-override-should-not-use-ic.html	2020-11-03 18:45:53 UTC (rev 269314)
@@ -8,10 +8,10 @@
 <script>
     test(function() {
         function transitioned() {
-            dataset = document.createElement('p').dataset;
+            style = document.createElement('p').style;
             for(var i = 0; i < 20; i++)
-                dataset['p'+i] = i;
-            return dataset;
+                style['p'+i] = i;
+            return style;
         }
 
         function putter(o) {

Modified: trunk/LayoutTests/transitions/transitions-parsing-expected.txt (269313 => 269314)


--- trunk/LayoutTests/transitions/transitions-parsing-expected.txt	2020-11-03 18:00:54 UTC (rev 269313)
+++ trunk/LayoutTests/transitions/transitions-parsing-expected.txt	2020-11-03 18:45:53 UTC (rev 269314)
@@ -6,6 +6,8 @@
 Valid transition-property values.
 PASS computedStyle.transitionProperty is 'all'
 PASS computedStyle.webkitTransitionProperty is 'all'
+PASS Object.keys(style).indexOf('transitionProperty') is not -1
+PASS Object.keys(style).indexOf('webkitTransitionProperty') is -1
 PASS style.transitionProperty is 'none'
 PASS computedStyle.transitionProperty is 'none'
 PASS style.webkitTransitionProperty is 'none'
@@ -98,6 +100,8 @@
 Valid transition-duration values.
 PASS computedStyle.transitionDuration is '0s'
 PASS computedStyle.webkitTransitionDuration is '0s'
+PASS Object.keys(style).indexOf('transitionDuration') is not -1
+PASS Object.keys(style).indexOf('webkitTransitionDuration') is -1
 PASS style.transitionDuration is '0s'
 PASS computedStyle.transitionDuration is '0s'
 PASS style.webkitTransitionDuration is '0s'
@@ -146,6 +150,8 @@
 Valid transition-timing-function values.
 PASS computedStyle.transitionTimingFunction is 'ease'
 PASS computedStyle.webkitTransitionTimingFunction is 'ease'
+PASS Object.keys(style).indexOf('transitionTimingFunction') is not -1
+PASS Object.keys(style).indexOf('webkitTransitionTimingFunction') is -1
 PASS style.transitionTimingFunction is 'linear'
 PASS computedStyle.transitionTimingFunction is 'linear'
 PASS style.webkitTransitionTimingFunction is 'linear'
@@ -294,6 +300,8 @@
 Valid transition-delay values.
 PASS computedStyle.transitionDelay is '0s'
 PASS computedStyle.webkitTransitionDelay is '0s'
+PASS Object.keys(style).indexOf('transitionDelay') is not -1
+PASS Object.keys(style).indexOf('webkitTransitionDelay') is -1
 PASS style.transitionDelay is '0s'
 PASS computedStyle.transitionDelay is '0s'
 PASS style.webkitTransitionDelay is '0s'
@@ -342,6 +350,8 @@
 Valid transition shorthand values.
 PASS computedStyle.transition is 'all 0s ease 0s'
 PASS computedStyle.webkitTransition is 'all 0s ease 0s'
+PASS Object.keys(style).indexOf('transition') is not -1
+PASS Object.keys(style).indexOf('webkitTransition') is -1
 PASS style.transition is 'none'
 PASS computedStyle.transition is 'none 0s ease 0s'
 PASS style.webkitTransition is 'none'

Modified: trunk/LayoutTests/transitions/transitions-parsing.html (269313 => 269314)


--- trunk/LayoutTests/transitions/transitions-parsing.html	2020-11-03 18:00:54 UTC (rev 269313)
+++ trunk/LayoutTests/transitions/transitions-parsing.html	2020-11-03 18:45:53 UTC (rev 269314)
@@ -30,6 +30,8 @@
 shouldBe("computedStyle.webkitTransitionProperty", "'all'");
 
 style.transitionProperty = "none";
+shouldNotBe("Object.keys(style).indexOf('transitionProperty')", "-1");
+shouldBe("Object.keys(style).indexOf('webkitTransitionProperty')", "-1");
 shouldBe("style.transitionProperty", "'none'");
 shouldBe("computedStyle.transitionProperty", "'none'");
 shouldBe("style.webkitTransitionProperty", "'none'");
@@ -174,6 +176,8 @@
 shouldBe("computedStyle.webkitTransitionDuration", "'0s'");
 
 style.transitionDuration = "0s";
+shouldNotBe("Object.keys(style).indexOf('transitionDuration')", "-1");
+shouldBe("Object.keys(style).indexOf('webkitTransitionDuration')", "-1");
 shouldBe("style.transitionDuration", "'0s'");
 shouldBe("computedStyle.transitionDuration", "'0s'");
 shouldBe("style.webkitTransitionDuration", "'0s'");
@@ -252,6 +256,8 @@
 shouldBe("computedStyle.webkitTransitionTimingFunction", "'ease'");
 
 style.transitionTimingFunction = "linear";
+shouldNotBe("Object.keys(style).indexOf('transitionTimingFunction')", "-1");
+shouldBe("Object.keys(style).indexOf('webkitTransitionTimingFunction')", "-1");
 shouldBe("style.transitionTimingFunction", "'linear'");
 shouldBe("computedStyle.transitionTimingFunction", "'linear'");
 shouldBe("style.webkitTransitionTimingFunction", "'linear'");
@@ -479,6 +485,8 @@
 shouldBe("computedStyle.webkitTransitionDelay", "'0s'");
 
 style.transitionDelay = "0s";
+shouldNotBe("Object.keys(style).indexOf('transitionDelay')", "-1");
+shouldBe("Object.keys(style).indexOf('webkitTransitionDelay')", "-1");
 shouldBe("style.transitionDelay", "'0s'");
 shouldBe("computedStyle.transitionDelay", "'0s'");
 shouldBe("style.webkitTransitionDelay", "'0s'");
@@ -557,6 +565,8 @@
 shouldBe("computedStyle.webkitTransition", "'all 0s ease 0s'");
 
 style.transition = "none";
+shouldNotBe("Object.keys(style).indexOf('transition')", "-1");
+shouldBe("Object.keys(style).indexOf('webkitTransition')", "-1");
 shouldBe("style.transition", "'none'");
 shouldBe("computedStyle.transition", "'none 0s ease 0s'");
 shouldBe("style.webkitTransition", "'none'");

Modified: trunk/Source/WebCore/CMakeLists.txt (269313 => 269314)


--- trunk/Source/WebCore/CMakeLists.txt	2020-11-03 18:00:54 UTC (rev 269313)
+++ trunk/Source/WebCore/CMakeLists.txt	2020-11-03 18:45:53 UTC (rev 269314)
@@ -1901,7 +1901,7 @@
 
 # Generate CSS property names
 add_custom_command(
-    OUTPUT ${WebCore_DERIVED_SOURCES_DIR}/CSSProperties.json ${WebCore_DERIVED_SOURCES_DIR}/CSSPropertyNames.h ${WebCore_DERIVED_SOURCES_DIR}/CSSPropertyNames.cpp ${WebCore_DERIVED_SOURCES_DIR}/CSSPropertyNames.gperf ${WebCore_DERIVED_SOURCES_DIR}/StyleBuilderGenerated.cpp ${WebCore_DERIVED_SOURCES_DIR}/StylePropertyShorthandFunctions.h ${WebCore_DERIVED_SOURCES_DIR}/StylePropertyShorthandFunctions.cpp ${WebCore_DERIVED_SOURCES_DIR}/CSSStyleDeclaration+PropertyNames.idl
+    OUTPUT ${WebCore_DERIVED_SOURCES_DIR}/CSSProperties.json ${WebCore_DERIVED_SOURCES_DIR}/CSSPropertyNames.h ${WebCore_DERIVED_SOURCES_DIR}/CSSPropertyNames.cpp ${WebCore_DERIVED_SOURCES_DIR}/CSSPropertyNames.gperf ${WebCore_DERIVED_SOURCES_DIR}/StyleBuilderGenerated.cpp ${WebCore_DERIVED_SOURCES_DIR}/StylePropertyShorthandFunctions.h ${WebCore_DERIVED_SOURCES_DIR}/StylePropertyShorthandFunctions.cpp
     MAIN_DEPENDENCY ${WEBCORE_DIR}/css/makeprop.pl
     DEPENDS ${WebCore_CSS_PROPERTY_NAMES}
     WORKING_DIRECTORY ${WebCore_DERIVED_SOURCES_DIR}
@@ -1911,7 +1911,6 @@
 list(APPEND WebCore_SOURCES ${WebCore_DERIVED_SOURCES_DIR}/CSSPropertyNames.cpp)
 list(APPEND WebCore_SOURCES ${WebCore_DERIVED_SOURCES_DIR}/StyleBuilderGenerated.cpp)
 list(APPEND WebCore_SOURCES ${WebCore_DERIVED_SOURCES_DIR}/StylePropertyShorthandFunctions.cpp)
-list(APPEND WebCore_IDL_FILES ${WebCore_DERIVED_SOURCES_DIR}/CSSStyleDeclaration+PropertyNames.idl)
 ADD_SOURCE_WEBCORE_DERIVED_DEPENDENCIES(${WEBCORE_DIR}/css/CSSParser.cpp CSSValueKeywords.h)
 
 # Generate CSS value keywords

Modified: trunk/Source/WebCore/ChangeLog (269313 => 269314)


--- trunk/Source/WebCore/ChangeLog	2020-11-03 18:00:54 UTC (rev 269313)
+++ trunk/Source/WebCore/ChangeLog	2020-11-03 18:45:53 UTC (rev 269314)
@@ -1,3 +1,26 @@
+2020-11-03  Commit Queue  <[email protected]>
+
+        Unreviewed, reverting r268564, r268957, and r268962.
+        https://bugs.webkit.org/show_bug.cgi?id=218525
+
+        Caused 9% binary size increase in WebCore
+
+        Reverted changesets:
+
+        "CSSStyleDeclaration breaks JS spec (properties not showing up
+        in Object.getOwnPropertyNames)"
+        https://bugs.webkit.org/show_bug.cgi?id=217623
+        https://trac.webkit.org/changeset/268564
+
+        "Remove support for 'pixel' and 'pos' CSSOM prefixes"
+        https://bugs.webkit.org/show_bug.cgi?id=119712
+        https://trac.webkit.org/changeset/268957
+
+        "Remove non-standard 'css'/'Css' prefixed properties on
+        CSSStyleDeclaration"
+        https://bugs.webkit.org/show_bug.cgi?id=218158
+        https://trac.webkit.org/changeset/268962
+
 2020-11-03  Wenson Hsieh  <[email protected]>
 
         Replace DisplayList::itemCount with DisplayList::isEmpty

Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (269313 => 269314)


--- trunk/Source/WebCore/DerivedSources-output.xcfilelist	2020-11-03 18:00:54 UTC (rev 269313)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist	2020-11-03 18:45:53 UTC (rev 269314)
@@ -3,7 +3,6 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/ByteLengthQueuingStrategyBuiltins.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/CSSPropertyNames.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/CSSPropertyNames.h
-$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/CSSStyleDeclaration+PropertyNames.idl
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/CSSValueKeywords.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/CSSValueKeywords.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/ColorData.cpp
@@ -293,8 +292,6 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSRule.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSRuleList.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSRuleList.h
-$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSStyleDeclaration+PropertyNames.cpp
-$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSStyleDeclaration+PropertyNames.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSStyleDeclaration.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSStyleDeclaration.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSStyleRule.cpp

Modified: trunk/Source/WebCore/DerivedSources.make (269313 => 269314)


--- trunk/Source/WebCore/DerivedSources.make	2020-11-03 18:00:54 UTC (rev 269313)
+++ trunk/Source/WebCore/DerivedSources.make	2020-11-03 18:45:53 UTC (rev 269314)
@@ -1276,7 +1276,6 @@
     $(WebCore)/xml/XPathResult.idl \
     $(WebCore)/xml/XSLTProcessor.idl \
     InternalSettingsGenerated.idl \
-    CSSStyleDeclaration+PropertyNames.idl \
 #
 
 # --------
@@ -1372,7 +1371,6 @@
     StyleBuilderGenerated.cpp \
     StylePropertyShorthandFunctions.cpp \
     StylePropertyShorthandFunctions.h \
-    CSSStyleDeclaration+PropertyNames.idl \
     UserAgentStyleSheets.h \
     WebKitFontFamilyNames.cpp \
     WebKitFontFamilyNames.h \
@@ -1400,7 +1398,6 @@
     StyleBuilderGenerated.cpp \
     StylePropertyShorthandFunctions.cpp \
     StylePropertyShorthandFunctions.h \
-    CSSStyleDeclaration+PropertyNames.idl \
 #
 CSS_PROPERTY_NAME_FILES_PATTERNS = $(subst .,%,$(CSS_PROPERTY_NAME_FILES))
 

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (269313 => 269314)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2020-11-03 18:00:54 UTC (rev 269313)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2020-11-03 18:45:53 UTC (rev 269314)
@@ -1187,6 +1187,8 @@
     push(@$outputArray, $indent . "auto nativeValue = ${nativeValue};\n");
     push(@$outputArray, $indent . "RETURN_IF_EXCEPTION(throwScope, true);\n");
 
+    push(@$outputArray, $indent . "bool isPropertySupported = true;\n") if $namedSetterOperation->extendedAttributes->{CallNamedSetterOnlyForSupportedProperties};
+
     my $namedSetterFunctionName = $namedSetterOperation->name || "setNamedItem";
     my $nativeValuePassExpression = PassArgumentExpression("nativeValue", $argument);
 
@@ -1193,6 +1195,7 @@
     my @arguments = ();
     push(@arguments, "propertyNameToString(propertyName)");
     push(@arguments, $nativeValuePassExpression);
+    push(@arguments, "isPropertySupported") if $namedSetterOperation->extendedAttributes->{CallNamedSetterOnlyForSupportedProperties};
 
     my $functionString = "thisObject->wrapped().${namedSetterFunctionName}(" . join(", ", @arguments) . ")";
     push(@$outputArray, $indent . "invokeFunctorPropagatingExceptionIfNecessary(*lexicalGlobalObject, throwScope, [&] { return ${functionString}; });\n");
@@ -1247,6 +1250,10 @@
         }
 
         GenerateInvokeNamedPropertySetter($outputArray, $additionalIndent . "        ", $interface, $namedSetterOperation, "value");
+        if ($namedSetterOperation->extendedAttributes->{CallNamedSetterOnlyForSupportedProperties}) {
+            push(@$outputArray, $additionalIndent . "        if (!isPropertySupported)\n");
+            push(@$outputArray, $additionalIndent . "            return JSObject::put(thisObject, lexicalGlobalObject, propertyName, value, putPropertySlot);\n");
+        }
         push(@$outputArray, $additionalIndent . "        return true;\n");
 
         if (!$legacyOverrideBuiltins) {
@@ -1279,7 +1286,7 @@
     my $indexedSetterOperation = GetIndexedSetterOperation($interface);
     
     my $legacyOverrideBuiltins = $codeGenerator->InheritsExtendedAttribute($interface, "LegacyOverrideBuiltIns");
-    my $ellidesCallsToBase = ($namedSetterOperation && $legacyOverrideBuiltins) && !$interface->extendedAttributes->{Plugin};
+    my $ellidesCallsToBase = ($namedSetterOperation && $legacyOverrideBuiltins) && !$interface->extendedAttributes->{Plugin} && !$namedSetterOperation->extendedAttributes->{CallNamedSetterOnlyForSupportedProperties};
     
     push(@$outputArray, "bool ${className}::putByIndex(JSCell* cell, JSGlobalObject* lexicalGlobalObject, unsigned index, JSValue value, bool" . (!$ellidesCallsToBase ? " shouldThrow" : "") . ")\n");
     push(@$outputArray, "{\n");
@@ -1321,6 +1328,10 @@
         }
         
         GenerateInvokeNamedPropertySetter($outputArray, $additionalIndent . "    ", $interface, $namedSetterOperation, "value");
+        if ($namedSetterOperation->extendedAttributes->{CallNamedSetterOnlyForSupportedProperties}) {
+            push(@$outputArray, $additionalIndent . "    if (!isPropertySupported)\n");
+            push(@$outputArray, $additionalIndent . "        return JSObject::putByIndex(cell, lexicalGlobalObject, index, value, shouldThrow);\n");
+        }
         push(@$outputArray, $additionalIndent . "    return true;\n");
         
         if (!$legacyOverrideBuiltins) {
@@ -1464,7 +1475,10 @@
             
             # 2.2.2. Invoke the named property setter with P and Desc.[[Value]].
             GenerateInvokeNamedPropertySetter($outputArray, $additionalIndent . "        ", $interface, $namedSetterOperation, "propertyDescriptor.value()");
-
+            if ($namedSetterOperation->extendedAttributes->{CallNamedSetterOnlyForSupportedProperties}) {
+                push(@$outputArray, $additionalIndent . "    if (!isPropertySupported)\n");
+                push(@$outputArray, $additionalIndent . "        return JSObject::defineOwnProperty(object, lexicalGlobalObject, propertyName, propertyDescriptor, shouldThrow);\n");
+            }
             # 2.2.3. Return true.
             push(@$outputArray, $additionalIndent . "        return true;\n");
         }
@@ -2190,6 +2204,8 @@
 {
     my $interface = shift;
 
+    return 0 if $interface->extendedAttributes->{DefaultDefineOwnProperty};
+
     return $interface->extendedAttributes->{CustomDefineOwnProperty}
         || GetIndexedSetterOperation($interface)
         || GetNamedSetterOperation($interface);
@@ -3962,9 +3978,6 @@
 sub ToMethodName
 {
     my $param = shift;
-    
-    return $param if $param =~ /^CSSOM/;
-
     my $ret = lcfirst($param);
     $ret =~ s/cSS/css/ if $ret =~ /^cSS/;
     $ret =~ s/dOM/dom/ if $ret =~ /^dOM/;
@@ -5280,14 +5293,6 @@
             AddToImplIncludes("JS" . $constructorType . ".h", $conditional);
             push(@$outputArray, "    return JS" . $constructorType . "::${constructorGetter}(JSC::getVM(&lexicalGlobalObject), thisObject.globalObject());\n");
         }
-    } elsif ($attribute->extendedAttributes->{CSSProperty}) {
-        $implIncludes{"CSSPropertyNames.h"} = 1;
-        my $propertyID = $attribute->extendedAttributes->{CSSProperty};
-        
-        my $getterName = "getPropertyValueInternal";
-        my $toJSExpression = NativeToJSValueUsingReferences($attribute, $interface, "impl.${getterName}(CSSProperty${propertyID})", "*thisObject.globalObject()");
-        push(@$outputArray, "    auto& impl = thisObject.wrapped();\n");
-        push(@$outputArray, "    RELEASE_AND_RETURN(throwScope, (${toJSExpression}));\n");
     } else {
         if ($attribute->extendedAttributes->{CachedAttribute}) {
             push(@$outputArray, "    if (JSValue cachedValue = thisObject.m_" . $attribute->name . ".get())\n");
@@ -5432,23 +5437,6 @@
         push(@$outputArray, "    vm.heap.writeBarrier(&thisObject, value);\n");
         push(@$outputArray, "    ensureStillAliveHere(value);\n\n");
         push(@$outputArray, "    return true;\n");
-    } elsif ($attribute->extendedAttributes->{CSSProperty}) {
-        $implIncludes{"CSSPropertyNames.h"} = 1;
-
-        my $propertyID = $attribute->extendedAttributes->{CSSProperty};
-        
-        my $setterName = "setPropertyValueInternal";
-
-        my $exceptionThrower = GetAttributeExceptionThrower($interface, $attribute);
-        my $toNativeExpression = JSValueToNative($interface, $attribute, "value", $attribute->extendedAttributes->{Conditional}, "&lexicalGlobalObject", "lexicalGlobalObject", "thisObject", "*thisObject.globalObject()", $exceptionThrower);
-
-        push(@$outputArray, "    auto& impl = thisObject.wrapped();\n");
-        push(@$outputArray, "    auto nativeValue = ${toNativeExpression};\n");
-        push(@$outputArray, "    RETURN_IF_EXCEPTION(throwScope, false);\n");
-        push(@$outputArray, "    AttributeSetter::call(lexicalGlobalObject, throwScope, [&] {\n");
-        push(@$outputArray, "        return impl.${setterName}(CSSProperty${propertyID}, WTFMove(nativeValue));\n");
-        push(@$outputArray, "    });\n");
-        push(@$outputArray, "    return true;\n");
     } elsif ($isConstructor) {
         my $constructorType = $attribute->type->name;
         $constructorType =~ s/Constructor$//;

Modified: trunk/Source/WebCore/bindings/scripts/IDLAttributes.json (269313 => 269314)


--- trunk/Source/WebCore/bindings/scripts/IDLAttributes.json	2020-11-03 18:00:54 UTC (rev 269313)
+++ trunk/Source/WebCore/bindings/scripts/IDLAttributes.json	2020-11-03 18:45:53 UTC (rev 269314)
@@ -39,10 +39,6 @@
                 "url": "https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions"
             }
         },
-        "CSSProperty": {
-            "contextsAllowed": ["attribute"],
-            "values": ["*"]
-        },
         "CachedAttribute": {
             "contextsAllowed": ["attribute"]
         },
@@ -53,6 +49,9 @@
         "CallbackThisObject": {
             "contextsAllowed": ["callback-function", "operation"]
         },
+        "CallNamedSetterOnlyForSupportedProperties": {
+            "contextsAllowed": ["operation"]
+        },
         "CallWith": {
             "contextsAllowed": ["attribute", "operation"],
             "values": ["Document", "ExecState", "ScriptExecutionContext", "GlobalObject", "ActiveWindow", "FirstWindow", "ResponsibleDocument", "World"],
@@ -158,6 +157,9 @@
         "Default": {
             "contextsAllowed": ["operation"]
         },
+        "DefaultDefineOwnProperty": {
+            "contextsAllowed": ["interface"]
+        },
         "DisabledByQuirk": {
             "contextsAllowed": ["interface", "dictionary", "enum", "attribute", "operation", "constant", "dictionary-member", "includes"],
             "values": ["*"],

Modified: trunk/Source/WebCore/css/CSSStyleDeclaration.cpp (269313 => 269314)


--- trunk/Source/WebCore/css/CSSStyleDeclaration.cpp	2020-11-03 18:00:54 UTC (rev 269313)
+++ trunk/Source/WebCore/css/CSSStyleDeclaration.cpp	2020-11-03 18:45:53 UTC (rev 269314)
@@ -34,6 +34,8 @@
 #include "Settings.h"
 #include "StyledElement.h"
 #include <wtf/IsoMallocInlines.h>
+#include <wtf/Optional.h>
+#include <wtf/Variant.h>
 
 namespace WebCore {
 
@@ -44,10 +46,14 @@
 enum class PropertyNamePrefix {
     None,
     Epub,
+    CSS,
+    Pixel,
+    Pos,
     WebKit
 };
 
-template<size_t prefixCStringLength> static inline bool matchesCSSPropertyNamePrefix(const StringImpl& propertyName, const char (&prefix)[prefixCStringLength])
+template<size_t prefixCStringLength>
+static inline bool matchesCSSPropertyNamePrefix(const StringImpl& propertyName, const char (&prefix)[prefixCStringLength])
 {
     size_t prefixLength = prefixCStringLength - 1;
 
@@ -84,10 +90,20 @@
     // First character of the prefix within the property name may be upper or lowercase.
     UChar firstChar = toASCIILower(propertyName[0]);
     switch (firstChar) {
+    case 'c':
+        if (matchesCSSPropertyNamePrefix(propertyName, "css"))
+            return PropertyNamePrefix::CSS;
+        break;
     case 'e':
         if (matchesCSSPropertyNamePrefix(propertyName, "epub"))
             return PropertyNamePrefix::Epub;
         break;
+    case 'p':
+        if (matchesCSSPropertyNamePrefix(propertyName, "pos"))
+            return PropertyNamePrefix::Pos;
+        if (matchesCSSPropertyNamePrefix(propertyName, "pixel"))
+            return PropertyNamePrefix::Pixel;
+        break;
     case 'w':
         if (matchesCSSPropertyNamePrefix(propertyName, "webkit"))
             return PropertyNamePrefix::WebKit;
@@ -120,24 +136,31 @@
     *buffer++ = '-';
 }
 
-static CSSPropertyID parseJavaScriptCSSPropertyName(const AtomString& propertyName)
+struct CSSPropertyInfo {
+    CSSPropertyID propertyID;
+    bool hadPixelOrPosPrefix;
+};
+
+static CSSPropertyInfo parseJavaScriptCSSPropertyName(const AtomString& propertyName)
 {
-    using CSSPropertyIDMap = HashMap<String, CSSPropertyID>;
-    static NeverDestroyed<CSSPropertyIDMap> propertyIDCache;
+    using CSSPropertyInfoMap = HashMap<String, CSSPropertyInfo>;
+    static NeverDestroyed<CSSPropertyInfoMap> propertyInfoCache;
 
-    CSSPropertyID propertyID = CSSPropertyInvalid;
+    CSSPropertyInfo propertyInfo = { CSSPropertyInvalid, false };
 
     auto* propertyNameString = propertyName.impl();
     if (!propertyNameString)
-        return propertyID;
+        return propertyInfo;
     unsigned length = propertyNameString->length();
     if (!length)
-        return propertyID;
+        return propertyInfo;
 
-    propertyID = propertyIDCache.get().get(propertyNameString);
-    if (propertyID)
-        return propertyID;
+    propertyInfo = propertyInfoCache.get().get(propertyNameString);
+    if (propertyInfo.propertyID)
+        return propertyInfo;
 
+    bool hadPixelOrPosPrefix = false;
+
     constexpr size_t bufferSize = maxCSSPropertyNameLength + 1;
     char buffer[bufferSize];
     char* bufferPtr = buffer;
@@ -144,13 +167,25 @@
     const char* name = bufferPtr;
 
     unsigned i = 0;
-    // Prefix Webkit becomes "-webkit-".
-    // Prefix Epub becomes "-epub-".
+    // Prefixes CSS, Pixel, Pos are ignored.
+    // Prefixes Apple, KHTML and Webkit are transposed to "-webkit-".
+    // The prefix "Epub" becomes "-epub-".
     switch (propertyNamePrefix(*propertyNameString)) {
     case PropertyNamePrefix::None:
         if (isASCIIUpper((*propertyNameString)[0]))
-            return propertyID;
+            return propertyInfo;
         break;
+    case PropertyNamePrefix::CSS:
+        i += 3;
+        break;
+    case PropertyNamePrefix::Pixel:
+        i += 5;
+        hadPixelOrPosPrefix = true;
+        break;
+    case PropertyNamePrefix::Pos:
+        i += 3;
+        hadPixelOrPosPrefix = true;
+        break;
     case PropertyNamePrefix::Epub:
         writeEpubPrefix(bufferPtr);
         i += 4;
@@ -168,17 +203,17 @@
     size_t bufferSizeLeft = stringEnd - bufferPtr;
     size_t propertySizeLeft = length - i;
     if (propertySizeLeft > bufferSizeLeft)
-        return propertyID;
+        return propertyInfo;
 
     for (; i < length; ++i) {
         UChar c = (*propertyNameString)[i];
         if (!c || !isASCII(c))
-            return propertyID; // illegal character
+            return propertyInfo; // illegal character
         if (isASCIIUpper(c)) {
             size_t bufferSizeLeft = stringEnd - bufferPtr;
             size_t propertySizeLeft = length - i + 1;
             if (propertySizeLeft > bufferSizeLeft)
-                return propertyID;
+                return propertyInfo;
             *bufferPtr++ = '-';
             *bufferPtr++ = toASCIILowerUnchecked(c);
         } else
@@ -194,25 +229,68 @@
 #endif
 
     auto* hashTableEntry = findProperty(name, outputLength);
-    if (auto id = hashTableEntry ? hashTableEntry->id : 0) {
-        propertyID = static_cast<CSSPropertyID>(id);
-        propertyIDCache.get().add(propertyNameString, propertyID);
+    if (auto propertyID = hashTableEntry ? hashTableEntry->id : 0) {
+        auto id = static_cast<CSSPropertyID>(propertyID);
+        propertyInfo.hadPixelOrPosPrefix = hadPixelOrPosPrefix;
+        propertyInfo.propertyID = id;
+        propertyInfoCache.get().add(propertyNameString, propertyInfo);
     }
-    return propertyID;
+    return propertyInfo;
 }
 
-static CSSPropertyID propertyIDFromJavaScriptCSSPropertyName(const AtomString& propertyName, const Settings* settings)
+static CSSPropertyInfo propertyInfoFromJavaScriptCSSPropertyName(const AtomString& propertyName, const Settings* settings)
 {
-    auto id = parseJavaScriptCSSPropertyName(propertyName);
+    auto propertyInfo = parseJavaScriptCSSPropertyName(propertyName);
+    auto id = propertyInfo.propertyID;
     if (!isEnabledCSSProperty(id) || !isCSSPropertyEnabledBySettings(id, settings))
-        return CSSPropertyInvalid;
-    return id;
+        return { CSSPropertyInvalid, false };
+    return propertyInfo;
 }
 
 }
 
-ExceptionOr<void> CSSStyleDeclaration::setPropertyValueInternal(CSSPropertyID propertyID, String value)
+CSSPropertyID CSSStyleDeclaration::getCSSPropertyIDFromJavaScriptPropertyName(const AtomString& propertyName)
 {
+    return propertyInfoFromJavaScriptCSSPropertyName(propertyName, nullptr).propertyID;
+}
+
+Optional<Variant<String, double>> CSSStyleDeclaration::namedItem(const AtomString& propertyName)
+{
+    auto* settings = parentElement() ? &parentElement()->document().settings() : nullptr;
+    auto propertyInfo = propertyInfoFromJavaScriptCSSPropertyName(propertyName, settings);
+    if (!propertyInfo.propertyID)
+        return WTF::nullopt;
+
+    auto value = getPropertyCSSValueInternal(propertyInfo.propertyID);
+    if (!value) {
+        // If the property is a shorthand property (such as "padding"), it can only be accessed using getPropertyValue.
+        return Variant<String, double> { getPropertyValueInternal(propertyInfo.propertyID) };
+    }
+    
+    if (propertyInfo.hadPixelOrPosPrefix && is<CSSPrimitiveValue>(*value)) {
+        // Call this version of the getter so that, e.g., pixelTop returns top as a number
+        // in pixel units and posTop should does the same _if_ this is a positioned element.
+        // FIXME: If not a positioned element, MSIE documentation says posTop should return 0; this rule is not implemented.
+        return Variant<String, double> { downcast<CSSPrimitiveValue>(*value).floatValue(CSSUnitType::CSS_PX) };
+    }
+
+    return Variant<String, double> { value->cssText() };
+}
+
+ExceptionOr<void> CSSStyleDeclaration::setNamedItem(const AtomString& propertyName, String value, bool& propertySupported)
+{
+    auto* settings = parentElement() ? &parentElement()->document().settings() : nullptr;
+    auto propertyInfo = propertyInfoFromJavaScriptCSSPropertyName(propertyName, settings);
+    if (!propertyInfo.propertyID) {
+        propertySupported = false;
+        return { };
+    }
+
+    propertySupported = true;
+
+    if (propertyInfo.hadPixelOrPosPrefix)
+        value.append("px");
+
     bool important = false;
     if (DeprecatedGlobalSettings::shouldRespectPriorityInCSSAttributeSetters()) {
         auto importantIndex = value.findIgnoringASCIICase("!important");
@@ -222,7 +300,7 @@
         }
     }
 
-    auto setPropertyInternalResult = setPropertyInternal(propertyID, value, important);
+    auto setPropertyInternalResult = setPropertyInternal(propertyInfo.propertyID, value, important);
     if (setPropertyInternalResult.hasException())
         return setPropertyInternalResult.releaseException();
 
@@ -229,9 +307,31 @@
     return { };
 }
 
-CSSPropertyID CSSStyleDeclaration::getCSSPropertyIDFromJavaScriptPropertyName(const AtomString& propertyName)
+Vector<AtomString> CSSStyleDeclaration::supportedPropertyNames() const
 {
-    return propertyIDFromJavaScriptCSSPropertyName(propertyName, nullptr);
+    static unsigned numNames = 0;
+    static const AtomString* const cssPropertyNames = [] {
+        String names[numCSSProperties];
+        for (int i = 0; i < numCSSProperties; ++i) {
+            CSSPropertyID id = static_cast<CSSPropertyID>(firstCSSProperty + i);
+            // FIXME: Should take account for flags in settings().
+            if (isEnabledCSSProperty(id))
+                names[numNames++] = getJSPropertyName(id);
+        }
+        std::sort(&names[0], &names[numNames], WTF::codePointCompareLessThan);
+        auto* identifiers = new AtomString[numNames];
+        for (unsigned i = 0; i < numNames; ++i)
+            identifiers[i] = names[i];
+        return identifiers;
+    }();
+
+    Vector<AtomString> result;
+    result.reserveInitialCapacity(numNames);
+
+    for (unsigned i = 0; i < numNames; ++i)
+        result.uncheckedAppend(cssPropertyNames[i]);
+
+    return result;
 }
 
 String CSSStyleDeclaration::cssFloat()

Modified: trunk/Source/WebCore/css/CSSStyleDeclaration.h (269313 => 269314)


--- trunk/Source/WebCore/css/CSSStyleDeclaration.h	2020-11-03 18:00:54 UTC (rev 269313)
+++ trunk/Source/WebCore/css/CSSStyleDeclaration.h	2020-11-03 18:45:53 UTC (rev 269314)
@@ -72,10 +72,12 @@
 
     virtual CSSStyleSheet* parentStyleSheet() const { return nullptr; }
 
-    ExceptionOr<void> setPropertyValueInternal(CSSPropertyID, String);
+    // Bindings support.
+    Optional<Variant<String, double>> namedItem(const AtomString&);
+    ExceptionOr<void> setNamedItem(const AtomString& name, String value, bool& propertySupported);
+    Vector<AtomString> supportedPropertyNames() const;
 
     static CSSPropertyID getCSSPropertyIDFromJavaScriptPropertyName(const AtomString&);
-
 protected:
     CSSStyleDeclaration() = default;
 };

Modified: trunk/Source/WebCore/css/CSSStyleDeclaration.idl (269313 => 269314)


--- trunk/Source/WebCore/css/CSSStyleDeclaration.idl	2020-11-03 18:00:54 UTC (rev 269313)
+++ trunk/Source/WebCore/css/CSSStyleDeclaration.idl	2020-11-03 18:45:53 UTC (rev 269314)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2007, 2009, 2020 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved.
  * Copyright (C) 2006 Samuel Weinig <[email protected]>
  *
  * This library is free software; you can redistribute it and/or
@@ -18,10 +18,9 @@
  * Boston, MA 02110-1301, USA.
  */
 
-typedef USVString CSSOMString;
-
 [
     ExportMacro=WEBCORE_EXPORT,
+    DefaultDefineOwnProperty,
     GenerateIsReachable,
     JSCustomHeader,
     JSCustomMarkFunction,
@@ -28,19 +27,31 @@
     SkipVTableValidation,
     Exposed=Window
 ] interface CSSStyleDeclaration {
-    [CEReactions] attribute CSSOMString cssText;
+    [CEReactions] attribute DOMString cssText;
+
+    DOMString getPropertyValue(DOMString propertyName);
+
+    [CEReactions, MayThrowException] DOMString removeProperty(DOMString propertyName);
+    DOMString? getPropertyPriority(DOMString propertyName);
+
+    [CEReactions, MayThrowException] undefined setProperty(DOMString propertyName, [LegacyNullToEmptyString] DOMString value, optional [LegacyNullToEmptyString] DOMString priority = "");
+
     readonly attribute unsigned long length;
-    getter CSSOMString item(unsigned long index);
-    CSSOMString getPropertyValue(CSSOMString property);
-    // FIXME: The return value of 'getPropertyPriority' should not be nullable.
-    CSSOMString? getPropertyPriority(CSSOMString property);
-    [CEReactions, MayThrowException] undefined setProperty(CSSOMString property, [LegacyNullToEmptyString] CSSOMString value, optional [LegacyNullToEmptyString] CSSOMString priority = "");
-    [CEReactions, MayThrowException] CSSOMString removeProperty(CSSOMString property);
+    getter DOMString item(unsigned long index);
     readonly attribute CSSRule? parentRule;
-    [CEReactions] attribute [LegacyNullToEmptyString] CSSOMString cssFloat;
 
-    // Non-standard.
+    [CEReactions] attribute [LegacyNullToEmptyString] DOMString cssFloat;
+
     DOMString? getPropertyShorthand(optional DOMString propertyName);
     boolean isPropertyImplicit(optional DOMString propertyName);
+
+    // Use named getters/setters for all support CSS property names. The spec says
+    // these should be normal attributes, but there are too many combinations with
+    // prefixes for this to be practical. If we remove legacy aliases, we should
+    // reconsider this decision.
+    getter (DOMString or double) (DOMString name);
+    [CEReactions, CallNamedSetterOnlyForSupportedProperties] setter undefined (DOMString name, [LegacyNullToEmptyString] DOMString value);
+
+    // This method is deprecated, and we would like to drop support for it someday
     DeprecatedCSSOMValue? getPropertyCSSValue(DOMString propertyName);
 };

Modified: trunk/Source/WebCore/css/makeprop.pl (269313 => 269314)


--- trunk/Source/WebCore/css/makeprop.pl	2020-11-03 18:00:54 UTC (rev 269313)
+++ trunk/Source/WebCore/css/makeprop.pl	2020-11-03 18:45:53 UTC (rev 269314)
@@ -1358,150 +1358,3 @@
     $gperf = $ENV{GPERF} ? $ENV{GPERF} : "gperf";
 }
 system("\"$gperf\" --key-positions=\"*\" -D -n -s 2 CSSPropertyNames.gperf --output-file=CSSPropertyNames.cpp") == 0 || die "calling gperf failed: $?";
-
-
-# Generate CSSStyleDeclaration+PropertyNames.idl
-
-# https://drafts.csswg.org/cssom/#css-property-to-idl-attribute
-sub cssPropertyToIDLAttribute($$$)
-{
-    my $property = shift;
-    my $lowercaseFirst = shift;
-    my $uppercaseFirst = shift;
-
-    my $output = "";
-    my $uppercaseNext = $uppercaseFirst;
-
-    if ($lowercaseFirst) {
-        $property = substr($property, 1);
-    }
-
-    foreach my $character (split //, $property) {
-        if ($character eq "-") {
-            $uppercaseNext = 1;
-        } elsif ($uppercaseNext) {
-            $uppercaseNext = 0;
-            $output .= uc $character;
-        } else {
-            $output .= $character;
-        }
-    }
-    
-    return $output;
-}
-
-my %namesAndAliasesToName;
-foreach my $name (@names) {
-    if (grep { $_ eq $name } @internalProprerties) {
-        next;
-    }
-    $namesAndAliasesToName{$name} = $name;
-    for my $alias (@{$nameToAliases{$name}}) {
-        $namesAndAliasesToName{$alias} = $name;
-    }
-}
-my @namesAndAliases = sort keys(%namesAndAliasesToName);
-
-open CSS_STYLE_DECLARATION_PROPERTY_NAMES_IDL, ">", "CSSStyleDeclaration+PropertyNames.idl" or die "Could not open CSSStyleDeclaration+PropertyNames.idl for writing\n";
-print CSS_STYLE_DECLARATION_PROPERTY_NAMES_IDL << "EOF";
-// This file is automatically generated from $inputFile by the makeprop.pl script. Do not edit it.
-
-typedef USVString CSSOMString;
-
-partial interface CSSStyleDeclaration {
-EOF
- 
-print CSS_STYLE_DECLARATION_PROPERTY_NAMES_IDL << "EOF";
-    // For each CSS property property that is a supported CSS property, the following
-    // partial interface applies where camel-cased attribute is obtained by running the
-    // CSS property to IDL attribute algorithm for property.
-    // Example: font-size -> element.style.fontSize
-    // Example: -webkit-transform -> element.style.WebkitTransform
-    // [CEReactions] attribute [LegacyNullToEmptyString] CSSOMString _camel_cased_attribute;
-EOF
-
-foreach my $nameOrAlias (@namesAndAliases) {
-    my $camelCasedAttributeName = cssPropertyToIDLAttribute($nameOrAlias, 0, 0);
-    my $name = $namesAndAliasesToName{$nameOrAlias};
-    my $propertyId = $nameToId{$namesAndAliasesToName{$name}};
-    
-    my @extendedAttributeValues = ("CSSProperty=${propertyId}");
-    push(@extendedAttributeValues, "EnabledBySetting=${settingsFlags{$name}}") if $settingsFlags{$name};
-    push(@extendedAttributeValues, "EnabledAtRuntime=${runtimeFlags{$name}}") if $runtimeFlags{$name};
-    my $extendedAttributes = join(", ", @extendedAttributeValues);
-
-    print CSS_STYLE_DECLARATION_PROPERTY_NAMES_IDL "    [CEReactions, ${extendedAttributes}] attribute [LegacyNullToEmptyString] CSSOMString ${camelCasedAttributeName};\n";
-}
-
-print CSS_STYLE_DECLARATION_PROPERTY_NAMES_IDL << "EOF";
-
-    // For each CSS property property that is a supported CSS property and that begins
-    // with the string -webkit-, the following partial interface applies where webkit-cased
-    // attribute is obtained by running the CSS property to IDL attribute algorithm for
-    // property, with the lowercase first flag set.
-    // Example: -webkit-transform -> element.style.webkitTransform
-    // [CEReactions] attribute [LegacyNullToEmptyString] CSSOMString _webkit_cased_attribute;
-EOF
-
-foreach my $nameOrAlias (grep { $_ =~ /^\-webkit\-/ } @namesAndAliases) {
-    my $webkitCasedAttributeName = cssPropertyToIDLAttribute($nameOrAlias, 1, 0);
-    my $name = $namesAndAliasesToName{$nameOrAlias};
-    my $propertyId = $nameToId{$namesAndAliasesToName{$name}};
-    
-    my @extendedAttributeValues = ("CSSProperty=${propertyId}");
-    push(@extendedAttributeValues, "EnabledBySetting=${settingsFlags{$name}}") if $settingsFlags{$name};
-    push(@extendedAttributeValues, "EnabledAtRuntime=${runtimeFlags{$name}}") if $runtimeFlags{$name};
-    my $extendedAttributes = join(", ", @extendedAttributeValues);
-
-    print CSS_STYLE_DECLARATION_PROPERTY_NAMES_IDL "    [CEReactions, ${extendedAttributes}] attribute [LegacyNullToEmptyString] CSSOMString ${webkitCasedAttributeName};\n";
-}
-
-print CSS_STYLE_DECLARATION_PROPERTY_NAMES_IDL << "EOF";
-
-    // For each CSS property property that is a supported CSS property, except for
-    // properties that have no "-" (U+002D) in the property name, the following partial
-    // interface applies where dashed attribute is property.
-    // Example: font-size -> element.style['font-size']
-    // Example: -webkit-transform -> element.style.['-webkit-transform']
-    // [CEReactions] attribute [LegacyNullToEmptyString] CSSOMString _dashed_attribute;
-EOF
-foreach my $nameOrAlias (grep { $_ =~ /\-/ } @namesAndAliases) {
-    my $dashedAttributeName = $nameOrAlias;
-    my $name = $namesAndAliasesToName{$nameOrAlias};
-    my $propertyId = $nameToId{$namesAndAliasesToName{$name}};
-    
-    my @extendedAttributeValues = ("CSSProperty=${propertyId}");
-    push(@extendedAttributeValues, "EnabledBySetting=${settingsFlags{$name}}") if $settingsFlags{$name};
-    push(@extendedAttributeValues, "EnabledAtRuntime=${runtimeFlags{$name}}") if $runtimeFlags{$name};
-    my $extendedAttributes = join(", ", @extendedAttributeValues);
-
-    print CSS_STYLE_DECLARATION_PROPERTY_NAMES_IDL "    [CEReactions, ${extendedAttributes}] attribute [LegacyNullToEmptyString] CSSOMString ${dashedAttributeName};\n";
-}
-
-# Everything below here is non-standard.
-
-print CSS_STYLE_DECLARATION_PROPERTY_NAMES_IDL << "EOF";
-
-    // Non-standard. Special case properties starting with -epub- like is done for
-    // -webkit-, where attribute is obtained by running the CSS property to IDL attribute
-    // algorithm for property, with the lowercase first flag set.
-    // Example: -epub-caption-side -> element.style.epubCaptionSide
-EOF
-foreach my $nameOrAlias (grep { $_ =~ /^\-epub\-/ } @namesAndAliases) {
-    my $epubCasedAttributeName = cssPropertyToIDLAttribute($nameOrAlias, 1, 0);
-    my $name = $namesAndAliasesToName{$nameOrAlias};
-    my $propertyId = $nameToId{$namesAndAliasesToName{$name}};
-    
-    my @extendedAttributeValues = ("CSSProperty=${propertyId}");
-    push(@extendedAttributeValues, "EnabledBySetting=${settingsFlags{$name}}") if $settingsFlags{$name};
-    push(@extendedAttributeValues, "EnabledAtRuntime=${runtimeFlags{$name}}") if $runtimeFlags{$name};
-    my $extendedAttributes = join(", ", @extendedAttributeValues);
-
-    print CSS_STYLE_DECLARATION_PROPERTY_NAMES_IDL "    [CEReactions, ${extendedAttributes}] attribute [LegacyNullToEmptyString] CSSOMString ${epubCasedAttributeName};\n";
-}
-
-print CSS_STYLE_DECLARATION_PROPERTY_NAMES_IDL << "EOF";
-};
-EOF
-
-close CSS_STYLE_DECLARATION_PROPERTY_NAMES_IDL;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to