Bug 1199529 - Remove :-moz-full-screen-ancestor pseudo-class as well as its state bit. r?smaug draft
authorXidorn Quan <me@upsuper.org>
Wed, 29 Jun 2016 17:44:18 +1000
changeset 382250 1291fd5e5df9c2e16df196f09a50eef6337c6b49
parent 382249 f15138055e80688ea8a1bd528374e1c8055b7633
child 524149 7a38fb84903e6aee0edbfcf66cc353b0dd3c3919
push id21674
push userxquan@mozilla.com
push dateWed, 29 Jun 2016 12:15:52 +0000
reviewerssmaug
bugs1199529
milestone50.0a1
Bug 1199529 - Remove :-moz-full-screen-ancestor pseudo-class as well as its state bit. r?smaug MozReview-Commit-ID: J0hGsLLdyam
dom/events/EventStateManager.cpp
dom/events/EventStates.h
dom/html/test/file_fullscreen-api.html
layout/style/nsCSSPseudoClassList.h
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -4823,24 +4823,16 @@ GetParentElement(Element* aElement)
   return (p && p->IsElement()) ? p->AsElement() : nullptr;
 }
 
 /* static */
 void
 EventStateManager::SetFullScreenState(Element* aElement, bool aIsFullScreen)
 {
   DoStateChange(aElement, NS_EVENT_STATE_FULL_SCREEN, aIsFullScreen);
-  Element* ancestor = aElement;
-  while ((ancestor = GetParentElement(ancestor))) {
-    DoStateChange(ancestor, NS_EVENT_STATE_FULL_SCREEN_ANCESTOR, aIsFullScreen);
-    if (ancestor->State().HasState(NS_EVENT_STATE_FULL_SCREEN)) {
-      // If we meet another fullscreen element, stop here.
-      break;
-    }
-  }
 }
 
 /* static */
 inline void
 EventStateManager::DoStateChange(Element* aElement, EventStates aState,
                                  bool aAddState)
 {
   if (aAddState) {
--- a/dom/events/EventStates.h
+++ b/dom/events/EventStates.h
@@ -257,18 +257,18 @@ private:
 #define NS_EVENT_STATE_MOZ_SUBMITINVALID NS_DEFINE_EVENT_STATE_MACRO(30)
 // UI friendly version of :invalid pseudo-class.
 #define NS_EVENT_STATE_MOZ_UI_INVALID NS_DEFINE_EVENT_STATE_MACRO(31)
 // UI friendly version of :valid pseudo-class.
 #define NS_EVENT_STATE_MOZ_UI_VALID NS_DEFINE_EVENT_STATE_MACRO(32)
 // Content is the full screen element, or a frame containing the
 // current full-screen element.
 #define NS_EVENT_STATE_FULL_SCREEN   NS_DEFINE_EVENT_STATE_MACRO(33)
-// Content is an ancestor of the DOM full-screen element.
-#define NS_EVENT_STATE_FULL_SCREEN_ANCESTOR   NS_DEFINE_EVENT_STATE_MACRO(34)
+// This bit is currently free.
+// #define NS_EVENT_STATE_?????????? NS_DEFINE_EVENT_STATE_MACRO(34)
 // Handler for click to play plugin
 #define NS_EVENT_STATE_TYPE_CLICK_TO_PLAY NS_DEFINE_EVENT_STATE_MACRO(35)
 // Content is in the optimum region.
 #define NS_EVENT_STATE_OPTIMUM NS_DEFINE_EVENT_STATE_MACRO(36)
 // Content is in the suboptimal region.
 #define NS_EVENT_STATE_SUB_OPTIMUM NS_DEFINE_EVENT_STATE_MACRO(37)
 // Content is in the sub-suboptimal region.
 #define NS_EVENT_STATE_SUB_SUB_OPTIMUM NS_DEFINE_EVENT_STATE_MACRO(38)
@@ -294,15 +294,14 @@ private:
  * NOTE: do not go over 63 without updating EventStates::InternalType!
  */
 
 #define DIRECTION_STATES (NS_EVENT_STATE_LTR | NS_EVENT_STATE_RTL)
 
 #define ESM_MANAGED_STATES (NS_EVENT_STATE_ACTIVE | NS_EVENT_STATE_FOCUS |     \
                             NS_EVENT_STATE_HOVER | NS_EVENT_STATE_DRAGOVER |   \
                             NS_EVENT_STATE_URLTARGET | NS_EVENT_STATE_FOCUSRING | \
-                            NS_EVENT_STATE_FULL_SCREEN | NS_EVENT_STATE_FULL_SCREEN_ANCESTOR | \
-                            NS_EVENT_STATE_UNRESOLVED)
+                            NS_EVENT_STATE_FULL_SCREEN | NS_EVENT_STATE_UNRESOLVED)
 
 #define INTRINSIC_STATES (~ESM_MANAGED_STATES)
 
 #endif // mozilla_EventStates_h_
 
--- a/dom/html/test/file_fullscreen-api.html
+++ b/dom/html/test/file_fullscreen-api.html
@@ -150,22 +150,16 @@ function error1(event) {
   addFullscreenChangeContinuation("enter", enter4);
   inDocElement.requestFullscreen();
 }
 
 function enter4(event) {
   is(event.target, document, "Event target should be full-screen document #5");
   is(document.fullscreenElement, inDocElement, "FSE should be inDocElement.");
 
-  var n = container;
-  do {
-    ok(n.matches(":-moz-full-screen-ancestor"), "Ancestor " + n + " should match :-moz-full-screen-ancestor")
-    n = n.parentNode;
-  } while (n && n.matches);
-    
   // Remove full-screen ancestor element from document, verify it stops being reported as current FSE.
   addFullscreenChangeContinuation("exit", exit_to_arg_test_1);
   container.parentNode.removeChild(container);
   is(document.fullscreenElement, null,
      "Should not have a full-screen element again.");
 }
 
 function exit_to_arg_test_1(event) {
--- a/layout/style/nsCSSPseudoClassList.h
+++ b/layout/style/nsCSSPseudoClassList.h
@@ -165,20 +165,16 @@ CSS_STATE_PSEUDO_CLASS(mozDevtoolsHighli
 // Matches the element which is being displayed full-screen, and
 // any containing frames.
 CSS_STATE_PSEUDO_CLASS(fullscreen, ":fullscreen",
                        CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME,
                        "full-screen-api.unprefix.enabled",
                        NS_EVENT_STATE_FULL_SCREEN)
 CSS_STATE_PSEUDO_CLASS(mozFullScreen, ":-moz-full-screen", 0, "", NS_EVENT_STATE_FULL_SCREEN)
 
-// Matches any element which is an ancestor of the DOM full-screen element,
-// or an ancestor of a containing frame of the full-screen element.
-CSS_STATE_PSEUDO_CLASS(mozFullScreenAncestor, ":-moz-full-screen-ancestor", 0, "", NS_EVENT_STATE_FULL_SCREEN_ANCESTOR)
-
 // Matches if the element is focused and should show a focus ring
 CSS_STATE_PSEUDO_CLASS(mozFocusRing, ":-moz-focusring", 0, "", NS_EVENT_STATE_FOCUSRING)
 
 // Image, object, etc state pseudo-classes
 CSS_STATE_PSEUDO_CLASS(mozBroken, ":-moz-broken", 0, "", NS_EVENT_STATE_BROKEN)
 CSS_STATE_PSEUDO_CLASS(mozLoading, ":-moz-loading", 0, "", NS_EVENT_STATE_LOADING)
 
 CSS_STATE_PSEUDO_CLASS(mozUserDisabled, ":-moz-user-disabled",