Bug 1454238: Remove nsINode::eMEDIA. r=bz
authorEmilio Cobos Álvarez <emilio@crisal.io>
Sun, 15 Apr 2018 12:29:46 +0200
changeset 468250 9aa58b68a002add2db9bf9ccd8966616b384bf72
parent 468249 658bffdfcc1d1597eb9a8a7639838a901f417eaa
child 468251 be575e9c66e18816eb90884b718342906c00f548
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1454238
milestone61.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 1454238: Remove nsINode::eMEDIA. r=bz MozReview-Commit-ID: LPutL6PlrgG
dom/base/nsINode.h
dom/html/HTMLMediaElement.cpp
dom/html/HTMLMediaElement.h
dom/html/HTMLSourceElement.cpp
dom/html/HTMLTrackElement.cpp
--- a/dom/base/nsINode.h
+++ b/dom/base/nsINode.h
@@ -417,18 +417,16 @@ public:
     /** xml processing instructions */
     ePROCESSING_INSTRUCTION = 1 << 4,
     /** comment nodes */
     eCOMMENT             = 1 << 5,
     /** form control elements */
     eHTML_FORM_CONTROL   = 1 << 6,
     /** character data nodes (comments, PIs, text). */
     eDATA_NODE           = 1 << 8,
-    /** HTMLMediaElement */
-    eMEDIA               = 1 << 9,
     /** animation elements */
     eANIMATION           = 1 << 10,
     /** filter elements that implement SVGFilterPrimitiveStandardAttributes */
     eFILTER              = 1 << 11,
     /** SVGGeometryElement */
     eSHAPE               = 1 << 12
   };
 
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -6527,22 +6527,16 @@ void HTMLMediaElement::DoRemoveSelfRefer
 
 void HTMLMediaElement::NotifyShutdownEvent()
 {
   mShuttingDown = true;
   ResetState();
   AddRemoveSelfReference();
 }
 
-bool
-HTMLMediaElement::IsNodeOfType(uint32_t aFlags) const
-{
-  return !(aFlags & ~eMEDIA);
-}
-
 void HTMLMediaElement::DispatchAsyncSourceError(nsIContent* aSourceElement)
 {
   LOG_EVENT(LogLevel::Debug, ("%p Queuing simple source error event", this));
 
   nsCOMPtr<nsIRunnable> event = new nsSourceErrorEventRunner(this, aSourceElement);
   mMainThreadEventTarget->Dispatch(event.forget());
 }
 
--- a/dom/html/HTMLMediaElement.h
+++ b/dom/html/HTMLMediaElement.h
@@ -374,18 +374,16 @@ public:
 
   /**
    * Called when a captured MediaStreamTrack is stopped so we can clean up its
    * MediaInputPort.
    */
   void NotifyOutputTrackStopped(DOMMediaStream* aOwningStream,
                                 TrackID aDestinationTrackID);
 
-  virtual bool IsNodeOfType(uint32_t aFlags) const override;
-
   /**
    * Returns the current load ID. Asynchronous events store the ID that was
    * current when they were enqueued, and if it has changed when they come to
    * fire, they consider themselves cancelled, and don't fire.
    */
   uint32_t GetCurrentLoadID() { return mCurrentLoadID; }
 
   /**
--- a/dom/html/HTMLSourceElement.cpp
+++ b/dom/html/HTMLSourceElement.cpp
@@ -3,16 +3,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/dom/HTMLSourceElement.h"
 #include "mozilla/dom/HTMLSourceElementBinding.h"
 
 #include "mozilla/dom/HTMLImageElement.h"
+#include "mozilla/dom/HTMLMediaElement.h"
 #include "mozilla/dom/ResponsiveImageSelector.h"
 #include "mozilla/dom/MediaList.h"
 #include "mozilla/dom/MediaSource.h"
 
 #include "nsGkAtoms.h"
 
 #include "nsHostObjectProtocolHandler.h"
 
@@ -147,18 +148,17 @@ HTMLSourceElement::BindToTree(nsIDocumen
                               bool aCompileEventHandlers)
 {
   nsresult rv = nsGenericHTMLElement::BindToTree(aDocument,
                                                  aParent,
                                                  aBindingParent,
                                                  aCompileEventHandlers);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  if (aParent && aParent->IsNodeOfType(nsINode::eMEDIA)) {
-    HTMLMediaElement* media = static_cast<HTMLMediaElement*>(aParent);
+  if (auto* media = HTMLMediaElement::FromNodeOrNull(aParent)) {
     media->NotifyAddedSource();
   }
 
   return NS_OK;
 }
 
 JSObject*
 HTMLSourceElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
--- a/dom/html/HTMLTrackElement.cpp
+++ b/dom/html/HTMLTrackElement.cpp
@@ -356,23 +356,24 @@ HTMLTrackElement::BindToTree(nsIDocument
 {
   nsresult rv = nsGenericHTMLElement::BindToTree(aDocument,
                                                  aParent,
                                                  aBindingParent,
                                                  aCompileEventHandlers);
   NS_ENSURE_SUCCESS(rv, rv);
 
   LOG(LogLevel::Debug, ("Track Element bound to tree."));
-  if (!aParent || !aParent->IsNodeOfType(nsINode::eMEDIA)) {
+  auto* parent = HTMLMediaElement::FromNodeOrNull(aParent);
+  if (!parent) {
     return NS_OK;
   }
 
   // Store our parent so we can look up its frame for display.
   if (!mMediaParent) {
-    mMediaParent = static_cast<HTMLMediaElement*>(aParent);
+    mMediaParent = parent;
 
     // TODO: separate notification for 'alternate' tracks?
     mMediaParent->NotifyAddedSource();
     LOG(LogLevel::Debug, ("Track element sent notification to parent."));
 
     // We may already have a TextTrack at this point if GetTrack() has already
     // been called. This happens, for instance, if script tries to get the
     // TextTrack before its mTrackElement has been bound to the DOM tree.