Bug 1455676 part 8. Remove nsIDOMNode usage from layout/. r=qdot
authorBoris Zbarsky <bzbarsky@mit.edu>
Tue, 29 May 2018 22:58:48 -0400
changeset 477114 7e614633875401c627ef19e8e70ed3ccb97a7a80
parent 477113 4eb337cfade1b2e4247c08bc66aab488a9ccfe3d
child 477115 62ece2b265ab958e1550c306116aa1384c6d8c0d
push id1757
push userffxbld-merge
push dateFri, 24 Aug 2018 17:02:43 +0000
treeherdermozilla-release@736023aebdb1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersqdot
bugs1455676
milestone62.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 1455676 part 8. Remove nsIDOMNode usage from layout/. r=qdot
dom/base/nsISelectionController.idl
dom/html/nsTextEditorState.cpp
dom/xul/nsIXULSortService.idl
dom/xul/nsXULSortService.cpp
layout/base/PresShell.cpp
layout/base/PresShell.h
layout/base/nsCaret.cpp
layout/base/nsCaret.h
layout/base/nsIPresShell.h
layout/forms/nsColorControlFrame.cpp
layout/forms/nsComboboxControlFrame.cpp
layout/forms/nsListControlFrame.cpp
layout/generic/nsFrame.cpp
layout/generic/nsFrameSelection.cpp
layout/style/Loader.cpp
layout/style/ServoBindings.cpp
layout/tables/nsTableWrapperFrame.cpp
layout/xul/nsBox.cpp
layout/xul/nsMenuBarListener.cpp
layout/xul/tree/nsTreeContentView.cpp
layout/xul/tree/nsTreeContentView.h
--- a/dom/base/nsISelectionController.idl
+++ b/dom/base/nsISelectionController.idl
@@ -11,19 +11,19 @@ typedef short SelectionRegion;
 namespace mozilla {
 namespace dom {
 class Selection;
 } // namespace dom
 } // namespace mozilla
 %}
 
 interface nsIContent;
-interface nsIDOMNode;
 interface nsISelectionDisplay;
 
+webidl Node;
 webidl Selection;
 
 [scriptable, uuid(3801c9d4-8e69-4bfc-9edb-b58278621f8f)]
 interface nsISelectionController : nsISelectionDisplay
 {
    // RawSelectionType values:
    const short SELECTION_NONE                      = 0;
    const short SELECTION_NORMAL                    = 1;
@@ -280,17 +280,17 @@ interface nsISelectionController : nsISe
 
   /** CheckVisibility will return true if textnode and offsets are actually rendered
    *  in the current precontext.
    *  @param aNode textNode to test
    *  @param aStartOffset  offset in dom to first char of textnode to test
    *  @param aEndOffset    offset in dom to last char of textnode to test
    *  @param aReturnBool   boolean returned TRUE if visible FALSE if not
    */
-    boolean checkVisibility(in nsIDOMNode node, in short startOffset, in short endOffset);
+    boolean checkVisibility(in Node node, in short startOffset, in short endOffset);
     [noscript,nostdcall] boolean checkVisibilityContent(in nsIContent node, in short startOffset, in short endOffset);
 };
 %{ C++
    #define NS_ISELECTIONCONTROLLER_CID \
    { 0x513b9460, 0xd56a, 0x4c4e, \
    { 0xb6, 0xf9, 0x0b, 0x8a, 0xe4, 0x37, 0x2a, 0x3b }}
 
 namespace mozilla {
--- a/dom/html/nsTextEditorState.cpp
+++ b/dom/html/nsTextEditorState.cpp
@@ -320,17 +320,17 @@ public:
   NS_IMETHOD IntraLineMove(bool aForward, bool aExtend) override;
   NS_IMETHOD PageMove(bool aForward, bool aExtend) override;
   NS_IMETHOD CompleteScroll(bool aForward) override;
   NS_IMETHOD CompleteMove(bool aForward, bool aExtend) override;
   NS_IMETHOD ScrollPage(bool aForward) override;
   NS_IMETHOD ScrollLine(bool aForward) override;
   NS_IMETHOD ScrollCharacter(bool aRight) override;
   NS_IMETHOD SelectAll(void) override;
-  NS_IMETHOD CheckVisibility(nsIDOMNode *node, int16_t startOffset, int16_t EndOffset, bool* _retval) override;
+  NS_IMETHOD CheckVisibility(nsINode *node, int16_t startOffset, int16_t EndOffset, bool* _retval) override;
   virtual nsresult CheckVisibilityContent(nsIContent* aNode, int16_t aStartOffset, int16_t aEndOffset, bool* aRetval) override;
 
 private:
   RefPtr<nsFrameSelection> mFrameSelection;
   nsCOMPtr<nsIContent>       mLimiter;
   nsIScrollableFrame        *mScrollFrame;
   nsWeakPtr mPresShellWeak;
 };
@@ -761,17 +761,17 @@ nsTextInputSelectionImpl::SelectAll()
   if (mFrameSelection) {
     RefPtr<nsFrameSelection> frameSelection = mFrameSelection;
     return frameSelection->SelectAll();
   }
   return NS_ERROR_NULL_POINTER;
 }
 
 NS_IMETHODIMP
