Bug 1396066: Restrict :-moz-system-metric to chrome and ua sheets. r?xidorn draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 02 Oct 2017 18:58:41 +0200
changeset 675931 cecb8c3ab1e1a23cac3a2d2c12a51f575d002e02
parent 675930 624eef99351ab655c9271bb59d01b89c17e50707
child 675932 77c763f82d33ca1bcdb3f03fdc9d5017eb885cb3
push id83306
push userbmo:emilio@crisal.io
push dateFri, 06 Oct 2017 08:13:37 +0000
reviewersxidorn
bugs1396066
milestone58.0a1
Bug 1396066: Restrict :-moz-system-metric to chrome and ua sheets. r?xidorn MozReview-Commit-ID: AyHWP3QgGlA
layout/reftests/css-mediaqueries/reftest.list
layout/reftests/css-mediaqueries/system-metrics-1-ref.html
layout/reftests/css-mediaqueries/system-metrics-1.html
layout/style/nsCSSPseudoClassList.h
--- a/layout/reftests/css-mediaqueries/reftest.list
+++ b/layout/reftests/css-mediaqueries/reftest.list
@@ -11,9 +11,8 @@ fuzzy-if(Android,8,454) == mq_print_maxh
 == mq_print_maxwidth.xhtml mq_print-ref.xhtml
 
 == mq_print_maxwidth_updown.xhtml mq_print-ref.xhtml
 == mq_print_maxheight_updown.xhtml mq_print-ref.xhtml
 == mq_print_minheight_updown.xhtml mq_print-ref.xhtml
 == mq_print_minwidth_updown.xhtml mq_print-ref.xhtml
 
 pref(layout.css.scoped-style.enabled,true) == scoped-mq-update.html scoped-mq-update-ref.html
-== system-metrics-1.html system-metrics-1-ref.html
deleted file mode 100644
--- a/layout/reftests/css-mediaqueries/system-metrics-1-ref.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<!DOCTYPE HTML>
-<title>test for system metric media queries (reference)</title>
-<style>
-
-p { color: green; }
-
-</style>
-<p>This text should be green.</p>
deleted file mode 100644
--- a/layout/reftests/css-mediaqueries/system-metrics-1.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE HTML>
-<title>test for system metric media queries</title>
-<style>
-
-p { color: red; }
-
-/* Exactly one of the next two should apply */
-
-@media all and (-moz-scrollbar-end-backward) {
-  p:-moz-system-metric(scrollbar-end-backward) { color: green; }
-}
-
-@media not all and (-moz-scrollbar-end-backward) {
-  p:not(:-moz-system-metric(scrollbar-end-backward)) { color: green; }
-}
-
-/* Neither of these should apply */
-
-@media not all and (-moz-scrollbar-end-backward) {
-  p:-moz-system-metric(scrollbar-end-backward) { color: red; }
-}
-
-@media all and (-moz-scrollbar-end-backward) {
-  p:not(:-moz-system-metric(scrollbar-end-backward)) { color: red; }
-}
-
-</style>
-<p>This text should be green.</p>
--- a/layout/style/nsCSSPseudoClassList.h
+++ b/layout/style/nsCSSPseudoClassList.h
@@ -96,17 +96,18 @@ CSS_PSEUDO_CLASS(mozIsHTML, ":-moz-is-ht
 // purposes).
 CSS_PSEUDO_CLASS(mozNativeAnonymous, ":-moz-native-anonymous",
                  CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS, "")
 
 CSS_PSEUDO_CLASS(mozUseShadowTreeRoot, ":-moz-use-shadow-tree-root",
                  CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS, "")
 
 // Matches anything when the specified look-and-feel metric is set
-CSS_PSEUDO_CLASS(mozSystemMetric, ":-moz-system-metric", 0, "")
+CSS_PSEUDO_CLASS(mozSystemMetric, ":-moz-system-metric",
+                 CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME, "")
 
 // -moz-locale-dir(ltr) and -moz-locale-dir(rtl) may be used
 // to match based on the locale's chrome direction
 CSS_PSEUDO_CLASS(mozLocaleDir, ":-moz-locale-dir", 0, "")
 
 // -moz-lwtheme may be used to match a document that has a lightweight theme
 CSS_PSEUDO_CLASS(mozLWTheme, ":-moz-lwtheme", 0, "")