Bug 1590894: Unprefix existing CSS4 system colors r=emilio
☠☠ backed out by f14f678590b7 ☠ ☠
authorSam Mauldin <sam@mauldin.me>
Sun, 15 Mar 2020 19:45:27 +0000
changeset 518878 a2030f611422814034b8c2ddf7014aea8b05bb56
parent 518877 da9cb42c5dc6f7d993354816e2ab43878d1afaa9
child 518879 f14f678590b7b71de62740c3ea540b48eb17397b
push id37218
push userrmaries@mozilla.com
push dateMon, 16 Mar 2020 09:28:04 +0000
treeherdermozilla-central@6199f7b91e8b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1590894
milestone76.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 1590894: Unprefix existing CSS4 system colors r=emilio Expect forced-colors-mode-backplate tests to fail because they were passing for the wrong reason, and the backplate is now properly applied, causing them to fail. Remove tests for field and fieldtext from color-valid.html because they are tested again in system-color-valid.html. Differential Revision: https://phabricator.services.mozilla.com/D66879
layout/style/test/property_database.js
servo/components/style/values/specified/color.rs
testing/web-platform/meta/css/css-color/parsing/system-color-valid.html.ini
testing/web-platform/meta/forced-colors-mode/backplate/forced-colors-mode-backplate-01.html.ini
testing/web-platform/meta/forced-colors-mode/backplate/forced-colors-mode-backplate-02.html.ini
testing/web-platform/meta/forced-colors-mode/backplate/forced-colors-mode-backplate-03.html.ini
testing/web-platform/meta/forced-colors-mode/backplate/forced-colors-mode-backplate-04.html.ini
testing/web-platform/meta/forced-colors-mode/backplate/forced-colors-mode-backplate-05.html.ini
testing/web-platform/meta/forced-colors-mode/backplate/forced-colors-mode-backplate-06.html.ini
testing/web-platform/meta/forced-colors-mode/backplate/forced-colors-mode-backplate-08.html.ini
testing/web-platform/meta/forced-colors-mode/backplate/forced-colors-mode-backplate-09.html.ini
testing/web-platform/meta/forced-colors-mode/backplate/forced-colors-mode-backplate-10.html.ini
testing/web-platform/tests/css/css-color/parsing/color-valid.html
--- a/layout/style/test/property_database.js
+++ b/layout/style/test/property_database.js
@@ -5287,16 +5287,35 @@ var gCSSProperties = {
       "hsl(720, 200%, 200%, 2.0)",
       "hsla(720 200% 200% / 200%)",
       "hsl(480deg, 20%, 30%, 0.3)",
       "hsl(55grad, 400%, 30%)",
       "hsl(0.5grad 400% 500% / 9.0)",
       "hsl(33rad 100% 90% / 4)",
       "hsl(0.33turn, 40%, 40%, 10%)",
       "hsl(63e292, 41%, 34%)",
+      /* CSS4 System Colors */
+      "canvas",
+      "canvastext",
+      "linktext",
+      "visitedtext",
+      "activetext",
+      "buttonface",
+      "buttontext",
+      "field",
+      "fieldtext",
+      "highlight",
+      "highlighttext",
+      "graytext",
+      /* Preserve previously available specially prefixed colors */
+      "-moz-activehyperlinktext",
+      "-moz-default-background-color",
+      "-moz-default-color",
+      "-moz-hyperlinktext",
+      "-moz-visitedhyperlinktext",
     ],
     invalid_values: [
       "#f",
       "#ff",
       "#fffff",
       "#fffffff",
       "#fffffffff",
       "rgb(100%, 0, 100%)",
--- a/servo/components/style/values/specified/color.rs
+++ b/servo/components/style/values/specified/color.rs
@@ -135,18 +135,20 @@ pub enum SystemColor {
     Threedface,
     Threedhighlight,
     Threedlightshadow,
     Threedshadow,
     Window,
     Windowframe,
     Windowtext,
     MozButtondefault,
-    MozDefaultColor,
-    MozDefaultBackgroundColor,
+    #[parse(aliases = "-moz-default-color")]
+    Canvastext,
+    #[parse(aliases = "-moz-default-background-color")]
+    Canvas,
     MozDialog,
     MozDialogtext,
     /// Used to highlight valid regions to drop something onto.
     MozDragtargetzone,
     /// Used for selected but not focused cell backgrounds.
     MozCellhighlight,
     /// Used for selected but not focused cell text.
     MozCellhighlighttext,
@@ -225,19 +227,22 @@ pub enum SystemColor {
     /// Hyperlink color extracted from the system, not affected by the
     /// browser.anchor_color user pref.
     ///
     /// There is no OS-specified safe background color for this text, but it is
     /// used regularly within Windows and the Gnome DE on Dialog and Window
     /// colors.
     MozNativehyperlinktext,
 
-    MozHyperlinktext,
-    MozActivehyperlinktext,
-    MozVisitedhyperlinktext,
+    #[parse(aliases = "-moz-hyperlinktext")]
+    Linktext,
+    #[parse(aliases = "-moz-activehyperlinktext")]
+    Activetext,
+    #[parse(aliases = "-moz-visitedhyperlinktext")]
+    Visitedtext,
 
     /// Combobox widgets
     MozComboboxtext,
     MozCombobox,
 
     MozGtkInfoBarText,
 
     #[css(skip)]
@@ -248,21 +253,21 @@ pub enum SystemColor {
 impl SystemColor {
     #[inline]
     fn compute(&self, cx: &Context) -> ComputedColor {
         use crate::gecko_bindings::bindings;
 
         let prefs = cx.device().pref_sheet_prefs();
 
         convert_nscolor_to_computedcolor(match *self {
-            SystemColor::MozDefaultColor => prefs.mDefaultColor,
-            SystemColor::MozDefaultBackgroundColor => prefs.mDefaultBackgroundColor,
-            SystemColor::MozHyperlinktext => prefs.mLinkColor,
-            SystemColor::MozActivehyperlinktext => prefs.mActiveLinkColor,
-            SystemColor::MozVisitedhyperlinktext => prefs.mVisitedLinkColor,
+            SystemColor::Canvastext => prefs.mDefaultColor,
+            SystemColor::Canvas => prefs.mDefaultBackgroundColor,
+            SystemColor::Linktext => prefs.mLinkColor,
+            SystemColor::Activetext => prefs.mActiveLinkColor,
+            SystemColor::Visitedtext => prefs.mVisitedLinkColor,
 
             _ => unsafe {
                 bindings::Gecko_GetLookAndFeelSystemColor(*self as i32, cx.device().document())
             },
         })
     }
 }
 
deleted file mode 100644
--- a/testing/web-platform/meta/css/css-color/parsing/system-color-valid.html.ini
+++ /dev/null
@@ -1,16 +0,0 @@
-[system-color-valid.html]
-  [e.style['color'\] = "VisitedText" should set the property value]
-    expected: FAIL
-
-  [e.style['color'\] = "ActiveText" should set the property value]
-    expected: FAIL
-
-  [e.style['color'\] = "CanvasText" should set the property value]
-    expected: FAIL
-
-  [e.style['color'\] = "LinkText" should set the property value]
-    expected: FAIL
-
-  [e.style['color'\] = "Canvas" should set the property value]
-    expected: FAIL
-
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/forced-colors-mode/backplate/forced-colors-mode-backplate-01.html.ini
@@ -0,0 +1,2 @@
+[forced-colors-mode-backplate-01.html]
+  expected: FAIL
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/forced-colors-mode/backplate/forced-colors-mode-backplate-02.html.ini
@@ -0,0 +1,2 @@
+[forced-colors-mode-backplate-02.html]
+  expected: FAIL
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/forced-colors-mode/backplate/forced-colors-mode-backplate-03.html.ini
@@ -0,0 +1,2 @@
+[forced-colors-mode-backplate-03.html]
+  expected: FAIL
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/forced-colors-mode/backplate/forced-colors-mode-backplate-04.html.ini
@@ -0,0 +1,2 @@
+[forced-colors-mode-backplate-04.html]
+  expected: FAIL
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/forced-colors-mode/backplate/forced-colors-mode-backplate-05.html.ini
@@ -0,0 +1,2 @@
+[forced-colors-mode-backplate-05.html]
+  expected: FAIL
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/forced-colors-mode/backplate/forced-colors-mode-backplate-06.html.ini
@@ -0,0 +1,2 @@
+[forced-colors-mode-backplate-06.html]
+  expected: FAIL
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/forced-colors-mode/backplate/forced-colors-mode-backplate-08.html.ini
@@ -0,0 +1,2 @@
+[forced-colors-mode-backplate-08.html]
+  expected: FAIL
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/forced-colors-mode/backplate/forced-colors-mode-backplate-09.html.ini
@@ -0,0 +1,2 @@
+[forced-colors-mode-backplate-09.html]
+  expected: FAIL
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/forced-colors-mode/backplate/forced-colors-mode-backplate-10.html.ini
@@ -0,0 +1,2 @@
+[forced-colors-mode-backplate-10.html]
+  expected: FAIL
--- a/testing/web-platform/tests/css/css-color/parsing/color-valid.html
+++ b/testing/web-platform/tests/css/css-color/parsing/color-valid.html
@@ -23,13 +23,11 @@ test_valid_value("color", "rgb(100%, 0%,
 test_valid_value("color", "rgba(2, 3, 4, 0.5)"); // Safari serializes alpha-value 0.498039
 test_valid_value("color", "rgba(2, 3, 4, 50%)", "rgba(2, 3, 4, 0.5)"); // Safari serializes alpha-value 0.498039
 test_valid_value("color", "hsl(120, 100%, 50%)", ["rgb(0, 255, 0)", "hsl(120, 100%, 50%)"]);
 test_valid_value("color", "hsla(120, 100%, 50%, 0.25)", ["rgba(0, 255, 0, 0.25)", "hsla(120, 100%, 50%, 0.25)"]); // Safari serializes alpha-value 0.247059
 test_valid_value("color", "rgb(-2, 3, 4)", "rgb(0, 3, 4)");
 test_valid_value("color", "rgb(100, 200, 300)", "rgb(100, 200, 255)");
 test_valid_value("color", "rgb(20, 10, 0, -10)", "rgba(20, 10, 0, 0)"); // Not supported by Edge/Safari.
 test_valid_value("color", "rgb(100%, 200%, 300%)", "rgb(255, 255, 255)");
-test_valid_value("color", "field");
-test_valid_value("color", "fieldtext");
 </script>
 </body>
 </html>