-nsTextInputSelectionImpl::CheckVisibility(nsIDOMNode *node, int16_t startOffset, int16_t EndOffset, bool *_retval)
+nsTextInputSelectionImpl::CheckVisibility(nsINode *node, int16_t startOffset, int16_t EndOffset, bool *_retval)
 {
   if (!mPresShellWeak) return NS_ERROR_NOT_INITIALIZED;
   nsresult result;
   nsCOMPtr<nsISelectionController> shell = do_QueryReferent(mPresShellWeak, &result);
   if (shell)
   {
     return shell->CheckVisibility(node,startOffset,EndOffset, _retval);
   }
--- a/dom/xul/nsIXULSortService.idl
+++ b/dom/xul/nsIXULSortService.idl
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsISupports.idl"
 
-interface nsIDOMNode;
+webidl Element;
 
 /**
  * A service used to sort the contents of a XUL widget.
  */
 [scriptable, uuid(F29270C8-3BE5-4046-9B57-945A84DFF132)]
 interface nsIXULSortService : nsISupports
 {
     const unsigned long SORT_COMPARECASE = 0x0001;
@@ -26,17 +26,17 @@ interface nsIXULSortService : nsISupport
      * @param aSortHints One or more hints as to how to sort:
      *
      *   ascending: to sort the contents in ascending order
      *   descending: to sort the contents in descending order
      *   comparecase: perform case sensitive comparisons
      *   integer: treat values as integers, non-integers are compared as strings
      *   twostate: don't allow the natural (unordered state)
      */
-    void sort(in nsIDOMNode aNode,
+    void sort(in Element aNode,
               in AString aSortKey,
               in AString aSortHints);
 };
 
 %{C++
 nsresult
 NS_NewXULSortService(nsIXULSortService **result);
 %}
--- a/dom/xul/nsXULSortService.cpp
+++ b/dom/xul/nsXULSortService.cpp
@@ -4,17 +4,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
   This file provides the implementation for the sort service manager.
  */
 
 #include "nsCOMPtr.h"
 #include "nsIContent.h"
-#include "nsIDOMNode.h"
 #include "nsIServiceManager.h"
 #include "nsGkAtoms.h"
 #include "nsNameSpaceManager.h"
 #include "nsXULContentUtils.h"
 #include "nsString.h"
 #include "nsQuickSort.h"
 #include "nsWhitespaceTokenizer.h"
 #include "nsXULSortService.h"
@@ -334,33 +333,28 @@ XULSortServiceImpl::CompareValues(const 
                              aLeft, aRight, &result);
     return result;
   }
 
   return ::Compare(aLeft, aRight, nsCaseInsensitiveStringComparator());
 }
 
 NS_IMETHODIMP
