⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 203437 in webkit


Ignore:
Timestamp:
Jul 19, 2016, 6:20:23 PM (10 years ago)
Author:
Chris Dumez
Message:

Align CSSStyleDeclaration.setProperty() with the specification
https://bugs.webkit.org/show_bug.cgi?id=159955

Reviewed by Benjamin Poulain.

Source/WebCore:

Align CSSStyleDeclaration.setProperty() with the specification:

In particular, the following changes were needed:

  1. The 'value' parameter should not be optional
  2. The 'priority' parameter should treat null as the empty string rather than the string "null".
  3. The 'priority' parameter's default value should be the empty string, not the string "undefined".
  4. CSSStyleDeclaration.setProperty() should return early if 'priority' is not the empty string and is not an ASCII case-insensitive match for the string "important".

Chrome matches the specification entirely.
Firefox matches the specification with the exception that it does a
case-sensitive match for "important".

Test: fast/css/CSSStyleDeclaration-setProperty.html

  • css/CSSStyleDeclaration.idl:
  • css/PropertySetCSSStyleDeclaration.cpp:

(WebCore::PropertySetCSSStyleDeclaration::setProperty):

LayoutTests:

Add layout test coverage.

  • fast/css/CSSStyleDeclaration-setProperty-expected.txt: Added.
  • fast/css/CSSStyleDeclaration-setProperty.html: Added.
  • fast/css/shorthand-priority.html:
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r203434 r203437  
     12016-07-19  Chris Dumez  <cdumez@apple.com>
     2
     3        Align CSSStyleDeclaration.setProperty() with the specification
     4        https://bugs.webkit.org/show_bug.cgi?id=159955
     5
     6        Reviewed by Benjamin Poulain.
     7
     8        Add layout test coverage.
     9
     10        * fast/css/CSSStyleDeclaration-setProperty-expected.txt: Added.
     11        * fast/css/CSSStyleDeclaration-setProperty.html: Added.
     12        * fast/css/shorthand-priority.html:
     13
    1142016-07-19  Daniel Bates  <dabates@apple.com>
    215
  • trunk/LayoutTests/fast/css/shorthand-priority.html

    r155263 r203437  
    1818
    1919// Sanity check.
    20 e.style.setProperty("border-bottom-style", "solid", "!important");
     20e.style.setProperty("border-bottom-style", "solid", "important");
    2121shouldBe("e.style.getPropertyValue('border-bottom-style')", "'solid'");
    2222shouldBe("e.style.getPropertyPriority('border-bottom-style')", "'important'");
     
    2828
    2929e.style.border = "";
    30 e.style.setProperty("border", "20px solid green", "!important");
     30e.style.setProperty("border", "20px solid green", "important");
    3131shouldBe("e.style.getPropertyValue('border')", "'20px solid green'");
    3232shouldBe("e.style.getPropertyPriority('border')", "'important'");
  • trunk/Source/WebCore/ChangeLog

    r203434 r203437  
     12016-07-19  Chris Dumez  <cdumez@apple.com>
     2
     3        Align CSSStyleDeclaration.setProperty() with the specification
     4        https://bugs.webkit.org/show_bug.cgi?id=159955
     5
     6        Reviewed by Benjamin Poulain.
     7
     8        Align CSSStyleDeclaration.setProperty() with the specification:
     9        - https://drafts.csswg.org/cssom/#the-cssstyledeclaration-interface
     10
     11        In particular, the following changes were needed:
     12        1. The 'value' parameter should not be optional
     13        2. The 'priority' parameter should treat null as the empty string
     14           rather than the string "null".
     15        3. The 'priority' parameter's default value should be the empty string,
     16           not the string "undefined".
     17        4. CSSStyleDeclaration.setProperty() should return early if 'priority'
     18           is not the empty string and is not an ASCII case-insensitive match
     19           for the string "important".
     20
     21        Chrome matches the specification entirely.
     22        Firefox matches the specification with the exception that it does a
     23        case-sensitive match for "important".
     24
     25        Test: fast/css/CSSStyleDeclaration-setProperty.html
     26
     27        * css/CSSStyleDeclaration.idl:
     28        * css/PropertySetCSSStyleDeclaration.cpp:
     29        (WebCore::PropertySetCSSStyleDeclaration::setProperty):
     30
    1312016-07-19  Daniel Bates  <dabates@apple.com>
    232
  • trunk/Source/WebCore/css/CSSStyleDeclaration.idl

    r199969 r203437  
    3939    DOMString? getPropertyPriority(optional DOMString propertyName = "undefined");
    4040
    41     // FIXME: 'priority' should use [TreatNullAs=EmptyString].
    42     // FIXME: Using "undefined" as default parameter value is wrong.
    43     [ObjCLegacyUnnamedParameters, RaisesException] void setProperty(optional DOMString propertyName = "undefined",
    44                                     [TreatNullAs=EmptyString] optional DOMString value = "undefined",
    45                                     optional DOMString priority = "undefined");
     41    [ObjCLegacyUnnamedParameters, RaisesException] void setProperty(DOMString propertyName, [TreatNullAs=EmptyString] DOMString value, [TreatNullAs=EmptyString] optional DOMString priority = "");
    4642
    4743    readonly attribute unsigned long    length;
  • trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp

    r203380 r203437  
    227227        return;
    228228
    229     bool important = priority.find("important", 0, false) != notFound;
     229    bool important = equalIgnoringASCIICase(priority, "important");
     230    if (!important && !priority.isEmpty())
     231        return;
    230232
    231233    ec = 0;
Note: See TracChangeset for help on using the changeset viewer.