Bug 1447098 part 1. Rename FromContent on various DOM classes to FromNode. r=mystor
authorBoris Zbarsky <bzbarsky@mit.edu>
Wed, 21 Mar 2018 17:39:04 -0400
changeset 409402 eb4e6e094d2051a0033c0e36aded9e07adf7dff3
parent 409401 ebffbbe870e5ef605116f992ea165ce3440d526c
child 409403 fd041053a1b554a9b4cb8e134bf7712145b40420
push id33687
push userapavel@mozilla.com
push dateThu, 22 Mar 2018 09:31:48 +0000
treeherdermozilla-central@7771df14ea18 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmystor
bugs1447098
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 1447098 part 1. Rename FromContent on various DOM classes to FromNode. r=mystor MozReview-Commit-ID: 202nkbmkwfR
accessible/base/AccIterator.cpp
accessible/base/nsCoreUtils.cpp
accessible/generic/Accessible.cpp
accessible/generic/ImageAccessible.cpp
accessible/html/HTMLElementAccessibles.cpp
accessible/html/HTMLFormControlAccessible.cpp
accessible/html/HTMLImageMapAccessible.cpp
accessible/html/HTMLSelectAccessible.cpp
accessible/html/HTMLTableAccessible.cpp
accessible/xul/XULTabAccessible.cpp
docshell/base/nsDocShell.cpp
dom/base/ChildIterator.cpp
dom/base/Element.cpp
dom/base/ShadowRoot.cpp
dom/base/nsContentAreaDragDrop.cpp
dom/base/nsContentList.cpp
dom/base/nsContentUtils.cpp
dom/base/nsDOMWindowUtils.cpp
dom/base/nsDocument.cpp
dom/base/nsFrameLoader.cpp
dom/base/nsIContent.h
dom/base/nsIContentInlines.h
dom/base/nsNodeUtils.cpp
dom/base/nsObjectLoadingContent.cpp
dom/base/nsRange.cpp
dom/base/nsWindowRoot.cpp
dom/events/EventStateManager.cpp
dom/events/IMEStateManager.cpp
dom/html/HTMLAllCollection.cpp
dom/html/HTMLFieldSetElement.cpp
dom/html/HTMLFormElement.cpp
dom/html/HTMLImageElement.cpp
dom/html/HTMLInputElement.cpp
dom/html/HTMLMediaElement.cpp
dom/html/HTMLMenuElement.cpp
dom/html/HTMLMenuItemElement.cpp
dom/html/HTMLOptGroupElement.cpp
dom/html/HTMLOptionElement.cpp
dom/html/HTMLPictureElement.cpp
dom/html/HTMLSelectElement.cpp
dom/html/HTMLSelectElement.h
dom/html/HTMLSlotElement.cpp
dom/html/HTMLSummaryElement.cpp
dom/html/HTMLTableCellElement.cpp
dom/html/HTMLTableElement.cpp
dom/html/HTMLTableRowElement.cpp
dom/html/ImageDocument.cpp
dom/html/RadioNodeList.cpp
dom/html/nsGenericHTMLElement.cpp
dom/html/nsGenericHTMLElement.h
dom/html/nsIConstraintValidation.cpp
dom/html/nsTextEditorState.cpp
dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
dom/xbl/nsXBLPrototypeHandler.cpp
dom/xml/nsXMLContentSink.cpp
dom/xul/nsXULElement.cpp
editor/libeditor/EditorBase.cpp
editor/libeditor/HTMLAnonymousNodeEditor.cpp
editor/libeditor/HTMLEditUtils.cpp
editor/libeditor/HTMLEditor.cpp
editor/libeditor/HTMLInlineTableEditor.cpp
layout/base/PresShell.cpp
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsLayoutUtils.cpp
layout/forms/nsCheckboxRadioFrame.cpp
layout/forms/nsColorControlFrame.cpp
layout/forms/nsFileControlFrame.cpp
layout/forms/nsGfxButtonControlFrame.cpp
layout/forms/nsLegendFrame.cpp
layout/forms/nsListControlFrame.cpp
layout/forms/nsNumberControlFrame.cpp
layout/forms/nsTextControlFrame.cpp
layout/generic/DetailsFrame.cpp
layout/generic/ReflowInput.cpp
layout/generic/nsBulletFrame.cpp
layout/generic/nsContainerFrame.cpp
layout/generic/nsFrame.cpp
layout/generic/nsFrameSetFrame.cpp
layout/generic/nsGfxScrollFrame.cpp
layout/generic/nsHTMLCanvasFrame.cpp
layout/generic/nsImageFrame.cpp
layout/generic/nsImageMap.cpp
layout/generic/nsSimplePageSequenceFrame.cpp
layout/generic/nsSubDocumentFrame.cpp
layout/printing/nsPrintJob.cpp
layout/style/ServoBindings.cpp
layout/xul/nsSplitterFrame.cpp
layout/xul/nsXULTooltipListener.cpp
layout/xul/tree/TreeBoxObject.cpp
layout/xul/tree/nsTreeColFrame.cpp
parser/html/nsHtml5TreeOperation.cpp
toolkit/components/satchel/nsFormFillController.cpp
widget/gtk/nsNativeThemeGTK.cpp
widget/nsBaseDragService.cpp
widget/nsNativeTheme.cpp
widget/windows/TaskbarPreview.cpp
--- a/accessible/base/AccIterator.cpp
+++ b/accessible/base/AccIterator.cpp
@@ -134,17 +134,17 @@ HTMLLabelIterator::
   mAcc(aAccessible), mLabelFilter(aFilter)
 {
 }
 
 bool
 HTMLLabelIterator::IsLabel(Accessible* aLabel)
 {
   dom::HTMLLabelElement* labelEl =
-    dom::HTMLLabelElement::FromContent(aLabel->GetContent());
+    dom::HTMLLabelElement::FromNode(aLabel->GetContent());
   return labelEl && labelEl->GetControl() == mAcc->GetContent();
 }
 
 Accessible*
 HTMLLabelIterator::Next()
 {
   // Get either <label for="[id]"> element which explicitly points to given
   // element, or <label> ancestor which implicitly point to it.
--- a/accessible/base/nsCoreUtils.cpp
+++ b/accessible/base/nsCoreUtils.cpp
@@ -43,17 +43,17 @@ using namespace mozilla;
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsCoreUtils
 ////////////////////////////////////////////////////////////////////////////////
 
 bool
 nsCoreUtils::IsLabelWithControl(nsIContent* aContent)
 {
-  dom::HTMLLabelElement* label = dom::HTMLLabelElement::FromContent(aContent);
+  dom::HTMLLabelElement* label = dom::HTMLLabelElement::FromNode(aContent);
   if (label && label->GetControl())
     return true;
 
   return false;
 }
 
 bool
 nsCoreUtils::HasClickListener(nsIContent *aContent)
@@ -95,17 +95,17 @@ nsCoreUtils::DispatchClickEvent(nsITreeB
   nsresult rv = aTreeBoxObj->GetCoordsForCellItem(aRowIndex, aColumn,
                                                   aPseudoElt,
                                                   &x, &y, &width, &height);
   if (NS_FAILED(rv))
     return;
 
   nsCOMPtr<nsIContent> tcXULElm(do_QueryInterface(tcElm));
   nsCOMPtr<nsIBoxObject> tcBoxObj =
-    nsXULElement::FromContent(tcXULElm)->GetBoxObject(IgnoreErrors());
+    nsXULElement::FromNode(tcXULElm)->GetBoxObject(IgnoreErrors());
 
   int32_t tcX = 0;
   tcBoxObj->GetX(&tcX);
 
   int32_t tcY = 0;
   tcBoxObj->GetY(&tcY);
 
   // Dispatch mouse events.
@@ -488,34 +488,34 @@ nsCoreUtils::GetLanguageFor(nsIContent *
 }
 
 already_AddRefed<nsIBoxObject>
 nsCoreUtils::GetTreeBodyBoxObject(nsITreeBoxObject *aTreeBoxObj)
 {
   nsCOMPtr<nsIDOMElement> tcElm;
   aTreeBoxObj->GetTreeBody(getter_AddRefs(tcElm));
   nsCOMPtr<nsIContent> tcContent(do_QueryInterface(tcElm));
-  RefPtr<nsXULElement> tcXULElm = nsXULElement::FromContentOrNull(tcContent);
+  RefPtr<nsXULElement> tcXULElm = nsXULElement::FromNodeOrNull(tcContent);
   if (!tcXULElm)
     return nullptr;
 
   return tcXULElm->GetBoxObject(IgnoreErrors());
 }
 
 already_AddRefed<nsITreeBoxObject>
 nsCoreUtils::GetTreeBoxObject(nsIContent *aContent)
 {
   // Find DOMNode's parents recursively until reach the <tree> tag
   nsIContent* currentContent = aContent;
   while (currentContent) {
     if (currentContent->NodeInfo()->Equals(nsGkAtoms::tree,
                                            kNameSpaceID_XUL)) {
       // We will get the nsITreeBoxObject from the tree node
       RefPtr<nsXULElement> xulElement =
-        nsXULElement::FromContent(currentContent);
+        nsXULElement::FromNode(currentContent);
       nsCOMPtr<nsIBoxObject> box = xulElement->GetBoxObject(IgnoreErrors());
       nsCOMPtr<nsITreeBoxObject> treeBox(do_QueryInterface(box));
       if (treeBox)
         return treeBox.forget();
     }
     currentContent = currentContent->GetFlattenedTreeParent();
   }
 
--- a/accessible/generic/Accessible.cpp
+++ b/accessible/generic/Accessible.cpp
@@ -640,17 +640,17 @@ Accessible::RelativeBounds(nsIFrame** aB
         canvasFrame = nsLayoutUtils::GetClosestFrameOfType(
           canvasFrame, LayoutFrameType::HTMLCanvas);
       }
 
       // make the canvas the bounding frame
       if (canvasFrame) {
         *aBoundingFrame = canvasFrame;
         dom::HTMLCanvasElement *canvas =
-          dom::HTMLCanvasElement::FromContent(canvasFrame->GetContent());
+          dom::HTMLCanvasElement::FromNode(canvasFrame->GetContent());
 
         // get the bounding rect of the hit region
         nsRect bounds;
         if (canvas && canvas->CountContexts() &&
           canvas->GetContextAtIndex(0)->GetHitRegionRect(mContent->AsElement(), bounds)) {
           return bounds;
         }
       }
@@ -1062,17 +1062,17 @@ Accessible::NativeAttributes()
     nsAccUtils::SetAccAttr(attributes, nsGkAtoms::_class, _class);
 
   // Expose tag.
   nsAutoString tagName;
   mContent->NodeInfo()->GetName(tagName);
   nsAccUtils::SetAccAttr(attributes, nsGkAtoms::tag, tagName);
 
   // Expose draggable object attribute.
-  if (auto htmlElement = nsGenericHTMLElement::FromContent(mContent)) {
+  if (auto htmlElement = nsGenericHTMLElement::FromNode(mContent)) {
     if (htmlElement->Draggable()) {
       nsAccUtils::SetAccAttr(attributes, nsGkAtoms::draggable,
                              NS_LITERAL_STRING("true"));
     }
   }
 
   // Don't calculate CSS-based object attributes when no frame (i.e.
   // the accessible is unattached from the tree).
--- a/accessible/generic/ImageAccessible.cpp
+++ b/accessible/generic/ImageAccessible.cpp
@@ -198,17 +198,17 @@ ImageAccessible::GetLongDescURI() const
   DocAccessible* document = Document();
   if (document) {
     IDRefsIterator iter(document, mContent, nsGkAtoms::aria_describedby);
     while (nsIContent* target = iter.NextElem()) {
       if ((target->IsHTMLElement(nsGkAtoms::a) ||
            target->IsHTMLElement(nsGkAtoms::area)) &&
           target->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
         nsGenericHTMLElement* element =
-          nsGenericHTMLElement::FromContent(target);
+          nsGenericHTMLElement::FromNode(target);
 
         nsCOMPtr<nsIURI> uri;
         element->GetURIAttr(nsGkAtoms::href, nullptr, getter_AddRefs(uri));
         return uri.forget();
       }
     }
   }
 
--- a/accessible/html/HTMLElementAccessibles.cpp
+++ b/accessible/html/HTMLElementAccessibles.cpp
@@ -63,17 +63,17 @@ HTMLLabelAccessible::NativeName(nsString
   return aName.IsEmpty() ? eNameOK : eNameFromSubtree;
 }
 
 Relation
 HTMLLabelAccessible::RelationByType(RelationType aType)
 {
   Relation rel = AccessibleWrap::RelationByType(aType);
   if (aType == RelationType::LABEL_FOR) {
-    dom::HTMLLabelElement* label = dom::HTMLLabelElement::FromContent(mContent);
+    dom::HTMLLabelElement* label = dom::HTMLLabelElement::FromNode(mContent);
     rel.AppendTarget(mDoc, label->GetControl());
   }
 
   return rel;
 }
 
 uint8_t
 HTMLLabelAccessible::ActionCount()
@@ -134,17 +134,17 @@ HTMLSummaryAccessible::ActionCount()
 
 void
 HTMLSummaryAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName)
 {
   if (aIndex != eAction_Click) {
     return;
   }
 
-  dom::HTMLSummaryElement* summary = dom::HTMLSummaryElement::FromContent(mContent);
+  dom::HTMLSummaryElement* summary = dom::HTMLSummaryElement::FromNode(mContent);
   if (!summary) {
     return;
   }
 
   dom::HTMLDetailsElement* details = summary->GetDetails();
   if (!details) {
     return;
   }
@@ -166,17 +166,17 @@ HTMLSummaryAccessible::DoAction(uint8_t 
   return true;
 }
 
 uint64_t
 HTMLSummaryAccessible::NativeState()
 {
   uint64_t state = HyperTextAccessibleWrap::NativeState();
 
-  dom::HTMLSummaryElement* summary = dom::HTMLSummaryElement::FromContent(mContent);
+  dom::HTMLSummaryElement* summary = dom::HTMLSummaryElement::FromNode(mContent);
   if (!summary) {
     return state;
   }
 
   dom::HTMLDetailsElement* details = summary->GetDetails();
   if (!details) {
     return state;
   }
--- a/accessible/html/HTMLFormControlAccessible.cpp
+++ b/accessible/html/HTMLFormControlAccessible.cpp
@@ -76,17 +76,17 @@ HTMLCheckboxAccessible::DoAction(uint8_t
 }
 
 uint64_t
 HTMLCheckboxAccessible::NativeState()
 {
   uint64_t state = LeafAccessible::NativeState();
 
   state |= states::CHECKABLE;
-  HTMLInputElement* input = HTMLInputElement::FromContent(mContent);
+  HTMLInputElement* input = HTMLInputElement::FromNode(mContent);
   if (!input)
     return state;
 
   if (input->Indeterminate())
     return state | states::MIXED;
 
   if (input->Checked())
     return state | states::CHECKED;
@@ -110,17 +110,17 @@ HTMLCheckboxAccessible::IsWidget() const
 
 uint64_t
 HTMLRadioButtonAccessible::NativeState()
 {
   uint64_t state = AccessibleWrap::NativeState();
 
   state |= states::CHECKABLE;
 
-  HTMLInputElement* input = HTMLInputElement::FromContent(mContent);
+  HTMLInputElement* input = HTMLInputElement::FromNode(mContent);
   if (input && input->Checked())
     state |= states::CHECKED;
 
   return state;
 }
 
 void
 HTMLRadioButtonAccessible::GetPositionAndSizeInternal(int32_t* aPosInSet,
@@ -340,23 +340,23 @@ HTMLTextFieldAccessible::NativeName(nsSt
 
 void
 HTMLTextFieldAccessible::Value(nsString& aValue)
 {
   aValue.Truncate();
   if (NativeState() & states::PROTECTED)    // Don't return password text!
     return;
 
-  HTMLTextAreaElement* textArea = HTMLTextAreaElement::FromContent(mContent);
+  HTMLTextAreaElement* textArea = HTMLTextAreaElement::FromNode(mContent);
   if (textArea) {
     textArea->GetValue(aValue);
     return;
   }
 
-  HTMLInputElement* input = HTMLInputElement::FromContent(mContent);
+  HTMLInputElement* input = HTMLInputElement::FromNode(mContent);
   if (input) {
     // Pass NonSystem as the caller type, to be safe.  We don't expect to have a
     // file input here.
     input->GetValue(aValue, CallerType::NonSystem);
   }
 }
 
 void
@@ -387,17 +387,17 @@ HTMLTextFieldAccessible::NativeState()
     state |= states::PROTECTED;
   }
 
   if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::readonly)) {
     state |= states::READONLY;
   }
 
   // Is it an <input> or a <textarea> ?
-  HTMLInputElement* input = HTMLInputElement::FromContent(mContent);
+  HTMLInputElement* input = HTMLInputElement::FromNode(mContent);
   state |= input && input->IsSingleLineTextControl() ?
     states::SINGLE_LINE : states::MULTI_LINE;
 
   if (state & (states::PROTECTED | states::MULTI_LINE | states::READONLY |
                states::UNAVAILABLE))
     return state;
 
   // Expose autocomplete states if this input is part of autocomplete widget.
@@ -552,66 +552,65 @@ void
 HTMLSpinnerAccessible::Value(nsString& aValue)
 {
   AccessibleWrap::Value(aValue);
   if (!aValue.IsEmpty())
     return;
 
   // Pass NonSystem as the caller type, to be safe.  We don't expect to have a
   // file input here.
-  HTMLInputElement::FromContent(mContent)->GetValue(aValue,
-                                                    CallerType::NonSystem);
+  HTMLInputElement::FromNode(mContent)->GetValue(aValue, CallerType::NonSystem);
 }
 
 double
 HTMLSpinnerAccessible::MaxValue() const
 {
   double value = AccessibleWrap::MaxValue();
   if (!IsNaN(value))
     return value;
 
-  return HTMLInputElement::FromContent(mContent)->GetMaximum().toDouble();
+  return HTMLInputElement::FromNode(mContent)->GetMaximum().toDouble();
 }
 
 
 double
 HTMLSpinnerAccessible::MinValue() const
 {
   double value = AccessibleWrap::MinValue();
   if (!IsNaN(value))
     return value;
 
-  return HTMLInputElement::FromContent(mContent)->GetMinimum().toDouble();
+  return HTMLInputElement::FromNode(mContent)->GetMinimum().toDouble();
 }
 
 double
 HTMLSpinnerAccessible::Step() const
 {
   double value = AccessibleWrap::Step();
   if (!IsNaN(value))
     return value;
 
-  return HTMLInputElement::FromContent(mContent)->GetStep().toDouble();
+  return HTMLInputElement::FromNode(mContent)->GetStep().toDouble();
 }
 
 double
 HTMLSpinnerAccessible::CurValue() const
 {
   double value = AccessibleWrap::CurValue();
   if (!IsNaN(value))
     return value;
 
-  return HTMLInputElement::FromContent(mContent)->GetValueAsDecimal().toDouble();
+  return HTMLInputElement::FromNode(mContent)->GetValueAsDecimal().toDouble();
 }
 
 bool
 HTMLSpinnerAccessible::SetCurValue(double aValue)
 {
   ErrorResult er;
-  HTMLInputElement::FromContent(mContent)->SetValueAsNumber(aValue, er);
+  HTMLInputElement::FromNode(mContent)->SetValueAsNumber(aValue, er);
   return !er.Failed();
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLRangeAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
@@ -631,65 +630,65 @@ void
 HTMLRangeAccessible::Value(nsString& aValue)
 {
   LeafAccessible::Value(aValue);
   if (!aValue.IsEmpty())
     return;
 
   // Pass NonSystem as the caller type, to be safe.  We don't expect to have a
   // file input here.
-  HTMLInputElement::FromContent(mContent)->GetValue(aValue,
-                                                    CallerType::NonSystem);
+  HTMLInputElement::FromNode(mContent)->GetValue(aValue,
+                                                 CallerType::NonSystem);
 }
 
 double
 HTMLRangeAccessible::MaxValue() const
 {
   double value = LeafAccessible::MaxValue();
   if (!IsNaN(value))
     return value;
 
-  return HTMLInputElement::FromContent(mContent)->GetMaximum().toDouble();
+  return HTMLInputElement::FromNode(mContent)->GetMaximum().toDouble();
 }
 
 double
 HTMLRangeAccessible::MinValue() const
 {
   double value = LeafAccessible::MinValue();
   if (!IsNaN(value))
     return value;
 
-  return HTMLInputElement::FromContent(mContent)->GetMinimum().toDouble();
+  return HTMLInputElement::FromNode(mContent)->GetMinimum().toDouble();
 }
 
 double
 HTMLRangeAccessible::Step() const
 {
   double value = LeafAccessible::Step();
   if (!IsNaN(value))
     return value;
 
-  return HTMLInputElement::FromContent(mContent)->GetStep().toDouble();
+  return HTMLInputElement::FromNode(mContent)->GetStep().toDouble();
 }
 
 double
 HTMLRangeAccessible::CurValue() const
 {
   double value = LeafAccessible::CurValue();
   if (!IsNaN(value))
     return value;
 
-  return HTMLInputElement::FromContent(mContent)->GetValueAsDecimal().toDouble();
+  return HTMLInputElement::FromNode(mContent)->GetValueAsDecimal().toDouble();
 }
 
 bool
 HTMLRangeAccessible::SetCurValue(double aValue)
 {
   ErrorResult er;
-  HTMLInputElement::FromContent(mContent)->SetValueAsNumber(aValue, er);
+  HTMLInputElement::FromNode(mContent)->SetValueAsNumber(aValue, er);
   return !er.Failed();
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLGroupboxAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
--- a/accessible/html/HTMLImageMapAccessible.cpp
+++ b/accessible/html/HTMLImageMapAccessible.cpp
@@ -158,17 +158,17 @@ HTMLAreaAccessible::NativeName(nsString&
 
 void
 HTMLAreaAccessible::Description(nsString& aDescription)
 {
   aDescription.Truncate();
 
   // Still to do - follow IE's standard here
   RefPtr<dom::HTMLAreaElement> area =
-    dom::HTMLAreaElement::FromContentOrNull(mContent);
+    dom::HTMLAreaElement::FromNodeOrNull(mContent);
   if (area)
     area->GetShape(aDescription);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLAreaAccessible: Accessible public
 
 Accessible*
--- a/accessible/html/HTMLSelectAccessible.cpp
+++ b/accessible/html/HTMLSelectAccessible.cpp
@@ -181,17 +181,17 @@ HTMLSelectOptionAccessible::NativeState(
   if (!select)
     return state;
 
   uint64_t selectState = select->State();
   if (selectState & states::INVISIBLE)
     return state;
 
   // Are we selected?
-  HTMLOptionElement* option = HTMLOptionElement::FromContent(mContent);
+  HTMLOptionElement* option = HTMLOptionElement::FromNode(mContent);
   bool selected = option && option->Selected();
   if (selected)
     state |= states::SELECTED;
 
   if (selectState & states::OFFSCREEN) {
     state |= states::OFFSCREEN;
   } else if (selectState & states::COLLAPSED) {
     // <select> is COLLAPSED: add OFFSCREEN, if not the currently
@@ -275,17 +275,17 @@ HTMLSelectOptionAccessible::DoAction(uin
 
   DoCommand();
   return true;
 }
 
 void
 HTMLSelectOptionAccessible::SetSelected(bool aSelect)
 {
-  HTMLOptionElement* option = HTMLOptionElement::FromContent(mContent);
+  HTMLOptionElement* option = HTMLOptionElement::FromNode(mContent);
   if (option)
     option->SetSelected(aSelect);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLSelectOptionAccessible: Widgets
 
 Accessible*
@@ -511,17 +511,17 @@ HTMLComboboxAccessible::SetCurrentItem(A
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLComboboxAccessible: protected
 
 Accessible*
 HTMLComboboxAccessible::SelectedOption() const
 {
-  HTMLSelectElement* select = HTMLSelectElement::FromContent(mContent);
+  HTMLSelectElement* select = HTMLSelectElement::FromNode(mContent);
   int32_t selectedIndex = select->SelectedIndex();
 
   if (selectedIndex >= 0) {
     HTMLOptionElement* option = select->Item(selectedIndex);
     if (option) {
       DocAccessible* document = Document();
       if (document)
         return document->GetAccessible(option);
--- a/accessible/html/HTMLTableAccessible.cpp
+++ b/accessible/html/HTMLTableAccessible.cpp
@@ -475,17 +475,17 @@ HTMLTableAccessible::Caption() const
 {
   Accessible* child = mChildren.SafeElementAt(0, nullptr);
   return child && child->Role() == roles::CAPTION ? child : nullptr;
 }
 
 void
 HTMLTableAccessible::Summary(nsString& aSummary)
 {
-  dom::HTMLTableElement* table = dom::HTMLTableElement::FromContent(mContent);
+  dom::HTMLTableElement* table = dom::HTMLTableElement::FromNode(mContent);
 
   if (table)
     table->GetSummary(aSummary);
 }
 
 uint32_t
 HTMLTableAccessible::ColCount()
 {
--- a/accessible/xul/XULTabAccessible.cpp
+++ b/accessible/xul/XULTabAccessible.cpp
@@ -47,17 +47,17 @@ XULTabAccessible::ActionNameAt(uint8_t a
     aName.AssignLiteral("switch");
 }
 
 bool
 XULTabAccessible::DoAction(uint8_t index)
 {
   if (index == eAction_Switch) {
     // XXXbz Could this just FromContent?
-    RefPtr<nsXULElement> tab = nsXULElement::FromContentOrNull(mContent);
+    RefPtr<nsXULElement> tab = nsXULElement::FromNodeOrNull(mContent);
     if (tab) {
       tab->Click(mozilla::dom::CallerType::System);
       return true;
     }
   }
   return false;
 }
 
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -13730,17 +13730,17 @@ nsDocShell::OnLinkClickSync(nsIContent* 
 
   // referer could be null here in some odd cases, but that's ok,
   // we'll just load the link w/o sending a referer in those cases.
 
   nsAutoString target(aTargetSpec);
 
   // If this is an anchor element, grab its type property to use as a hint
   nsAutoString typeHint;
-  RefPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::FromContent(aContent);
+  RefPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::FromNode(aContent);
   if (anchor) {
     anchor->GetType(typeHint);
     NS_ConvertUTF16toUTF8 utf8Hint(typeHint);
     nsAutoCString type, dummy;
     NS_ParseRequestContentType(utf8Hint, type, dummy);
     CopyUTF8toUTF16(type, typeHint);
   }
 
--- a/dom/base/ChildIterator.cpp
+++ b/dom/base/ChildIterator.cpp
@@ -21,17 +21,17 @@ ExplicitChildIterator::ExplicitChildIter
                                              bool aStartAtBeginning)
   : mParent(aParent),
     mChild(nullptr),
     mDefaultChild(nullptr),
     mIsFirst(aStartAtBeginning),
     mIndexInInserted(0)
 {
   mParentAsSlot = nsDocument::IsShadowDOMEnabled(mParent) ?
-    HTMLSlotElement::FromContent(mParent) : nullptr;
+    HTMLSlotElement::FromNode(mParent) : nullptr;
 }
 
 nsIContent*
 ExplicitChildIterator::GetNextChild()
 {
   // If we're already in the inserted-children array, look there first
   if (mIndexInInserted) {
     MOZ_ASSERT(mChild);
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -1532,17 +1532,17 @@ Element::GetElementsByMatching(nsElement
 
 /**
  * Returns the count of descendants (inclusive of aContent) in
  * the uncomposed document that are explicitly set as editable.
  */
 static uint32_t
 EditableInclusiveDescendantCount(nsIContent* aContent)
 {
-  auto htmlElem = nsGenericHTMLElement::FromContent(aContent);
+  auto htmlElem = nsGenericHTMLElement::FromNode(aContent);
   if (htmlElem) {
     return htmlElem->EditableInclusiveDescendantCount();
   }
 
   return aContent->EditableDescendantCount();
 }
 
 nsresult
@@ -1572,17 +1572,17 @@ Element::BindToTree(nsIDocument* aDocume
                   "Native anonymous content must have its parent as its "
                   "own binding parent");
   NS_PRECONDITION(aBindingParent || !aParent ||
                   aBindingParent == aParent->GetBindingParent(),
                   "We should be passed the right binding parent");
 
 #ifdef MOZ_XUL
   // First set the binding parent
-  nsXULElement* xulElem = nsXULElement::FromContent(this);
+  nsXULElement* xulElem = nsXULElement::FromNode(this);
   if (xulElem) {
     xulElem->SetXULBindingParent(aBindingParent);
   }
   else
 #endif
   {
     if (aBindingParent) {
       nsExtendedDOMSlots* slots = ExtendedDOMSlots();
@@ -1974,17 +1974,17 @@ Element::UnbindFromTree(bool aDeep, bool
 
     // Begin keeping track of our subtree root.
     SetSubtreeRootPointer(aNullParent ? this : mParent->SubtreeRoot());
   }
 
   bool clearBindingParent = true;
 
 #ifdef MOZ_XUL
-  if (nsXULElement* xulElem = nsXULElement::FromContent(this)) {;
+  if (nsXULElement* xulElem = nsXULElement::FromNode(this)) {;
     xulElem->SetXULBindingParent(nullptr);
     clearBindingParent = false;
   }
 #endif
 
   if (nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots()) {
     if (clearBindingParent) {
       slots->mBindingParent = nullptr;
--- a/dom/base/ShadowRoot.cpp
+++ b/dom/base/ShadowRoot.cpp
@@ -614,17 +614,17 @@ ShadowRoot::ContentInserted(nsIContent* 
       assignment.mSlot->AppendAssignedNode(aChild);
     }
     assignment.mSlot->EnqueueSlotChangeEvent();
     return;
   }
 
   // If parent's root is a shadow root, and parent is a slot whose assigned
   // nodes is the empty list, then run signal a slot change for parent.
-  HTMLSlotElement* slot = HTMLSlotElement::FromContentOrNull(aChild->GetParent());
+  HTMLSlotElement* slot = HTMLSlotElement::FromNodeOrNull(aChild->GetParent());
   if (slot && slot->GetContainingShadow() == this &&
       slot->AssignedNodes().IsEmpty()) {
     slot->EnqueueSlotChangeEvent();
   }
 }
 
 void
 ShadowRoot::ContentRemoved(nsIContent* aChild, nsIContent* aPreviousSibling)
@@ -650,17 +650,17 @@ ShadowRoot::ContentRemoved(nsIContent* a
       slot->RemoveAssignedNode(aChild);
       slot->EnqueueSlotChangeEvent();
     }
     return;
   }
 
   // If parent's root is a shadow root, and parent is a slot whose assigned
   // nodes is the empty list, then run signal a slot change for parent.
-  HTMLSlotElement* slot = HTMLSlotElement::FromContentOrNull(aChild->GetParent());
+  HTMLSlotElement* slot = HTMLSlotElement::FromNodeOrNull(aChild->GetParent());
   if (slot && slot->GetContainingShadow() == this &&
       slot->AssignedNodes().IsEmpty()) {
     slot->EnqueueSlotChangeEvent();
   }
 }
 
 ServoStyleRuleMap&
 ShadowRoot::ServoStyleRuleMap()
--- a/dom/base/nsContentAreaDragDrop.cpp
+++ b/dom/base/nsContentAreaDragDrop.cpp
@@ -504,17 +504,17 @@ DragDataProducer::Produce(DataTransfer* 
       }
       image = do_QueryInterface(draggedNode);
     }
 
     {
       // set for linked images, and links
       nsCOMPtr<nsIContent> linkNode;
 
-      RefPtr<HTMLAreaElement> areaElem = HTMLAreaElement::FromContentOrNull(draggedNode);
+      RefPtr<HTMLAreaElement> areaElem = HTMLAreaElement::FromNodeOrNull(draggedNode);
       if (areaElem) {
         // use the alt text (or, if missing, the href) as the title
         areaElem->GetAttribute(NS_LITERAL_STRING("alt"), mTitleString);
         if (mTitleString.IsEmpty()) {
           // this can be a relative link
           areaElem->GetAttribute(NS_LITERAL_STRING("href"), mTitleString);
         }
 
--- a/dom/base/nsContentList.cpp
+++ b/dom/base/nsContentList.cpp
@@ -541,17 +541,17 @@ nsContentList::GetSupportedNames(nsTArra
       nsAtom* id = content->GetID();
       MOZ_ASSERT(id != nsGkAtoms::_empty,
                  "Empty ids don't get atomized");
       if (!atoms.Contains(id)) {
         atoms.AppendElement(id);
       }
     }
 
-    nsGenericHTMLElement* el = nsGenericHTMLElement::FromContent(content);
+    nsGenericHTMLElement* el = nsGenericHTMLElement::FromNode(content);
     if (el) {
       // XXXbz should we be checking for particular tags here?  How
       // stable is this part of the spec?
       // Note: nsINode::HasName means the name is exposed on the document,
       // which is false for options, so we don't check it here.
       const nsAttrValue* val = el->GetParsedAttr(nsGkAtoms::name);
       if (val && val->Type() == nsAttrValue::eAtom) {
         nsAtom* name = val->GetAtomValue();
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -3888,17 +3888,17 @@ nsContentUtils::GetStaticRequest(nsIDocu
 }
 
 // static
 bool
 nsContentUtils::ContentIsDraggable(nsIContent* aContent)
 {
   MOZ_ASSERT(aContent);
 
-  if (auto htmlElement = nsGenericHTMLElement::FromContent(aContent)) {
+  if (auto htmlElement = nsGenericHTMLElement::FromNode(aContent)) {
     if (htmlElement->Draggable()) {
       return true;
     }
 
     if (htmlElement->AttrValueIs(kNameSpaceID_None,
                                  nsGkAtoms::draggable,
                                  nsGkAtoms::_false,
                                  eIgnoreCase)) {
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -1475,18 +1475,18 @@ nsDOMWindowUtils::CompareCanvases(nsISup
 {
   if (aCanvas1 == nullptr ||
       aCanvas2 == nullptr ||
       retVal == nullptr)
     return NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIContent> contentCanvas1 = do_QueryInterface(aCanvas1);
   nsCOMPtr<nsIContent> contentCanvas2 = do_QueryInterface(aCanvas2);
-  auto canvas1 = HTMLCanvasElement::FromContentOrNull(contentCanvas1);
-  auto canvas2 = HTMLCanvasElement::FromContentOrNull(contentCanvas2);
+  auto canvas1 = HTMLCanvasElement::FromNodeOrNull(contentCanvas1);
+  auto canvas2 = HTMLCanvasElement::FromNodeOrNull(contentCanvas2);
 
   if (!canvas1 || !canvas2) {
     return NS_ERROR_FAILURE;
   }
 
   RefPtr<DataSourceSurface> img1 = CanvasToDataSourceSurface(canvas1);
   RefPtr<DataSourceSurface> img2 = CanvasToDataSourceSurface(canvas2);
 
@@ -4162,17 +4162,17 @@ nsDOMWindowUtils::ForceUseCounterFlush(n
     // Flush the document and any external documents that it depends on.
     const auto reportKind
       = nsDocument::UseCounterReportKind::eIncludeExternalResources;
     static_cast<nsDocument*>(doc.get())->ReportUseCounters(reportKind);
     return NS_OK;
   }
 
   if (nsCOMPtr<nsIContent> content = do_QueryInterface(aNode)) {
-    if (HTMLImageElement* img = HTMLImageElement::FromContent(content)) {
+    if (HTMLImageElement* img = HTMLImageElement::FromNode(content)) {
       img->FlushUseCounters();
       return NS_OK;
     }
   }
 
   return NS_OK;
 }
 
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -4705,17 +4705,17 @@ nsIDocument::SetScopeObject(nsIGlobalObj
     }
   }
 }
 
 static void
 CheckIfContainsEMEContent(nsISupports* aSupports, void* aContainsEME)
 {
   nsCOMPtr<nsIContent> content(do_QueryInterface(aSupports));
-  if (auto mediaElem = HTMLMediaElement::FromContentOrNull(content)) {
+  if (auto mediaElem = HTMLMediaElement::FromNodeOrNull(content)) {
     bool* contains = static_cast<bool*>(aContainsEME);
     if (mediaElem->GetMediaKeys()) {
       *contains = true;
     }
   }
 }
 
 bool
@@ -4726,17 +4726,17 @@ nsIDocument::ContainsEMEContent()
                              static_cast<void*>(&containsEME));
   return containsEME;
 }
 
 static void
 CheckIfContainsMSEContent(nsISupports* aSupports, void* aContainsMSE)
 {
   nsCOMPtr<nsIContent> content(do_QueryInterface(aSupports));
-  if (auto mediaElem = HTMLMediaElement::FromContentOrNull(content)) {
+  if (auto mediaElem = HTMLMediaElement::FromNodeOrNull(content)) {
     bool* contains = static_cast<bool*>(aContainsMSE);
     RefPtr<MediaSource> ms = mediaElem->GetMozMediaSourceObject();
     if (ms) {
       *contains = true;
     }
   }
 }
 
@@ -4748,17 +4748,17 @@ nsIDocument::ContainsMSEContent()
                              static_cast<void*>(&containsMSE));
   return containsMSE;
 }
 
 static void
 NotifyActivityChanged(nsISupports *aSupports, void *aUnused)
 {
   nsCOMPtr<nsIContent> content(do_QueryInterface(aSupports));
-  if (auto mediaElem = HTMLMediaElement::FromContentOrNull(content)) {
+  if (auto mediaElem = HTMLMediaElement::FromNodeOrNull(content)) {
     mediaElem->NotifyOwnerDocumentActivityChanged();
   }
   nsCOMPtr<nsIObjectLoadingContent> objectLoadingContent(do_QueryInterface(aSupports));
   if (objectLoadingContent) {
     nsObjectLoadingContent* olc = static_cast<nsObjectLoadingContent*>(objectLoadingContent.get());
     olc->NotifyOwnerDocumentActivityChanged();
   }
   nsCOMPtr<nsIDocumentActivity> objectDocumentActivity(do_QueryInterface(aSupports));
@@ -8046,17 +8046,17 @@ nsIDocument::Sanitize()
   RefPtr<nsContentList> nodes = GetElementsByTagName(NS_LITERAL_STRING("input"));
 
   nsAutoString value;
 
   uint32_t length = nodes->Length(true);
   for (uint32_t i = 0; i < length; ++i) {
     NS_ASSERTION(nodes->Item(i), "null item in node list!");
 
-    RefPtr<HTMLInputElement> input = HTMLInputElement::FromContentOrNull(nodes->Item(i));
+    RefPtr<HTMLInputElement> input = HTMLInputElement::FromNodeOrNull(nodes->Item(i));
     if (!input)
       continue;
 
     bool resetValue = false;
 
     input->GetAttribute(NS_LITERAL_STRING("autocomplete"), value);
     if (value.LowerCaseEqualsLiteral("off")) {
       resetValue = true;
@@ -8073,17 +8073,17 @@ nsIDocument::Sanitize()
 
   // Now locate all _form_ elements that have autocomplete=off and reset them
   nodes = GetElementsByTagName(NS_LITERAL_STRING("form"));
 
   length = nodes->Length(true);
   for (uint32_t i = 0; i < length; ++i) {
     NS_ASSERTION(nodes->Item(i), "null item in nodelist");
 
-    HTMLFormElement* form = HTMLFormElement::FromContent(nodes->Item(i));
+    HTMLFormElement* form = HTMLFormElement::FromNode(nodes->Item(i));
     if (!form)
       continue;
 
     form->GetAttr(kNameSpaceID_None, nsGkAtoms::autocomplete, value);
     if (value.LowerCaseEqualsLiteral("off"))
       form->Reset();
   }
 }
@@ -10063,17 +10063,17 @@ nsIDocument::CaretPositionFromPoint(floa
 
   nsCOMPtr<nsIContent> node = offsets.content;
   uint32_t offset = offsets.offset;
   nsCOMPtr<nsIContent> anonNode = node;
   bool nodeIsAnonymous = node && node->IsInNativeAnonymousSubtree();
   if (nodeIsAnonymous) {
     node = ptFrame->GetContent();
     nsIContent* nonanon = node->FindFirstNonChromeOnlyAccessContent();
-    HTMLTextAreaElement* textArea = HTMLTextAreaElement::FromContent(nonanon);
+    HTMLTextAreaElement* textArea = HTMLTextAreaElement::FromNode(nonanon);
     nsITextControlFrame* textFrame = do_QueryFrame(nonanon->GetPrimaryFrame());
     nsNumberControlFrame* numberFrame = do_QueryFrame(nonanon->GetPrimaryFrame());
     if (textFrame || numberFrame) {
       // If the anonymous content node has a child, then we need to make sure
       // that we get the appropriate child, as otherwise the offset may not be
       // correct when we construct a range for it.
       nsCOMPtr<nsIContent> firstChild = anonNode->GetFirstChild();
       if (firstChild) {
--- a/dom/base/nsFrameLoader.cpp
+++ b/dom/base/nsFrameLoader.cpp
@@ -568,17 +568,17 @@ nsFrameLoader::ReallyStartLoadingInterna
     }
   }
 
   // get referrer policy for this iframe:
   // first load document wide policy, then
   // load iframe referrer attribute if enabled in preferences
   // per element referrer overrules document wide referrer if enabled
   net::ReferrerPolicy referrerPolicy = mOwnerContent->OwnerDoc()->GetReferrerPolicy();
-  HTMLIFrameElement* iframe = HTMLIFrameElement::FromContent(mOwnerContent);
+  HTMLIFrameElement* iframe = HTMLIFrameElement::FromNode(mOwnerContent);
   if (iframe) {
     net::ReferrerPolicy iframeReferrerPolicy = iframe->GetReferrerPolicyAsEnum();
     if (iframeReferrerPolicy != net::RP_Unset) {
       referrerPolicy = iframeReferrerPolicy;
     }
   }
   loadInfo->SetReferrerPolicy(referrerPolicy);
 
@@ -2243,17 +2243,17 @@ nsFrameLoader::MaybeCreateDocShell()
     mDocShell->SetFrameType(nsIDocShell::FRAME_TYPE_BROWSER);
   }
 
   // Apply sandbox flags even if our owner is not an iframe, as this copies
   // flags from our owning content's owning document.
   // Note: ApplySandboxFlags should be called after mDocShell->SetFrameType
   // because we need to get the correct presentation URL in ApplySandboxFlags.
   uint32_t sandboxFlags = 0;
-  HTMLIFrameElement* iframe = HTMLIFrameElement::FromContent(mOwnerContent);
+  HTMLIFrameElement* iframe = HTMLIFrameElement::FromNode(mOwnerContent);
   if (iframe) {
     sandboxFlags = iframe->GetSandboxFlags();
   }
   ApplySandboxFlags(sandboxFlags);
 
   // Grab the userContextId from owner if XUL
   nsresult rv = PopulateUserContextIdFromAttribute(attrs);
   if (NS_WARN_IF(NS_FAILED(rv))) {
--- a/dom/base/nsIContent.h
+++ b/dom/base/nsIContent.h
@@ -1003,32 +1003,32 @@ public:
 NS_DEFINE_STATIC_IID_ACCESSOR(nsIContent, NS_ICONTENT_IID)
 
 inline nsIContent* nsINode::AsContent()
 {
   MOZ_ASSERT(IsContent());
   return static_cast<nsIContent*>(this);
 }
 
-#define NS_IMPL_FROMCONTENT_HELPER(_class, _check)                             \
-  static _class* FromContent(nsINode* aContent)                                \
-  {                                                                            \
-    return aContent->_check ? static_cast<_class*>(aContent) : nullptr;        \
-  }                                                                            \
-  static const _class* FromContent(const nsINode* aContent)                    \
-  {                                                                            \
-    return aContent->_check ? static_cast<const _class*>(aContent) : nullptr;  \
-  }                                                                            \
-  static _class* FromContentOrNull(nsINode* aContent)                          \
-  {                                                                            \
-    return aContent ? FromContent(aContent) : nullptr;                         \
-  }                                                                            \
-  static const _class* FromContentOrNull(const nsINode* aContent)              \
-  {                                                                            \
-    return aContent ? FromContent(aContent) : nullptr;                         \
+#define NS_IMPL_FROMCONTENT_HELPER(_class, _check)                      \
+  static _class* FromNode(nsINode* aNode)                               \
+  {                                                                     \
+    return aNode->_check ? static_cast<_class*>(aNode) : nullptr;       \
+  }                                                                     \
+  static const _class* FromNode(const nsINode* aNode)                   \
+  {                                                                     \
+    return aNode->_check ? static_cast<const _class*>(aNode) : nullptr; \
+  }                                                                     \
+  static _class* FromNodeOrNull(nsINode* aNode)                         \
+  {                                                                     \
+    return aNode ? FromNode(aNode) : nullptr;                           \
+  }                                                                     \
+  static const _class* FromNodeOrNull(const nsINode* aNode)             \
+  {                                                                     \
+    return aNode ? FromNode(aNode) : nullptr;                           \
   }
 
 #define NS_IMPL_FROMCONTENT(_class, _nsid)                                     \
   NS_IMPL_FROMCONTENT_HELPER(_class, IsInNamespace(_nsid))
 
 #define NS_IMPL_FROMCONTENT_WITH_TAG(_class, _nsid, _tag)                      \
   NS_IMPL_FROMCONTENT_HELPER(_class, NodeInfo()->Equals(nsGkAtoms::_tag, _nsid))
 
--- a/dom/base/nsIContentInlines.h
+++ b/dom/base/nsIContentInlines.h
@@ -90,17 +90,17 @@ GetFlattenedTreeParentNode(const nsINode
 
   if (parentAsContent->GetShadowRoot()) {
     // If it's not assigned to any slot it's not part of the flat tree, and thus
     // we return null.
     return content->GetAssignedSlot();
   }
 
   if (parentAsContent->IsInShadowTree()) {
-    if (auto* slot = mozilla::dom::HTMLSlotElement::FromContent(parentAsContent)) {
+    if (auto* slot = mozilla::dom::HTMLSlotElement::FromNode(parentAsContent)) {
       // If the assigned nodes list is empty, we're fallback content which is
       // active, otherwise we are not part of the flat tree.
       return slot->AssignedNodes().IsEmpty()
         ? parent
         : nullptr;
     }
 
     if (auto* shadowRoot = mozilla::dom::ShadowRoot::FromNode(parentAsContent)) {
--- a/dom/base/nsNodeUtils.cpp
+++ b/dom/base/nsNodeUtils.cpp
@@ -555,17 +555,17 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNod
             window->SetHasSelectionChangeEventListeners();
           }
         }
       }
     }
 
     if (wasRegistered && oldDoc != newDoc) {
       nsIContent* content = aNode->AsContent();
-      if (auto mediaElem = HTMLMediaElement::FromContentOrNull(content)) {
+      if (auto mediaElem = HTMLMediaElement::FromNodeOrNull(content)) {
         mediaElem->NotifyOwnerDocumentActivityChanged();
       }
       nsCOMPtr<nsIObjectLoadingContent> objectLoadingContent(do_QueryInterface(aNode));
       if (objectLoadingContent) {
         nsObjectLoadingContent* olc = static_cast<nsObjectLoadingContent*>(objectLoadingContent.get());
         olc->NotifyOwnerDocumentActivityChanged();
       }
     }
--- a/dom/base/nsObjectLoadingContent.cpp
+++ b/dom/base/nsObjectLoadingContent.cpp
@@ -884,17 +884,17 @@ nsObjectLoadingContent::GetNestedParams(
     element->GetAttribute(NS_LITERAL_STRING("name"), name);
 
     if (name.IsEmpty())
       continue;
 
     nsCOMPtr<nsIContent> parent = element->GetParent();
     RefPtr<HTMLObjectElement> objectElement;
     while (!objectElement && parent) {
-      objectElement = HTMLObjectElement::FromContent(parent);
+      objectElement = HTMLObjectElement::FromNode(parent);
       parent = parent->GetParent();
     }
 
     if (objectElement) {
       parent = objectElement;
     } else {
       continue;
     }
@@ -2964,20 +2964,20 @@ nsObjectLoadingContent::LoadFallback(Fal
       // those subtrees themselves if they end up falling back.
       bool skipChildDescendants = false;
       if (aType != eFallbackAlternate &&
           !child->IsHTMLElement(nsGkAtoms::param) &&
           nsStyleUtil::IsSignificantChild(child, false)) {
         aType = eFallbackAlternate;
       }
       if (thisIsObject) {
-        if (auto embed = HTMLEmbedElement::FromContent(child)) {
+        if (auto embed = HTMLEmbedElement::FromNode(child)) {
           embed->StartObjectLoad(true, true);
           skipChildDescendants = true;
-        } else if (auto object = HTMLObjectElement::FromContent(child)) {
+        } else if (auto object = HTMLObjectElement::FromNode(child)) {
           object->StartObjectLoad(true, true);
           skipChildDescendants = true;
         }
       }
 
       if (skipChildDescendants) {
         child = child->GetNextNonChildNode(thisContent);
       } else {
@@ -3797,17 +3797,17 @@ nsObjectLoadingContent::BlockEmbedOrObje
        parent;
        parent = parent->GetParent()) {
     if (parent->IsAnyOfHTMLElements(nsGkAtoms::video, nsGkAtoms::audio)) {
       return true;
     }
     // If we have an ancestor that is an object with a source, it'll have an
     // associated displayed type. If that type is not null, don't load content
     // for the embed.
-    if (HTMLObjectElement* object = HTMLObjectElement::FromContent(parent)) {
+    if (HTMLObjectElement* object = HTMLObjectElement::FromNode(parent)) {
       uint32_t type = object->DisplayedType();
       if (type != eType_Null) {
         return true;
       }
     }
   }
   return false;
 }
--- a/dom/base/nsRange.cpp
+++ b/dom/base/nsRange.cpp
@@ -2283,17 +2283,17 @@ nsRange::CutContents(DocumentFragment** 
     handled = false;
 
     // If it's CharacterData, make sure we might need to delete
     // part of the data, instead of removing the whole node.
     //
     // XXX_kin: We need to also handle ProcessingInstruction
     // XXX_kin: according to the spec.
 
-    if (auto charData = CharacterData::FromContent(node)) {
+    if (auto charData = CharacterData::FromNode(node)) {
       uint32_t dataLength = 0;
 
       if (node == startContainer) {
         if (node == endContainer) {
           // This range is completely contained within a single text node.
           // Delete or extract the data between startOffset and endOffset.
 
           if (endOffset > startOffset) {
@@ -2720,17 +2720,17 @@ nsRange::CloneContents(ErrorResult& aRv)
     }
 
     // If it's CharacterData, make sure we only clone what
     // is in the range.
     //
     // XXX_kin: We need to also handle ProcessingInstruction
     // XXX_kin: according to the spec.
 
-    if (auto charData = CharacterData::FromContent(clone))
+    if (auto charData = CharacterData::FromNode(clone))
     {
       if (node == mEnd.Container()) {
         // We only need the data before mEndOffset, so get rid of any
         // data after it.
 
         uint32_t dataLength = charData->Length();
         if (dataLength > (uint32_t)mEnd.Offset())
         {
--- a/dom/base/nsWindowRoot.cpp
+++ b/dom/base/nsWindowRoot.cpp
@@ -219,32 +219,32 @@ nsWindowRoot::GetControllers(bool aForVi
     aForVisibleWindow ? nsFocusManager::eIncludeVisibleDescendants :
                         nsFocusManager::eIncludeAllDescendants;
   nsCOMPtr<nsPIDOMWindowOuter> focusedWindow;
   nsIContent* focusedContent =
     nsFocusManager::GetFocusedDescendant(mWindow, searchRange,
                                          getter_AddRefs(focusedWindow));
   if (focusedContent) {
 #ifdef MOZ_XUL
-    RefPtr<nsXULElement> xulElement = nsXULElement::FromContent(focusedContent);
+    RefPtr<nsXULElement> xulElement = nsXULElement::FromNode(focusedContent);
     if (xulElement) {
       ErrorResult rv;
       *aResult = xulElement->GetControllers(rv);
       NS_IF_ADDREF(*aResult);
       return rv.StealNSResult();
     }
 #endif
 
     HTMLTextAreaElement* htmlTextArea =
-      HTMLTextAreaElement::FromContent(focusedContent);
+      HTMLTextAreaElement::FromNode(focusedContent);
     if (htmlTextArea)
       return htmlTextArea->GetControllers(aResult);
 
     HTMLInputElement* htmlInputElement =
-      HTMLInputElement::FromContent(focusedContent);
+      HTMLInputElement::FromNode(focusedContent);
     if (htmlInputElement)
       return htmlInputElement->GetControllers(aResult);
 
     if (focusedContent->IsEditable() && focusedWindow)
       return focusedWindow->GetControllers(aResult);
   }
   else {
     return focusedWindow->GetControllers(aResult);
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -1988,17 +1988,17 @@ EventStateManager::DetermineDragTargetAn
   nsIContent* originalDragContent = dragContent;
 
   // If a selection isn't being dragged, look for an ancestor with the
   // draggable property set. If one is found, use that as the target of the
   // drag instead of the node that was clicked on. If a draggable node wasn't
   // found, just use the clicked node.
   if (!*aSelection) {
     while (dragContent) {
-      if (auto htmlElement = nsGenericHTMLElement::FromContent(dragContent)) {
+      if (auto htmlElement = nsGenericHTMLElement::FromNode(dragContent)) {
         if (htmlElement->Draggable()) {
           break;
         }
       }
       else {
         if (dragContent->IsXULElement()) {
           // All XUL elements are draggable, so if a XUL element is
           // encountered, stop looking for draggable nodes and just use the
@@ -5004,17 +5004,17 @@ EventStateManager::GetEventTargetContent
 
   return content.forget();
 }
 
 static Element*
 GetLabelTarget(nsIContent* aPossibleLabel)
 {
   mozilla::dom::HTMLLabelElement* label =
-    mozilla::dom::HTMLLabelElement::FromContent(aPossibleLabel);
+    mozilla::dom::HTMLLabelElement::FromNode(aPossibleLabel);
   if (!label)
     return nullptr;
 
   return label->GetLabeledElement();
 }
 
 static nsIContent*
 FindCommonAncestor(nsIContent* aNode1, nsIContent* aNode2)
--- a/dom/events/IMEStateManager.cpp
+++ b/dom/events/IMEStateManager.cpp
@@ -1290,17 +1290,17 @@ IMEStateManager::SetIMEState(const IMESt
       aContent->IsAnyOfHTMLElements(nsGkAtoms::input, nsGkAtoms::textarea)) {
     if (!aContent->IsHTMLElement(nsGkAtoms::textarea)) {
       // <input type=number> has an anonymous <input type=text> descendant
       // that gets focus whenever anyone tries to focus the number control. We
       // need to check if aContent is one of those anonymous text controls and,
       // if so, use the number control instead:
       Element* element = aContent->AsElement();
       HTMLInputElement* inputElement =
-        HTMLInputElement::FromContentOrNull(aContent);
+        HTMLInputElement::FromNodeOrNull(aContent);
       if (inputElement) {
         HTMLInputElement* ownerNumberControl =
           inputElement->GetOwnerNumberControl();
         if (ownerNumberControl) {
           element = ownerNumberControl; // an <input type=number>
         }
       }
       element->GetAttr(kNameSpaceID_None, nsGkAtoms::type,
--- a/dom/html/HTMLAllCollection.cpp
+++ b/dom/html/HTMLAllCollection.cpp
@@ -88,17 +88,17 @@ IsAllNamedElement(nsIContent* aContent)
 static bool
 DocAllResultMatch(Element* aElement, int32_t aNamespaceID, nsAtom* aAtom,
                   void* aData)
 {
   if (aElement->GetID() == aAtom) {
     return true;
   }
 
-  nsGenericHTMLElement* elm = nsGenericHTMLElement::FromContent(aElement);
+  nsGenericHTMLElement* elm = nsGenericHTMLElement::FromNode(aElement);
   if (!elm) {
     return false;
   }
 
   if (!IsAllNamedElement(elm)) {
     return false;
   }
 
@@ -168,17 +168,17 @@ HTMLAllCollection::GetSupportedNames(nsT
       nsAtom* id = content->GetID();
       MOZ_ASSERT(id != nsGkAtoms::_empty,
                  "Empty ids don't get atomized");
       if (!atoms.Contains(id)) {
         atoms.AppendElement(id);
       }
     }
 
-    nsGenericHTMLElement* el = nsGenericHTMLElement::FromContent(content);
+    nsGenericHTMLElement* el = nsGenericHTMLElement::FromNode(content);
     if (el) {
       // Note: nsINode::HasName means the name is exposed on the document,
       // which is false for options, so we don't check it here.
       const nsAttrValue* val = el->GetParsedAttr(nsGkAtoms::name);
       if (val && val->Type() == nsAttrValue::eAtom &&
           IsAllNamedElement(content)) {
         nsAtom* name = val->GetAtomValue();
         MOZ_ASSERT(name != nsGkAtoms::_empty,
--- a/dom/html/HTMLFieldSetElement.cpp
+++ b/dom/html/HTMLFieldSetElement.cpp
@@ -258,17 +258,17 @@ HTMLFieldSetElement::RemoveChildNode(nsI
 
 void
 HTMLFieldSetElement::AddElement(nsGenericHTMLFormElement* aElement)
 {
   mDependentElements.AppendElement(aElement);
 
   // If the element that we are adding aElement is a fieldset, then all the
   // invalid elements in aElement are also invalid elements of this.
-  HTMLFieldSetElement* fieldSet = FromContent(aElement);
+  HTMLFieldSetElement* fieldSet = FromNode(aElement);
   if (fieldSet) {
     for (int32_t i = 0; i < fieldSet->mInvalidElementsCount; i++) {
       UpdateValidity(false);
     }
     return;
   }
 
   // We need to update the validity of the fieldset.
@@ -276,17 +276,17 @@ HTMLFieldSetElement::AddElement(nsGeneri
   if (cvElmt &&
       cvElmt->IsCandidateForConstraintValidation() && !cvElmt->IsValid()) {
     UpdateValidity(false);
   }
 
 #if DEBUG
   int32_t debugInvalidElementsCount = 0;
   for (uint32_t i = 0; i < mDependentElements.Length(); i++) {
-    HTMLFieldSetElement* fieldSet = FromContent(mDependentElements[i]);
+    HTMLFieldSetElement* fieldSet = FromNode(mDependentElements[i]);
     if (fieldSet) {
       debugInvalidElementsCount += fieldSet->mInvalidElementsCount;
       continue;
     }
     nsCOMPtr<nsIConstraintValidation>
       cvElmt = do_QueryObject(mDependentElements[i]);
     if (cvElmt &&
         cvElmt->IsCandidateForConstraintValidation() &&
@@ -300,17 +300,17 @@ HTMLFieldSetElement::AddElement(nsGeneri
 
 void
 HTMLFieldSetElement::RemoveElement(nsGenericHTMLFormElement* aElement)
 {
   mDependentElements.RemoveElement(aElement);
 
   // If the element that we are removing aElement is a fieldset, then all the
   // invalid elements in aElement are also removed from this.
-  HTMLFieldSetElement* fieldSet = FromContent(aElement);
+  HTMLFieldSetElement* fieldSet = FromNode(aElement);
   if (fieldSet) {
     for (int32_t i = 0; i < fieldSet->mInvalidElementsCount; i++) {
       UpdateValidity(true);
     }
     return;
   }
 
   // We need to update the validity of the fieldset.
@@ -318,17 +318,17 @@ HTMLFieldSetElement::RemoveElement(nsGen
   if (cvElmt &&
       cvElmt->IsCandidateForConstraintValidation() && !cvElmt->IsValid()) {
     UpdateValidity(true);
   }
 
 #if DEBUG
   int32_t debugInvalidElementsCount = 0;
   for (uint32_t i = 0; i < mDependentElements.Length(); i++) {
-    HTMLFieldSetElement* fieldSet = FromContent(mDependentElements[i]);
+    HTMLFieldSetElement* fieldSet = FromNode(mDependentElements[i]);
     if (fieldSet) {
       debugInvalidElementsCount += fieldSet->mInvalidElementsCount;
       continue;
     }
     nsCOMPtr<nsIConstraintValidation>
       cvElmt = do_QueryObject(mDependentElements[i]);
     if (cvElmt &&
         cvElmt->IsCandidateForConstraintValidation() &&
--- a/dom/html/HTMLFormElement.cpp
+++ b/dom/html/HTMLFormElement.cpp
@@ -1619,21 +1619,21 @@ HTMLFormElement::GetActionURL(nsIURI** a
   if (aOriginatingElement &&
       aOriginatingElement->HasAttr(kNameSpaceID_None, nsGkAtoms::formaction)) {
 #ifdef DEBUG
     nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(aOriginatingElement);
     NS_ASSERTION(formControl && formControl->IsSubmitControl(),
                  "The originating element must be a submit form control!");
 #endif // DEBUG
 
-    HTMLInputElement* inputElement = HTMLInputElement::FromContent(aOriginatingElement);
+    HTMLInputElement* inputElement = HTMLInputElement::FromNode(aOriginatingElement);
     if (inputElement) {
       inputElement->GetFormAction(action);
     } else {
-      auto buttonElement = HTMLButtonElement::FromContent(aOriginatingElement);
+      auto buttonElement = HTMLButtonElement::FromNode(aOriginatingElement);
       if (buttonElement) {
         buttonElement->GetFormAction(action);
       } else {
         NS_ERROR("Originating element must be an input or button element!");
         return NS_ERROR_UNEXPECTED;
       }
     }
   } else {
@@ -2196,17 +2196,17 @@ HTMLFormElement::GetNextRadioButton(cons
     if (aPrevious) {
       if (--index < 0) {
         index = numRadios -1;
       }
     }
     else if (++index >= (int32_t)numRadios) {
       index = 0;
     }
-    radio = HTMLInputElement::FromContentOrNull(radioGroup->Item(index));
+    radio = HTMLInputElement::FromNodeOrNull(radioGroup->Item(index));
     isRadio = radio && radio->ControlType() == NS_FORM_INPUT_RADIO;
     if (!isRadio) {
       continue;
     }
 
     nsAutoString name;
     radio->GetName(name);
     isRadio = aName.Equals(name);
--- a/dom/html/HTMLImageElement.cpp
+++ b/dom/html/HTMLImageElement.cpp
@@ -1038,17 +1038,17 @@ HTMLImageElement::PictureSourceSrcsetCha
     mResponsiveSelector ? mResponsiveSelector->Content() : nullptr;
 
   if (aSourceNode == currentSrc) {
     // We're currently using this node as our responsive selector
     // source.
     nsCOMPtr<nsIPrincipal> principal;
     if (aSourceNode == this) {
       principal = mSrcsetTriggeringPrincipal;
-    } else if (auto* source = HTMLSourceElement::FromContent(aSourceNode)) {
+    } else if (auto* source = HTMLSourceElement::FromNode(aSourceNode)) {
       principal = source->GetSrcsetTriggeringPrincipal();
     }
     mResponsiveSelector->SetCandidatesFromSourceSet(aNewValue, principal);
   }
 
   if (!mInDocResponsiveContent && IsInComposedDoc()) {
     nsIDocument* doc = GetOurOwnerDoc();
     if (doc) {
@@ -1234,17 +1234,17 @@ HTMLImageElement::TryCreateResponsiveSel
   nsCOMPtr<nsIPrincipal> principal;
 
   // Skip if this is not a <source> with matching media query
   bool isSourceTag = aSourceElement->IsHTMLElement(nsGkAtoms::source);
   if (isSourceTag) {
     if (!SourceElementMatches(aSourceElement)) {
       return false;
     }
-    auto* source = HTMLSourceElement::FromContent(aSourceElement);
+    auto* source = HTMLSourceElement::FromNode(aSourceElement);
     principal = source->GetSrcsetTriggeringPrincipal();
   } else if (aSourceElement->IsHTMLElement(nsGkAtoms::img)) {
     // Otherwise this is the <img> tag itself
     MOZ_ASSERT(aSourceElement == this);
     principal = mSrcsetTriggeringPrincipal;
   }
 
   // Skip if has no srcset or an empty srcset
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -2460,17 +2460,17 @@ HTMLInputElement::MozIsTextField(bool aE
 
 HTMLInputElement*
 HTMLInputElement::GetOwnerNumberControl()
 {
   if (IsInNativeAnonymousSubtree() &&
       mType == NS_FORM_INPUT_TEXT &&
       GetParent() && GetParent()->GetParent()) {
     HTMLInputElement* grandparent =
-      HTMLInputElement::FromContentOrNull(GetParent()->GetParent());
+      HTMLInputElement::FromNodeOrNull(GetParent()->GetParent());
     if (grandparent && grandparent->mType == NS_FORM_INPUT_NUMBER) {
       return grandparent;
     }
   }
   return nullptr;
 }
 
 void
@@ -4239,17 +4239,17 @@ HTMLInputElement::PostHandleEvent(EventC
   if (mCheckedIsToggled && outerActivateEvent) {
     if (aVisitor.mEventStatus == nsEventStatus_eConsumeNoDefault) {
       // if it was cancelled and a radio button, then set the old
       // selected btn to TRUE. if it is a checkbox then set it to its
       // original value
       if (oldType == NS_FORM_INPUT_RADIO) {
         nsCOMPtr<nsIContent> content = do_QueryInterface(aVisitor.mItemData);
         HTMLInputElement* selectedRadioButton =
-          HTMLInputElement::FromContentOrNull(content);
+          HTMLInputElement::FromNodeOrNull(content);
         if (selectedRadioButton) {
           selectedRadioButton->SetChecked(true);
         }
         // If there was no checked radio button or this one is no longer a
         // radio button we must reset it back to false to cancel the action.
         // See how the web of hack grows?
         if (!selectedRadioButton || mType != NS_FORM_INPUT_RADIO) {
           DoSetChecked(false, true, true);
@@ -4275,17 +4275,17 @@ HTMLInputElement::PostHandleEvent(EventC
         FireEventForAccessibility(this, aVisitor.mPresContext,
                                   eFormCheckboxStateChange);
       } else {
         FireEventForAccessibility(this, aVisitor.mPresContext,
                                   eFormRadioStateChange);
         // Fire event for the previous selected radio.
         nsCOMPtr<nsIContent> content = do_QueryInterface(aVisitor.mItemData);
         HTMLInputElement* previous =
-          HTMLInputElement::FromContentOrNull(content);
+          HTMLInputElement::FromNodeOrNull(content);
         if (previous) {
           FireEventForAccessibility(previous, aVisitor.mPresContext,
                                     eFormRadioStateChange);
         }
       }
 #endif
     }
   }
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -2392,17 +2392,17 @@ void HTMLMediaElement::LoadFromSourceChi
         OwnerDoc(), type, canPlay != CANPLAY_NO, __func__);
       if (canPlay == CANPLAY_NO) {
         const char16_t* params[] = { type.get(), src.get() };
         ReportLoadError("MediaLoadUnsupportedTypeAttribute", params, ArrayLength(params));
         DealWithFailedElement(child);
         return;
       }
     }
-    HTMLSourceElement *childSrc = HTMLSourceElement::FromContent(child);
+    HTMLSourceElement *childSrc = HTMLSourceElement::FromNode(child);
     LOG(LogLevel::Debug, ("%p Trying load from <source>=%s type=%s", this,
       NS_ConvertUTF16toUTF8(src).get(), NS_ConvertUTF16toUTF8(type).get()));
 
     nsCOMPtr<nsIURI> uri;
     NewURIFromString(src, getter_AddRefs(uri));
     if (!uri) {
       const char16_t* params[] = { src.get() };
       ReportLoadError("MediaLoadInvalidURI", params, ArrayLength(params));
@@ -4506,17 +4506,17 @@ HTMLMediaElement::ReportTelemetry()
     }
   }
 
   Telemetry::Accumulate(Telemetry::VIDEO_UNLOAD_STATE, state);
   LOG(LogLevel::Debug, ("%p VIDEO_UNLOAD_STATE = %d", this, state));
 
   FrameStatisticsData data;
 
-  if (HTMLVideoElement* vid = HTMLVideoElement::FromContentOrNull(this)) {
+  if (HTMLVideoElement* vid = HTMLVideoElement::FromNodeOrNull(this)) {
     FrameStatistics* stats = vid->GetFrameStatistics();
     if (stats) {
       data = stats->GetFrameStatisticsData();
       if (data.mParsedFrames) {
         MOZ_ASSERT(data.mDroppedFrames <= data.mParsedFrames);
         // Dropped frames <= total frames, so 'percentage' cannot be higher than
         // 100 and therefore can fit in a uint32_t (that Telemetry takes).
         uint32_t percentage = 100 * data.mDroppedFrames / data.mParsedFrames;
--- a/dom/html/HTMLMenuElement.cpp
+++ b/dom/html/HTMLMenuElement.cpp
@@ -180,23 +180,23 @@ HTMLMenuElement::CanLoadIcon(nsIContent*
 void
 HTMLMenuElement::TraverseContent(nsIContent* aContent,
                                  nsIMenuBuilder* aBuilder,
                                  int8_t& aSeparator)
 {
   nsCOMPtr<nsIContent> child;
   for (child = aContent->GetFirstChild(); child;
        child = child->GetNextSibling()) {
-    nsGenericHTMLElement* element = nsGenericHTMLElement::FromContent(child);
+    nsGenericHTMLElement* element = nsGenericHTMLElement::FromNode(child);
     if (!element) {
       continue;
     }
 
     if (child->IsHTMLElement(nsGkAtoms::menuitem)) {
-      HTMLMenuItemElement* menuitem = HTMLMenuItemElement::FromContent(child);
+      HTMLMenuItemElement* menuitem = HTMLMenuItemElement::FromNode(child);
 
       if (menuitem->IsHidden()) {
         continue;
       }
 
       nsAutoString label;
       menuitem->GetLabel(label);
       if (label.IsEmpty()) {
--- a/dom/html/HTMLMenuItemElement.cpp
+++ b/dom/html/HTMLMenuItemElement.cpp
@@ -279,17 +279,17 @@ HTMLMenuItemElement::PostHandleEvent(Eve
   if (aVisitor.mEvent->mMessage == eMouseClick &&
       aVisitor.mItemFlags & NS_CHECKED_IS_TOGGLED &&
       aVisitor.mEventStatus == nsEventStatus_eConsumeNoDefault) {
     bool originalCheckedValue =
       !!(aVisitor.mItemFlags & NS_ORIGINAL_CHECKED_VALUE);
     uint8_t oldType = NS_MENUITEM_TYPE(aVisitor.mItemFlags);
 
     nsCOMPtr<nsIContent> content(do_QueryInterface(aVisitor.mItemData));
-    RefPtr<HTMLMenuItemElement> selectedRadio = HTMLMenuItemElement::FromContentOrNull(content);
+    RefPtr<HTMLMenuItemElement> selectedRadio = HTMLMenuItemElement::FromNodeOrNull(content);
     if (selectedRadio) {
       selectedRadio->SetChecked(true);
       if (mType != CMD_TYPE_RADIO) {
         SetChecked(false);
       }
     } else if (oldType == CMD_TYPE_CHECKBOX) {
       SetChecked(originalCheckedValue);
     }
@@ -411,17 +411,17 @@ HTMLMenuItemElement::WalkRadioGroup(Visi
 
   BorrowedAttrInfo info1(GetAttrInfo(kNameSpaceID_None,
                                nsGkAtoms::radiogroup));
   bool info1Empty = !info1.mValue || info1.mValue->IsEmptyString();
 
   for (nsIContent* cur = parent->GetFirstChild();
        cur;
        cur = cur->GetNextSibling()) {
-    HTMLMenuItemElement* menuitem = HTMLMenuItemElement::FromContent(cur);
+    HTMLMenuItemElement* menuitem = HTMLMenuItemElement::FromNode(cur);
 
     if (!menuitem || menuitem->GetType() != CMD_TYPE_RADIO) {
       continue;
     }
 
     BorrowedAttrInfo info2(menuitem->GetAttrInfo(kNameSpaceID_None,
                                            nsGkAtoms::radiogroup));
     bool info2Empty = !info2.mValue || info2.mValue->IsEmptyString();
--- a/dom/html/HTMLOptGroupElement.cpp
+++ b/dom/html/HTMLOptGroupElement.cpp
@@ -137,17 +137,17 @@ HTMLOptGroupElement::AfterSetAttr(int32_
 
     if (!changedStates.IsEmpty()) {
       ToggleStates(changedStates, aNotify);
 
       // All our children <option> have their :disabled state depending on our
       // disabled attribute. We should make sure their state is updated.
       for (nsIContent* child = nsINode::GetFirstChild(); child;
            child = child->GetNextSibling()) {
-        if (auto optElement = HTMLOptionElement::FromContent(child)) {
+        if (auto optElement = HTMLOptionElement::FromNode(child)) {
           optElement->OptGroupDisabledChanged(true);
         }
       }
     }
   }
 
   return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName, aValue,
                                             aOldValue, aSubjectPrincipal, aNotify);
--- a/dom/html/HTMLOptionElement.cpp
+++ b/dom/html/HTMLOptionElement.cpp
@@ -77,17 +77,17 @@ HTMLOptionElement::OptGroupDisabledChang
 
 void
 HTMLOptionElement::UpdateDisabledState(bool aNotify)
 {
   bool isDisabled = HasAttr(kNameSpaceID_None, nsGkAtoms::disabled);
 
   if (!isDisabled) {
     nsIContent* parent = GetParent();
-    if (auto optGroupElement = HTMLOptGroupElement::FromContentOrNull(parent)) {
+    if (auto optGroupElement = HTMLOptGroupElement::FromNodeOrNull(parent)) {
       isDisabled = optGroupElement->IsDisabled();
     }
   }
 
   EventStates disabledStates;
   if (isDisabled) {
     disabledStates |= NS_EVENT_STATE_DISABLED;
   } else {
@@ -313,26 +313,26 @@ HTMLOptionElement::IntrinsicState() cons
 HTMLSelectElement*
 HTMLOptionElement::GetSelect()
 {
   nsIContent* parent = GetParent();
   if (!parent) {
     return nullptr;
   }
 
-  HTMLSelectElement* select = HTMLSelectElement::FromContent(parent);
+  HTMLSelectElement* select = HTMLSelectElement::FromNode(parent);
   if (select) {
     return select;
   }
 
   if (!parent->IsHTMLElement(nsGkAtoms::optgroup)) {
     return nullptr;
   }
 
-  return HTMLSelectElement::FromContentOrNull(parent->GetParent());
+  return HTMLSelectElement::FromNodeOrNull(parent->GetParent());
 }
 
 already_AddRefed<HTMLOptionElement>
 HTMLOptionElement::Option(const GlobalObject& aGlobal,
                           const nsAString& aText,
                           const Optional<nsAString>& aValue,
                           bool aDefaultSelected,
                           bool aSelected,
--- a/dom/html/HTMLPictureElement.cpp
+++ b/dom/html/HTMLPictureElement.cpp
@@ -31,50 +31,50 @@ HTMLPictureElement::~HTMLPictureElement(
 NS_IMPL_ELEMENT_CLONE(HTMLPictureElement)
 
 void
 HTMLPictureElement::RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify)
 {
   nsCOMPtr<nsIContent> child = GetChildAt_Deprecated(aIndex);
 
   if (child && child->IsHTMLElement(nsGkAtoms::img)) {
-    HTMLImageElement* img = HTMLImageElement::FromContent(child);
+    HTMLImageElement* img = HTMLImageElement::FromNode(child);
     if (img) {
       img->PictureSourceRemoved(child->AsContent());
     }
   } else if (child && child->IsHTMLElement(nsGkAtoms::source)) {
     // Find all img siblings after this <source> to notify them of its demise
     nsCOMPtr<nsIContent> nextSibling = child->GetNextSibling();
     if (nextSibling && nextSibling->GetParentNode() == this) {
       do {
-        HTMLImageElement* img = HTMLImageElement::FromContent(nextSibling);
+        HTMLImageElement* img = HTMLImageElement::FromNode(nextSibling);
         if (img) {
           img->PictureSourceRemoved(child->AsContent());
         }
       } while ( (nextSibling = nextSibling->GetNextSibling()) );
     }
   }
 
   nsGenericHTMLElement::RemoveChildAt_Deprecated(aIndex, aNotify);
 }
 
 void
 HTMLPictureElement::RemoveChildNode(nsIContent* aKid, bool aNotify)
 {
   if (aKid && aKid->IsHTMLElement(nsGkAtoms::img)) {
-    HTMLImageElement* img = HTMLImageElement::FromContent(aKid);
+    HTMLImageElement* img = HTMLImageElement::FromNode(aKid);
     if (img) {
       img->PictureSourceRemoved(aKid->AsContent());
     }
   } else if (aKid && aKid->IsHTMLElement(nsGkAtoms::source)) {
     // Find all img siblings after this <source> to notify them of its demise
     nsCOMPtr<nsIContent> nextSibling = aKid->GetNextSibling();
     if (nextSibling && nextSibling->GetParentNode() == this) {
       do {
-        HTMLImageElement* img = HTMLImageElement::FromContent(nextSibling);
+        HTMLImageElement* img = HTMLImageElement::FromNode(nextSibling);
         if (img) {
           img->PictureSourceRemoved(aKid->AsContent());
         }
       } while ( (nextSibling = nextSibling->GetNextSibling()) );
     }
   }
 
   nsGenericHTMLElement::RemoveChildNode(aKid, aNotify);
@@ -86,26 +86,26 @@ HTMLPictureElement::InsertChildBefore(ns
 {
   nsresult rv =
     nsGenericHTMLElement::InsertChildBefore(aKid, aBeforeThis, aNotify);
 
   NS_ENSURE_SUCCESS(rv, rv);
   NS_ENSURE_TRUE(aKid, rv);
 
   if (aKid->IsHTMLElement(nsGkAtoms::img)) {
-    HTMLImageElement* img = HTMLImageElement::FromContent(aKid);
+    HTMLImageElement* img = HTMLImageElement::FromNode(aKid);
     if (img) {
       img->PictureSourceAdded(aKid->AsContent());
     }
   } else if (aKid->IsHTMLElement(nsGkAtoms::source)) {
     // Find all img siblings after this <source> to notify them of its insertion
     nsCOMPtr<nsIContent> nextSibling = aKid->GetNextSibling();
     if (nextSibling && nextSibling->GetParentNode() == this) {
       do {
-        HTMLImageElement* img = HTMLImageElement::FromContent(nextSibling);
+        HTMLImageElement* img = HTMLImageElement::FromNode(nextSibling);
         if (img) {
           img->PictureSourceAdded(aKid->AsContent());
         }
       } while ( (nextSibling = nextSibling->GetNextSibling()) );
     }
   }
 
   return rv;
@@ -115,26 +115,26 @@ nsresult
 HTMLPictureElement::InsertChildAt_Deprecated(nsIContent* aKid, uint32_t aIndex, bool aNotify)
 {
   nsresult rv = nsGenericHTMLElement::InsertChildAt_Deprecated(aKid, aIndex, aNotify);
 
   NS_ENSURE_SUCCESS(rv, rv);
   NS_ENSURE_TRUE(aKid, rv);
 
   if (aKid->IsHTMLElement(nsGkAtoms::img)) {
-    HTMLImageElement* img = HTMLImageElement::FromContent(aKid);
+    HTMLImageElement* img = HTMLImageElement::FromNode(aKid);
     if (img) {
       img->PictureSourceAdded(aKid->AsContent());
     }
   } else if (aKid->IsHTMLElement(nsGkAtoms::source)) {
     // Find all img siblings after this <source> to notify them of its insertion
     nsCOMPtr<nsIContent> nextSibling = aKid->GetNextSibling();
     if (nextSibling && nextSibling->GetParentNode() == this) {
       do {
-        HTMLImageElement* img = HTMLImageElement::FromContent(nextSibling);
+        HTMLImageElement* img = HTMLImageElement::FromNode(nextSibling);
         if (img) {
           img->PictureSourceAdded(aKid->AsContent());
         }
       } while ( (nextSibling = nextSibling->GetNextSibling()) );
     }
   }
 
   return rv;
--- a/dom/html/HTMLSelectElement.cpp
+++ b/dom/html/HTMLSelectElement.cpp
@@ -49,17 +49,17 @@ NS_IMPL_ISUPPORTS(SelectState, SelectSta
 // SafeOptionListMutation
 //
 
 SafeOptionListMutation::SafeOptionListMutation(nsIContent* aSelect,
                                                nsIContent* aParent,
                                                nsIContent* aKid,
                                                uint32_t aIndex,
                                                bool aNotify)
-  : mSelect(HTMLSelectElement::FromContentOrNull(aSelect))
+  : mSelect(HTMLSelectElement::FromNodeOrNull(aSelect))
   , mTopLevelMutation(false)
   , mNeedsRebuild(false)
   , mNotify(aNotify)
   , mInitialSelectedIndex(-1)
 {
   if (mSelect) {
     mInitialSelectedIndex = mSelect->SelectedIndex();
     mTopLevelMutation = !mSelect->mMutating;
@@ -253,33 +253,33 @@ void
 HTMLSelectElement::InsertOptionsIntoList(nsIContent* aOptions,
                                          int32_t aListIndex,
                                          int32_t aDepth,
                                          bool aNotify)
 {
   MOZ_ASSERT(aDepth == 0 || aDepth == 1);
   int32_t insertIndex = aListIndex;
 
-  HTMLOptionElement* optElement = HTMLOptionElement::FromContent(aOptions);
+  HTMLOptionElement* optElement = HTMLOptionElement::FromNode(aOptions);
   if (optElement) {
     mOptions->InsertOptionAt(optElement, insertIndex);
     insertIndex++;
   } else if (aDepth == 0) {
     // If it's at the top level, then we just found out there are non-options
     // at the top level, which will throw off the insert count
     mNonOptionChildren++;
 
     // Deal with optgroups
     if (aOptions->IsHTMLElement(nsGkAtoms::optgroup)) {
       mOptGroupCount++;
 
       for (nsIContent* child = aOptions->GetFirstChild();
            child;
            child = child->GetNextSibling()) {
-        optElement = HTMLOptionElement::FromContent(child);
+        optElement = HTMLOptionElement::FromNode(child);
         if (optElement) {
           mOptions->InsertOptionAt(optElement, insertIndex);
           insertIndex++;
         }
       }
     }
   } // else ignore even if optgroup; we want to ignore nested optgroups.
 
@@ -334,17 +334,17 @@ nsresult
 HTMLSelectElement::RemoveOptionsFromList(nsIContent* aOptions,
                                          int32_t aListIndex,
                                          int32_t aDepth,
                                          bool aNotify)
 {
   MOZ_ASSERT(aDepth == 0 || aDepth == 1);
   int32_t numRemoved = 0;
 
-  HTMLOptionElement* optElement = HTMLOptionElement::FromContent(aOptions);
+  HTMLOptionElement* optElement = HTMLOptionElement::FromNode(aOptions);
   if (optElement) {
     if (mOptions->ItemAsOption(aListIndex) != optElement) {
       NS_ERROR("wrong option at index");
       return NS_ERROR_UNEXPECTED;
     }
     mOptions->RemoveOptionAt(aListIndex);
     numRemoved++;
   } else if (aDepth == 0) {
@@ -353,17 +353,17 @@ HTMLSelectElement::RemoveOptionsFromList
 
     // Recurse down deeper for options
     if (mOptGroupCount && aOptions->IsHTMLElement(nsGkAtoms::optgroup)) {
       mOptGroupCount--;
 
       for (nsIContent* child = aOptions->GetFirstChild();
           child;
           child = child->GetNextSibling()) {
-        optElement = HTMLOptionElement::FromContent(child);
+        optElement = HTMLOptionElement::FromNode(child);
         if (optElement) {
           if (mOptions->ItemAsOption(aListIndex) != optElement) {
             NS_ERROR("wrong option at index");
             return NS_ERROR_UNEXPECTED;
           }
           mOptions->RemoveOptionAt(aListIndex);
           numRemoved++;
         }
@@ -529,17 +529,17 @@ HTMLSelectElement::GetOptionIndexAfter(n
 
   return retval;
 }
 
 int32_t
 HTMLSelectElement::GetFirstOptionIndex(nsIContent* aOptions)
 {
   int32_t listIndex = -1;
-  HTMLOptionElement* optElement = HTMLOptionElement::FromContent(aOptions);
+  HTMLOptionElement* optElement = HTMLOptionElement::FromNode(aOptions);
   if (optElement) {
     mOptions->GetOptionIndex(optElement->AsElement(), 0, true, &listIndex);
     return listIndex;
   }
 
   listIndex = GetFirstChildOptionIndex(aOptions, 0, aOptions->GetChildCount());
 
   return listIndex;
@@ -693,17 +693,17 @@ HTMLSelectElement::SetLength(uint32_t aL
 
 /* static */
 bool
 HTMLSelectElement::MatchSelectedOptions(Element* aElement,
                                         int32_t /* unused */,
                                         nsAtom* /* unused */,
                                         void* /* unused*/)
 {
-  HTMLOptionElement* option = HTMLOptionElement::FromContent(aElement);
+  HTMLOptionElement* option = HTMLOptionElement::FromNode(aElement);
   return option && option->Selected();
 }
 
 nsIHTMLCollection*
 HTMLSelectElement::SelectedOptions()
 {
   if (!mSelectedOptions) {
     mSelectedOptions = new nsContentList(this, MatchSelectedOptions, nullptr,
@@ -1009,17 +1009,17 @@ HTMLSelectElement::IsOptionDisabled(HTML
          node;
          node = node->GetParentElement()) {
       // If we reached the select element, we're done
       if (node->IsHTMLElement(nsGkAtoms::select)) {
         return false;
       }
 
       RefPtr<HTMLOptGroupElement> optGroupElement =
-        HTMLOptGroupElement::FromContent(node);
+        HTMLOptGroupElement::FromNode(node);
 
       if (!optGroupElement) {
         // If you put something else between you and the optgroup, you're a
         // moron and you deserve not to have optgroup disabling work.
         return false;
       }
 
       if (optGroupElement->Disabled()) {
@@ -1629,24 +1629,24 @@ HTMLSelectElement::DispatchContentReset(
 }
 
 static void
 AddOptions(nsIContent* aRoot, HTMLOptionsCollection* aArray)
 {
   for (nsIContent* child = aRoot->GetFirstChild();
        child;
        child = child->GetNextSibling()) {
-    HTMLOptionElement* opt = HTMLOptionElement::FromContent(child);
+    HTMLOptionElement* opt = HTMLOptionElement::FromNode(child);
     if (opt) {
       aArray->AppendOption(opt);
     } else if (child->IsHTMLElement(nsGkAtoms::optgroup)) {
       for (nsIContent* grandchild = child->GetFirstChild();
            grandchild;
            grandchild = grandchild->GetNextSibling()) {
-        opt = HTMLOptionElement::FromContent(grandchild);
+        opt = HTMLOptionElement::FromNode(grandchild);
         if (opt) {
           aArray->AppendOption(opt);
         }
       }
     }
   }
 }
 
@@ -1721,25 +1721,25 @@ HTMLSelectElement::GetValidationMessage(
 
 void
 HTMLSelectElement::VerifyOptionsArray()
 {
   int32_t index = 0;
   for (nsIContent* child = nsINode::GetFirstChild();
        child;
        child = child->GetNextSibling()) {
-    HTMLOptionElement* opt = HTMLOptionElement::FromContent(child);
+    HTMLOptionElement* opt = HTMLOptionElement::FromNode(child);
     if (opt) {
       NS_ASSERTION(opt == mOptions->ItemAsOption(index++),
                    "Options collection broken");
     } else if (child->IsHTMLElement(nsGkAtoms::optgroup)) {
       for (nsIContent* grandchild = child->GetFirstChild();
            grandchild;
            grandchild = grandchild->GetNextSibling()) {
-        opt = HTMLOptionElement::FromContent(grandchild);
+        opt = HTMLOptionElement::FromNode(grandchild);
         if (opt) {
           NS_ASSERTION(opt == mOptions->ItemAsOption(index++),
                        "Options collection broken");
         }
       }
     }
   }
 }
--- a/dom/html/HTMLSelectElement.h
+++ b/dom/html/HTMLSelectElement.h
@@ -415,17 +415,17 @@ public:
    */
   void Add(nsGenericHTMLElement& aElement, nsGenericHTMLElement* aBefore,
            ErrorResult& aError);
   void Add(nsGenericHTMLElement& aElement, int32_t aIndex, ErrorResult& aError)
   {
     // If item index is out of range, insert to last.
     // (since beforeElement becomes null, it is inserted to last)
     nsIContent* beforeContent = mOptions->GetElementAt(aIndex);
-    return Add(aElement, nsGenericHTMLElement::FromContentOrNull(beforeContent),
+    return Add(aElement, nsGenericHTMLElement::FromNodeOrNull(beforeContent),
                aError);
   }
 
   /**
    * Is this a combobox?
    */
   bool IsCombobox() const
   {
--- a/dom/html/HTMLSlotElement.cpp
+++ b/dom/html/HTMLSlotElement.cpp
@@ -135,29 +135,29 @@ FlattenAssignedNodes(HTMLSlotElement* aS
     for (nsIContent* child = aSlot->AsContent()->GetFirstChild();
          child;
          child = child->GetNextSibling()) {
       if (!child->IsSlotable()) {
         continue;
       }
 
       if (child->IsHTMLElement(nsGkAtoms::slot)) {
-        FlattenAssignedNodes(HTMLSlotElement::FromContent(child), aNodes);
+        FlattenAssignedNodes(HTMLSlotElement::FromNode(child), aNodes);
       } else {
         aNodes.AppendElement(child);
       }
     }
     return;
   }
 
   for (uint32_t i = 0; i < assignedNodes.Length(); i++) {
     nsINode* assignedNode = assignedNodes[i];
     if (assignedNode->IsHTMLElement(nsGkAtoms::slot)) {
       FlattenAssignedNodes(
-        HTMLSlotElement::FromContent(assignedNode->AsContent()), aNodes);
+        HTMLSlotElement::FromNode(assignedNode->AsContent()), aNodes);
     } else {
       aNodes.AppendElement(assignedNode);
     }
   }
 }
 
 void
 HTMLSlotElement::AssignedNodes(const AssignedNodesOptions& aOptions,
--- a/dom/html/HTMLSummaryElement.cpp
+++ b/dom/html/HTMLSummaryElement.cpp
@@ -138,17 +138,17 @@ HTMLSummaryElement::IsMainSummary() cons
   }
 
   return details->GetFirstSummary() == this || IsRootOfNativeAnonymousSubtree();
 }
 
 HTMLDetailsElement*
 HTMLSummaryElement::GetDetails() const
 {
-  return HTMLDetailsElement::FromContentOrNull(GetParent());
+  return HTMLDetailsElement::FromNodeOrNull(GetParent());
 }
 
 JSObject*
 HTMLSummaryElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return HTMLElementBinding::Wrap(aCx, this, aGivenProto);
 }
 
--- a/dom/html/HTMLTableCellElement.cpp
+++ b/dom/html/HTMLTableCellElement.cpp
@@ -30,17 +30,17 @@ HTMLTableCellElement::WrapNode(JSContext
 
 NS_IMPL_ELEMENT_CLONE(HTMLTableCellElement)
 
 
 // protected method
 HTMLTableRowElement*
 HTMLTableCellElement::GetRow() const
 {
-  return HTMLTableRowElement::FromContentOrNull(GetParent());
+  return HTMLTableRowElement::FromNodeOrNull(GetParent());
 }
 
 // protected method
 HTMLTableElement*
 HTMLTableCellElement::GetTable() const
 {
   nsIContent *parent = GetParent();
   if (!parent) {
--- a/dom/html/HTMLTableElement.cpp
+++ b/dom/html/HTMLTableElement.cpp
@@ -269,17 +269,17 @@ TableRowsCollection::GetSupportedNames(n
       MOZ_ASSERT(idAtom != nsGkAtoms::_empty,
                  "Empty ids don't get atomized");
       nsDependentAtomString idStr(idAtom);
       if (!aNames.Contains(idStr)) {
         aNames.AppendElement(idStr);
       }
     }
 
-    nsGenericHTMLElement* el = nsGenericHTMLElement::FromContent(node);
+    nsGenericHTMLElement* el = nsGenericHTMLElement::FromNode(node);
     if (el) {
       const nsAttrValue* val = el->GetParsedAttr(nsGkAtoms::name);
       if (val && val->Type() == nsAttrValue::eAtom) {
         nsAtom* nameAtom = val->GetAtomValue();
         MOZ_ASSERT(nameAtom != nsGkAtoms::_empty,
                    "Empty names don't get atomized");
         nsDependentAtomString nameStr(nameAtom);
         if (!aNames.Contains(nameStr)) {
--- a/dom/html/HTMLTableRowElement.cpp
+++ b/dom/html/HTMLTableRowElement.cpp
@@ -61,22 +61,22 @@ HTMLTableElement*
 HTMLTableRowElement::GetTable() const
 {
   nsIContent* parent = GetParent();
   if (!parent) {
     return nullptr;
   }
 
   // We may not be in a section
-  HTMLTableElement* table = HTMLTableElement::FromContent(parent);
+  HTMLTableElement* table = HTMLTableElement::FromNode(parent);
   if (table) {
     return table;
   }
 
-  return HTMLTableElement::FromContentOrNull(parent->GetParent());
+  return HTMLTableElement::FromNodeOrNull(parent->GetParent());
 }
 
 int32_t
 HTMLTableRowElement::RowIndex() const
 {
   HTMLTableElement* table = GetTable();
   if (!table) {
     return -1;
--- a/dom/html/ImageDocument.cpp
+++ b/dom/html/ImageDocument.cpp
@@ -356,17 +356,17 @@ ImageDocument::ShrinkToFit()
     // mImageIsResized if and only if its displayed width/height fit in
     // mVisibleWidth/mVisibleHeight, then we may need to switch to/from the
     // overflowingVertical class here, because our viewport size may have
     // changed and we don't plan to adjust the image size to compensate.  Since
     // mImageIsResized it has a "height" attribute set, and we can just get the
     // displayed image height by getting .height on the HTMLImageElement.
     //
     // Hold strong ref, because Height() can run script.
-    RefPtr<HTMLImageElement> img = HTMLImageElement::FromContent(mImageContent);
+    RefPtr<HTMLImageElement> img = HTMLImageElement::FromNode(mImageContent);
     uint32_t imageHeight = img->Height();
     nsDOMTokenList* classList = img->ClassList();
     ErrorResult ignored;
     if (imageHeight > mVisibleHeight) {
       classList->Add(NS_LITERAL_STRING("overflowingVertical"), ignored);
     } else {
       classList->Remove(NS_LITERAL_STRING("overflowingVertical"), ignored);
     }
@@ -377,17 +377,17 @@ ImageDocument::ShrinkToFit()
   if (GetResolution() != mOriginalResolution && mImageIsResized) {
     // Don't resize if resolution has changed, e.g., through pinch-zooming on
     // Android.
     return;
   }
 #endif
 
   // Keep image content alive while changing the attributes.
-  RefPtr<HTMLImageElement> image = HTMLImageElement::FromContent(mImageContent);
+  RefPtr<HTMLImageElement> image = HTMLImageElement::FromNode(mImageContent);
 
   uint32_t newWidth = std::max(1, NSToCoordFloor(GetRatio() * mImageWidth));
   uint32_t newHeight = std::max(1, NSToCoordFloor(GetRatio() * mImageHeight));
   image->SetWidth(newWidth, IgnoreErrors());
   image->SetHeight(newHeight, IgnoreErrors());
 
   // The view might have been scrolled when zooming in, scroll back to the
   // origin now that we're showing a shrunk-to-window version.
@@ -634,17 +634,17 @@ ImageDocument::HandleEvent(nsIDOMEvent* 
   else if (eventType.EqualsLiteral("click") && mClickResizingEnabled) {
     ResetZoomLevel();
     mShouldResize = true;
     if (mImageIsResized) {
       int32_t x = 0, y = 0;
       MouseEvent* event = aEvent->InternalDOMEvent()->AsMouseEvent();
       if (event) {
         RefPtr<HTMLImageElement> img =
-          HTMLImageElement::FromContent(mImageContent);
+          HTMLImageElement::FromNode(mImageContent);
         x = event->ClientX() - img->OffsetLeft();
         y = event->ClientY() - img->OffsetTop();
       }
       mShouldResize = false;
       RestoreImageTo(x, y);
     }
     else if (ImageIsOverflowing()) {
       ShrinkToFit();
--- a/dom/html/RadioNodeList.cpp
+++ b/dom/html/RadioNodeList.cpp
@@ -19,17 +19,17 @@ namespace dom {
 RadioNodeList::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return RadioNodeListBinding::Wrap(aCx, this, aGivenProto);
 }
 
 HTMLInputElement*
 GetAsRadio(nsIContent* node)
 {
-  HTMLInputElement* el = HTMLInputElement::FromContent(node);
+  HTMLInputElement* el = HTMLInputElement::FromNode(node);
   if (el && el->ControlType() == NS_FORM_INPUT_RADIO) {
     return el;
   }
   return nullptr;
 }
 
 void
 RadioNodeList::GetValue(nsString& retval, CallerType aCallerType)
--- a/dom/html/nsGenericHTMLElement.cpp
+++ b/dom/html/nsGenericHTMLElement.cpp
@@ -1605,33 +1605,33 @@ HTMLMenuElement*
 nsGenericHTMLElement::GetContextMenu() const
 {
   nsAutoString value;
   GetHTMLAttr(nsGkAtoms::contextmenu, value);
   if (!value.IsEmpty()) {
     //XXXsmaug How should this work in Shadow DOM?
     nsIDocument* doc = GetUncomposedDoc();
     if (doc) {
-      return HTMLMenuElement::FromContentOrNull(doc->GetElementById(value));
+      return HTMLMenuElement::FromNodeOrNull(doc->GetElementById(value));
     }
   }
   return nullptr;
 }
 
 bool
 nsGenericHTMLElement::IsLabelable() const
 {
   return IsAnyOfHTMLElements(nsGkAtoms::progress, nsGkAtoms::meter);
 }
 
 /* static */ bool
 nsGenericHTMLElement::MatchLabelsElement(Element* aElement, int32_t aNamespaceID,
                                          nsAtom* aAtom, void* aData)
 {
-  HTMLLabelElement* element = HTMLLabelElement::FromContent(aElement);
+  HTMLLabelElement* element = HTMLLabelElement::FromNode(aElement);
   return element && element->GetControl() == aData;
 }
 
 already_AddRefed<nsINodeList>
 nsGenericHTMLElement::Labels()
 {
   MOZ_ASSERT(IsLabelable(),
              "Labels() only allow labelable elements to use it.");
@@ -2333,17 +2333,17 @@ nsGenericHTMLFormElement::UpdateFieldSet
 
   // Don't walk out of anonymous subtrees. Note the similar code in
   // nsGenericHTMLElement::FindAncestorForm.
   nsIContent* bindingParent = GetBindingParent();
 
   for (parent = GetParent(); parent && parent != bindingParent;
        prev = parent, parent = parent->GetParent()) {
     HTMLFieldSetElement* fieldset =
-      HTMLFieldSetElement::FromContent(parent);
+      HTMLFieldSetElement::FromNode(parent);
     if (fieldset &&
         (!prev || fieldset->GetFirstLegend() != prev)) {
       if (mFieldSet == fieldset) {
         // We already have the right fieldset;
         return;
       }
 
       if (mFieldSet) {
@@ -2401,17 +2401,17 @@ nsGenericHTMLFormElement::UpdateRequired
   int32_t type = ControlType();
 #endif
   MOZ_ASSERT((type & NS_FORM_INPUT_ELEMENT) ||
               type == NS_FORM_SELECT ||
               type == NS_FORM_TEXTAREA,
              "This should be called only on types that @required applies");
 
 #ifdef DEBUG
-  HTMLInputElement* input = HTMLInputElement::FromContent(this);
+  HTMLInputElement* input = HTMLInputElement::FromNode(this);
   if (input) {
     MOZ_ASSERT(input->DoesRequiredApply(),
                "This should be called only on input types that @required applies");
   }
 #endif
 
   EventStates requiredStates;
   if (aIsRequired) {
@@ -2632,17 +2632,17 @@ nsGenericHTMLElement::GetAssociatedEdito
   return textEditor.forget();
 }
 
 // static
 void
 nsGenericHTMLElement::SyncEditorsOnSubtree(nsIContent* content)
 {
   /* Sync this node */
-  nsGenericHTMLElement* element = FromContent(content);
+  nsGenericHTMLElement* element = FromNode(content);
   if (element) {
     RefPtr<TextEditor> textEditor = element->GetAssociatedEditor();
     if (textEditor) {
       textEditor->SyncRealTimeSpell();
     }
   }
 
   /* Sync all children */
--- a/dom/html/nsGenericHTMLElement.h
+++ b/dom/html/nsGenericHTMLElement.h
@@ -144,17 +144,17 @@ public:
       SetHTMLAttr(nsGkAtoms::contenteditable, NS_LITERAL_STRING("false"), aError);
     } else {
       aError.Throw(NS_ERROR_DOM_SYNTAX_ERR);
     }
   }
   bool IsContentEditable()
   {
     for (nsIContent* node = this; node; node = node->GetParent()) {
-      nsGenericHTMLElement* element = FromContent(node);
+      nsGenericHTMLElement* element = FromNode(node);
       if (element) {
         ContentEditableTristate value = element->GetContentEditableValue();
         if (value != eInherit) {
           return value == eTrue;
         }
       }
     }
     return false;
--- a/dom/html/nsIConstraintValidation.cpp
+++ b/dom/html/nsIConstraintValidation.cpp
@@ -172,17 +172,17 @@ nsIConstraintValidation::ReportValidity(
 
     if (observer) {
       observer->NotifyInvalidSubmit(nullptr, invalidElements);
     }
   }
 
   if (content->IsHTMLElement(nsGkAtoms::input) &&
       nsContentUtils::IsFocusedContent(content)) {
-    HTMLInputElement* inputElement = HTMLInputElement::FromContent(content);
+    HTMLInputElement* inputElement = HTMLInputElement::FromNode(content);
     inputElement->UpdateValidityUIBits(true);
   }
 
   dom::Element* element = content->AsElement();
   element->UpdateState(true);
   return false;
 }
 
--- a/dom/html/nsTextEditorState.cpp
+++ b/dom/html/nsTextEditorState.cpp
@@ -877,22 +877,22 @@ TextInputListener::OnSelectionChange(Sel
 
 static void
 DoCommandCallback(Command aCommand, void* aData)
 {
   nsTextControlFrame *frame = static_cast<nsTextControlFrame*>(aData);
   nsIContent *content = frame->GetContent();
 
   nsCOMPtr<nsIControllers> controllers;
-  HTMLInputElement* input = HTMLInputElement::FromContent(content);
+  HTMLInputElement* input = HTMLInputElement::FromNode(content);
   if (input) {
     input->GetControllers(getter_AddRefs(controllers));
   } else {
     HTMLTextAreaElement* textArea =
-      HTMLTextAreaElement::FromContent(content);
+      HTMLTextAreaElement::FromNode(content);
 
     if (textArea) {
       textArea->GetControllers(getter_AddRefs(controllers));
     }
   }
 
   if (!controllers) {
     NS_WARNING("Could not get controllers");
@@ -1409,22 +1409,22 @@ nsTextEditorState::PrepareEditor(const n
   }
 
   // Initialize the controller for the editor
 
   if (!SuppressEventHandlers(presContext)) {
     nsCOMPtr<nsIControllers> controllers;
     nsCOMPtr<nsIContent> content = do_QueryInterface(mTextCtrlElement);
     HTMLInputElement* inputElement =
-      HTMLInputElement::FromContentOrNull(content);
+      HTMLInputElement::FromNodeOrNull(content);
     if (inputElement) {
       rv = inputElement->GetControllers(getter_AddRefs(controllers));
     } else {
       HTMLTextAreaElement* textAreaElement =
-        HTMLTextAreaElement::FromContentOrNull(content);
+        HTMLTextAreaElement::FromNodeOrNull(content);
 
       if (!textAreaElement)
         return NS_ERROR_FAILURE;
 
       rv = textAreaElement->GetControllers(getter_AddRefs(controllers));
     }
 
     NS_ENSURE_SUCCESS(rv, rv);
@@ -1981,17 +1981,17 @@ nsTextEditorState::GetParentNumberContro
   nsIContent* parent = content->GetParent();
   if (!parent) {
     return nullptr;
   }
   nsIContent* parentOfParent = parent->GetParent();
   if (!parentOfParent) {
     return nullptr;
   }
-  HTMLInputElement* input = HTMLInputElement::FromContent(parentOfParent);
+  HTMLInputElement* input = HTMLInputElement::FromNode(parentOfParent);
   if (input) {
     // This function might be called during frame reconstruction as a result
     // of changing the input control's type from number to something else. In
     // that situation, the type of the control has changed, but its frame has
     // not been reconstructed yet.  So we need to check the type of the input
     // control in addition to the type of the frame.
     return (input->ControlType() == NS_FORM_INPUT_NUMBER) ? input : nullptr;
   }
@@ -2068,23 +2068,23 @@ nsTextEditorState::UnbindFromFrame(nsTex
   DestroyEditor();
 
   // Clean up the controller
   if (!SuppressEventHandlers(mBoundFrame->PresContext()))
   {
     nsCOMPtr<nsIControllers> controllers;
     nsCOMPtr<nsIContent> content = do_QueryInterface(mTextCtrlElement);
     HTMLInputElement* inputElement =
-      HTMLInputElement::FromContentOrNull(content);
+      HTMLInputElement::FromNodeOrNull(content);
     if (inputElement)
       inputElement->GetControllers(getter_AddRefs(controllers));
     else
     {
       HTMLTextAreaElement* textAreaElement =
-        HTMLTextAreaElement::FromContentOrNull(content);
+        HTMLTextAreaElement::FromNodeOrNull(content);
       if (textAreaElement) {
         textAreaElement->GetControllers(getter_AddRefs(controllers));
       }
     }
 
     if (controllers)
     {
       uint32_t numControllers;
@@ -2147,17 +2147,17 @@ nsTextEditorState::UnbindFromFrame(nsTex
   }
 }
 
 int32_t
 nsTextEditorState::GetMaxLength()
 {
   nsCOMPtr<nsIContent> content = do_QueryInterface(mTextCtrlElement);
   nsGenericHTMLElement* element =
-    nsGenericHTMLElement::FromContentOrNull(content);
+    nsGenericHTMLElement::FromNodeOrNull(content);
   if (NS_WARN_IF(!element)) {
     return -1;
   }
 
   const nsAttrValue* attr = element->GetParsedAttr(nsGkAtoms::maxlength);
   if (attr && attr->Type() == nsAttrValue::eInteger) {
     return attr->GetIntegerValue();
   }
--- a/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
+++ b/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
@@ -443,17 +443,17 @@ nsresult
 ResourceReader::OnWalkDOMNode(nsIDOMNode* aNode)
 {
     nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
     if (!content) {
         return NS_OK;
     }
 
     // Fixup xml-stylesheet processing instructions
-    if (auto nodeAsPI = dom::ProcessingInstruction::FromContent(content)) {
+    if (auto nodeAsPI = dom::ProcessingInstruction::FromNode(content)) {
         nsAutoString target;
         nodeAsPI->GetTarget(target);
         if (target.EqualsLiteral("xml-stylesheet")) {
             nsAutoString href;
             GetXMLStyleSheetLink(nodeAsPI, href);
             if (!href.IsEmpty()) {
                 return OnWalkURI(NS_ConvertUTF16toUTF8(href));
             }
@@ -505,17 +505,17 @@ ResourceReader::OnWalkDOMNode(nsIDOMNode
     if (content->IsHTMLElement(nsGkAtoms::embed)) {
         return OnWalkAttribute(aNode, "src");
     }
 
     if (content->IsHTMLElement(nsGkAtoms::object)) {
         return OnWalkAttribute(aNode, "data");
     }
 
-    if (auto nodeAsLink = dom::HTMLLinkElement::FromContent(content)) {
+    if (auto nodeAsLink = dom::HTMLLinkElement::FromNode(content)) {
         // Test if the link has a rel value indicating it to be a stylesheet
         nsAutoString linkRel;
         nodeAsLink->GetRel(linkRel);
         if (!linkRel.IsEmpty()) {
             nsReadingIterator<char16_t> start;
             nsReadingIterator<char16_t> end;
             nsReadingIterator<char16_t> current;
 
@@ -553,17 +553,17 @@ ResourceReader::OnWalkDOMNode(nsIDOMNode
         return OnWalkSubframe(aNode);
     }
 
     if (content->IsHTMLElement(nsGkAtoms::iframe) &&
         !(mPersistFlags & IWBP::PERSIST_FLAGS_IGNORE_IFRAMES)) {
         return OnWalkSubframe(aNode);
     }
 
-    auto nodeAsInput = dom::HTMLInputElement::FromContent(content);
+    auto nodeAsInput = dom::HTMLInputElement::FromNode(content);
     if (nodeAsInput) {
         return OnWalkAttribute(aNode, "src");
     }
 
     return NS_OK;
 }
 
 // Helper class for node rewriting in writeContent().
@@ -874,17 +874,17 @@ PersistNodeFixup::FixupNode(nsINode* aNo
         type != nsINode::PROCESSING_INSTRUCTION_NODE) {
         return NS_OK;
     }
 
     MOZ_ASSERT(aNodeIn->IsContent());
 
     // Fixup xml-stylesheet processing instructions
     if (auto nodeAsPI =
-          dom::ProcessingInstruction::FromContent(aNodeIn->AsContent())) {
+          dom::ProcessingInstruction::FromNode(aNodeIn)) {
         nsAutoString target;
         nodeAsPI->GetTarget(target);
         if (target.EqualsLiteral("xml-stylesheet"))
         {
             nsresult rv = GetNodeToFixup(aNodeIn, aNodeOut);
             if (NS_SUCCEEDED(rv) && *aNodeOut) {
                 MOZ_ASSERT((*aNodeOut)->IsProcessingInstruction());
                 auto nodeAsPI =
@@ -922,26 +922,26 @@ PersistNodeFixup::FixupNode(nsINode* aNo
             commentText += NS_LITERAL_STRING("href=\"") + href
                 + NS_LITERAL_STRING("\" ");
         }
         *aNodeOut = ownerDoc->CreateComment(commentText).take();
         return NS_OK;
     }
 
     // Fix up href and file links in the elements
-    RefPtr<dom::HTMLAnchorElement> nodeAsAnchor = dom::HTMLAnchorElement::FromContent(content);
+    RefPtr<dom::HTMLAnchorElement> nodeAsAnchor = dom::HTMLAnchorElement::FromNode(content);
     if (nodeAsAnchor) {
         nsresult rv = GetNodeToFixup(aNodeIn, aNodeOut);
         if (NS_SUCCEEDED(rv) && *aNodeOut) {
             FixupAnchor(*aNodeOut);
         }
         return rv;
     }
 
-    RefPtr<dom::HTMLAreaElement> nodeAsArea = dom::HTMLAreaElement::FromContent(content);
+    RefPtr<dom::HTMLAreaElement> nodeAsArea = dom::HTMLAreaElement::FromNode(content);
     if (nodeAsArea) {
         nsresult rv = GetNodeToFixup(aNodeIn, aNodeOut);
         if (NS_SUCCEEDED(rv) && *aNodeOut) {
             FixupAnchor(*aNodeOut);
         }
         return rv;
     }
 
@@ -1082,34 +1082,34 @@ PersistNodeFixup::FixupNode(nsINode* aNo
         nsresult rv = GetNodeToFixup(aNodeIn, aNodeOut);
         if (NS_SUCCEEDED(rv) && *aNodeOut) {
             FixupAttribute(*aNodeOut, "src");
         }
         return rv;
     }
 
     RefPtr<dom::HTMLInputElement> nodeAsInput =
-        dom::HTMLInputElement::FromContentOrNull(content);
+        dom::HTMLInputElement::FromNodeOrNull(content);
     if (nodeAsInput) {
         nsresult rv = GetNodeToFixup(aNodeIn, aNodeOut);
         if (NS_SUCCEEDED(rv) && *aNodeOut) {
             // Disable image loads
             nsCOMPtr<nsIImageLoadingContent> imgCon =
                 do_QueryInterface(*aNodeOut);
             if (imgCon) {
                 imgCon->SetLoadingEnabled(false);
             }
 
             FixupAttribute(*aNodeOut, "src");
 
             nsAutoString valueStr;
             NS_NAMED_LITERAL_STRING(valueAttr, "value");
             // Update element node attributes with user-entered form state
             RefPtr<dom::HTMLInputElement> outElt =
-                dom::HTMLInputElement::FromContent((*aNodeOut)->AsContent());
+                dom::HTMLInputElement::FromNode((*aNodeOut)->AsContent());
             nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(*aNodeOut);
             switch (formControl->ControlType()) {
                 case NS_FORM_INPUT_EMAIL:
                 case NS_FORM_INPUT_SEARCH:
                 case NS_FORM_INPUT_TEXT:
                 case NS_FORM_INPUT_TEL:
                 case NS_FORM_INPUT_URL:
                 case NS_FORM_INPUT_NUMBER:
@@ -1134,37 +1134,37 @@ PersistNodeFixup::FixupNode(nsINode* aNo
                     break;
                 default:
                     break;
             }
         }
         return rv;
     }
 
-    dom::HTMLTextAreaElement* nodeAsTextArea = dom::HTMLTextAreaElement::FromContent(content);
+    dom::HTMLTextAreaElement* nodeAsTextArea = dom::HTMLTextAreaElement::FromNode(content);
     if (nodeAsTextArea) {
         nsresult rv = GetNodeToFixup(aNodeIn, aNodeOut);
         if (NS_SUCCEEDED(rv) && *aNodeOut) {
             // Tell the document encoder to serialize the text child we create below
             *aSerializeCloneKids = true;
 
             nsAutoString valueStr;
             nodeAsTextArea->GetValue(valueStr);
 
             (*aNodeOut)->SetTextContent(valueStr, IgnoreErrors());
         }
         return rv;
     }
 
-    dom::HTMLOptionElement* nodeAsOption = dom::HTMLOptionElement::FromContent(content);
+    dom::HTMLOptionElement* nodeAsOption = dom::HTMLOptionElement::FromNode(content);
     if (nodeAsOption) {
         nsresult rv = GetNodeToFixup(aNodeIn, aNodeOut);
         if (NS_SUCCEEDED(rv) && *aNodeOut) {
             dom::HTMLOptionElement* outElt =
-                dom::HTMLOptionElement::FromContent((*aNodeOut)->AsContent());
+                dom::HTMLOptionElement::FromNode((*aNodeOut)->AsContent());
             bool selected = nodeAsOption->Selected();
             outElt->SetDefaultSelected(selected, IgnoreErrors());
         }
         return rv;
     }
 
     return NS_OK;
 }
--- a/dom/xbl/nsXBLPrototypeHandler.cpp
+++ b/dom/xbl/nsXBLPrototypeHandler.cpp
@@ -659,29 +659,29 @@ already_AddRefed<nsIController>
 nsXBLPrototypeHandler::GetController(EventTarget* aTarget)
 {
   // XXX Fix this so there's a generic interface that describes controllers,
   // This code should have no special knowledge of what objects might have controllers.
   nsCOMPtr<nsIControllers> controllers;
 
   nsCOMPtr<nsIContent> targetContent(do_QueryInterface(aTarget));
   RefPtr<nsXULElement> xulElement =
-    nsXULElement::FromContentOrNull(targetContent);
+    nsXULElement::FromNodeOrNull(targetContent);
   if (xulElement) {
     controllers = xulElement->GetControllers(IgnoreErrors());
   }
 
   if (!controllers) {
-    HTMLTextAreaElement* htmlTextArea = HTMLTextAreaElement::FromContent(targetContent);
+    HTMLTextAreaElement* htmlTextArea = HTMLTextAreaElement::FromNode(targetContent);
     if (htmlTextArea)
       htmlTextArea->GetControllers(getter_AddRefs(controllers));
   }
 
   if (!controllers) {
-    HTMLInputElement* htmlInputElement = HTMLInputElement::FromContent(targetContent);
+    HTMLInputElement* htmlInputElement = HTMLInputElement::FromNode(targetContent);
     if (htmlInputElement)
       htmlInputElement->GetControllers(getter_AddRefs(controllers));
   }
 
   if (!controllers) {
     nsCOMPtr<nsPIDOMWindowOuter> domWindow(do_QueryInterface(aTarget));
     if (domWindow) {
       domWindow->GetControllers(getter_AddRefs(controllers));
--- a/dom/xml/nsXMLContentSink.cpp
+++ b/dom/xml/nsXMLContentSink.cpp
@@ -275,17 +275,17 @@ nsXMLContentSink::DidBuildModel(bool aTe
     // stop observing in order to avoid crashing when replacing content
     mDocument->RemoveObserver(this);
     mIsDocumentObserver = false;
 
     // Check for xslt-param and xslt-param-namespace PIs
     for (nsIContent* child = mDocument->GetFirstChild();
          child;
          child = child->GetNextSibling()) {
-      if (auto pi = ProcessingInstruction::FromContent(child)) {
+      if (auto pi = ProcessingInstruction::FromNode(child)) {
         CheckXSLTParamPI(pi, mXSLTProcessor, mDocument);
       }
       else if (child->IsElement()) {
         // Only honor PIs in the prolog
         break;
       }
     }
 
--- a/dom/xul/nsXULElement.cpp
+++ b/dom/xul/nsXULElement.cpp
@@ -172,17 +172,17 @@ already_AddRefed<nsXULElement>
 nsXULElement::Create(nsXULPrototypeElement* aPrototype, mozilla::dom::NodeInfo *aNodeInfo,
                      bool aIsScriptable, bool aIsRoot)
 {
     RefPtr<mozilla::dom::NodeInfo> ni = aNodeInfo;
     nsCOMPtr<Element> baseElement;
     NS_NewXULElement(getter_AddRefs(baseElement), ni.forget(), dom::FROM_PARSER_NETWORK);
 
     if (baseElement) {
-        nsXULElement* element = FromContent(baseElement);
+        nsXULElement* element = FromNode(baseElement);
 
         if (aPrototype->mHasIdAttribute) {
             element->SetHasID();
         }
         if (aPrototype->mHasClassAttribute) {
             element->SetMayHaveClass();
         }
         if (aPrototype->mHasStyleAttribute) {
@@ -572,17 +572,17 @@ nsXULElement::PerformAccesskey(bool aKey
     }
 
     nsIFrame* frame = content->GetPrimaryFrame();
     if (!frame || !frame->IsVisibleConsideringAncestors()) {
         return false;
     }
 
     bool focused = false;
-    nsXULElement* elm = FromContent(content);
+    nsXULElement* elm = FromNode(content);
     if (elm) {
         // Define behavior for each type of XUL element.
         if (!content->IsXULElement(nsGkAtoms::toolbarbutton)) {
           nsIFocusManager* fm = nsFocusManager::GetFocusManager();
           if (fm) {
             nsCOMPtr<nsIDOMElement> elementToFocus;
             // for radio buttons, focus the radiogroup instead
             if (content->IsXULElement(nsGkAtoms::radio)) {
@@ -865,17 +865,17 @@ nsXULElement::RemoveChildAt_Deprecated(u
       // First, retrieve the tree.
       // Check first whether this element IS the tree
       controlElement = do_QueryObject(this);
 
       // If it's not, look at our parent
       if (!controlElement)
         GetParentTree(getter_AddRefs(controlElement));
       nsCOMPtr<nsIContent> controlContent(do_QueryInterface(controlElement));
-      RefPtr<nsXULElement> xulElement = FromContentOrNull(controlContent);
+      RefPtr<nsXULElement> xulElement = FromNodeOrNull(controlContent);
 
       nsCOMPtr<nsIDOMElement> oldKidElem = do_QueryInterface(oldKid);
       if (xulElement && oldKidElem) {
         // Iterate over all of the items and find out if they are contained inside
         // the removed subtree.
         int32_t length;
         controlElement->GetSelectedCount(&length);
         for (int32_t i = 0; i < length; i++) {
@@ -959,17 +959,17 @@ nsXULElement::RemoveChildNode(nsIContent
       // First, retrieve the tree.
       // Check first whether this element IS the tree
       controlElement = do_QueryObject(this);
 
       // If it's not, look at our parent
       if (!controlElement)
         GetParentTree(getter_AddRefs(controlElement));
       nsCOMPtr<nsIContent> controlContent(do_QueryInterface(controlElement));
-      RefPtr<nsXULElement> xulElement = FromContentOrNull(controlContent);
+      RefPtr<nsXULElement> xulElement = FromNodeOrNull(controlContent);
 
       nsCOMPtr<nsIDOMElement> oldKidElem = do_QueryInterface(aKid);
       if (xulElement && oldKidElem) {
         // Iterate over all of the items and find out if they are contained inside
         // the removed subtree.
         int32_t length;
         controlElement->GetSelectedCount(&length);
         for (int32_t i = 0; i < length; i++) {
--- a/editor/libeditor/EditorBase.cpp
+++ b/editor/libeditor/EditorBase.cpp
@@ -439,17 +439,17 @@ EditorBase::GetDesiredSpellCheckState()
   }
 
   // Check DOM state
   nsCOMPtr<nsIContent> content = GetExposedRoot();
   if (!content) {
     return false;
   }
 
-  auto element = nsGenericHTMLElement::FromContent(content);
+  auto element = nsGenericHTMLElement::FromNode(content);
   if (!element) {
     return false;
   }
 
   if (!IsPlaintextEditor()) {
     // Some of the page content might be editable and some not, if spellcheck=
     // is explicitly set anywhere, so if there's anything editable on the page,
     // return true and let the spellchecker figure it out.
@@ -4346,17 +4346,17 @@ EditorBase::DeleteSelectionImpl(EDirecti
                                   &deleteCharOffset,
                                   &deleteCharLength);
     if (NS_WARN_IF(!deleteSelectionTransaction)) {
       return NS_ERROR_FAILURE;
     }
   }
 
   RefPtr<CharacterData> deleteCharData =
-    CharacterData::FromContentOrNull(deleteNode);
+    CharacterData::FromNodeOrNull(deleteNode);
   AutoRules beginRulesSniffing(this, EditAction::deleteSelection, aAction);
 
   if (mRules && mRules->AsHTMLEditRules()) {
     if (!deleteNode) {
       RefPtr<HTMLEditRules> htmlEditRules = mRules->AsHTMLEditRules();
       htmlEditRules->WillDeleteSelection(selection);
     } else if (!deleteCharData) {
       RefPtr<HTMLEditRules> htmlEditRules = mRules->AsHTMLEditRules();
--- a/editor/libeditor/HTMLAnonymousNodeEditor.cpp
+++ b/editor/libeditor/HTMLAnonymousNodeEditor.cpp
@@ -488,17 +488,17 @@ HTMLEditor::GetPositionAndDimensions(Ele
          aMarginLeft + aBorderLeft;
     aY = GetCSSFloatValue(cssDecl, NS_LITERAL_STRING("top")) +
          aMarginTop + aBorderTop;
     aW = GetCSSFloatValue(cssDecl, NS_LITERAL_STRING("width"));
     aH = GetCSSFloatValue(cssDecl, NS_LITERAL_STRING("height"));
   } else {
     mResizedObjectIsAbsolutelyPositioned = false;
     RefPtr<nsGenericHTMLElement> htmlElement =
-      nsGenericHTMLElement::FromContent(&aElement);
+      nsGenericHTMLElement::FromNode(&aElement);
     if (!htmlElement) {
       return NS_ERROR_NULL_POINTER;
     }
     GetElementOrigin(aElement, aX, aY);
 
     aW = htmlElement->OffsetWidth();
     aH = htmlElement->OffsetHeight();
 
--- a/editor/libeditor/HTMLEditUtils.cpp
+++ b/editor/libeditor/HTMLEditUtils.cpp
@@ -333,17 +333,17 @@ bool
 HTMLEditUtils::IsLink(nsINode* aNode)
 {
   MOZ_ASSERT(aNode);
 
   if (!aNode->IsContent()) {
     return false;
   }
 
-  RefPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::FromContentOrNull(aNode->AsContent());
+  RefPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::FromNodeOrNull(aNode->AsContent());
   if (!anchor) {
     return false;
   }
 
   nsAutoString tmpText;
   anchor->GetHref(tmpText);
   return !tmpText.IsEmpty();
 }
--- a/editor/libeditor/HTMLEditor.cpp
+++ b/editor/libeditor/HTMLEditor.cpp
@@ -2682,17 +2682,17 @@ HTMLEditor::InsertLinkAroundSelection(ns
   if (selection->Collapsed()) {
     NS_WARNING("InsertLinkAroundSelection called but there is no selection!!!");
     return NS_OK;
   }
 
 
   // Be sure we were given an anchor element
   nsCOMPtr<nsIContent> content = do_QueryInterface(aAnchorElement);
-  RefPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::FromContentOrNull(content);
+  RefPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::FromNodeOrNull(content);
   if (!anchor) {
     return NS_OK;
   }
 
   nsAutoString href;
   anchor->GetHref(href);
   if (href.IsEmpty()) {
     return NS_OK;
--- a/editor/libeditor/HTMLInlineTableEditor.cpp
+++ b/editor/libeditor/HTMLInlineTableEditor.cpp
@@ -199,17 +199,17 @@ HTMLEditor::RemoveMouseClickListener(Ele
 NS_IMETHODIMP
 HTMLEditor::RefreshInlineTableEditingUI()
 {
   if (!mInlineEditedCell) {
    return NS_OK;
   }
 
   RefPtr<nsGenericHTMLElement> htmlElement =
-    nsGenericHTMLElement::FromContent(mInlineEditedCell);
+    nsGenericHTMLElement::FromNode(mInlineEditedCell);
   if (!htmlElement) {
     return NS_ERROR_NULL_POINTER;
   }
 
   int32_t xCell, yCell, wCell, hCell;
   GetElementOrigin(*mInlineEditedCell, xCell, yCell);
 
   wCell = htmlElement->OffsetWidth();
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -8233,18 +8233,17 @@ PresShell::GetCurrentItemAndPositionForE
   nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelect =
     do_QueryInterface(aCurrentEl);
   if (multiSelect) {
     checkLineHeight = false;
 
     int32_t currentIndex;
     multiSelect->GetCurrentIndex(&currentIndex);
     if (currentIndex >= 0) {
-      RefPtr<nsXULElement> xulElement =
-        nsXULElement::FromContent(focusedContent);
+      RefPtr<nsXULElement> xulElement = nsXULElement::FromNode(focusedContent);
       if (xulElement) {
         nsCOMPtr<nsIBoxObject> box = xulElement->GetBoxObject(IgnoreErrors());
         nsCOMPtr<nsITreeBoxObject> treeBox(do_QueryInterface(box));
         // Tree view special case (tree items have no frames)
         // Get the focused row and add its coordinates, which are already in pixels
         // XXX Boris, should we create a new interface so that this doesn't
         // need to know about trees? Something like nsINodelessChildCreator which
         // could provide the current focus coordinates?
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -3078,17 +3078,17 @@ nsCSSFrameConstructor::ConstructSelectFr
                                             nsContainerFrame*        aParentFrame,
                                             const nsStyleDisplay*    aStyleDisplay,
                                             nsFrameItems&            aFrameItems)
 {
   nsIContent* const content = aItem.mContent;
   nsStyleContext* const styleContext = aItem.mStyleContext;
 
   // Construct a frame-based listbox or combobox
-  dom::HTMLSelectElement* sel = dom::HTMLSelectElement::FromContent(content);
+  dom::HTMLSelectElement* sel = dom::HTMLSelectElement::FromNode(content);
   MOZ_ASSERT(sel);
   if (sel->IsCombobox()) {
     // Construct a frame-based combo box.
     // The frame-based combo box is built out of three parts. A display area, a button and
     // a dropdown list. The display area and button are created through anonymous content.
     // The drop-down list's frame is created explicitly. The combobox frame shares its content
     // with the drop-down list.
     nsFrameState flags = NS_BLOCK_FLOAT_MGR;
@@ -5771,22 +5771,22 @@ nsCSSFrameConstructor::AddFrameConstruct
     }
   }
 
   // When constructing a child of a non-open <details>, create only the frame
   // for the main <summary> element, and skip other elements.  This only applies
   // to things that are not roots of native anonymous subtrees (except for
   // ::before and ::after); we always want to create "internal" anonymous
   // content.
-  auto* details = HTMLDetailsElement::FromContentOrNull(parent);
+  auto* details = HTMLDetailsElement::FromNodeOrNull(parent);
   if (details && !details->Open() &&
       (!aContent->IsRootOfNativeAnonymousSubtree() ||
        aContent->IsGeneratedContentContainerForBefore() ||
        aContent->IsGeneratedContentContainerForAfter())) {
-    auto* summary = HTMLSummaryElement::FromContentOrNull(aContent);
+    auto* summary = HTMLSummaryElement::FromNodeOrNull(aContent);
     if (!summary || !summary->IsMainSummary()) {
       SetAsUndisplayedContent(aState, aItems, aContent, styleContext,
                               isGeneratedContent);
       return;
     }
   }
 
   bool isPopup = false;
@@ -5923,17 +5923,17 @@ nsCSSFrameConstructor::AddFrameConstruct
     if (canHavePageBreak && display->mBreakAfter) {
       AddPageBreakItem(aContent, aItems);
     }
     return;
   }
 
   FrameConstructionItem* item = nullptr;
   if (details && details->Open()) {
-    auto* summary = HTMLSummaryElement::FromContentOrNull(aContent);
+    auto* summary = HTMLSummaryElement::FromNodeOrNull(aContent);
     if (summary && summary->IsMainSummary()) {
       // If details is open, the main summary needs to be rendered as if it is
       // the first child, so add the item to the front of the item list.
       item = aItems.PrependItem(this, data, aContent, aTag, aNameSpaceID,
                                 pendingBinding, styleContext.forget(),
                                 aSuppressWhiteSpaceOptimizations, aAnonChildren);
     }
   }
@@ -6809,17 +6809,17 @@ static
 nsListBoxBodyFrame*
 MaybeGetListBoxBodyFrame(nsIContent* aContainer, nsIContent* aChild)
 {
   if (!aContainer)
     return nullptr;
 
   if (IsXULListBox(aContainer) &&
       aChild->IsXULElement(nsGkAtoms::listitem)) {
-    RefPtr<nsXULElement> xulElement = nsXULElement::FromContent(aContainer);
+    RefPtr<nsXULElement> xulElement = nsXULElement::FromNode(aContainer);
     nsCOMPtr<nsIBoxObject> boxObject = xulElement->GetBoxObject(IgnoreErrors());
     nsCOMPtr<nsPIListBoxObject> listBoxObject = do_QueryInterface(boxObject);
     if (listBoxObject) {
       return listBoxObject->GetListBoxBody(false);
     }
   }
 
   return nullptr;
@@ -9028,17 +9028,17 @@ nsCSSFrameConstructor::MaybeRecreateCont
       aFrame->GetPlaceholderFrame() : aFrame;
   MOZ_ASSERT(inFlowFrame, "How did that happen?");
   MOZ_ASSERT(inFlowFrame == inFlowFrame->FirstContinuation(),
              "placeholder for primary frame has previous continuations?");
   nsIFrame* parent = inFlowFrame->GetParent();
 
   if (parent && parent->IsDetailsFrame()) {
     HTMLSummaryElement* summary =
-      HTMLSummaryElement::FromContent(aFrame->GetContent());
+      HTMLSummaryElement::FromNode(aFrame->GetContent());
     DetailsFrame* detailsFrame = static_cast<DetailsFrame*>(parent);
 
     // Unlike adding summary element cases, we need to check children of the
     // parent details frame since at this moment the summary element has been
     // already removed from the parent details element's child list.
     if (summary && detailsFrame->HasMainSummaryFrame(aFrame)) {
       // When removing a summary, we should reframe the parent details frame to
       // ensure that another summary is used or the default summary is
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -7755,17 +7755,17 @@ nsLayoutUtils::SurfaceFromElement(nsIIma
   if (aSurfaceFlags & SFE_NO_COLORSPACE_CONVERSION)
     frameFlags |= imgIContainer::FLAG_DECODE_NO_COLORSPACE_CONVERSION;
   if (aSurfaceFlags & SFE_PREFER_NO_PREMULTIPLY_ALPHA) {
     frameFlags |= imgIContainer::FLAG_DECODE_NO_PREMULTIPLY_ALPHA;
   }
 
   int32_t imgWidth, imgHeight;
   nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
-  HTMLImageElement* element = HTMLImageElement::FromContentOrNull(content);
+  HTMLImageElement* element = HTMLImageElement::FromNodeOrNull(content);
   if (aSurfaceFlags & SFE_USE_ELEMENT_SIZE_IF_VECTOR &&
       element &&
       imgContainer->GetType() == imgIContainer::TYPE_VECTOR) {
     // We're holding a strong ref to "element" via "content".
     imgWidth = MOZ_KnownLive(element)->Width();
     imgHeight = MOZ_KnownLive(element)->Height();
   } else {
     rv = imgContainer->GetWidth(&imgWidth);
@@ -7923,23 +7923,23 @@ nsLayoutUtils::SurfaceFromElement(HTMLVi
 
 nsLayoutUtils::SurfaceFromElementResult
 nsLayoutUtils::SurfaceFromElement(dom::Element* aElement,
                                   uint32_t aSurfaceFlags,
                                   RefPtr<DrawTarget>& aTarget)
 {
   // If it's a <canvas>, we may be able to just grab its internal surface
   if (HTMLCanvasElement* canvas =
-        HTMLCanvasElement::FromContentOrNull(aElement)) {
+        HTMLCanvasElement::FromNodeOrNull(aElement)) {
     return SurfaceFromElement(canvas, aSurfaceFlags, aTarget);
   }
 
   // Maybe it's <video>?
   if (HTMLVideoElement* video =
-        HTMLVideoElement::FromContentOrNull(aElement)) {
+        HTMLVideoElement::FromNodeOrNull(aElement)) {
     return SurfaceFromElement(video, aSurfaceFlags, aTarget);
   }
 
   // Finally, check if it's a normal image
   nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(aElement);
 
   if (!imageLoader) {
     return SurfaceFromElementResult();
--- a/layout/forms/nsCheckboxRadioFrame.cpp
+++ b/layout/forms/nsCheckboxRadioFrame.cpp
@@ -191,17 +191,17 @@ nsCheckboxRadioFrame::HandleEvent(nsPres
     return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
   }
   return NS_OK;
 }
 
 void
 nsCheckboxRadioFrame::GetCurrentCheckState(bool* aState)
 {
-  HTMLInputElement* inputElement = HTMLInputElement::FromContent(mContent);
+  HTMLInputElement* inputElement = HTMLInputElement::FromNode(mContent);
   if (inputElement) {
     *aState = inputElement->Checked();
   }
 }
 
 nsresult
 nsCheckboxRadioFrame::SetFormProperty(nsAtom* aName, const nsAString& aValue)
 {
--- a/layout/forms/nsColorControlFrame.cpp
+++ b/layout/forms/nsColorControlFrame.cpp
@@ -88,17 +88,17 @@ nsColorControlFrame::AppendAnonymousCont
 }
 
 nsresult
 nsColorControlFrame::UpdateColor()
 {
   // Get the color from the "value" property of our content; it will return the
   // default color (through the sanitization algorithm) if the value is empty.
   nsAutoString color;
-  HTMLInputElement* elt = HTMLInputElement::FromContent(mContent);
+  HTMLInputElement* elt = HTMLInputElement::FromNode(mContent);
   elt->GetValue(color, CallerType::System);
 
   if (color.IsEmpty()) {
     // OK, there is one case the color string might be empty -- if our content
     // is still being created, i.e. if it has mDoneCreating==false.  In that
     // case, we simply do nothing, because we'll be called again with a complete
     // content node before we ever reflow or paint. Specifically: we can expect
     // that HTMLInputElement::DoneCreatingElement() will set mDoneCreating to
--- a/layout/forms/nsFileControlFrame.cpp
+++ b/layout/forms/nsFileControlFrame.cpp
@@ -102,17 +102,17 @@ MakeAnonButton(nsIDocument* aDoc, const 
   nsresult rv = button->AppendChildTo(textContent, false);
   if (NS_FAILED(rv)) {
     return nullptr;
   }
 
   // Make sure access key and tab order for the element actually redirect to the
   // file picking button.
   RefPtr<HTMLButtonElement> buttonElement =
-    HTMLButtonElement::FromContentOrNull(button);
+    HTMLButtonElement::FromNodeOrNull(button);
 
   if (!aAccessKey.IsEmpty()) {
     buttonElement->SetAccessKey(aAccessKey, IgnoreErrors());
   }
 
   // Both elements are given the same tab index so that the user can tab
   // to the file control at the correct index, and then between the two
   // buttons.
@@ -121,17 +121,17 @@ MakeAnonButton(nsIDocument* aDoc, const 
   return button.forget();
 }
 
 nsresult
 nsFileControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
 {
   nsCOMPtr<nsIDocument> doc = mContent->GetComposedDoc();
 
-  RefPtr<HTMLInputElement> fileContent = HTMLInputElement::FromContentOrNull(mContent);
+  RefPtr<HTMLInputElement> fileContent = HTMLInputElement::FromNodeOrNull(mContent);
 
   // The access key is transferred to the "Choose files..." button only. In
   // effect that access key allows access to the control via that button, then
   // the user can tab between the two buttons.
   nsAutoString accessKey;
   fileContent->GetAccessKey(accessKey);
 
   mBrowseFilesOrDirs = MakeAnonButton(doc, "Browse", fileContent, accessKey);
@@ -148,17 +148,17 @@ nsFileControlFrame::CreateAnonymousConte
   // NOTE: SetIsNativeAnonymousRoot() has to be called before setting any
   // attribute.
   mTextContent->SetIsNativeAnonymousRoot();
   mTextContent->SetAttr(kNameSpaceID_None, nsGkAtoms::crop,
                         NS_LITERAL_STRING("center"), false);
 
   // Update the displayed text to reflect the current element's value.
   nsAutoString value;
-  HTMLInputElement::FromContent(mContent)->GetDisplayFileName(value);
+  HTMLInputElement::FromNode(mContent)->GetDisplayFileName(value);
   UpdateDisplayedValue(value, false);
 
   if (!aElements.AppendElement(mTextContent)) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   // We should be able to interact with the element by doing drag and drop.
   mContent->AddSystemEventListener(NS_LITERAL_STRING("drop"),
@@ -249,17 +249,17 @@ nsFileControlFrame::DnDListener::HandleE
 
   RefPtr<DataTransfer> dataTransfer = dragEvent->GetDataTransfer();
   if (!IsValidDropData(dataTransfer)) {
     return NS_OK;
   }
 
 
   RefPtr<HTMLInputElement> inputElement =
-    HTMLInputElement::FromContent(mFrame->GetContent());
+    HTMLInputElement::FromNode(mFrame->GetContent());
   bool supportsMultiple =
     inputElement->HasAttr(kNameSpaceID_None, nsGkAtoms::multiple);
   if (!CanDropTheseFiles(dataTransfer, supportsMultiple)) {
     dataTransfer->SetDropEffect(NS_LITERAL_STRING("none"));
     aEvent->StopPropagation();
     return NS_OK;
   }
 
@@ -342,17 +342,17 @@ nsFileControlFrame::DnDListener::HandleE
 
 nsresult
 nsFileControlFrame::DnDListener::GetBlobImplForWebkitDirectory(FileList* aFileList,
                                                                BlobImpl** aBlobImpl)
 {
   *aBlobImpl = nullptr;
 
   HTMLInputElement* inputElement =
-    HTMLInputElement::FromContent(mFrame->GetContent());
+    HTMLInputElement::FromNode(mFrame->GetContent());
   bool webkitDirPicker =
     DOMPrefs::WebkitBlinkDirectoryPickerEnabled() &&
     inputElement->HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory);
   if (!webkitDirPicker) {
     return NS_OK;
   }
 
   if (!aFileList) {
--- a/layout/forms/nsGfxButtonControlFrame.cpp
+++ b/layout/forms/nsGfxButtonControlFrame.cpp
@@ -103,17 +103,17 @@ nsGfxButtonControlFrame::GetDefaultLabel
                                             prop, aString);
 }
 
 nsresult
 nsGfxButtonControlFrame::GetLabel(nsString& aLabel)
 {
   // Get the text from the "value" property on our content if there is
   // one; otherwise set it to a default value (localized).
-  dom::HTMLInputElement* elt = dom::HTMLInputElement::FromContent(mContent);
+  dom::HTMLInputElement* elt = dom::HTMLInputElement::FromNode(mContent);
   if (elt && elt->HasAttr(kNameSpaceID_None, nsGkAtoms::value)) {
     elt->GetValue(aLabel, dom::CallerType::System);
   } else {
     // Generate localized label.
     // We can't make any assumption as to what the default would be
     // because the value is localized for non-english platforms, thus
     // it might not be the string "Reset", "Submit Query", or "Browse..."
     nsresult rv;
--- a/layout/forms/nsLegendFrame.cpp
+++ b/layout/forms/nsLegendFrame.cpp
@@ -54,17 +54,17 @@ nsLegendFrame::Reflow(nsPresContext*    
   }
   return nsBlockFrame::Reflow(aPresContext, aDesiredSize, aReflowInput, aStatus);
 }
 
 int32_t
 nsLegendFrame::GetLogicalAlign(WritingMode aCBWM)
 {
   int32_t intValue = NS_STYLE_TEXT_ALIGN_START;
-  nsGenericHTMLElement* content = nsGenericHTMLElement::FromContent(mContent);
+  nsGenericHTMLElement* content = nsGenericHTMLElement::FromNode(mContent);
   if (content) {
     const nsAttrValue* attr = content->GetParsedAttr(nsGkAtoms::align);
     if (attr && attr->Type() == nsAttrValue::eEnum) {
       intValue = attr->GetEnumValue();
       switch (intValue) {
         case NS_STYLE_TEXT_ALIGN_LEFT:
           intValue = aCBWM.IsBidiLTR() ? NS_STYLE_TEXT_ALIGN_START
                                        : NS_STYLE_TEXT_ALIGN_END;
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -232,17 +232,17 @@ void nsListControlFrame::PaintFocus(Draw
       fRect.width = CalcFallbackRowBSize(inflation);
       fRect.height = GetScrollPortRect().height;
     }
     fRect.MoveBy(containerFrame->GetOffsetTo(this));
   }
   fRect += aPt;
 
   bool lastItemIsSelected = false;
-  HTMLOptionElement* domOpt = HTMLOptionElement::FromContentOrNull(focusedContent);
+  HTMLOptionElement* domOpt = HTMLOptionElement::FromNodeOrNull(focusedContent);
   if (domOpt) {
     lastItemIsSelected = domOpt->Selected();
   }
 
   // set up back stop colors and then ask L&F service for the real colors
   nscolor color =
     LookAndFeel::GetColor(lastItemIsSelected ?
                             LookAndFeel::eColorID_WidgetSelectForeground :
@@ -278,17 +278,17 @@ nsListControlFrame::AccessibleType()
 #endif
 
 static nscoord
 GetMaxOptionBSize(nsIFrame* aContainer, WritingMode aWM)
 {
   nscoord result = 0;
   for (nsIFrame* option : aContainer->PrincipalChildList()) {
     nscoord optionBSize;
-    if (HTMLOptGroupElement::FromContent(option->GetContent())) {
+    if (HTMLOptGroupElement::FromNode(option->GetContent())) {
       // An optgroup; drill through any scroll frame and recurse.  |frame| might
       // be null here though if |option| is an anonymous leaf frame of some sort.
       auto frame = option->GetContentInsertionFrame();
       optionBSize = frame ? GetMaxOptionBSize(frame, aWM) : 0;
     } else {
       // an option
       optionBSize = option->BSize(aWM);
     }
@@ -748,17 +748,17 @@ CountOptionsAndOptgroups(nsIFrame* aFram
   for (; !e.AtEnd(); e.Next()) {
     nsIFrame* child = e.get();
     nsIContent* content = child->GetContent();
     if (content) {
       if (content->IsHTMLElement(nsGkAtoms::option)) {
         ++count;
       } else {
         RefPtr<HTMLOptGroupElement> optgroup =
-          HTMLOptGroupElement::FromContent(content);
+          HTMLOptGroupElement::FromNode(content);
         if (optgroup) {
           nsAutoString label;
           optgroup->GetLabel(label);
           if (label.Length() > 0) {
             ++count;
           }
           count += CountOptionsAndOptgroups(child);
         }
@@ -999,27 +999,27 @@ nsListControlFrame::Init(nsIContent*    
 
   mLastDropdownBackstopColor = PresContext()->DefaultBackgroundColor();
 }
 
 dom::HTMLOptionsCollection*
 nsListControlFrame::GetOptions() const
 {
   dom::HTMLSelectElement* select =
-    dom::HTMLSelectElement::FromContentOrNull(mContent);
+    dom::HTMLSelectElement::FromNodeOrNull(mContent);
   NS_ENSURE_TRUE(select, nullptr);
 
   return select->Options();
 }
 
 dom::HTMLOptionElement*
 nsListControlFrame::GetOption(uint32_t aIndex) const
 {
   dom::HTMLSelectElement* select =
-    dom::HTMLSelectElement::FromContentOrNull(mContent);
+    dom::HTMLSelectElement::FromNodeOrNull(mContent);
   NS_ENSURE_TRUE(select, nullptr);
 
   return select->Item(aIndex);
 }
 
 NS_IMETHODIMP
 nsListControlFrame::OnOptionSelected(int32_t aIndex, bool aSelected)
 {
@@ -1045,17 +1045,17 @@ nsListControlFrame::ResetList(bool aAllo
   }
 
   if (aAllowScrolling) {
     mPostChildrenLoadedReset = true;
 
     // Scroll to the selected index
     int32_t indexToSelect = kNothingSelected;
 
-    HTMLSelectElement* selectElement = HTMLSelectElement::FromContent(mContent);
+    HTMLSelectElement* selectElement = HTMLSelectElement::FromNode(mContent);
     if (selectElement) {
       indexToSelect = selectElement->SelectedIndex();
       AutoWeakFrame weakFrame(this);
       ScrollToIndex(indexToSelect);
       if (!weakFrame.IsAlive()) {
         return;
       }
     }
@@ -1103,17 +1103,17 @@ nsListControlFrame::GetOptionText(uint32
     optionElement->GetText(aStr);
   }
 }
 
 int32_t
 nsListControlFrame::GetSelectedIndex()
 {
   dom::HTMLSelectElement* select =
-    dom::HTMLSelectElement::FromContentOrNull(mContent);
+    dom::HTMLSelectElement::FromNodeOrNull(mContent);
   return select->SelectedIndex();
 }
 
 dom::HTMLOptionElement*
 nsListControlFrame::GetCurrentOption()
 {
   // The mEndSelectionIndex is what is currently being selected. Use
   // the selected index if this is kNothingSelected.
@@ -1128,17 +1128,17 @@ nsListControlFrame::GetCurrentOption()
   return GetNonDisabledOptionFrom(0);
 }
 
 HTMLOptionElement*
 nsListControlFrame::GetNonDisabledOptionFrom(int32_t aFromIndex,
                                              int32_t* aFoundIndex)
 {
   RefPtr<dom::HTMLSelectElement> selectElement =
-    dom::HTMLSelectElement::FromContent(mContent);
+    dom::HTMLSelectElement::FromNode(mContent);
 
   const uint32_t length = selectElement->Length();
   for (uint32_t i = std::max(aFromIndex, 0); i < length; ++i) {
     HTMLOptionElement* node = selectElement->Item(i);
     if (!node) {
       break;
     }
     if (!selectElement->IsOptionDisabled(node)) {
@@ -1280,17 +1280,17 @@ nsListControlFrame::RemoveOption(int32_t
 // of this event rather than the receiver.
 bool
 nsListControlFrame::SetOptionsSelectedFromFrame(int32_t aStartIndex,
                                                 int32_t aEndIndex,
                                                 bool aValue,
                                                 bool aClearAll)
 {
   RefPtr<dom::HTMLSelectElement> selectElement =
-    dom::HTMLSelectElement::FromContent(mContent);
+    dom::HTMLSelectElement::FromNode(mContent);
 
   uint32_t mask = dom::HTMLSelectElement::NOTIFY;
   if (mForceSelection) {
     mask |= dom::HTMLSelectElement::SET_DISABLED;
   }
   if (aValue) {
     mask |= dom::HTMLSelectElement::IS_SELECTED;
   }
@@ -1304,17 +1304,17 @@ nsListControlFrame::SetOptionsSelectedFr
 bool
 nsListControlFrame::ToggleOptionSelectedFromFrame(int32_t aIndex)
 {
   RefPtr<dom::HTMLOptionElement> option =
     GetOption(static_cast<uint32_t>(aIndex));
   NS_ENSURE_TRUE(option, false);
 
   RefPtr<dom::HTMLSelectElement> selectElement =
-    dom::HTMLSelectElement::FromContent(mContent);
+    dom::HTMLSelectElement::FromNode(mContent);
 
   uint32_t mask = dom::HTMLSelectElement::NOTIFY;
   if (!option->Selected()) {
     mask |= dom::HTMLSelectElement::IS_SELECTED;
   }
 
   return selectElement->SetOptionsSelectedByIndex(aIndex, aIndex, mask);
 }
@@ -1544,17 +1544,17 @@ nsListControlFrame::GetBSizeOfARow()
 {
   return BSizeOfARow();
 }
 
 nsresult
 nsListControlFrame::IsOptionDisabled(int32_t anIndex, bool &aIsDisabled)
 {
   RefPtr<dom::HTMLSelectElement> sel =
-    dom::HTMLSelectElement::FromContent(mContent);
+    dom::HTMLSelectElement::FromNode(mContent);
   if (sel) {
     sel->IsOptionDisabled(anIndex, &aIsDisabled);
     return NS_OK;
   }
   return NS_ERROR_FAILURE;
 }
 
 //----------------------------------------------------------------------
@@ -1579,17 +1579,17 @@ nsListControlFrame::CalcFallbackRowBSize
 nscoord
 nsListControlFrame::CalcIntrinsicBSize(nscoord aBSizeOfARow,
                                        int32_t aNumberOfOptions)
 {
   NS_PRECONDITION(!IsInDropDownMode(),
                   "Shouldn't be in dropdown mode when we call this");
 
   dom::HTMLSelectElement* select =
-    dom::HTMLSelectElement::FromContentOrNull(mContent);
+    dom::HTMLSelectElement::FromNodeOrNull(mContent);
   if (select) {
     mNumDisplayRows = select->Size();
   } else {
     mNumDisplayRows = 1;
   }
 
   if (mNumDisplayRows < 1) {
     mNumDisplayRows = 4;
@@ -1759,17 +1759,17 @@ nsListControlFrame::GetIndexFromDOMEvent
     }
   }
 
   RefPtr<dom::HTMLOptionElement> option;
   for (nsCOMPtr<nsIContent> content =
          PresContext()->EventStateManager()->GetEventTargetContent(nullptr);
        content && !option;
        content = content->GetParent()) {
-    option = dom::HTMLOptionElement::FromContent(content);
+    option = dom::HTMLOptionElement::FromNode(content);
   }
 
   if (option) {
     aCurIndex = option->Index();
     MOZ_ASSERT(aCurIndex >= 0);
     return NS_OK;
   }
 
@@ -1843,17 +1843,17 @@ nsListControlFrame::MouseDown(nsIDOMEven
     // NOTE: the combo box is responsible for dropping it down
     if (mComboboxFrame) {
       // Ignore the click that occurs on the option element when one is
       // selected from the parent process popup.
       if (mComboboxFrame->IsOpenInParentProcess()) {
         nsCOMPtr<nsIDOMEventTarget> etarget;
         aMouseEvent->GetTarget(getter_AddRefs(etarget));
         nsCOMPtr<nsIContent> econtent = do_QueryInterface(etarget);
-        HTMLOptionElement* option = HTMLOptionElement::FromContentOrNull(econtent);
+        HTMLOptionElement* option = HTMLOptionElement::FromNodeOrNull(econtent);
         if (option) {
           return NS_OK;
         }
       }
 
       uint16_t inputSource = mouseEvent->MozInputSource();
       bool isSourceTouchEvent = inputSource == MouseEventBinding::MOZ_SOURCE_TOUCH;
       if (FireShowDropDownEvent(mContent, !mComboboxFrame->IsDroppedDownOrHasParentPopup(),
--- a/layout/forms/nsNumberControlFrame.cpp
+++ b/layout/forms/nsNumberControlFrame.cpp
@@ -306,17 +306,17 @@ public:
     : mozilla::Runnable("FocusTextField")
     , mNumber(aNumber)
     , mTextField(aTextField)
   {}
 
   NS_IMETHOD Run() override
   {
     if (mNumber->AsElement()->State().HasState(NS_EVENT_STATE_FOCUS)) {
-      HTMLInputElement::FromContent(mTextField)->Focus(IgnoreErrors());
+      HTMLInputElement::FromNode(mTextField)->Focus(IgnoreErrors());
     }
 
     return NS_OK;
   }
 
 private:
   nsCOMPtr<nsIContent> mNumber;
   nsCOMPtr<nsIContent> mTextField;
@@ -381,18 +381,18 @@ nsNumberControlFrame::CreateAnonymousCon
                             outerWrapperCI.mChildren,
                             nsGkAtoms::input,
                             CSSPseudoElementType::mozNumberText);
   NS_ENSURE_SUCCESS(rv, rv);
 
   mTextField->SetAttr(kNameSpaceID_None, nsGkAtoms::type,
                       NS_LITERAL_STRING("text"), PR_FALSE);
 
-  HTMLInputElement* content = HTMLInputElement::FromContent(mContent);
-  HTMLInputElement* textField = HTMLInputElement::FromContent(mTextField);
+  HTMLInputElement* content = HTMLInputElement::FromNode(mContent);
+  HTMLInputElement* textField = HTMLInputElement::FromNode(mTextField);
 
   // Initialize the text field value:
   nsAutoString value;
   content->GetValue(value, CallerType::System);
   SetValueOfAnonTextControl(value);
 
   // If we're readonly, make sure our anonymous text control is too:
   nsAutoString readonly;
@@ -460,17 +460,17 @@ nsresult
 nsNumberControlFrame::SetFormProperty(nsAtom* aName, const nsAString& aValue)
 {
   return GetTextFieldFrame()->SetFormProperty(aName, aValue);
 }
 
 HTMLInputElement*
 nsNumberControlFrame::GetAnonTextControl()
 {
-  return mTextField ? HTMLInputElement::FromContent(mTextField) : nullptr;
+  return HTMLInputElement::FromNode(mTextField);
 }
 
 /* static */ nsNumberControlFrame*
 nsNumberControlFrame::GetNumberControlFrameForTextField(nsIFrame* aFrame)
 {
   // If aFrame is the anon text field for an <input type=number> then we expect
   // the frame of its mContent's grandparent to be that input's frame. We
   // have to check for this via the content tree because we don't know whether
@@ -564,24 +564,24 @@ nsNumberControlFrame::SpinnerStateChange
   if (spinDownFrame && spinDownFrame->IsThemed()) {
     spinDownFrame->InvalidateFrame();
   }
 }
 
 bool
 nsNumberControlFrame::SpinnerUpButtonIsDepressed() const
 {
-  return HTMLInputElement::FromContent(mContent)->
+  return HTMLInputElement::FromNode(mContent)->
            NumberSpinnerUpButtonIsDepressed();
 }
 
 bool
 nsNumberControlFrame::SpinnerDownButtonIsDepressed() const
 {
-  return HTMLInputElement::FromContent(mContent)->
+  return HTMLInputElement::FromNode(mContent)->
            NumberSpinnerDownButtonIsDepressed();
 }
 
 bool
 nsNumberControlFrame::IsFocused() const
 {
   // Normally this depends on the state of our anonymous text control (which
   // takes focus for us), but in the case that it does not have a frame we will
@@ -590,25 +590,25 @@ nsNumberControlFrame::IsFocused() const
          mContent->AsElement()->State().HasState(NS_EVENT_STATE_FOCUS);
 }
 
 void
 nsNumberControlFrame::HandleFocusEvent(WidgetEvent* aEvent)
 {
   if (aEvent->mOriginalTarget != mTextField) {
     // Move focus to our text field
-    RefPtr<HTMLInputElement> textField = HTMLInputElement::FromContent(mTextField);
+    RefPtr<HTMLInputElement> textField = HTMLInputElement::FromNode(mTextField);
     textField->Focus(IgnoreErrors());
   }
 }
 
 void
 nsNumberControlFrame::HandleSelectCall()
 {
-  RefPtr<HTMLInputElement> textField = HTMLInputElement::FromContent(mTextField);
+  RefPtr<HTMLInputElement> textField = HTMLInputElement::FromNode(mTextField);
   textField->Select();
 }
 
 #define STYLES_DISABLING_NATIVE_THEMING \
   NS_AUTHOR_SPECIFIED_BACKGROUND | \
   NS_AUTHOR_SPECIFIED_PADDING | \
   NS_AUTHOR_SPECIFIED_BORDER
 
@@ -672,30 +672,30 @@ nsNumberControlFrame::SetValueOfAnonText
   // We need to update the value of our anonymous text control here. Note that
   // this must be its value, and not its 'value' attribute (the default value),
   // since the default value is ignored once a user types into the text
   // control.
   //
   // Pass NonSystem as the caller type; this should work fine for actual number
   // inputs, and be safe in case our input has a type we don't expect for some
   // reason.
-  HTMLInputElement::FromContent(mTextField)->SetValue(localizedValue,
-                                                      CallerType::NonSystem,
-                                                      IgnoreErrors());
+  HTMLInputElement::FromNode(mTextField)->SetValue(localizedValue,
+                                                   CallerType::NonSystem,
+                                                   IgnoreErrors());
 }
 
 void
 nsNumberControlFrame::GetValueOfAnonTextControl(nsAString& aValue)
 {
   if (!mTextField) {
     aValue.Truncate();
     return;
   }
 
-  HTMLInputElement::FromContent(mTextField)->GetValue(aValue, CallerType::System);
+  HTMLInputElement::FromNode(mTextField)->GetValue(aValue, CallerType::System);
 
   // Here we need to de-localize any number typed in by the user. That is, we
   // need to convert it from the number format of the user's language, region,
   // etc. to the format that the HTML 5 spec defines to be a "valid
   // floating-point number":
   //
   //   http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#floating-point-numbers
   //
@@ -736,17 +736,17 @@ nsNumberControlFrame::GetValueOfAnonText
 
 bool
 nsNumberControlFrame::AnonTextControlIsEmpty()
 {
   if (!mTextField) {
     return true;
   }
   nsAutoString value;
-  HTMLInputElement::FromContent(mTextField)->GetValue(value, CallerType::System);
+  HTMLInputElement::FromNode(mTextField)->GetValue(value, CallerType::System);
   return value.IsEmpty();
 }
 
 Element*
 nsNumberControlFrame::GetPseudoElement(CSSPseudoElementType aType)
 {
   if (aType == CSSPseudoElementType::mozNumberWrapper) {
     return mOuterWrapper;
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -416,17 +416,17 @@ nsTextControlFrame::ShouldInitializeEage
   // Also, input elements which have a cached selection should get eager
   // editor initialization.
   nsCOMPtr<nsITextControlElement> txtCtrl = do_QueryInterface(GetContent());
   if (txtCtrl->HasCachedSelection()) {
     return true;
   }
 
   // So do input text controls with spellcheck=true
-  if (auto* htmlElement = nsGenericHTMLElement::FromContent(mContent)) {
+  if (auto* htmlElement = nsGenericHTMLElement::FromNode(mContent)) {
     if (htmlElement->Spellcheck()) {
       return true;
     }
   }
 
   return false;
 }
 
@@ -1163,33 +1163,33 @@ void
 nsTextControlFrame::GetText(nsString& aText)
 {
   nsCOMPtr<nsITextControlElement> txtCtrl = do_QueryInterface(GetContent());
   NS_ASSERTION(txtCtrl, "Content not a text control element");
   if (IsSingleLineTextControl()) {
     // There will be no line breaks so we can ignore the wrap property.
     txtCtrl->GetTextEditorValue(aText, true);
   } else {
-    HTMLTextAreaElement* textArea = HTMLTextAreaElement::FromContent(mContent);
+    HTMLTextAreaElement* textArea = HTMLTextAreaElement::FromNode(mContent);
     if (textArea) {
       textArea->GetValue(aText);
     }
   }
 }
 
 
 ///END NSIFRAME OVERLOADS
 /////BEGIN PROTECTED METHODS
 
 bool
 nsTextControlFrame::GetMaxLength(int32_t* aSize)
 {
   *aSize = -1;
 
-  nsGenericHTMLElement *content = nsGenericHTMLElement::FromContent(mContent);
+  nsGenericHTMLElement *content = nsGenericHTMLElement::FromNode(mContent);
   if (content) {
     const nsAttrValue* attr = content->GetParsedAttr(nsGkAtoms::maxlength);
     if (attr && attr->Type() == nsAttrValue::eInteger) {
       *aSize = attr->GetIntegerValue();
 
       return true;
     }
   }
--- a/layout/generic/DetailsFrame.cpp
+++ b/layout/generic/DetailsFrame.cpp
@@ -53,17 +53,17 @@ DetailsFrame::SetInitialChildList(ChildL
 }
 
 #ifdef DEBUG
 bool
 DetailsFrame::CheckValidMainSummary(const nsFrameList& aFrameList) const
 {
   for (nsIFrame* child : aFrameList) {
     HTMLSummaryElement* summary =
-      HTMLSummaryElement::FromContent(child->GetContent());
+      HTMLSummaryElement::FromNode(child->GetContent());
 
     if (child == aFrameList.FirstChild()) {
       if (summary && summary->IsMainSummary()) {
         return true;
       } else if (child->GetContent() == GetContent()) {
         // The child frame's content is the same as our content, which means
         // it's a kind of wrapper frame. Descend into its child list to find
         // main summary.
@@ -86,17 +86,17 @@ DetailsFrame::DestroyFrom(nsIFrame* aDes
 {
   aPostDestroyData.AddAnonymousContent(mDefaultSummary.forget());
   nsBlockFrame::DestroyFrom(aDestructRoot, aPostDestroyData);
 }
 
 nsresult
 DetailsFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
 {
-  auto* details = HTMLDetailsElement::FromContent(GetContent());
+  auto* details = HTMLDetailsElement::FromNode(GetContent());
   if (details->GetFirstSummary()) {
     return NS_OK;
   }
 
   // The <details> element lacks any direct <summary> child. Create a default
   // <summary> element as an anonymous content.
   nsNodeInfoManager* nodeInfoManager =
     GetContent()->NodeInfo()->NodeInfoManager();
--- a/layout/generic/ReflowInput.cpp
+++ b/layout/generic/ReflowInput.cpp
@@ -2897,17 +2897,17 @@ ReflowInput::CalcLineHeight(nsIContent* 
 {
   NS_PRECONDITION(aStyleContext, "Must have a style context");
 
   nscoord lineHeight =
     ComputeLineHeight(aStyleContext, aBlockBSize, aFontSizeInflation);
 
   NS_ASSERTION(lineHeight >= 0, "ComputeLineHeight screwed up");
 
-  HTMLInputElement* input = HTMLInputElement::FromContentOrNull(aContent);
+  HTMLInputElement* input = HTMLInputElement::FromNodeOrNull(aContent);
   if (input && input->IsSingleLineTextControl()) {
     // For Web-compatibility, single-line text input elements cannot
     // have a line-height smaller than one.
     nscoord lineHeightOne =
       aFontSizeInflation * aStyleContext->StyleFont()->mFont.size;
     if (lineHeight < lineHeightOne) {
       lineHeight = lineHeightOne;
     }
--- a/layout/generic/nsBulletFrame.cpp
+++ b/layout/generic/nsBulletFrame.cpp
@@ -911,17 +911,17 @@ nsBulletFrame::SetListItemOrdinal(int32_
   mOrdinal = aNextOrdinal;
 
   // Try to get value directly from the list-item, if it specifies a
   // value attribute. Note: we do this with our parent's content
   // because our parent is the list-item.
   nsIContent* parentContent = GetParent()->GetContent();
   if (parentContent) {
     nsGenericHTMLElement *hc =
-      nsGenericHTMLElement::FromContent(parentContent);
+      nsGenericHTMLElement::FromNode(parentContent);
     if (hc) {
       const nsAttrValue* attr = hc->GetParsedAttr(nsGkAtoms::value);
       if (attr && attr->Type() == nsAttrValue::eInteger) {
         // Use ordinal specified by the value attribute
         mOrdinal = attr->GetIntegerValue();
       }
     }
   }
--- a/layout/generic/nsContainerFrame.cpp
+++ b/layout/generic/nsContainerFrame.cpp
@@ -1829,17 +1829,17 @@ nsContainerFrame::RenumberList()
   int32_t increment;
   if (mContent->IsHTMLElement(nsGkAtoms::ol) &&
       mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::reversed)) {
     increment = -1;
   } else {
     increment = 1;
   }
 
-  nsGenericHTMLElement* hc = nsGenericHTMLElement::FromContent(mContent);
+  nsGenericHTMLElement* hc = nsGenericHTMLElement::FromNode(mContent);
   // Must be non-null, since FrameStartsCounterScope only returns true
   // for HTML elements.
   MOZ_ASSERT(hc, "How is mContent not HTML?");
   const nsAttrValue* attr = hc->GetParsedAttr(nsGkAtoms::start);
   nsContainerFrame* fif = static_cast<nsContainerFrame*>(FirstInFlow());
   if (attr && attr->Type() == nsAttrValue::eInteger) {
     ordinal = attr->GetIntegerValue();
   } else if (increment < 0) {
@@ -1873,17 +1873,17 @@ nsContainerFrame::RenumberFrameAndDescen
   // drill down through any wrappers to the real frame
   nsIFrame* kid = GetContentInsertionFrame();
   if (!kid) {
     return false;
   }
 
   // Do not renumber list for summary elements.
   HTMLSummaryElement* summary =
-    HTMLSummaryElement::FromContent(kid->GetContent());
+    HTMLSummaryElement::FromNode(kid->GetContent());
   if (summary && summary->IsMainSummary()) {
     return false;
   }
 
   bool kidRenumberedABullet = false;
 
   // If the frame is a list-item and the frame implements our
   // block frame API then get its bullet and set the list item
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -6548,17 +6548,17 @@ bool
 nsIFrame::IsContentDisabled() const
 {
   // FIXME(emilio): Doing this via CSS means callers must ensure the style is up
   // to date, and they don't!
   if (StyleUserInterface()->mUserInput == StyleUserInput::None) {
     return true;
   }
 
-  auto* element = nsGenericHTMLElement::FromContentOrNull(GetContent());
+  auto* element = nsGenericHTMLElement::FromNodeOrNull(GetContent());
   return element && element->IsDisabled();
 }
 
 nsresult
 nsFrame::CharacterDataChanged(const CharacterDataChangeInfo&)
 {
   NS_NOTREACHED("should only be called for text frames");
   return NS_OK;
--- a/layout/generic/nsFrameSetFrame.cpp
+++ b/layout/generic/nsFrameSetFrame.cpp
@@ -222,17 +222,17 @@ nsHTMLFramesetFrame::Init(nsIContent*   
   nsPresContext* presContext = PresContext();
   nsIPresShell* shell = presContext->PresShell();
 
   nsFrameborder  frameborder = GetFrameBorder();
   int32_t borderWidth = GetBorderWidth(presContext, false);
   nscolor borderColor = GetBorderColor();
 
   // Get the rows= cols= data
-  HTMLFrameSetElement* ourContent = HTMLFrameSetElement::FromContent(mContent);
+  HTMLFrameSetElement* ourContent = HTMLFrameSetElement::FromNode(mContent);
   NS_ASSERTION(ourContent, "Someone gave us a broken frameset element!");
   const nsFramesetSpec* rowSpecs = nullptr;
   const nsFramesetSpec* colSpecs = nullptr;
   // GetRowSpec and GetColSpec can fail, but when they do they set
   // mNumRows and mNumCols respectively to 0, so we deal with it fine.
   ourContent->GetRowSpec(&mNumRows, &rowSpecs);
   ourContent->GetColSpec(&mNumCols, &colSpecs);
 
@@ -537,17 +537,17 @@ void nsHTMLFramesetFrame::GenerateRowCol
 
 int32_t nsHTMLFramesetFrame::GetBorderWidth(nsPresContext* aPresContext,
                                             bool aTakeForcingIntoAccount)
 {
   nsFrameborder frameborder = GetFrameBorder();
   if (frameborder == eFrameborder_No) {
     return 0;
   }
-  nsGenericHTMLElement *content = nsGenericHTMLElement::FromContent(mContent);
+  nsGenericHTMLElement *content = nsGenericHTMLElement::FromNode(mContent);
 
   if (content) {
     const nsAttrValue* attr = content->GetParsedAttr(nsGkAtoms::border);
     if (attr) {
       int32_t intVal = 0;
       if (attr->Type() == nsAttrValue::eInteger) {
         intVal = attr->GetIntegerValue();
         if (intVal < 0) {
@@ -731,62 +731,62 @@ nsFrameborder GetFrameBorderHelper(nsGen
     }
   }
   return eFrameborder_Notset;
 }
 
 nsFrameborder nsHTMLFramesetFrame::GetFrameBorder()
 {
   nsFrameborder result = eFrameborder_Notset;
-  nsGenericHTMLElement *content = nsGenericHTMLElement::FromContent(mContent);
+  nsGenericHTMLElement *content = nsGenericHTMLElement::FromNode(mContent);
 
   if (content) {
     result = GetFrameBorderHelper(content);
   }
   if (eFrameborder_Notset == result) {
     return mParentFrameborder;
   }
   return result;
 }
 
 nsFrameborder nsHTMLFramesetFrame::GetFrameBorder(nsIContent* aContent)
 {
   nsFrameborder result = eFrameborder_Notset;
 
-  nsGenericHTMLElement *content = nsGenericHTMLElement::FromContent(aContent);
+  nsGenericHTMLElement *content = nsGenericHTMLElement::FromNode(aContent);
 
   if (content) {
     result = GetFrameBorderHelper(content);
   }
   if (eFrameborder_Notset == result) {
     return GetFrameBorder();
   }
   return result;
 }
 
 nscolor nsHTMLFramesetFrame::GetBorderColor()
 {
-  nsGenericHTMLElement *content = nsGenericHTMLElement::FromContent(mContent);
+  nsGenericHTMLElement *content = nsGenericHTMLElement::FromNode(mContent);
 
   if (content) {
     const nsAttrValue* attr = content->GetParsedAttr(nsGkAtoms::bordercolor);
     if (attr) {
       nscolor color;
       if (attr->GetColorValue(color)) {
         return color;
       }
     }
   }
 
   return mParentBorderColor;
 }
 
 nscolor nsHTMLFramesetFrame::GetBorderColor(nsIContent* aContent)
 {
-  nsGenericHTMLElement *content = nsGenericHTMLElement::FromContent(aContent);
+  nsGenericHTMLElement *content = nsGenericHTMLElement::FromNode(aContent);
 
   if (content) {
     const nsAttrValue* attr = content->GetParsedAttr(nsGkAtoms::bordercolor);
     if (attr) {
       nscolor color;
       if (attr->GetColorValue(color)) {
         return color;
       }
@@ -834,17 +834,17 @@ nsHTMLFramesetFrame::Reflow(nsPresContex
   int32_t borderWidth = GetBorderWidth(aPresContext, true);
 
   width  -= (mNumCols - 1) * borderWidth;
   if (width < 0) width = 0;
 
   height -= (mNumRows - 1) * borderWidth;
   if (height < 0) height = 0;
 
-  HTMLFrameSetElement* ourContent = HTMLFrameSetElement::FromContent(mContent);
+  HTMLFrameSetElement* ourContent = HTMLFrameSetElement::FromNode(mContent);
   NS_ASSERTION(ourContent, "Someone gave us a broken frameset element!");
   const nsFramesetSpec* rowSpecs = nullptr;
   const nsFramesetSpec* colSpecs = nullptr;
   int32_t rows = 0;
   int32_t cols = 0;
   ourContent->GetRowSpec(&rows, &rowSpecs);
   ourContent->GetColSpec(&cols, &colSpecs);
   // If the number of cols or rows has changed, the frame for the frameset
@@ -1252,17 +1252,17 @@ nsHTMLFramesetFrame::MouseDrag(nsPresCon
       change = mMinDrag - mPrevNeighborOrigSize;
     }
     mColSizes[mDragger->mPrevNeighbor] = mPrevNeighborOrigSize + change;
     mColSizes[mDragger->mNextNeighbor] = mNextNeighborOrigSize - change;
 
     if (change != 0) {
       // Recompute the specs from the new sizes.
       nscoord width = mRect.width - (mNumCols - 1) * GetBorderWidth(aPresContext, true);
-      HTMLFrameSetElement* ourContent = HTMLFrameSetElement::FromContent(mContent);
+      HTMLFrameSetElement* ourContent = HTMLFrameSetElement::FromNode(mContent);
       NS_ASSERTION(ourContent, "Someone gave us a broken frameset element!");
       const nsFramesetSpec* colSpecs = nullptr;
       ourContent->GetColSpec(&mNumCols, &colSpecs);
       nsAutoString newColAttr;
       GenerateRowCol(aPresContext, width, mNumCols, colSpecs, mColSizes.get(),
                      newColAttr);
       // Setting the attr will trigger a reflow
       mContent->AsElement()->SetAttr(kNameSpaceID_None, nsGkAtoms::cols,
@@ -1277,17 +1277,17 @@ nsHTMLFramesetFrame::MouseDrag(nsPresCon
       change = mMinDrag - mPrevNeighborOrigSize;
     }
     mRowSizes[mDragger->mPrevNeighbor] = mPrevNeighborOrigSize + change;
     mRowSizes[mDragger->mNextNeighbor] = mNextNeighborOrigSize - change;
 
     if (change != 0) {
       // Recompute the specs from the new sizes.
       nscoord height = mRect.height - (mNumRows - 1) * GetBorderWidth(aPresContext, true);
-      HTMLFrameSetElement* ourContent = HTMLFrameSetElement::FromContent(mContent);
+      HTMLFrameSetElement* ourContent = HTMLFrameSetElement::FromNode(mContent);
       NS_ASSERTION(ourContent, "Someone gave us a broken frameset element!");
       const nsFramesetSpec* rowSpecs = nullptr;
       ourContent->GetRowSpec(&mNumRows, &rowSpecs);
       nsAutoString newRowAttr;
       GenerateRowCol(aPresContext, height, mNumRows, rowSpecs, mRowSizes.get(),
                      newRowAttr);
       // Setting the attr will trigger a reflow
       mContent->AsElement()->SetAttr(kNameSpaceID_None, nsGkAtoms::rows,
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -4616,17 +4616,17 @@ ScrollFrameHelper::CreateAnonymousConten
     canHaveVertical = true;
   }
 
   // The anonymous <div> used by <inputs> never gets scrollbars.
   nsITextControlFrame* textFrame = do_QueryFrame(parent);
   if (textFrame) {
     // Make sure we are not a text area.
     HTMLTextAreaElement* textAreaElement =
-      HTMLTextAreaElement::FromContent(parent->GetContent());
+      HTMLTextAreaElement::FromNode(parent->GetContent());
     if (!textAreaElement) {
       mNeverHasVerticalScrollbar = mNeverHasHorizontalScrollbar = true;
       return NS_OK;
     }
   }
 
   nsNodeInfoManager* nodeInfoManager = presContext->Document()->NodeInfoManager();
   RefPtr<NodeInfo> nodeInfo =
--- a/layout/generic/nsHTMLCanvasFrame.cpp
+++ b/layout/generic/nsHTMLCanvasFrame.cpp
@@ -79,17 +79,17 @@ public:
   NS_DISPLAY_DECL_NAME("nsDisplayCanvas", TYPE_CANVAS)
 
   virtual nsRegion GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
                                    bool* aSnap) const override
   {
     *aSnap = false;
     nsHTMLCanvasFrame* f = static_cast<nsHTMLCanvasFrame*>(Frame());
     HTMLCanvasElement* canvas =
-      HTMLCanvasElement::FromContent(f->GetContent());
+      HTMLCanvasElement::FromNode(f->GetContent());
     nsRegion result;
     if (canvas->GetIsOpaque()) {
       // OK, the entire region painted by the canvas is opaque. But what is
       // that region? It's the canvas's "dest rect" (controlled by the
       // object-fit/object-position CSS properties), clipped to the container's
       // content box (which is what GetBounds() returns). So, we grab those
       // rects and intersect them.
       nsRect constraintRect = GetBounds(aBuilder, aSnap);
@@ -206,17 +206,17 @@ public:
     }
     return true;
   }
 
   virtual LayerState GetLayerState(nsDisplayListBuilder* aBuilder,
                                    LayerManager* aManager,
                                    const ContainerLayerParameters& aParameters) override
   {
-    if (HTMLCanvasElement::FromContent(mFrame->GetContent())->ShouldForceInactiveLayer(aManager))
+    if (HTMLCanvasElement::FromNode(mFrame->GetContent())->ShouldForceInactiveLayer(aManager))
       return LAYER_INACTIVE;
 
     // If compositing is cheap, just do that
     if (aManager->IsCompositingCheap() ||
         ActiveLayerTracker::IsContentActive(mFrame))
       return mozilla::LAYER_ACTIVE;
 
     return LAYER_INACTIVE;
@@ -253,17 +253,17 @@ nsHTMLCanvasFrame::~nsHTMLCanvasFrame()
 {
 }
 
 nsIntSize
 nsHTMLCanvasFrame::GetCanvasSize()
 {
   nsIntSize size(0,0);
   HTMLCanvasElement *canvas =
-    HTMLCanvasElement::FromContentOrNull(GetContent());
+    HTMLCanvasElement::FromNodeOrNull(GetContent());
   if (canvas) {
     size = canvas->GetSize();
     MOZ_ASSERT(size.width >= 0 && size.height >= 0,
                "we should've required <canvas> width/height attrs to be "
                "unsigned (non-negative) values");
   } else {
     NS_NOTREACHED("couldn't get canvas size");
   }
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -2010,17 +2010,17 @@ nsImageFrame::GetAnchorHREFTargetAndNode
     nsCOMPtr<dom::Link> link(do_QueryInterface(content));
     if (link) {
       nsCOMPtr<nsIURI> href = content->GetHrefURI();
       if (href) {
         href->Clone(aHref);
       }
       status = (*aHref != nullptr);
 
-      RefPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::FromContent(content);
+      RefPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::FromNode(content);
       if (anchor) {
         anchor->GetTarget(aTarget);
       }
       NS_ADDREF(*aNode = content);
       break;
     }
   }
   return status;
--- a/layout/generic/nsImageMap.cpp
+++ b/layout/generic/nsImageMap.cpp
@@ -751,17 +751,17 @@ nsImageMap::Init(nsImageFrame* aImageFra
 
 void
 nsImageMap::SearchForAreas(nsIContent* aParent)
 {
   // Look for <area> elements.
   for (nsIContent* child = aParent->GetFirstChild();
        child;
        child = child->GetNextSibling()) {
-    if (auto* area = HTMLAreaElement::FromContent(child)) {
+    if (auto* area = HTMLAreaElement::FromNode(child)) {
       AddArea(area);
 
       // Continue to next child. This stops mConsiderWholeSubtree from
       // getting set. It also makes us ignore children of <area>s which
       // is consistent with how we react to dynamic insertion of such
       // children.
       continue;
     }
@@ -942,17 +942,17 @@ TakeArea(nsImageMap::AreaList& aAreas, H
 void
 nsImageMap::ContentRemoved(nsIContent* aChild,
                            nsIContent* aPreviousSibling)
 {
   if (aChild->GetParent() != mMap && !mConsiderWholeSubtree) {
     return;
   }
 
-  auto* areaElement = HTMLAreaElement::FromContent(aChild);
+  auto* areaElement = HTMLAreaElement::FromNode(aChild);
   if (!areaElement) {
     return;
   }
 
   UniquePtr<Area> area = TakeArea(mAreas, areaElement);
   if (!area) {
     return;
   }
--- a/layout/generic/nsSimplePageSequenceFrame.cpp
+++ b/layout/generic/nsSimplePageSequenceFrame.cpp
@@ -455,17 +455,17 @@ GetPrintCanvasElementsInFrame(nsIFrame* 
       nsIFrame* child = e.get();
 
       // Check if child is a nsHTMLCanvasFrame.
       nsHTMLCanvasFrame* canvasFrame = do_QueryFrame(child);
 
       // If there is a canvasFrame, try to get actual canvas element.
       if (canvasFrame) {
         HTMLCanvasElement* canvas =
-          HTMLCanvasElement::FromContentOrNull(canvasFrame->GetContent());
+          HTMLCanvasElement::FromNodeOrNull(canvasFrame->GetContent());
         if (canvas && canvas->GetMozPrintCallback()) {
           aArr->AppendElement(canvas);
           continue;
         }
       }
 
       if (!child->PrincipalChildList().FirstChild()) {
         nsSubDocumentFrame* subdocumentFrame = do_QueryFrame(child);
--- a/layout/generic/nsSubDocumentFrame.cpp
+++ b/layout/generic/nsSubDocumentFrame.cpp
@@ -1031,17 +1031,17 @@ nsSubDocumentFrame::DestroyFrom(nsIFrame
 
   nsAtomicContainerFrame::DestroyFrom(aDestructRoot, aPostDestroyData);
 }
 
 CSSIntSize
 nsSubDocumentFrame::GetMarginAttributes()
 {
   CSSIntSize result(-1, -1);
-  nsGenericHTMLElement *content = nsGenericHTMLElement::FromContent(mContent);
+  nsGenericHTMLElement *content = nsGenericHTMLElement::FromNode(mContent);
   if (content) {
     const nsAttrValue* attr = content->GetParsedAttr(nsGkAtoms::marginwidth);
     if (attr && attr->Type() == nsAttrValue::eInteger)
       result.width = attr->GetIntegerValue();
     attr = content->GetParsedAttr(nsGkAtoms::marginheight);
     if (attr && attr->Type() == nsAttrValue::eInteger)
       result.height = attr->GetIntegerValue();
   }
--- a/layout/printing/nsPrintJob.cpp
+++ b/layout/printing/nsPrintJob.cpp
@@ -2756,17 +2756,17 @@ DocHasPrintCallbackCanvas(nsIDocument* a
   if (!root) {
     return true;
   }
   RefPtr<nsContentList> canvases = NS_GetContentList(root,
                                                        kNameSpaceID_XHTML,
                                                        NS_LITERAL_STRING("canvas"));
   uint32_t canvasCount = canvases->Length(true);
   for (uint32_t i = 0; i < canvasCount; ++i) {
-    HTMLCanvasElement* canvas = HTMLCanvasElement::FromContentOrNull(canvases->Item(i, false));
+    HTMLCanvasElement* canvas = HTMLCanvasElement::FromNodeOrNull(canvases->Item(i, false));
     if (canvas && canvas->GetMozPrintCallback()) {
       // This subdocument has a print callback. Set result and return false to
       // stop iteration.
       *static_cast<bool*>(aData) = true;
       return false;
     }
   }
   return true;
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -447,17 +447,17 @@ AsRefRawStrong(const RefPtr<RawServoDecl
   return reinterpret_cast<const RawServoDeclarationBlockStrong*>(&aDecl);
 }
 
 RawServoDeclarationBlockStrongBorrowedOrNull
 Gecko_GetHTMLPresentationAttrDeclarationBlock(RawGeckoElementBorrowed aElement)
 {
   const nsMappedAttributes* attrs = aElement->GetMappedAttributes();
   if (!attrs) {
-    auto* svg = nsSVGElement::FromContentOrNull(aElement);
+    auto* svg = nsSVGElement::FromNodeOrNull(aElement);
     if (svg) {
       if (auto decl = svg->GetContentDeclarationBlock()) {
         return decl->AsServo()->RefRawStrong();
       }
     }
     return nullptr;
   }
 
--- a/layout/xul/nsSplitterFrame.cpp
+++ b/layout/xul/nsSplitterFrame.cpp
@@ -424,17 +424,17 @@ nsSplitterFrameInner::MouseUp(nsPresCont
                                              true);
     }
 
     mPressed = false;
 
     // if we dragged then fire a command event.
     if (mDidDrag) {
       RefPtr<nsXULElement> element =
-        nsXULElement::FromContent(mOuter->GetContent());
+        nsXULElement::FromNode(mOuter->GetContent());
       element->DoCommand();
     }
 
     //printf("MouseUp\n");
   }
 
   mChildInfosBefore = nullptr;
   mChildInfosAfter = nullptr;
--- a/layout/xul/nsXULTooltipListener.cpp
+++ b/layout/xul/nsXULTooltipListener.cpp
@@ -455,17 +455,17 @@ nsXULTooltipListener::ShowTooltip()
 //       in the future."
 #ifdef DEBUG_crap
 static void
 GetTreeCellCoords(nsITreeBoxObject* aTreeBox, nsIContent* aSourceNode,
                   int32_t aRow, nsITreeColumn* aCol, int32_t* aX, int32_t* aY)
 {
   int32_t junk;
   aTreeBox->GetCoordsForCellItem(aRow, aCol, EmptyCString(), aX, aY, &junk, &junk);
-  RefPtr<nsXULElement> xulEl = nsXULElement::FromContent(aSourceNode);
+  RefPtr<nsXULElement> xulEl = nsXULElement::FromNode(aSourceNode);
   nsCOMPtr<nsIBoxObject> bx = xulEl->GetBoxObject(IgnoreErrors());
   int32_t myX, myY;
   bx->GetX(&myX);
   bx->GetY(&myY);
   *aX += myX;
   *aY += myY;
 }
 #endif
@@ -717,17 +717,17 @@ nsXULTooltipListener::sTooltipCallback(n
 nsresult
 nsXULTooltipListener::GetSourceTreeBoxObject(nsITreeBoxObject** aBoxObject)
 {
   *aBoxObject = nullptr;
 
   nsCOMPtr<nsIContent> sourceNode = do_QueryReferent(mSourceNode);
   if (mIsSourceTree && sourceNode) {
     RefPtr<nsXULElement> xulEl =
-      nsXULElement::FromContentOrNull(sourceNode->GetParent());
+      nsXULElement::FromNodeOrNull(sourceNode->GetParent());
     if (xulEl) {
       nsCOMPtr<nsIBoxObject> bx = xulEl->GetBoxObject(IgnoreErrors());
       nsCOMPtr<nsITreeBoxObject> obx(do_QueryInterface(bx));
       if (obx) {
         *aBoxObject = obx;
         NS_ADDREF(*aBoxObject);
         return NS_OK;
       }
--- a/layout/xul/tree/TreeBoxObject.cpp
+++ b/layout/xul/tree/TreeBoxObject.cpp
@@ -138,17 +138,17 @@ TreeBoxObject::GetView(nsITreeView * *aV
       return NS_OK;
     }
 
     if (mView)
       // Our new frame needs to initialise itself
       return mTreeBody->GetView(aView);
   }
   if (!mView) {
-    RefPtr<nsXULElement> xulele = nsXULElement::FromContentOrNull(mContent);
+    RefPtr<nsXULElement> xulele = nsXULElement::FromNodeOrNull(mContent);
     if (xulele) {
       // No tree builder, create a tree content view.
       nsresult rv = NS_NewTreeContentView(getter_AddRefs(mView));
       NS_ENSURE_SUCCESS(rv, rv);
 
       // Initialise the frame and view
       mTreeBody->SetView(mView);
     }
--- a/layout/xul/tree/nsTreeColFrame.cpp
+++ b/layout/xul/tree/nsTreeColFrame.cpp
@@ -165,17 +165,17 @@ nsITreeBoxObject*
 nsTreeColFrame::GetTreeBoxObject()
 {
   nsITreeBoxObject* result = nullptr;
 
   nsIContent* parent = mContent->GetParent();
   if (parent) {
     nsIContent* grandParent = parent->GetParent();
     RefPtr<nsXULElement> treeElement =
-      nsXULElement::FromContentOrNull(grandParent);
+      nsXULElement::FromNodeOrNull(grandParent);
     if (treeElement) {
       nsCOMPtr<nsIBoxObject> boxObject =
         treeElement->GetBoxObject(IgnoreErrors());
 
       nsCOMPtr<nsITreeBoxObject> treeBoxObject = do_QueryInterface(boxObject);
       result = treeBoxObject.get();
     }
   }
--- a/parser/html/nsHtml5TreeOperation.cpp
+++ b/parser/html/nsHtml5TreeOperation.cpp
@@ -626,23 +626,23 @@ nsHtml5TreeOperation::CreateMathMLElemen
   return newContent;
 }
 
 void
 nsHtml5TreeOperation::SetFormElement(nsIContent* aNode, nsIContent* aParent)
 {
   nsCOMPtr<nsIFormControl> formControl(do_QueryInterface(aNode));
   RefPtr<dom::HTMLImageElement> domImageElement =
-    dom::HTMLImageElement::FromContentOrNull(aNode);
+    dom::HTMLImageElement::FromNodeOrNull(aNode);
   // NS_ASSERTION(formControl, "Form-associated element did not implement
   // nsIFormControl.");
   // TODO: uncomment the above line when <keygen> (bug 101019) is supported by
   // Gecko
   RefPtr<dom::HTMLFormElement> formElement =
-    dom::HTMLFormElement::FromContentOrNull(aParent);
+    dom::HTMLFormElement::FromNodeOrNull(aParent);
   NS_ASSERTION(formElement,
                "The form element doesn't implement HTMLFormElement.");
   // avoid crashing on <keygen>
   if (formControl &&
       !aNode->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::form)) {
     formControl->SetForm(formElement);
   } else if (domImageElement) {
     domImageElement->SetForm(formElement);
--- a/toolkit/components/satchel/nsFormFillController.cpp
+++ b/toolkit/components/satchel/nsFormFillController.cpp
@@ -305,17 +305,17 @@ nsFormFillController::MarkAsLoginManager
   mPwmgrInputs.Put(node, true);
   node->AddMutationObserverUnlessExists(this);
 
   nsFocusManager *fm = nsFocusManager::GetFocusManager();
   if (fm) {
     nsCOMPtr<nsIContent> focusedContent = fm->GetFocusedContent();
     if (focusedContent == node) {
       if (!mFocusedInput) {
-        MaybeStartControllingInput(HTMLInputElement::FromContent(node));
+        MaybeStartControllingInput(HTMLInputElement::FromNode(node));
       }
     }
   }
 
   if (!mLoginManager) {
     mLoginManager = do_GetService("@mozilla.org/login-manager;1");
   }
 
@@ -344,17 +344,17 @@ nsFormFillController::MarkAsAutofillFiel
 
   nsCOMPtr<nsITextControlElement> txtCtrl = do_QueryInterface(aInput);
   txtCtrl->EnablePreview();
 
   nsFocusManager *fm = nsFocusManager::GetFocusManager();
   if (fm) {
     nsCOMPtr<nsIContent> focusedContent = fm->GetFocusedContent();
     if (focusedContent == node) {
-      MaybeStartControllingInput(HTMLInputElement::FromContent(node));
+      MaybeStartControllingInput(HTMLInputElement::FromNode(node));
     }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsFormFillController::GetFocusedInput(nsIDOMHTMLInputElement **aInput)
@@ -1027,17 +1027,17 @@ nsFormFillController::MaybeStartControll
 
 }
 
 nsresult
 nsFormFillController::Focus(nsIDOMEvent* aEvent)
 {
   nsCOMPtr<nsIContent> input = do_QueryInterface(
     aEvent->InternalDOMEvent()->GetTarget());
-  MaybeStartControllingInput(HTMLInputElement::FromContentOrNull(input));
+  MaybeStartControllingInput(HTMLInputElement::FromNodeOrNull(input));
 
   // Bail if we didn't start controlling the input.
   if (!mFocusedInput) {
     return NS_OK;
   }
 
 #ifndef ANDROID
   // If this focus doesn't follow a right click within our specified
--- a/widget/gtk/nsNativeThemeGTK.cpp
+++ b/widget/gtk/nsNativeThemeGTK.cpp
@@ -253,17 +253,17 @@ nsNativeThemeGTK::GetGtkWidgetAndState(u
                     aWidgetType == NS_THEME_CHECKBOX_LABEL) ? nsGkAtoms::checked
                                                             : nsGkAtoms::selected;
           }
           *aWidgetFlags = CheckBooleanAttr(aFrame, atom);
         }
       } else {
         if (aWidgetFlags) {
           *aWidgetFlags = 0;
-          HTMLInputElement* inputElt = HTMLInputElement::FromContent(aFrame->GetContent());
+          HTMLInputElement* inputElt = HTMLInputElement::FromNode(aFrame->GetContent());
           if (inputElt && inputElt->Checked())
             *aWidgetFlags |= MOZ_GTK_WIDGET_CHECKED;
 
           if (GetIndeterminate(aFrame))
             *aWidgetFlags |= MOZ_GTK_WIDGET_INCONSISTENT;
         }
       }
     } else if (aWidgetType == NS_THEME_TOOLBARBUTTON_DROPDOWN ||
--- a/widget/nsBaseDragService.cpp
+++ b/widget/nsBaseDragService.cpp
@@ -675,17 +675,17 @@ nsBaseDragService::DrawDrag(nsIDOMNode* 
     return NS_OK;
   }
 
   // if a custom image was specified, check if it is an image node and draw
   // using the source rather than the displayed image. But if mImage isn't
   // an image or canvas, fall through to RenderNode below.
   if (mImage) {
     nsCOMPtr<nsIContent> content = do_QueryInterface(dragNode);
-    HTMLCanvasElement *canvas = HTMLCanvasElement::FromContentOrNull(content);
+    HTMLCanvasElement *canvas = HTMLCanvasElement::FromNodeOrNull(content);
     if (canvas) {
       return DrawDragForImage(*aPresContext, nullptr, canvas, aScreenDragRect, aSurface);
     }
 
     nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(dragNode);
     // for image nodes, create the drag image from the actual image data
     if (imageLoader) {
       return DrawDragForImage(*aPresContext, imageLoader, nullptr, aScreenDragRect, aSurface);
--- a/widget/nsNativeTheme.cpp
+++ b/widget/nsNativeTheme.cpp
@@ -205,17 +205,17 @@ nsNativeTheme::GetCheckedOrSelected(nsIF
   nsIContent* content = aFrame->GetContent();
 
   if (content->IsXULElement()) {
     // For a XUL checkbox or radio button, the state of the parent determines
     // the checked state
     aFrame = aFrame->GetParent();
   } else {
     // Check for an HTML input element
-    HTMLInputElement* inputElt = HTMLInputElement::FromContent(content);
+    HTMLInputElement* inputElt = HTMLInputElement::FromNode(content);
     if (inputElt) {
       return inputElt->Checked();
     }
   }
 
   return CheckBooleanAttr(aFrame, aCheckSelected ? nsGkAtoms::selected
                                                  : nsGkAtoms::checked);
 }
@@ -255,17 +255,17 @@ nsNativeTheme::GetIndeterminate(nsIFrame
 
   if (content->IsXULElement()) {
     // For a XUL checkbox or radio button, the state of the parent determines
     // the state
     return CheckBooleanAttr(aFrame->GetParent(), nsGkAtoms::indeterminate);
   }
 
   // Check for an HTML input element
-  HTMLInputElement* inputElt = HTMLInputElement::FromContent(content);
+  HTMLInputElement* inputElt = HTMLInputElement::FromNode(content);
   if (inputElt) {
     return inputElt->Indeterminate();
   }
 
   return false;
 }
 
 bool
--- a/widget/windows/TaskbarPreview.cpp
+++ b/widget/windows/TaskbarPreview.cpp
@@ -343,17 +343,17 @@ TaskbarPreviewCallback::Done(nsISupports
   // be sure the tab is still alive before doing all this gfx work and making
   // dwm calls. To accomplish this we check the result of PreviewWindow().
   if (!aCanvas || !mPreview || !mPreview->PreviewWindow() ||
       !mPreview->IsWindowAvailable()) {
     return NS_ERROR_FAILURE;
   }
 
   nsCOMPtr<nsIContent> content(do_QueryInterface(aCanvas));
-  auto canvas = dom::HTMLCanvasElement::FromContentOrNull(content);
+  auto canvas = dom::HTMLCanvasElement::FromNodeOrNull(content);
   if (!canvas) {
     return NS_ERROR_FAILURE;
   }
 
   RefPtr<gfx::SourceSurface> source = canvas->GetSurfaceSnapshot();
   if (!source) {
     return NS_ERROR_FAILURE;
   }