Bug 1532570 - nsDOMCSSDeclaration::SetProperty should check for the "important" string in a case-insensitive way. r=emilio
authorhrdktg <hrdktg@gmail.com>
Wed, 06 Mar 2019 23:36:23 +0000
changeset 520669 edb56e9a487b9f3eb96688d39ddd6bc662947a23
parent 520668 35b20b5040638d1c4a055c360a3913606975f5f1
child 520670 4f6e4cbf401f4e32bfa4431b6ee2e003f8faa832
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1532570
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1532570 - nsDOMCSSDeclaration::SetProperty should check for the "important" string in a case-insensitive way. r=emilio Differential Revision: https://phabricator.services.mozilla.com/D22423
layout/style/nsDOMCSSDeclaration.cpp
testing/web-platform/tests/css/cssom/css-style-declaration-modifications.html
--- a/layout/style/nsDOMCSSDeclaration.cpp
+++ b/layout/style/nsDOMCSSDeclaration.cpp
@@ -189,17 +189,17 @@ nsDOMCSSDeclaration::SetProperty(const n
   nsCSSPropertyID propID = nsCSSProps::LookupProperty(aPropertyName);
   if (propID == eCSSProperty_UNKNOWN) {
     return NS_OK;
   }
 
   bool important;
   if (aPriority.IsEmpty()) {
     important = false;
-  } else if (aPriority.EqualsLiteral("important")) {
+  } else if (aPriority.LowerCaseEqualsASCII("important")) {
     important = true;
   } else {
     // XXX silent failure?
     return NS_OK;
   }
 
   if (propID == eCSSPropertyExtra_variable) {
     return ParseCustomPropertyValue(aPropertyName, aValue, important,
--- a/testing/web-platform/tests/css/cssom/css-style-declaration-modifications.html
+++ b/testing/web-platform/tests/css/cssom/css-style-declaration-modifications.html
@@ -43,21 +43,29 @@
 
     test(function() {
         while (declaration.length > 0) {
             declaration.removeProperty(declaration.item(0));
         }
         declaration.setProperty("margin-left", "15px");
         declaration.setProperty("padding-left", "15px");
 
+
         assert_equals(declaration.length, 2);
         assert_equals(declaration.item(0), "margin-left");
         assert_equals(declaration.item(1), "padding-left");
         assert_equals(declaration.getPropertyValue("margin-left"), "15px");
         assert_equals(declaration.getPropertyValue("padding-left"), "15px");
 
         var computedStyle = window.getComputedStyle(document.getElementById("test"));
         assert_equals(computedStyle.getPropertyValue("margin-left"), "15px");
         assert_equals(computedStyle.getPropertyValue("padding-left"), "15px");
+
     }, "Calling CSSStyleDeclaration#setProperty");
+
+    test(function() {
+        declaration.setProperty("background-color", "red", "ImPoRtAnt");
+        assert_equals(declaration.getPropertyPriority("background-color"), "important");
+    }, "setProperty priority should be case-insensitive");
+
  </script>
  </body>
 </html>