Bug 1396073: Remove :-moz-empty-except-children-with-local-name. r?heycam draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Wed, 27 Sep 2017 16:28:10 +0200
changeset 671152 3bc587a7a716ad6b4ca0a1d47209aaa965b28a33
parent 671151 d1562dc750436f9c8160af4ec4dfd8e559ef3fbd
child 671153 25a8b4e8c709ad5e6813d6bb9a104123e2c656a4
push id81847
push userbmo:emilio@crisal.io
push dateWed, 27 Sep 2017 14:56:42 +0000
reviewersheycam
bugs1396073
milestone58.0a1
Bug 1396073: Remove :-moz-empty-except-children-with-local-name. r?heycam <applet> is not a thing anymore, and that selector in our UA sheet will never match anyway, since an <applet> element will never have the BROKEN state. MozReview-Commit-ID: 7UOMKOv55uJ Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
layout/style/nsCSSPseudoClassList.h
layout/style/nsCSSPseudoClasses.cpp
layout/style/nsCSSRuleProcessor.cpp
layout/style/res/html.css
servo/components/style/gecko/non_ts_pseudo_class_list.rs
servo/components/style/gecko/wrapper.rs
--- a/layout/style/nsCSSPseudoClassList.h
+++ b/layout/style/nsCSSPseudoClassList.h
@@ -63,17 +63,16 @@
 
 // The CSS_PSEUDO_CLASS entries should all come before the
 // CSS_STATE_PSEUDO_CLASS entries.  The CSS_PSEUDO_CLASS entry order
 // must be the same as the order of cases in SelectorMatches.  :not
 // must be the last CSS_PSEUDO_CLASS.
 
 CSS_PSEUDO_CLASS(empty, ":empty", 0, "")
 CSS_PSEUDO_CLASS(mozOnlyWhitespace, ":-moz-only-whitespace", 0, "")
-CSS_PSEUDO_CLASS(mozEmptyExceptChildrenWithLocalname, ":-moz-empty-except-children-with-localname", 0, "")
 CSS_PSEUDO_CLASS(lang, ":lang", 0, "")
 CSS_PSEUDO_CLASS(root, ":root", 0, "")
 CSS_PSEUDO_CLASS(any, ":-moz-any", 0, "")
 
 CSS_PSEUDO_CLASS(firstChild, ":first-child", 0, "")
 CSS_PSEUDO_CLASS(firstNode, ":-moz-first-node", 0, "")
 CSS_PSEUDO_CLASS(lastChild, ":last-child", 0, "")
 CSS_PSEUDO_CLASS(lastNode, ":-moz-last-node", 0, "")
