Title: [278848] trunk
Revision
278848
Author
pan...@apple.com
Date
2021-06-14 13:01:30 -0700 (Mon, 14 Jun 2021)

Log 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:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (278847 => 278848)


--- trunk/LayoutTests/ChangeLog	2021-06-14 19:54:50 UTC (rev 278847)
+++ trunk/LayoutTests/ChangeLog	2021-06-14 20:01:30 UTC (rev 278848)
@@ -1,3 +1,15 @@
+2021-06-14  Patrick Angle  <pan...@apple.com>
+
+        Web Inspector: CSS variables not handled as case sensitive
+        https://bugs.webkit.org/show_bug.cgi?id=226875
+
+        Reviewed by Devin Rousso.
+
+        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:
+
 2021-06-14  Youenn Fablet  <you...@apple.com>
 
         Fix RTCDataChannelInit::decode

Modified: trunk/LayoutTests/inspector/css/overridden-property-expected.txt (278847 => 278848)


--- trunk/LayoutTests/inspector/css/overridden-property-expected.txt	2021-06-14 19:54:50 UTC (rev 278847)
+++ trunk/LayoutTests/inspector/css/overridden-property-expected.txt	2021-06-14 20:01:30 UTC (rev 278848)
@@ -27,3 +27,7 @@
 PASS: border-color is NOT overridden.
 PASS: border-top-color is NOT overridden.
 
+-- Running test case: OverriddenProperty.MixedCaseVariablesNotOverridden
+PASS: `--foo` is NOT overridden.
+PASS: `--FOO` is NOT overridden.
+

Modified: trunk/LayoutTests/inspector/css/overridden-property.html (278847 => 278848)


--- trunk/LayoutTests/inspector/css/overridden-property.html	2021-06-14 19:54:50 UTC (rev 278847)
+++ trunk/LayoutTests/inspector/css/overridden-property.html	2021-06-14 20:01:30 UTC (rev 278848)
@@ -152,6 +152,22 @@
         }
     });
 
+    suite.addTestCase({
+        name: "OverriddenProperty.MixedCaseVariablesNotOverridden",
+        test(resolve, reject) {
+            getStyleDeclaration(".mixed-case-variables-not-overridden", (style) => {
+                const dontCreateIfMissing = true;
+                let lowercaseVariableProperty = style.propertyForName("--foo", dontCreateIfMissing);
+                InspectorTest.expectFalse(lowercaseVariableProperty.overridden, "`--foo` is NOT overridden.");
+
+                let uppercaseVariableProperty = style.propertyForName("--FOO", dontCreateIfMissing);
+                InspectorTest.expectFalse(uppercaseVariableProperty.overridden, "`--FOO` is NOT overridden.");
+
+                resolve();
+            }, reject);
+        }
+    });
+
     suite.runTestCasesAndFinish();
 }
 </script>
@@ -182,6 +198,11 @@
         border-color: green;
         border-top-color: red;
     }
+
+    .mixed-case-variables-not-overridden {
+        --foo: green;
+        --FOO: red;
+    }
     </style>
     <div id="x" style="color: green"></div>
     <div class="longhand-overridden-by-shorthand"></div>
@@ -188,5 +209,6 @@
     <div class="longhand-overridden-by-important-shorthand"></div>
     <div class="shorthand-overridden-by-important-longhand"></div>
     <div class="shorthand-not-overridden-by-longhand"></div>
+    <div class="mixed-case-variables-not-overridden"></div>
 </body>
 </html>

Modified: trunk/Source/WebCore/ChangeLog (278847 => 278848)


--- trunk/Source/WebCore/ChangeLog	2021-06-14 19:54:50 UTC (rev 278847)
+++ trunk/Source/WebCore/ChangeLog	2021-06-14 20:01:30 UTC (rev 278848)
@@ -1,3 +1,18 @@
+2021-06-14  Patrick Angle  <pan...@apple.com>
+
+        Web Inspector: CSS variables not handled as case sensitive
+        https://bugs.webkit.org/show_bug.cgi?id=226875
+
+        Reviewed by Devin Rousso.
+
+        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):
+
 2021-06-14  Youenn Fablet  <you...@apple.com>
 
         Fix RTCDataChannelInit::decode

Modified: trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp (278847 => 278848)


--- trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp	2021-06-14 19:54:50 UTC (rev 278847)
+++ trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp	2021-06-14 20:01:30 UTC (rev 278848)
@@ -645,7 +645,7 @@
         auto status = it->disabled ? Protocol::CSS::CSSPropertyStatus::Disabled : Protocol::CSS::CSSPropertyStatus::Active;
 
         auto property = Protocol::CSS::CSSProperty::create()
-            .setName(name.convertToASCIILowercase())
+            .setName(lowercasePropertyName(name))
             .setValue(propertyEntry.value)
             .release();
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to