Bug 1380375 - Remove the DOM bindings for the unused scrollgrab feature. r=smaug
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 12 Jul 2017 15:28:50 -0400
changeset 607740 61c6ddbcf8a9cb92dd19622507865a2001982677
parent 607739 703825995ef40591a932983f7a812c335f50ec75
child 607741 0fef3ce5bc6360bedb4548cc4c3396c7480f6406
push id68095
push userbmo:rbarker@mozilla.com
push dateWed, 12 Jul 2017 20:01:47 +0000
reviewerssmaug
bugs1380375
milestone56.0a1
Bug 1380375 - Remove the DOM bindings for the unused scrollgrab feature. r=smaug MozReview-Commit-ID: 87aJOsc6zbO
dom/base/Element.h
dom/base/nsContentUtils.cpp
dom/html/nsGenericHTMLElement.cpp
dom/html/nsGenericHTMLElement.h
dom/webidl/HTMLElement.webidl
--- a/dom/base/Element.h
+++ b/dom/base/Element.h
@@ -144,18 +144,17 @@ enum {
     ELEMENT_IS_POTENTIAL_RESTYLE_ROOT |
     ELEMENT_IS_POTENTIAL_ANIMATION_ONLY_RESTYLE_ROOT,
 
   // All of the restyle bits together, for convenience.
   ELEMENT_ALL_RESTYLE_FLAGS = ELEMENT_PENDING_RESTYLE_FLAGS |
                               ELEMENT_POTENTIAL_RESTYLE_ROOT_FLAGS |
                               ELEMENT_IS_CONDITIONAL_RESTYLE_ANCESTOR,
 
-  // Set if this element is marked as 'scrollgrab' (see bug 912666)
-  ELEMENT_HAS_SCROLLGRAB = ELEMENT_FLAG_BIT(5),
+  // ELEMENT_FLAG_BIT(5) is currently unused
 
   // Remaining bits are for subclasses
   ELEMENT_TYPE_SPECIFIC_BITS_OFFSET = NODE_TYPE_SPECIFIC_BITS_OFFSET + 6
 };
 
 #undef ELEMENT_FLAG_BIT
 
 // Make sure we have space for our bits
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -6846,18 +6846,20 @@ nsContentUtils::IsUserFocusIgnored(nsINo
   }
 
   return false;
 }
 
 bool
 nsContentUtils::HasScrollgrab(nsIContent* aContent)
 {
-  nsGenericHTMLElement* element = nsGenericHTMLElement::FromContentOrNull(aContent);
-  return element && element->Scrollgrab();
+  // If we ever standardize this feature we'll want to hook this up properly
+  // again. For now we're removing all the DOM-side code related to it but
+  // leaving the layout and APZ handling for it in place.
+  return false;
 }
 
 void
 nsContentUtils::FlushLayoutForTree(nsPIDOMWindowOuter* aWindow)
 {
   if (!aWindow) {
     return;
   }
--- a/dom/html/nsGenericHTMLElement.cpp
+++ b/dom/html/nsGenericHTMLElement.cpp
@@ -1679,24 +1679,16 @@ nsGenericHTMLElement::GetURIAttr(nsIAtom
   // Don't care about return value.  If it fails, we still want to
   // return true, and *aURI will be null.
   nsContentUtils::NewURIWithDocumentCharset(aURI,
                                             attr->GetStringValue(),
                                             OwnerDoc(), baseURI);
   return true;
 }
 
-/* static */ bool
-nsGenericHTMLElement::IsScrollGrabAllowed(JSContext*, JSObject*)
-{
-  // Only allow scroll grabbing in chrome
-  nsIPrincipal* prin = nsContentUtils::SubjectPrincipal();
-  return nsContentUtils::IsSystemPrincipal(prin);
-}
-
 HTMLMenuElement*
 nsGenericHTMLElement::GetContextMenu() const
 {
   nsAutoString value;
   GetHTMLAttr(nsGkAtoms::contextmenu, value);
   if (!value.IsEmpty()) {
     //XXXsmaug How should this work in Shadow DOM?
     nsIDocument* doc = GetUncomposedDoc();
--- a/dom/html/nsGenericHTMLElement.h
+++ b/dom/html/nsGenericHTMLElement.h
@@ -175,28 +175,16 @@ public:
   bool Spellcheck();
   void SetSpellcheck(bool aSpellcheck, mozilla::ErrorResult& aError)
   {
     SetHTMLAttr(nsGkAtoms::spellcheck,
                 aSpellcheck ? NS_LITERAL_STRING("true")
                             : NS_LITERAL_STRING("false"),
                 aError);
   }
-  bool Scrollgrab() const
-  {
-    return HasFlag(ELEMENT_HAS_SCROLLGRAB);
-  }
-  void SetScrollgrab(bool aValue)
-  {
-    if (aValue) {
-      SetFlags(ELEMENT_HAS_SCROLLGRAB);
-    } else {
-      UnsetFlags(ELEMENT_HAS_SCROLLGRAB);
-    }
-  }
 
   void GetInnerText(mozilla::dom::DOMString& aValue, mozilla::ErrorResult& aError);
   void SetInnerText(const nsAString& aValue);
 
   /**
    * Determine whether an attribute is an event (onclick, etc.)
    * @param aName the attribute
    * @return whether the name is an event handler name
@@ -882,19 +870,16 @@ public:
     }
 
     // Per spec, <img> is exposed by id only if it also has a nonempty
     // name (which doesn't have to match the id or anything).
     // HasName() is true precisely when name is nonempty.
     return aElement->IsHTMLElement(nsGkAtoms::img) && aElement->HasName();
   }
 
-  static bool
-  IsScrollGrabAllowed(JSContext*, JSObject*);
-
 protected:
   /**
    * Add/remove this element to the documents name cache
    */
   void AddToNameTable(nsIAtom* aName) {
     NS_ASSERTION(HasName(), "Node doesn't have name?");
     nsIDocument* doc = GetUncomposedDoc();
     if (doc && !IsInAnonymousSubtree()) {
--- a/dom/webidl/HTMLElement.webidl
+++ b/dom/webidl/HTMLElement.webidl
@@ -75,23 +75,16 @@ partial interface HTMLElement {
   // CSSOM things are not [Pure] because they can flush
   readonly attribute Element? offsetParent;
   readonly attribute long offsetTop;
   readonly attribute long offsetLeft;
   readonly attribute long offsetWidth;
   readonly attribute long offsetHeight;
 };
 
-// Extension for scroll-grabbing, used in the B2G dynamic toolbar.
-// This is likely to be revised.
-partial interface HTMLElement {
-  [Func="nsGenericHTMLElement::IsScrollGrabAllowed"]
-           attribute boolean scrollgrab;
-};
-
 [NoInterfaceObject]
 interface TouchEventHandlers {
   [Func="nsGenericHTMLElement::TouchEventsEnabled"]
            attribute EventHandler ontouchstart;
   [Func="nsGenericHTMLElement::TouchEventsEnabled"]
            attribute EventHandler ontouchend;
   [Func="nsGenericHTMLElement::TouchEventsEnabled"]
            attribute EventHandler ontouchmove;