-XULSortServiceImpl::Sort(nsIDOMNode* aNode,
+XULSortServiceImpl::Sort(Element* aNode,
                          const nsAString& aSortKey,
                          const nsAString& aSortHints)
 {
-  // get root content node
-  nsCOMPtr<Element> sortNode = do_QueryInterface(aNode);
-  if (!sortNode)
-    return NS_ERROR_FAILURE;
-
   nsSortState sortState;
-  nsresult rv = InitializeSortState(sortNode, sortNode,
+  nsresult rv = InitializeSortState(aNode, aNode,
                                     aSortKey, aSortHints, &sortState);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // store sort info in attributes on content
-  SetSortHints(sortNode, &sortState);
-  rv = SortContainer(sortNode, &sortState);
+  SetSortHints(aNode, &sortState);
+  rv = SortContainer(aNode, &sortState);
 
   return rv;
 }
 
 nsresult
 NS_NewXULSortService(nsIXULSortService** sortService)
 {
   *sortService = new XULSortServiceImpl();
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -54,17 +54,16 @@
 #include "nsView.h"
 #include "nsCRTGlue.h"
 #include "prinrval.h"
 #include "nsTArray.h"
 #include "nsCOMArray.h"
 #include "nsContainerFrame.h"
 #include "mozilla/dom/Selection.h"
 #include "nsGkAtoms.h"
-#include "nsIDOMNode.h"
 #include "nsRange.h"
 #include "nsWindowSizes.h"
 #include "nsCOMPtr.h"
 #include "nsAutoPtr.h"
 #include "nsReadableUtils.h"
 #include "nsIPageSequenceFrame.h"
 #include "nsIPermissionManager.h"
 #include "nsIMozBrowserFrame.h"
@@ -2448,17 +2447,17 @@ DoCheckVisibility(nsPresContext* aPresCo
   // chars after that to see if anything until EndOffset is visible.
   bool finished = false;
   frame->CheckVisibility(aPresContext, aStartOffset, aEndOffset, true,
                          &finished, aRetval);
   // Don't worry about other return value.
 }
 
 NS_IMETHODIMP
-PresShell::CheckVisibility(nsIDOMNode *node, int16_t startOffset, int16_t EndOffset, bool *_retval)
+PresShell::CheckVisibility(nsINode *node, int16_t startOffset, int16_t EndOffset, bool *_retval)
 {
   if (!node || startOffset>EndOffset || !_retval || startOffset<0 || EndOffset<0)
     return NS_ERROR_INVALID_ARG;
   *_retval = false; //initialize return parameter
   nsCOMPtr<nsIContent> content(do_QueryInterface(node));
   if (!content)
     return NS_ERROR_FAILURE;
 
--- a/layout/base/PresShell.h
+++ b/layout/base/PresShell.h
@@ -273,17 +273,17 @@ public:
   NS_IMETHOD IntraLineMove(bool aForward, bool aExtend) override;
   NS_IMETHOD PageMove(bool aForward, bool aExtend) override;
   NS_IMETHOD ScrollPage(bool aForward) override;
   NS_IMETHOD ScrollLine(bool aForward) override;
   NS_IMETHOD ScrollCharacter(bool aRight) override;
   NS_IMETHOD CompleteScroll(bool aForward) override;
   NS_IMETHOD CompleteMove(bool aForward, bool aExtend) override;
   NS_IMETHOD SelectAll() override;
-  NS_IMETHOD CheckVisibility(nsIDOMNode *node, int16_t startOffset, int16_t EndOffset, bool *_retval) override;
+  NS_IMETHOD CheckVisibility(nsINode *node, int16_t startOffset, int16_t EndOffset, bool *_retval) override;
   nsresult CheckVisibilityContent(nsIContent* aNode, int16_t aStartOffset,
                                   int16_t aEndOffset, bool* aRetval) override;
 
   // nsIDocumentObserver
   NS_DECL_NSIDOCUMENTOBSERVER_BEGINLOAD
   NS_DECL_NSIDOCUMENTOBSERVER_ENDLOAD
   NS_DECL_NSIDOCUMENTOBSERVER_CONTENTSTATECHANGED
   NS_DECL_NSIDOCUMENTOBSERVER_DOCUMENTSTATESCHANGED
--- a/layout/base/nsCaret.cpp
+++ b/layout/base/nsCaret.cpp
@@ -13,17 +13,16 @@
 #include "gfxUtils.h"
 #include "mozilla/gfx/2D.h"
 #include "nsCOMPtr.h"
 #include "nsFontMetrics.h"
 #include "nsITimer.h"
 #include "nsFrameSelection.h"
 #include "nsIFrame.h"
 #include "nsIScrollableFrame.h"
-#include "nsIDOMNode.h"
 #include "nsIContent.h"
 #include "nsIPresShell.h"
 #include "nsLayoutUtils.h"
 #include "nsPresContext.h"
 #include "nsBlockFrame.h"
 #include "nsISelectionController.h"
 #include "nsTextFrame.h"
 #include "nsXULPopupManager.h"
@@ -466,23 +465,16 @@ nsCaret::SetCaretPosition(nsINode* aNode
   mOverrideContent = aNode;
   mOverrideOffset = aOffset;
 
   ResetBlinking();
   SchedulePaint();
 }
 
 void
-nsCaret::SetCaretPosition(nsIDOMNode* aNode, int32_t aOffset)
-{
-  nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
-  SetCaretPosition(node, aOffset);
-}
-
-void
 nsCaret::CheckSelectionLanguageChange()
 {
   if (!IsBidiUI()) {
     return;
   }
 
   bool isKeyboardRTL = false;
   nsIBidiKeyboard* bidiKeyboard = nsContentUtils::GetBidiKeyboard();
@@ -857,17 +849,16 @@ bool nsCaret::IsMenuPopupHidingCaret()
   nsTArray<nsIFrame*> popups;
   popMgr->GetVisiblePopups(popups);
 
   if (popups.Length() == 0)
     return false; // No popups, so caret can't be hidden by them.
 
   // Get the selection focus content, that's where the caret would
   // go if it was drawn.
-  nsCOMPtr<nsIDOMNode> node;
   if (!mDomSelectionWeak) {
     return true; // No selection/caret to draw.
   }
   nsCOMPtr<nsIContent> caretContent =
     nsIContent::FromNodeOrNull(mDomSelectionWeak->GetFocusNode());
   if (!caretContent)
     return true; // No selection/caret to draw.
 
--- a/layout/base/nsCaret.h
+++ b/layout/base/nsCaret.h
@@ -16,17 +16,16 @@
 #include "nsIWeakReferenceUtils.h"
 #include "CaretAssociationHint.h"
 #include "nsPoint.h"
 #include "nsRect.h"
 
 class nsDisplayListBuilder;
 class nsFrameSelection;
 class nsIContent;
-class nsIDOMNode;
 class nsIFrame;
 class nsINode;
 class nsIPresShell;
 class nsITimer;
 
 namespace mozilla {
 namespace gfx {
 class DrawTarget;
@@ -126,17 +125,16 @@ class nsCaret final : public nsISelectio
     void SetVisibilityDuringSelection(bool aVisibility);
 
     /**
      * Set the caret's position explicitly to the specified node and offset
      * instead of tracking its selection.
      * Passing null for aNode would set the caret to track its selection again.
      **/
     void SetCaretPosition(nsINode* aNode, int32_t aOffset);
-    void SetCaretPosition(nsIDOMNode* aNode, int32_t aOffset);
 
     /**
      * Schedule a repaint for the frame where the caret would appear.
      * Does not check visibility etc.
      */
     void SchedulePaint(mozilla::dom::Selection* aSelection = nullptr);
 
     /**
--- a/layout/base/nsIPresShell.h
+++ b/layout/base/nsIPresShell.h
@@ -58,17 +58,16 @@ class nsCaret;
 namespace mozilla {
 class AccessibleCaretEventHub;
 class StyleSheet;
 } // namespace mozilla
 class nsFrameSelection;
 class nsFrameManager;
 class nsILayoutHistoryState;
 class nsIReflowCallback;
-class nsIDOMNode;
 class nsCSSFrameConstructor;
 template<class E> class nsCOMArray;
 class AutoWeakFrame;
 class WeakFrame;
 class nsIScrollableFrame;
 class nsDisplayList;
 class nsDisplayListBuilder;
 class nsPIDOMWindowOuter;
--- a/layout/forms/nsColorControlFrame.cpp
+++ b/layout/forms/nsColorControlFrame.cpp
@@ -6,17 +6,16 @@
 
 #include "nsColorControlFrame.h"
 
 #include "nsContentCreatorFunctions.h"
 #include "nsContentUtils.h"
 #include "nsCSSPseudoElements.h"
 #include "nsCheckboxRadioFrame.h"
 #include "nsGkAtoms.h"
-#include "nsIDOMNode.h"
 #include "nsIFormControl.h"
 #include "mozilla/dom/HTMLInputElement.h"
 #include "nsIDocument.h"
 
 using mozilla::dom::Element;
 using mozilla::dom::HTMLInputElement;
 using mozilla::dom::CallerType;
 
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -21,17 +21,16 @@
 #include "nsIListControlFrame.h"
 #include "nsPIDOMWindow.h"
 #include "nsIPresShell.h"
 #include "mozilla/PresState.h"
 #include "nsView.h"
 #include "nsViewManager.h"
 #include "nsIContentInlines.h"
 #include "nsIDOMEventListener.h"
-#include "nsIDOMNode.h"
 #include "nsISelectControlFrame.h"
 #include "nsContentUtils.h"
 #include "mozilla/dom/Event.h"
 #include "mozilla/dom/HTMLSelectElement.h"
 #include "nsIDocument.h"
 #include "nsIScrollableFrame.h"
 #include "nsListControlFrame.h"
 #include "mozilla/ServoStyleSet.h"
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -1169,24 +1169,20 @@ nsListControlFrame::GetNumberOfOptions()
   return options->Length();
 }
 
 //----------------------------------------------------------------------
 // nsISelectControlFrame
 //----------------------------------------------------------------------
 bool nsListControlFrame::CheckIfAllFramesHere()
 {
-  // Get the number of optgroups and options
-  //int32_t numContentItems = 0;
-  nsCOMPtr<nsIDOMNode> node(do_QueryInterface(mContent));
-  if (node) {
-    // XXX Need to find a fail proff way to determine that
-    // all the frames are there
-    mIsAllFramesHere = true;//NS_OK == CountAllChild(node, numContentItems);
-  }
+  // XXX Need to find a fail proof way to determine that
+  // all the frames are there
+  mIsAllFramesHere = true;
+
   // now make sure we have a frame each piece of content
 
   return mIsAllFramesHere;
 }
 
 NS_IMETHODIMP
 nsListControlFrame::DoneAddingChildren(bool aIsDone)
 {
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -45,17 +45,16 @@
 #include "nsStyleConsts.h"
 #include "nsIPresShell.h"
 #include "mozilla/Logging.h"
 #include "mozilla/Sprintf.h"
 #include "nsLayoutUtils.h"
 #include "LayoutLogging.h"
 #include "mozilla/RestyleManager.h"
 #include "nsInlineFrame.h"
-#include "nsIDOMNode.h"
 #include "nsFrameSelection.h"
 #include "nsGkAtoms.h"
 #include "nsCSSAnonBoxes.h"
 #include "nsCSSClipPathInstance.h"
 
 #include "nsFrameTraversal.h"
 #include "nsRange.h"
 #include "nsITextControlFrame.h"
--- a/layout/generic/nsFrameSelection.cpp
+++ b/layout/generic/nsFrameSelection.cpp
@@ -17,17 +17,16 @@
 #include "mozilla/PresShell.h"
 
 #include "nsCOMPtr.h"
 #include "nsString.h"
 #include "nsISelectionListener.h"
 #include "nsContentCID.h"
 #include "nsDeviceContext.h"
 #include "nsIContent.h"
-#include "nsIDOMNode.h"
 #include "nsRange.h"
 #include "nsITableCellLayout.h"
 #include "nsTArray.h"
 #include "nsTableWrapperFrame.h"
 #include "nsTableCellFrame.h"
 #include "nsIScrollableFrame.h"
 #include "nsCCUncollectableMarker.h"
 #include "nsIContentIterator.h"
--- a/layout/style/Loader.cpp
+++ b/layout/style/Loader.cpp
@@ -20,17 +20,16 @@
 #include "mozilla/ResultExtensions.h"
 #include "mozilla/URLPreloader.h"
 #include "nsIRunnable.h"
 #include "nsSyncLoadService.h"
 #include "nsCOMPtr.h"
 #include "nsString.h"
 #include "nsIContent.h"
 #include "nsIDocument.h"
-#include "nsIDOMNode.h"
 #include "nsIURI.h"
 #include "nsNetUtil.h"
 #include "nsIProtocolHandler.h"
 #include "nsContentUtils.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsContentPolicyUtils.h"
 #include "nsIHttpChannel.h"
 #include "nsIHttpChannelInternal.h"
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -16,17 +16,16 @@
 #include "nsCSSFrameConstructor.h"
 #include "nsCSSProps.h"
 #include "nsCSSPseudoElements.h"
 #include "nsContentUtils.h"
 #include "nsDOMTokenList.h"
 #include "nsDeviceContext.h"
 #include "nsIContentInlines.h"
 #include "nsICrashReporter.h"
-#include "nsIDOMNode.h"
 #include "nsIDocumentInlines.h"
 #include "nsILoadContext.h"
 #include "nsIFrame.h"
 #include "nsIMemoryReporter.h"
 #include "nsIMozBrowserFrame.h"
 #include "nsINode.h"
 #include "nsIPresShell.h"
 #include "nsIPresShellInlines.h"
--- a/layout/tables/nsTableWrapperFrame.cpp
+++ b/layout/tables/nsTableWrapperFrame.cpp
@@ -13,17 +13,16 @@
 #include "nsPresContext.h"
 #include "nsCSSRendering.h"
 #include "nsIContent.h"
 #include "prinrval.h"
 #include "nsGkAtoms.h"
 #include "nsHTMLParts.h"
 #include "nsIPresShell.h"
 #include "nsIServiceManager.h"
-#include "nsIDOMNode.h"
 #include "nsDisplayList.h"
 #include "nsLayoutUtils.h"
 #include "nsIFrameInlines.h"
 #include <algorithm>
 
 using namespace mozilla;
 using namespace mozilla::layout;
 
--- a/layout/xul/nsBox.cpp
+++ b/layout/xul/nsBox.cpp
@@ -9,17 +9,16 @@
 #include "nsBoxFrame.h"
 #include "nsDOMAttributeMap.h"
 #include "nsPresContext.h"
 #include "nsCOMPtr.h"
 #include "nsIContent.h"
 #include "nsContainerFrame.h"
 #include "nsNameSpaceManager.h"
 #include "nsGkAtoms.h"
-#include "nsIDOMNode.h"
 #include "nsITheme.h"
 #include "nsIServiceManager.h"
 #include "nsBoxLayout.h"
 #include "FrameLayerBuilder.h"
 #include "mozilla/dom/Attr.h"
 #include "mozilla/dom/Element.h"
 #include <algorithm>
 
--- a/layout/xul/nsMenuBarListener.cpp
+++ b/layout/xul/nsMenuBarListener.cpp
@@ -9,17 +9,16 @@
 #include "nsMenuPopupFrame.h"
 #include "nsPIWindowRoot.h"
 
 // Drag & Drop, Clipboard
 #include "nsIServiceManager.h"
 #include "nsWidgetsCID.h"
 #include "nsCOMPtr.h"
 #include "nsIContent.h"
-#include "nsIDOMNode.h"
 
 #include "nsContentUtils.h"
 #include "mozilla/BasicEvents.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/TextEvents.h"
 #include "mozilla/dom/Event.h"
 #include "mozilla/dom/EventBinding.h"
 #include "mozilla/dom/KeyboardEvent.h"
--- a/layout/xul/tree/nsTreeContentView.cpp
+++ b/layout/xul/tree/nsTreeContentView.cpp
@@ -680,18 +680,17 @@ nsTreeContentView::CycleHeader(nsTreeCol
           default: sortdirection.AssignLiteral("ascending"); break;
         }
 
         nsAutoString hints;
         column->GetAttr(kNameSpaceID_None, nsGkAtoms::sorthints, hints);
         sortdirection.Append(' ');
         sortdirection += hints;
 
-        nsCOMPtr<nsIDOMNode> rootnode = do_QueryInterface(mRoot);
-        xs->Sort(rootnode, sort, sortdirection);
+        xs->Sort(mRoot, sort, sortdirection);
       }
     }
   }
 }
 
 NS_IMETHODIMP
 nsTreeContentView::CycleHeader(nsITreeColumn* aCol)
 {
--- a/layout/xul/tree/nsTreeContentView.h
+++ b/layout/xul/tree/nsTreeContentView.h
@@ -20,27 +20,29 @@
 class nsIDocument;
 class nsSelection;
 class nsTreeColumn;
 class Row;
 
 namespace mozilla {
 namespace dom {
 class DataTransfer;
+class Element;
 class TreeBoxObject;
 } // namespace dom
 } // namespace mozilla
 
 nsresult NS_NewTreeContentView(nsITreeView** aResult);
 
 class nsTreeContentView final : public nsITreeView,
                                 public nsITreeContentView,
                                 public nsStubDocumentObserver,
                                 public nsWrapperCache
 {
+  typedef mozilla::dom::Element Element;
   public:
     nsTreeContentView(void);
 
     NS_DECL_CYCLE_COLLECTING_ISUPPORTS
     NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsTreeContentView,
                                                            nsITreeView)
 
     virtual JSObject* WrapObject(JSContext* aCx,
@@ -107,19 +109,18 @@ class nsTreeContentView final : public n
     }
     void PerformActionOnRow(const nsAString& aAction, int32_t aRow)
     {
     }
     void PerformActionOnCell(const nsAString& aAction, int32_t aRow,
                              nsTreeColumn& aColumn)
     {
     }
-    mozilla::dom::Element* GetItemAtIndex(int32_t aRow,
-                                          mozilla::ErrorResult& aError);
-    int32_t GetIndexOfItem(mozilla::dom::Element* aItem);
+    Element* GetItemAtIndex(int32_t aRow, mozilla::ErrorResult& aError);
+    int32_t GetIndexOfItem(Element* aItem);
 
     NS_DECL_NSITREEVIEW
 
     NS_DECL_NSITREECONTENTVIEW
 
     // nsIDocumentObserver
     NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
     NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
@@ -167,22 +168,22 @@ class nsTreeContentView final : public n
 
     void UpdateParentIndexes(int32_t aIndex, int32_t aSkip, int32_t aCount);
 
     bool CanDrop(int32_t aRow, int32_t aOrientation,
                  mozilla::ErrorResult& aError);
     void Drop(int32_t aRow, int32_t aOrientation, mozilla::ErrorResult& aError);
 
     // Content helpers.
-    mozilla::dom::Element* GetCell(nsIContent* aContainer, nsTreeColumn& aCol);
+    Element* GetCell(nsIContent* aContainer, nsTreeColumn& aCol);
 
   private:
     bool IsValidRowIndex(int32_t aRowIndex);
 
     nsCOMPtr<nsITreeBoxObject>          mBoxObject;
     nsCOMPtr<nsITreeSelection>          mSelection;
-    nsCOMPtr<nsIContent>                mRoot;
+    nsCOMPtr<Element>                   mRoot;
     nsCOMPtr<nsIContent>                mBody;
     nsIDocument*                        mDocument;      // WEAK
     nsTArray<mozilla::UniquePtr<Row>>   mRows;
 };
 
 #endif // nsTreeContentView_h__