--- a/layout/style/nsCSSPseudoClasses.cpp
+++ b/layout/style/nsCSSPseudoClasses.cpp
@@ -84,17 +84,16 @@ void nsCSSPseudoClasses::AddRefAtoms()
 #include "nsCSSPseudoClassList.h"
 #undef CSS_PSEUDO_CLASS
 }
 
 bool
 nsCSSPseudoClasses::HasStringArg(Type aType)
 {
   return aType == Type::lang ||
-         aType == Type::mozEmptyExceptChildrenWithLocalname ||
          aType == Type::mozSystemMetric ||
          aType == Type::mozLocaleDir ||
          aType == Type::dir;
 }
 
 bool
 nsCSSPseudoClasses::HasNthPairArg(Type aType)
 {
--- a/layout/style/nsCSSRuleProcessor.cpp
+++ b/layout/style/nsCSSRuleProcessor.cpp
@@ -1790,42 +1790,16 @@ nsCSSRuleProcessor::StringPseudoMatches(
       {
         nsCOMPtr<nsIAtom> metric = NS_Atomize(aString);
         if (!nsCSSRuleProcessor::HasSystemMetric(metric)) {
           return false;
         }
       }
       break;
 
-    case CSSPseudoClassType::mozEmptyExceptChildrenWithLocalname:
-      {
-        NS_ASSERTION(aString, "Must have string!");
-        const nsIContent *child = nullptr;
-        int32_t index = -1;
-
-        if (aForStyling) {
-          // FIXME:  This isn't sufficient to handle:
-          //   :-moz-empty-except-children-with-localname() + E
-          //   :-moz-empty-except-children-with-localname() ~ E
-          // because we don't know to restyle the grandparent of the
-          // inserted/removed element (as in bug 534804 for :empty).
-          *aSetSlowSelectorFlag = true;
-        }
-        do {
-          child = aElement->GetChildAt(++index);
-        } while (child &&
-                  (!IsSignificantChildMaybeThreadSafe(child, true, false) ||
-                  (child->GetNameSpaceID() == aElement->GetNameSpaceID() &&
-                    child->NodeInfo()->NameAtom()->Equals(nsDependentString(aString)))));
-        if (child) {
-          return false;
-        }
-      }
-      break;
-
     case CSSPseudoClassType::dir:
       {
         if (aDependence) {
           EventStates states = sPseudoClassStateDependences[
             static_cast<CSSPseudoClassTypeBase>(aPseudo)];
           if (aStateMask.HasAtLeastOneOfStates(states)) {
             *aDependence = true;
             return false;
--- a/layout/style/res/html.css
+++ b/layout/style/res/html.css
@@ -637,19 +637,17 @@ hr {
 }
 
 hr[size="1"] {
   border-style: solid none none none;
 }
 
 img:-moz-broken::before, input:-moz-broken::before,
 img:-moz-user-disabled::before, input:-moz-user-disabled::before,
-img:-moz-loading::before, input:-moz-loading::before,
-applet:-moz-empty-except-children-with-localname(param):-moz-broken::before,
-applet:-moz-empty-except-children-with-localname(param):-moz-user-disabled::before {
+img:-moz-loading::before, input:-moz-loading::before {
   content: -moz-alt-content !important;
   unicode-bidi: isolate;
 }
 
 :-moz-any(object,applet):-moz-any(:-moz-broken,:-moz-user-disabled) > *|* {
   /*
     Inherit in the object's alignment so that if we aren't aligned explicitly
     we'll end up in the right place vertically.  See bug 36997.  Note that this
--- a/servo/components/style/gecko/non_ts_pseudo_class_list.rs
+++ b/servo/components/style/gecko/non_ts_pseudo_class_list.rs
@@ -114,19 +114,17 @@ macro_rules! apply_non_ts_list {
                 ("-moz-lwtheme", MozLWTheme, mozLWTheme, _, _),
                 ("-moz-lwtheme-brighttext", MozLWThemeBrightText, mozLWThemeBrightText, _, _),
                 ("-moz-lwtheme-darktext", MozLWThemeDarkText, mozLWThemeDarkText, _, _),
                 ("-moz-window-inactive", MozWindowInactive, mozWindowInactive, _, _),
             ],
             string: [
                 // FIXME(emilio): Unship this for content docs (bug 1396066).
                 ("-moz-system-metric", MozSystemMetric, mozSystemMetric, _, _),
-                // FIXME(emilio): Unship this for content docs (bug 1396073).
-                ("-moz-empty-except-children-with-localname", MozEmptyExceptChildrenWithLocalname,
-                 mozEmptyExceptChildrenWithLocalname, _, _),
+                 mozEmptyExceptChildrenWithLocalname, _, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
                 ("lang", Lang, lang, _, _),
             ],
             keyword: [
                 ("-moz-locale-dir", MozLocaleDir, mozLocaleDir, _, _),
                 ("dir", Dir, dir, _, _),
             ]
         }
     }
--- a/servo/components/style/gecko/wrapper.rs
+++ b/servo/components/style/gecko/wrapper.rs
@@ -1965,17 +1965,16 @@ impl<'le> ::selectors::Element for Gecko
                 context.nesting_level -= 1;
                 result
             }
             NonTSPseudoClass::Lang(ref lang_arg) => {
                 self.match_element_lang(None, lang_arg)
             }
             NonTSPseudoClass::MozSystemMetric(ref s) |
             NonTSPseudoClass::MozLocaleDir(ref s) |
-            NonTSPseudoClass::MozEmptyExceptChildrenWithLocalname(ref s) |
             NonTSPseudoClass::Dir(ref s) => {
                 unsafe {
                     let mut set_slow_selector = false;
                     let matches = Gecko_MatchStringArgPseudo(self.0,
                                        pseudo_class.to_gecko_pseudoclasstype().unwrap(),
                                        s.as_ptr(), &mut set_slow_selector);
                     if set_slow_selector {
                         flags_setter(self, HAS_SLOW_SELECTOR);