Changeset 278848 in webkit


Ignore:
Timestamp:
Jun 14, 2021 1:01:30 PM (13 months ago)
Author:
Patrick Angle
Message:

Web Inspector: CSS variables not handled as case sensitive
https://bugs.webkit.org/show_bug.cgi?id=226875

Reviewed by Devin Rousso.

Source/WebCore:

Test: inspector/css/overridden-property.html

CSS variables support distinct declarations with only differences in cases. Previously, we naively converted all
property names to lowercase, instead of properly providing variable names in their original case.

  • inspector/InspectorStyleSheet.cpp:

(WebCore::InspectorStyle::styleWithProperties const):

LayoutTests:

Add a test to make sure that CSS variable declarations that vary only in case do not override each other.

  • inspector/css/overridden-property-expected.txt:
  • inspector/css/overridden-property.html:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r278842 r278848  
     12021-06-14  Patrick Angle  <pangle@apple.com>
     2
     3        Web Inspector: CSS variables not handled as case sensitive
     4        https://bugs.webkit.org/show_bug.cgi?id=226875
     5
     6        Reviewed by Devin Rousso.
     7
     8        Add a test to make sure that CSS variable declarations that vary only in case do not override each other.
     9
     10        * inspector/css/overridden-property-expected.txt:
     11        * inspector/css/overridden-property.html:
     12
    1132021-06-14  Youenn Fablet  <youenn@apple.com>
    214
  • trunk/LayoutTests/inspector/css/overridden-property-expected.txt

    r246223 r278848  
    2828PASS: border-top-color is NOT overridden.
    2929
     30-- Running test case: OverriddenProperty.MixedCaseVariablesNotOverridden
     31PASS: `--foo` is NOT overridden.
     32PASS: `--FOO` is NOT overridden.
     33
  • trunk/LayoutTests/inspector/css/overridden-property.html

    r253242 r278848  
    153153    });
    154154
     155    suite.addTestCase({
     156        name: "OverriddenProperty.MixedCaseVariablesNotOverridden",
     157        test(resolve, reject) {
     158            getStyleDeclaration(".mixed-case-variables-not-overridden", (style) => {
     159                const dontCreateIfMissing = true;
     160                let lowercaseVariableProperty = style.propertyForName("--foo", dontCreateIfMissing);
     161                InspectorTest.expectFalse(lowercaseVariableProperty.overridden, "`--foo` is NOT overridden.");
     162
     163                let uppercaseVariableProperty = style.propertyForName("--FOO", dontCreateIfMissing);
     164                InspectorTest.expectFalse(uppercaseVariableProperty.overridden, "`--FOO` is NOT overridden.");
     165
     166                resolve();
     167            }, reject);
     168        }
     169    });
     170
    155171    suite.runTestCasesAndFinish();
    156172}
     
    183199        border-top-color: red;
    184200    }
     201
     202    .mixed-case-variables-not-overridden {
     203        --foo: green;
     204        --FOO: red;
     205    }
    185206    </style>
    186207    <div id="x" style="color: green"></div>
     
    189210    <div class="shorthand-overridden-by-important-longhand"></div>
    190211    <div class="shorthand-not-overridden-by-longhand"></div>
     212    <div class="mixed-case-variables-not-overridden"></div>
    191213</body>
    192214</html>
  • trunk/Source/WebCore/ChangeLog

    r278842 r278848  
     12021-06-14  Patrick Angle  <pangle@apple.com>
     2
     3        Web Inspector: CSS variables not handled as case sensitive
     4        https://bugs.webkit.org/show_bug.cgi?id=226875
     5
     6        Reviewed by Devin Rousso.
     7
     8        Test: inspector/css/overridden-property.html
     9
     10        CSS variables support distinct declarations with only differences in cases. Previously, we naively converted all
     11        property names to lowercase, instead of properly providing variable names in their original case.
     12
     13        * inspector/InspectorStyleSheet.cpp:
     14        (WebCore::InspectorStyle::styleWithProperties const):
     15
    1162021-06-14  Youenn Fablet  <youenn@apple.com>
    217
  • trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp

    r278185 r278848  
    646646
    647647        auto property = Protocol::CSS::CSSProperty::create()
    648             .setName(name.convertToASCIILowercase())
     648            .setName(lowercasePropertyName(name))
    649649            .setValue(propertyEntry.value)
    650650            .release();
Note: See TracChangeset for help on using the changeset viewer.