Bug 1482389, remove methods of XULTreeElement that return unused nsresults. In addition, change GetView to return the nsITreeView instead of using an out-parameter, r=paolo
☠☠ backed out by 9663d8100bdb ☠ ☠
authorNeil Deakin <neil@mozilla.com>
Tue, 04 Dec 2018 11:25:41 -0500
changeset 453075 c1cfc595892fe24cccb8989a850e6556be6a778f
parent 453074 bd20e420f257ee6f7a983e67f2fce72b6a3310f3
child 453076 72da18aff712e3bb7db72d638f26fa9177dcce00
push id35345
push usershindli@mozilla.com
push dateWed, 09 Jan 2019 21:42:48 +0000
treeherdermozilla-central@8e746f670f43 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspaolo
bugs1482389
milestone66.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 1482389, remove methods of XULTreeElement that return unused nsresults. In addition, change GetView to return the nsITreeView instead of using an out-parameter, r=paolo
accessible/base/nsCoreUtils.cpp
accessible/xul/XULTreeAccessible.cpp
accessible/xul/XULTreeGridAccessible.cpp
dom/xul/XULTreeElement.cpp
dom/xul/XULTreeElement.h
layout/base/PresShell.cpp
layout/xul/nsXULTooltipListener.cpp
layout/xul/tree/nsTreeBodyFrame.cpp
layout/xul/tree/nsTreeColFrame.cpp
layout/xul/tree/nsTreeContentView.cpp
layout/xul/tree/nsTreeSelection.cpp
--- a/accessible/base/nsCoreUtils.cpp
+++ b/accessible/base/nsCoreUtils.cpp
@@ -61,34 +61,35 @@ bool nsCoreUtils::HasClickListener(nsICo
          (listenerManager->HasListenersFor(nsGkAtoms::onclick) ||
           listenerManager->HasListenersFor(nsGkAtoms::onmousedown) ||
           listenerManager->HasListenersFor(nsGkAtoms::onmouseup));
 }
 
 void nsCoreUtils::DispatchClickEvent(XULTreeElement *aTree,
                                      int32_t aRowIndex, nsTreeColumn *aColumn,
                                      const nsAString &aPseudoElt) {
-  RefPtr<dom::Element> tcElm;
-  aTree->GetTreeBody(getter_AddRefs(tcElm));
+  RefPtr<dom::Element> tcElm = aTree->GetTreeBody();
   if (!tcElm) return;
 
   Document *document = tcElm->GetUncomposedDoc();
   if (!document) return;
 
   nsCOMPtr<nsIPresShell> presShell = document->GetShell();
   if (!presShell) return;
 
   // Ensure row is visible.
   aTree->EnsureRowIsVisible(aRowIndex);
 
   // Calculate x and y coordinates.
-  int32_t x = 0, y = 0, width = 0, height = 0;
-  nsresult rv = aTree->GetCoordsForCellItem(aRowIndex, aColumn, aPseudoElt, &x,
-                                            &y, &width, &height);
-  if (NS_FAILED(rv)) return;
+  nsresult rv;
+  nsIntRect rect =
+      aTree->GetCoordsForCellItem(aRowIndex, aColumn, aPseudoElt, rv);
+  if (NS_FAILED(rv)) {
+    return;
+  }
 
   nsCOMPtr<nsIBoxObject> tcBoxObj =
       nsXULElement::FromNode(tcElm)->GetBoxObject(IgnoreErrors());
 
   int32_t tcX = 0;
   tcBoxObj->GetX(&tcX);
 
   int32_t tcY = 0;
@@ -98,19 +99,19 @@ void nsCoreUtils::DispatchClickEvent(XUL
   AutoWeakFrame tcFrame = tcElm->GetPrimaryFrame();
   nsIFrame *rootFrame = presShell->GetRootFrame();
 
   nsPoint offset;
   nsIWidget *rootWidget = rootFrame->GetView()->GetNearestWidget(&offset);
 
   RefPtr<nsPresContext> presContext = presShell->GetPresContext();
 
-  int32_t cnvdX = presContext->CSSPixelsToDevPixels(tcX + x + 1) +
+  int32_t cnvdX = presContext->CSSPixelsToDevPixels(tcX + int32_t(rect.x) + 1) +
                   presContext->AppUnitsToDevPixels(offset.x);
-  int32_t cnvdY = presContext->CSSPixelsToDevPixels(tcY + y + 1) +
+  int32_t cnvdY = presContext->CSSPixelsToDevPixels(tcY + int32_t(rect.y) + 1) +
                   presContext->AppUnitsToDevPixels(offset.y);
 
   // XUL is just desktop, so there is no real reason for senfing touch events.
   DispatchMouseEvent(eMouseDown, cnvdX, cnvdY, tcElm, tcFrame, presShell,
                      rootWidget);
 
   DispatchMouseEvent(eMouseUp, cnvdX, cnvdY, tcElm, tcFrame, presShell,
                      rootWidget);
@@ -421,18 +422,17 @@ void nsCoreUtils::GetLanguageFor(nsICont
          (!walkUp->IsElement() ||
           !walkUp->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::lang,
                                         aLanguage)))
     walkUp = walkUp->GetParent();
 }
 
 already_AddRefed<nsIBoxObject> nsCoreUtils::GetTreeBodyBoxObject(
     XULTreeElement *aTree) {
-  RefPtr<dom::Element> tcElm;
-  aTree->GetTreeBody(getter_AddRefs(tcElm));
+  RefPtr<dom::Element> tcElm = aTree->GetTreeBody();
   RefPtr<nsXULElement> tcXULElm = nsXULElement::FromNodeOrNull(tcElm);
   if (!tcXULElm) return nullptr;
 
   return tcXULElm->GetBoxObject(IgnoreErrors());
 }
 
 XULTreeElement *nsCoreUtils::GetTree(nsIContent *aContent) {
   // Find DOMNode's parents recursively until reach the <tree> tag
@@ -444,31 +444,29 @@ XULTreeElement *nsCoreUtils::GetTree(nsI
     currentContent = currentContent->GetFlattenedTreeParent();
   }
 
   return nullptr;
 }
 
 already_AddRefed<nsTreeColumn> nsCoreUtils::GetFirstSensibleColumn(
     XULTreeElement *aTree) {
-  RefPtr<nsTreeColumns> cols;
-  aTree->GetColumns(getter_AddRefs(cols));
+  RefPtr<nsTreeColumns> cols = aTree->GetColumns();
   if (!cols) return nullptr;
 
   RefPtr<nsTreeColumn> column = cols->GetFirstColumn();
   if (column && IsColumnHidden(column)) return GetNextSensibleColumn(column);
 
   return column.forget();
 }
 
 uint32_t nsCoreUtils::GetSensibleColumnCount(XULTreeElement *aTree) {
   uint32_t count = 0;
 
-  RefPtr<nsTreeColumns> cols;
-  aTree->GetColumns(getter_AddRefs(cols));
+  RefPtr<nsTreeColumns> cols = aTree->GetColumns();
   if (!cols) return count;
 
   nsTreeColumn *column = cols->GetFirstColumn();
 
   while (column) {
     if (!IsColumnHidden(column)) count++;
 
     column = column->GetNext();
--- a/accessible/xul/XULTreeAccessible.cpp
+++ b/accessible/xul/XULTreeAccessible.cpp
@@ -26,16 +26,17 @@
 #include "nsIBoxObject.h"
 #include "nsIDOMXULMenuListElement.h"
 #include "nsIDOMXULMultSelectCntrlEl.h"
 #include "nsITreeSelection.h"
 #include "nsIMutableArray.h"
 #include "nsTreeBodyFrame.h"
 #include "nsTreeColumns.h"
 #include "nsTreeUtils.h"
+#include "mozilla/dom/XULTreeElementBinding.h"
 
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 XULTreeAccessible::XULTreeAccessible(nsIContent* aContent, DocAccessible* aDoc,
@@ -108,18 +109,17 @@ void XULTreeAccessible::Value(nsString& 
   mTreeView->GetSelection(getter_AddRefs(selection));
   if (!selection) return;
 
   int32_t currentIndex;
   selection->GetCurrentIndex(&currentIndex);
   if (currentIndex >= 0) {
     RefPtr<nsTreeColumn> keyCol;
 
-    RefPtr<nsTreeColumns> cols;
-    mTree->GetColumns(getter_AddRefs(cols));
+    RefPtr<nsTreeColumns> cols = mTree->GetColumns();
     if (cols) keyCol = cols->GetKeyColumn();
 
     mTreeView->GetCellText(currentIndex, keyCol, aValue);
   }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeAccessible: Accessible implementation
@@ -166,33 +166,31 @@ Accessible* XULTreeAccessible::ChildAtPo
   nsIFrame* rootFrame = presShell->GetRootFrame();
   NS_ENSURE_TRUE(rootFrame, nullptr);
 
   CSSIntRect rootRect = rootFrame->GetScreenRect();
 
   int32_t clientX = presContext->DevPixelsToIntCSSPixels(aX) - rootRect.X();
   int32_t clientY = presContext->DevPixelsToIntCSSPixels(aY) - rootRect.Y();
 
-  int32_t row = -1;
-  RefPtr<nsTreeColumn> column;
-  nsAutoString childEltUnused;
-  mTree->GetCellAt(clientX, clientY, &row, getter_AddRefs(column),
-                   childEltUnused);
+  ErrorResult rv;
+  dom::TreeCellInfo cellInfo;
+  mTree->GetCellAt(clientX, clientY, cellInfo, rv);
 
   // If we failed to find tree cell for the given point then it might be
   // tree columns.
-  if (row == -1 || !column)
+  if (cellInfo.mRow == -1 || !cellInfo.mCol)
     return AccessibleWrap::ChildAtPoint(aX, aY, aWhichChild);
 
-  Accessible* child = GetTreeItemAccessible(row);
+  Accessible* child = GetTreeItemAccessible(cellInfo.mRow);
   if (aWhichChild == eDeepestChild && child) {
     // Look for accessible cell for the found item accessible.
     RefPtr<XULTreeItemAccessibleBase> treeitem = do_QueryObject(child);
 
-    Accessible* cell = treeitem->GetCellAccessible(column);
+    Accessible* cell = treeitem->GetCellAccessible(cellInfo.mCol);
     if (cell) child = cell;
   }
 
   return child;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeAccessible: SelectAccessible
@@ -519,18 +517,17 @@ void XULTreeAccessible::TreeViewInvalida
   if (endRow == -1) {
     int32_t rowCount = 0;
     rv = mTreeView->GetRowCount(&rowCount);
     if (NS_FAILED(rv)) return;
 
     endRow = rowCount - 1;
   }
 
-  RefPtr<nsTreeColumns> treeColumns;
-  mTree->GetColumns(getter_AddRefs(treeColumns));
+  RefPtr<nsTreeColumns> treeColumns = mTree->GetColumns();
   if (!treeColumns) return;
 
   int32_t endCol = aEndCol;
 
   if (endCol == -1) {
     // We need to make sure to cast to int32_t before we do the subtraction, in
     // case the column count is 0.
     endCol = static_cast<int32_t>(treeColumns->Count()) - 1;
@@ -620,33 +617,29 @@ nsIntRect XULTreeItemAccessibleBase::Bou
 
   nsCOMPtr<nsIBoxObject> boxObj = nsCoreUtils::GetTreeBodyBoxObject(mTree);
   if (!boxObj) {
     return nsIntRect();
   }
 
   RefPtr<nsTreeColumn> column = nsCoreUtils::GetFirstSensibleColumn(mTree);
 
-  int32_t x = 0, y = 0, width = 0, height = 0;
-  nsresult rv = mTree->GetCoordsForCellItem(mRow, column, EmptyString(), &x, &y,
-                                            &width, &height);
+  nsresult rv;
+  nsIntRect rect =
+      mTree->GetCoordsForCellItem(mRow, column, NS_LITERAL_STRING("cell"), rv);
   if (NS_FAILED(rv)) {
     return nsIntRect();
   }
 
-  boxObj->GetWidth(&width);
+  boxObj->GetWidth(&rect.width);
 
   int32_t tcX = 0, tcY = 0;
   boxObj->GetScreenX(&tcX);
   boxObj->GetScreenY(&tcY);
-
-  x = tcX;
-  y += tcY;
-
-  return nsIntRect(x, y, width, height);
+  return nsIntRect(tcX, rect.y + tcY, rect.width, rect.height);
 }
 
 nsRect XULTreeItemAccessibleBase::BoundsInAppUnits() const {
   nsIntRect bounds = BoundsInCSSPixels();
   nsPresContext* presContext = mDoc->PresContext();
   return nsRect(presContext->CSSPixelsToAppUnits(bounds.X()),
                 presContext->CSSPixelsToAppUnits(bounds.Y()),
                 presContext->CSSPixelsToAppUnits(bounds.Width()),
@@ -801,19 +794,18 @@ uint64_t XULTreeItemAccessibleBase::Nati
     selection->IsSelected(mRow, &isSelected);
     if (isSelected) state |= states::SELECTED;
   }
 
   // focused state
   if (FocusMgr()->IsFocused(this)) state |= states::FOCUSED;
 
   // invisible state
-  int32_t firstVisibleRow, lastVisibleRow;
-  mTree->GetFirstVisibleRow(&firstVisibleRow);
-  mTree->GetLastVisibleRow(&lastVisibleRow);
+  int32_t firstVisibleRow = mTree->GetFirstVisibleRow();
+  int32_t lastVisibleRow = mTree->GetLastVisibleRow();
   if (mRow < firstVisibleRow || mRow > lastVisibleRow)
     state |= states::INVISIBLE;
 
   return state;
 }
 
 uint64_t XULTreeItemAccessibleBase::NativeInteractiveState() const {
   return states::FOCUSABLE | states::SELECTABLE;
@@ -832,18 +824,17 @@ Accessible* XULTreeItemAccessibleBase::C
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeItemAccessibleBase: Accessible protected methods
 
 void XULTreeItemAccessibleBase::DispatchClickEvent(
     nsIContent* aContent, uint32_t aActionIndex) const {
   if (IsDefunct()) return;
 
-  RefPtr<nsTreeColumns> columns;
-  mTree->GetColumns(getter_AddRefs(columns));
+  RefPtr<nsTreeColumns> columns = mTree->GetColumns();
   if (!columns) return;
 
   // Get column and pseudo element.
   RefPtr<nsTreeColumn> column;
   nsAutoString pseudoElm;
 
   if (aActionIndex == eAction_Click) {
     // Key column is visible and clickable.
@@ -869,18 +860,17 @@ Accessible* XULTreeItemAccessibleBase::G
 
 bool XULTreeItemAccessibleBase::IsExpandable() const {
   bool isContainer = false;
   mTreeView->IsContainer(mRow, &isContainer);
   if (isContainer) {
     bool isEmpty = false;
     mTreeView->IsContainerEmpty(mRow, &isEmpty);
     if (!isEmpty) {
-      RefPtr<nsTreeColumns> columns;
-      mTree->GetColumns(getter_AddRefs(columns));
+      RefPtr<nsTreeColumns> columns = mTree->GetColumns();
       if (columns) {
         nsTreeColumn* primaryColumn = columns->GetPrimaryColumn();
         if (primaryColumn && !nsCoreUtils::IsColumnHidden(primaryColumn))
           return true;
       }
     }
   }
 
@@ -941,18 +931,17 @@ ENameValueFlag XULTreeItemAccessible::Na
 // XULTreeItemAccessible: Accessible implementation
 
 void XULTreeItemAccessible::Shutdown() {
   mColumn = nullptr;
   XULTreeItemAccessibleBase::Shutdown();
 }
 
 role XULTreeItemAccessible::NativeRole() const {
-  RefPtr<nsTreeColumns> columns;
-  mTree->GetColumns(getter_AddRefs(columns));
+  RefPtr<nsTreeColumns> columns = mTree->GetColumns();
   if (!columns) {
     NS_ERROR("No tree columns object in the tree!");
     return roles::NOTHING;
   }
 
   nsTreeColumn* primaryColumn = columns->GetPrimaryColumn();
 
   return primaryColumn ? roles::OUTLINEITEM : roles::LISTITEM;
@@ -984,18 +973,17 @@ Accessible* XULTreeColumAccessible::GetS
                                                        nsresult* aError) const {
   if (aOffset < 0)
     return XULColumAccessible::GetSiblingAtOffset(aOffset, aError);
 
   if (aError) *aError = NS_OK;  // fail peacefully
 
   RefPtr<dom::XULTreeElement> tree = nsCoreUtils::GetTree(mContent);
   if (tree) {
-    nsCOMPtr<nsITreeView> treeView;
-    tree->GetView(getter_AddRefs(treeView));
+    nsCOMPtr<nsITreeView> treeView = tree->GetView();
     if (treeView) {
       int32_t rowCount = 0;
       treeView->GetRowCount(&rowCount);
       if (rowCount > 0 && aOffset <= rowCount) {
         XULTreeAccessible* treeAcc = Parent()->AsXULTree();
 
         if (treeAcc) return treeAcc->GetTreeItemAccessible(aOffset - 1);
       }
--- a/accessible/xul/XULTreeGridAccessible.cpp
+++ b/accessible/xul/XULTreeGridAccessible.cpp
@@ -18,16 +18,17 @@
 
 #include "nsIBoxObject.h"
 #include "nsIMutableArray.h"
 #include "nsPersistentProperties.h"
 #include "nsITreeSelection.h"
 #include "nsComponentManagerUtils.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/TreeColumnBinding.h"
+#include "mozilla/dom/XULTreeElementBinding.h"
 
 using namespace mozilla::a11y;
 using namespace mozilla;
 
 XULTreeGridAccessible::~XULTreeGridAccessible() {}
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeGridAccessible: Table
@@ -164,18 +165,17 @@ void XULTreeGridAccessible::UnselectRow(
 
   if (selection) selection->ClearRange(aRowIdx, aRowIdx);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeGridAccessible: Accessible implementation
 
 role XULTreeGridAccessible::NativeRole() const {
-  RefPtr<nsTreeColumns> treeColumns;
-  mTree->GetColumns(getter_AddRefs(treeColumns));
+  RefPtr<nsTreeColumns> treeColumns = mTree->GetColumns();
   if (!treeColumns) {
     NS_ERROR("No treecolumns object for tree!");
     return roles::NOTHING;
   }
 
   nsTreeColumn* primaryColumn = treeColumns->GetPrimaryColumn();
 
   return primaryColumn ? roles::TREE_TABLE : roles::TABLE;
@@ -263,26 +263,24 @@ Accessible* XULTreeGridRowAccessible::Ch
   nsIFrame* rootFrame = presShell->GetRootFrame();
   NS_ENSURE_TRUE(rootFrame, nullptr);
 
   CSSIntRect rootRect = rootFrame->GetScreenRect();
 
   int32_t clientX = presContext->DevPixelsToIntCSSPixels(aX) - rootRect.X();
   int32_t clientY = presContext->DevPixelsToIntCSSPixels(aY) - rootRect.Y();
 
-  int32_t row = -1;
-  RefPtr<nsTreeColumn> column;
-  nsAutoString childEltUnused;
-  mTree->GetCellAt(clientX, clientY, &row, getter_AddRefs(column),
-                   childEltUnused);
+  ErrorResult rv;
+  dom::TreeCellInfo cellInfo;
+  mTree->GetCellAt(clientX, clientY, cellInfo, rv);
 
   // Return if we failed to find tree cell in the row for the given point.
-  if (row != mRow || !column) return nullptr;
+  if (cellInfo.mRow != mRow || !cellInfo.mCol) return nullptr;
 
-  return GetCellAccessible(column);
+  return GetCellAccessible(cellInfo.mCol);
 }
 
 Accessible* XULTreeGridRowAccessible::GetChildAt(uint32_t aIndex) const {
   if (IsDefunct()) return nullptr;
 
   RefPtr<nsTreeColumn> column = nsCoreUtils::GetSensibleColumnAt(mTree, aIndex);
   if (!column) return nullptr;
 
@@ -309,18 +307,17 @@ XULTreeGridCellAccessible* XULTreeGridRo
       mTreeView, mRow, aColumn);
   mAccessibleCache.Put(key, cell);
   Document()->BindToDocument(cell, nullptr);
   return cell;
 }
 
 void XULTreeGridRowAccessible::RowInvalidated(int32_t aStartColIdx,
                                               int32_t aEndColIdx) {
-  RefPtr<nsTreeColumns> treeColumns;
-  mTree->GetColumns(getter_AddRefs(treeColumns));
+  RefPtr<nsTreeColumns> treeColumns = mTree->GetColumns();
   if (!treeColumns) return;
 
   bool nameChanged = false;
   for (int32_t colIdx = aStartColIdx; colIdx <= aEndColIdx; ++colIdx) {
     nsTreeColumn* column = treeColumns->GetColumnAt(colIdx);
     if (column && !nsCoreUtils::IsColumnHidden(column)) {
       XULTreeGridCellAccessible* cell = GetCellAccessible(column);
       if (cell) nameChanged |= cell->CellInvalidated();
@@ -405,30 +402,27 @@ ENameValueFlag XULTreeGridCellAccessible
 nsIntRect XULTreeGridCellAccessible::BoundsInCSSPixels() const {
   // Get bounds for tree cell and add x and y of treechildren element to
   // x and y of the cell.
   nsCOMPtr<nsIBoxObject> boxObj = nsCoreUtils::GetTreeBodyBoxObject(mTree);
   if (!boxObj) {
     return nsIntRect();
   }
 
-  int32_t x = 0, y = 0, width = 0, height = 0;
-  nsresult rv = mTree->GetCoordsForCellItem(
-      mRow, mColumn, NS_LITERAL_STRING("cell"), &x, &y, &width, &height);
+  nsresult rv;
+  nsIntRect rect =
+      mTree->GetCoordsForCellItem(mRow, mColumn, NS_LITERAL_STRING("cell"), rv);
   if (NS_FAILED(rv)) {
     return nsIntRect();
   }
 
   int32_t tcX = 0, tcY = 0;
   boxObj->GetScreenX(&tcX);
   boxObj->GetScreenY(&tcY);
-  x += tcX;
-  y += tcY;
-
-  return nsIntRect(x, y, width, height);
+  return nsIntRect(rect.x + tcX, rect.y + tcY, rect.width, rect.height);
 }
 
 nsRect XULTreeGridCellAccessible::BoundsInAppUnits() const {
   nsIntRect bounds = BoundsInCSSPixels();
   nsPresContext* presContext = mDoc->PresContext();
   return nsRect(presContext->CSSPixelsToAppUnits(bounds.X()),
                 presContext->CSSPixelsToAppUnits(bounds.Y()),
                 presContext->CSSPixelsToAppUnits(bounds.Width()),
--- a/dom/xul/XULTreeElement.cpp
+++ b/dom/xul/XULTreeElement.cpp
@@ -105,165 +105,144 @@ nsTreeBodyFrame* XULTreeElement::GetTree
   nsCOMPtr<nsIContent> tree = FindBodyElement(this);
   if (tree) {
     mTreeBody = do_QueryFrame(tree->GetPrimaryFrame());
   }
 
   return mTreeBody;
 }
 
-nsresult XULTreeElement::GetView(nsITreeView** aView) {
+already_AddRefed<nsITreeView> XULTreeElement::GetView() {
   if (!mTreeBody) {
     if (!GetTreeBodyFrame()) {
-      // Don't return an uninitialised view
-      *aView = nullptr;
-      return NS_OK;
+      return nullptr;
     }
 
     if (mView) {
+      nsCOMPtr<nsITreeView> view;
       // Our new frame needs to initialise itself
-      return mTreeBody->GetView(aView);
+      mTreeBody->GetView(getter_AddRefs(view));
+      return view.forget();
     }
   }
   if (!mView) {
     // No tree builder, create a tree content view.
-    nsresult rv = NS_NewTreeContentView(getter_AddRefs(mView));
-    NS_ENSURE_SUCCESS(rv, rv);
+    if (NS_FAILED(NS_NewTreeContentView(getter_AddRefs(mView)))) {
+      return nullptr;
+    }
 
     // Initialise the frame and view
     mTreeBody->SetView(mView);
   }
-  NS_IF_ADDREF(*aView = mView);
-  return NS_OK;
-}
 
-already_AddRefed<nsITreeView> XULTreeElement::GetView(CallerType /* unused */) {
-  nsCOMPtr<nsITreeView> view;
-  GetView(getter_AddRefs(view));
-  return view.forget();
-}
-
-nsresult XULTreeElement::SetView(nsITreeView* aView) {
-  ErrorResult rv;
-  SetView(aView, CallerType::System, rv);
-  return rv.StealNSResult();
+  return do_AddRef(mView);
 }
 
 void XULTreeElement::SetView(nsITreeView* aView, CallerType aCallerType,
                              ErrorResult& aRv) {
   if (aCallerType != CallerType::System) {
     // Don't trust views coming from random places.
     aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
     return;
   }
 
   mView = aView;
   nsTreeBodyFrame* body = GetTreeBodyFrame();
-  if (body) body->SetView(aView);
+  if (body) {
+    body->SetView(aView);
+  }
 }
 
 bool XULTreeElement::Focused() {
   nsTreeBodyFrame* body = GetTreeBodyFrame();
-  if (body) return body->GetFocused();
+  if (body) {
+    return body->GetFocused();
+  }
   return false;
 }
 
-nsresult XULTreeElement::GetFocused(bool* aFocused) {
-  *aFocused = Focused();
-  return NS_OK;
-}
-
 void XULTreeElement::SetFocused(bool aFocused) {
   nsTreeBodyFrame* body = GetTreeBodyFrame();
-  if (body) body->SetFocused(aFocused);
-}
-
-nsresult XULTreeElement::GetTreeBody(Element** aElement) {
-  *aElement = nullptr;
-  nsTreeBodyFrame* body = GetTreeBodyFrame();
-  if (body) return body->GetTreeBody(aElement);
-  return NS_OK;
+  if (body) {
+    body->SetFocused(aFocused);
+  }
 }
 
 already_AddRefed<Element> XULTreeElement::GetTreeBody() {
-  RefPtr<Element> el;
-  GetTreeBody(getter_AddRefs(el));
-  return el.forget();
+  nsTreeBodyFrame* body = GetTreeBodyFrame();
+  if (body) {
+    nsCOMPtr<Element> element;
+    body->GetTreeBody(getter_AddRefs(element));
+    return element.forget();
+  }
+
+  return nullptr;
 }
 
 already_AddRefed<nsTreeColumns> XULTreeElement::GetColumns() {
   nsTreeBodyFrame* body = GetTreeBodyFrame();
-  if (body) return body->Columns();
+  if (body) {
+    return body->Columns();
+  }
   return nullptr;
 }
 
-nsresult XULTreeElement::GetColumns(nsTreeColumns** aColumns) {
-  *aColumns = GetColumns().take();
-  return NS_OK;
-}
-
 int32_t XULTreeElement::RowHeight() {
   nsTreeBodyFrame* body = GetTreeBodyFrame();
-  if (body) return body->RowHeight();
+  if (body) {
+    return body->RowHeight();
+  }
   return 0;
 }
 
 int32_t XULTreeElement::RowWidth() {
   nsTreeBodyFrame* body = GetTreeBodyFrame();
-  if (body) return body->RowWidth();
+  if (body) {
+    return body->RowWidth();
+  }
   return 0;
 }
 
-nsresult XULTreeElement::GetRowHeight(int32_t* aRowHeight) {
-  *aRowHeight = RowHeight();
-  return NS_OK;
-}
-
-nsresult XULTreeElement::GetRowWidth(int32_t* aRowWidth) {
-  *aRowWidth = RowWidth();
-  return NS_OK;
-}
-
 int32_t XULTreeElement::GetFirstVisibleRow() {
   nsTreeBodyFrame* body = GetTreeBodyFrame();
-  if (body) return body->FirstVisibleRow();
+  if (body) {
+    return body->FirstVisibleRow();
+  }
   return 0;
 }
 
-nsresult XULTreeElement::GetFirstVisibleRow(int32_t* aFirstVisibleRow) {
-  *aFirstVisibleRow = GetFirstVisibleRow();
-  return NS_OK;
-}
-
 int32_t XULTreeElement::GetLastVisibleRow() {
   nsTreeBodyFrame* body = GetTreeBodyFrame();
-  if (body) return body->LastVisibleRow();
+  if (body) {
+    return body->LastVisibleRow();
+  }
   return 0;
 }
 
-nsresult XULTreeElement::GetLastVisibleRow(int32_t* aLastVisibleRow) {
-  *aLastVisibleRow = GetLastVisibleRow();
-  return NS_OK;
-}
-
 int32_t XULTreeElement::HorizontalPosition() {
   nsTreeBodyFrame* body = GetTreeBodyFrame();
-  if (body) return body->GetHorizontalPosition();
+  if (body) {
+    return body->GetHorizontalPosition();
+  }
   return 0;
 }
 
 int32_t XULTreeElement::GetPageLength() {
   nsTreeBodyFrame* body = GetTreeBodyFrame();
-  if (body) return body->PageLength();
+  if (body) {
+    return body->PageLength();
+  }
   return 0;
 }
 
 void XULTreeElement::EnsureRowIsVisible(int32_t aRow) {
   nsTreeBodyFrame* body = GetTreeBodyFrame();
-  if (body) body->EnsureRowIsVisible(aRow);
+  if (body) {
+    body->EnsureRowIsVisible(aRow);
+  }
 }
 
 void XULTreeElement::EnsureCellIsVisible(int32_t aRow, nsTreeColumn* aCol,
                                          ErrorResult& aRv) {
   nsTreeBodyFrame* body = GetTreeBodyFrame();
   if (body) {
     nsresult rv = body->EnsureCellIsVisible(aRow, aCol);
     if (NS_FAILED(rv)) {
@@ -286,128 +265,144 @@ void XULTreeElement::ScrollByLines(int32
   if (!body) {
     return;
   }
   body->ScrollByLines(aNumLines);
 }
 
 void XULTreeElement::ScrollByPages(int32_t aNumPages) {
   nsTreeBodyFrame* body = GetTreeBodyFrame();
-  if (body) body->ScrollByPages(aNumPages);
+  if (body) {
+    body->ScrollByPages(aNumPages);
+  }
 }
 
 void XULTreeElement::Invalidate() {
   nsTreeBodyFrame* body = GetTreeBodyFrame();
-  if (body) body->Invalidate();
+  if (body) {
+    body->Invalidate();
+  }
 }
 
 void XULTreeElement::InvalidateColumn(nsTreeColumn* aCol) {
   nsTreeBodyFrame* body = GetTreeBodyFrame();
-  if (body) body->InvalidateColumn(aCol);
+  if (body) {
+    body->InvalidateColumn(aCol);
+  }
 }
 
 void XULTreeElement::InvalidateRow(int32_t aIndex) {
   nsTreeBodyFrame* body = GetTreeBodyFrame();
-  if (body) body->InvalidateRow(aIndex);
+  if (body) {
+    body->InvalidateRow(aIndex);
+  }
 }
 
 void XULTreeElement::InvalidateCell(int32_t aRow, nsTreeColumn* aCol) {
   nsTreeBodyFrame* body = GetTreeBodyFrame();
-  if (body) body->InvalidateCell(aRow, aCol);
+  if (body) {
+    body->InvalidateCell(aRow, aCol);
+  }
 }
 
 void XULTreeElement::InvalidateRange(int32_t aStart, int32_t aEnd) {
   nsTreeBodyFrame* body = GetTreeBodyFrame();
-  if (body) body->InvalidateRange(aStart, aEnd);
+  if (body) {
+    body->InvalidateRange(aStart, aEnd);
+  }
 }
 
 int32_t XULTreeElement::GetRowAt(int32_t x, int32_t y) {
   nsTreeBodyFrame* body = GetTreeBodyFrame();
   if (!body) {
     return 0;
   }
   return body->GetRowAt(x, y);
 }
 
-nsresult XULTreeElement::GetCellAt(int32_t aX, int32_t aY, int32_t* aRow,
-                                   nsTreeColumn** aCol, nsAString& aChildElt) {
-  *aRow = 0;
-  *aCol = nullptr;
+void XULTreeElement::GetCellAt(int32_t aX, int32_t aY, TreeCellInfo& aRetVal,
+                               ErrorResult& aRv) {
+  aRetVal.mRow = 0;
+  aRetVal.mCol = nullptr;
+
   nsTreeBodyFrame* body = GetTreeBodyFrame();
   if (body) {
     nsAutoCString element;
-    nsresult retval = body->GetCellAt(aX, aY, aRow, aCol, element);
-    CopyUTF8toUTF16(element, aChildElt);
-    return retval;
+    body->GetCellAt(aX, aY, &aRetVal.mRow, getter_AddRefs(aRetVal.mCol),
+                    element);
+    CopyUTF8toUTF16(element, aRetVal.mChildElt);
   }
-  return NS_OK;
-}
-
-void XULTreeElement::GetCellAt(int32_t x, int32_t y, TreeCellInfo& aRetVal,
-                               ErrorResult& aRv) {
-  GetCellAt(x, y, &aRetVal.mRow, getter_AddRefs(aRetVal.mCol),
-            aRetVal.mChildElt);
 }
 
-nsresult XULTreeElement::GetCoordsForCellItem(int32_t aRow, nsTreeColumn* aCol,
-                                              const nsAString& aElement,
-                                              int32_t* aX, int32_t* aY,
-                                              int32_t* aWidth,
-                                              int32_t* aHeight) {
-  *aX = *aY = *aWidth = *aHeight = 0;
+nsIntRect XULTreeElement::GetCoordsForCellItem(int32_t aRow, nsTreeColumn* aCol,
+                                               const nsAString& aElement,
+                                               nsresult& rv) {
+  rv = NS_OK;
+  nsIntRect rect;
+
   nsTreeBodyFrame* body = GetTreeBodyFrame();
   NS_ConvertUTF16toUTF8 element(aElement);
-  if (body)
-    return body->GetCoordsForCellItem(aRow, aCol, element, aX, aY, aWidth,
-                                      aHeight);
-  return NS_OK;
+  if (body) {
+    rv = body->GetCoordsForCellItem(aRow, aCol, element, &rect.x, &rect.y,
+                                    &rect.width, &rect.height);
+  }
+
+  return rect;
 }
 
 already_AddRefed<DOMRect> XULTreeElement::GetCoordsForCellItem(
-    int32_t row, nsTreeColumn& col, const nsAString& element,
+    int32_t aRow, nsTreeColumn& aCol, const nsAString& aElement,
     ErrorResult& aRv) {
-  int32_t x, y, w, h;
-  GetCoordsForCellItem(row, &col, element, &x, &y, &w, &h);
-  RefPtr<DOMRect> rect = new DOMRect(this, x, y, w, h);
-  return rect.forget();
+  nsresult rv;
+  nsIntRect rect = GetCoordsForCellItem(aRow, &aCol, aElement, rv);
+  aRv = rv;
+
+  RefPtr<DOMRect> domRect =
+      new DOMRect(this, rect.x, rect.y, rect.width, rect.height);
+  return domRect.forget();
 }
 
-nsresult XULTreeElement::IsCellCropped(int32_t aRow, nsTreeColumn* aCol,
-                                       bool* aIsCropped) {
-  *aIsCropped = false;
+bool XULTreeElement::IsCellCropped(int32_t aRow, nsTreeColumn* aCol,
+                                   ErrorResult& aRv) {
+  bool cropped = false;
+
   nsTreeBodyFrame* body = GetTreeBodyFrame();
-  if (body) return body->IsCellCropped(aRow, aCol, aIsCropped);
-  return NS_OK;
-}
+  if (body) {
+    aRv = body->IsCellCropped(aRow, aCol, &cropped);
+  }
 
-bool XULTreeElement::IsCellCropped(int32_t row, nsTreeColumn* col,
-                                   ErrorResult& aRv) {
-  bool ret;
-  aRv = IsCellCropped(row, col, &ret);
-  return ret;
+  return cropped;
 }
 
 void XULTreeElement::RowCountChanged(int32_t aIndex, int32_t aDelta) {
   nsTreeBodyFrame* body = GetTreeBodyFrame();
-  if (body) body->RowCountChanged(aIndex, aDelta);
+  if (body) {
+    body->RowCountChanged(aIndex, aDelta);
+  }
 }
 
 void XULTreeElement::BeginUpdateBatch() {
   nsTreeBodyFrame* body = GetTreeBodyFrame();
-  if (body) body->BeginUpdateBatch();
+  if (body) {
+    body->BeginUpdateBatch();
+  }
 }
 
 void XULTreeElement::EndUpdateBatch() {
   nsTreeBodyFrame* body = GetTreeBodyFrame();
-  if (body) body->EndUpdateBatch();
+  if (body) {
+    body->EndUpdateBatch();
+  }
 }
 
 void XULTreeElement::ClearStyleAndImageCaches() {
   nsTreeBodyFrame* body = GetTreeBodyFrame();
-  if (body) body->ClearStyleAndImageCaches();
+  if (body) {
+    body->ClearStyleAndImageCaches();
+  }
 }
 
 void XULTreeElement::RemoveImageCacheEntry(int32_t aRowIndex,
                                            nsTreeColumn& aCol,
                                            ErrorResult& aRv) {
   if (NS_WARN_IF(aRowIndex < 0)) {
     aRv.Throw(NS_ERROR_INVALID_ARG);
     return;
--- a/dom/xul/XULTreeElement.h
+++ b/dom/xul/XULTreeElement.h
@@ -33,102 +33,92 @@ class XULTreeElement final : public nsXU
         mCachedFirstVisibleRow(0),
         mTreeBody(nullptr) {}
 
   NS_IMPL_FROMNODE_WITH_TAG(XULTreeElement, kNameSpaceID_XUL, tree)
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XULTreeElement, nsXULElement)
 
-  nsTreeBodyFrame *GetTreeBodyFrame(bool aFlushLayout = false);
-  nsTreeBodyFrame *GetCachedTreeBodyFrame() { return mTreeBody; }
+  nsTreeBodyFrame* GetTreeBodyFrame(bool aFlushLayout = false);
+  nsTreeBodyFrame* GetCachedTreeBodyFrame() { return mTreeBody; }
 
   already_AddRefed<nsTreeColumns> GetColumns();
 
-  already_AddRefed<nsITreeView> GetView(CallerType /* unused */);
+  already_AddRefed<nsITreeView> GetView(CallerType /* unused */) {
+    return GetView();
+  }
+  already_AddRefed<nsITreeView> GetView();
 
   void SetView(nsITreeView* arg, CallerType aCallerType, ErrorResult& aRv);
 
   bool Focused();
 
   already_AddRefed<Element> GetTreeBody();
 
   int32_t RowHeight();
 
   int32_t RowWidth();
 
   int32_t HorizontalPosition();
 
-  void EnsureCellIsVisible(int32_t row, nsTreeColumn *col, ErrorResult &aRv);
+  void EnsureCellIsVisible(int32_t row, nsTreeColumn* col, ErrorResult& aRv);
 
   void ScrollToRow(int32_t aRow);
 
   void ScrollByLines(int32_t aNumLines);
 
   void ScrollByPages(int32_t aNumPages);
 
   int32_t GetFirstVisibleRow();
 
   int32_t GetLastVisibleRow();
 
   int32_t GetPageLength();
 
   int32_t GetRowAt(int32_t x, int32_t y);
 
-  void GetCellAt(int32_t x, int32_t y, TreeCellInfo &aRetVal, ErrorResult &aRv);
+  void GetCellAt(int32_t x, int32_t y, TreeCellInfo& aRetVal, ErrorResult& aRv);
 
-  already_AddRefed<DOMRect> GetCoordsForCellItem(int32_t row, nsTreeColumn &col,
-                                                 const nsAString &element,
-                                                 ErrorResult &aRv);
+  nsIntRect GetCoordsForCellItem(int32_t aRow, nsTreeColumn* aCol,
+                                 const nsAString& aElement, nsresult& rv);
+  already_AddRefed<DOMRect> GetCoordsForCellItem(int32_t row, nsTreeColumn& col,
+                                                 const nsAString& element,
+                                                 ErrorResult& aRv);
 
-  bool IsCellCropped(int32_t row, nsTreeColumn *col, ErrorResult &aRv);
+  bool IsCellCropped(int32_t row, nsTreeColumn* col, ErrorResult& aRv);
 
-  void RemoveImageCacheEntry(int32_t row, nsTreeColumn &col, ErrorResult &aRv);
+  void RemoveImageCacheEntry(int32_t row, nsTreeColumn& col, ErrorResult& aRv);
 
   void SetFocused(bool aFocused);
   void EnsureRowIsVisible(int32_t index);
   void Invalidate(void);
-  void InvalidateColumn(nsTreeColumn *col);
+  void InvalidateColumn(nsTreeColumn* col);
   void InvalidateRow(int32_t index);
-  void InvalidateCell(int32_t row, nsTreeColumn *col);
+  void InvalidateCell(int32_t row, nsTreeColumn* col);
   void InvalidateRange(int32_t startIndex, int32_t endIndex);
   void RowCountChanged(int32_t index, int32_t count);
   void BeginUpdateBatch(void);
   void EndUpdateBatch(void);
   void ClearStyleAndImageCaches(void);
-  nsresult GetColumns(nsTreeColumns **aColumns);
-  nsresult GetView(nsITreeView **aView);
-  nsresult SetView(nsITreeView *aView);
-  nsresult GetFocused(bool *aFocused);
-  nsresult GetTreeBody(mozilla::dom::Element **aTreeBody);
-  nsresult GetRowHeight(int32_t *aRowHeight);
-  nsresult GetRowWidth(int32_t *aRowWidth);
-  nsresult GetFirstVisibleRow(int32_t *_retval);
-  nsresult GetLastVisibleRow(int32_t *_retval);
-  nsresult GetCellAt(int32_t x, int32_t y, int32_t *row, nsTreeColumn **col,
-                     nsAString &childElt);
-  nsresult GetCoordsForCellItem(int32_t row, nsTreeColumn *col,
-                                const nsAString &element, int32_t *x,
-                                int32_t *y, int32_t *width, int32_t *height);
-  nsresult IsCellCropped(int32_t row, nsTreeColumn *col, bool *_retval);
 
   virtual void UnbindFromTree(bool aDeep, bool aNullParent) override;
   virtual void DestroyContent() override;
 
   void BodyDestroyed(int32_t aFirstVisibleRow) {
     mTreeBody = nullptr;
     mCachedFirstVisibleRow = aFirstVisibleRow;
   }
 
   int32_t GetCachedTopVisibleRow() { return mCachedFirstVisibleRow; }
 
  protected:
   int32_t mCachedFirstVisibleRow;
 
-  nsTreeBodyFrame *mTreeBody;
+  nsTreeBodyFrame* mTreeBody;
   nsCOMPtr<nsITreeView> mView;
 
   virtual ~XULTreeElement() {}
 
   JSObject *WrapNode(JSContext *aCx,
                      JS::Handle<JSObject *> aGivenProto) override;
 };
 
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -7979,26 +7979,24 @@ void PresShell::GetCurrentItemAndPositio
       // 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?
       if (tree) {
         tree->EnsureRowIsVisible(currentIndex);
-        int32_t firstVisibleRow, rowHeight;
-        tree->GetFirstVisibleRow(&firstVisibleRow);
-        tree->GetRowHeight(&rowHeight);
+        int32_t firstVisibleRow = tree->GetFirstVisibleRow();
+        int32_t rowHeight = tree->RowHeight();
 
         extraTreeY += nsPresContext::CSSPixelsToAppUnits(
             (currentIndex - firstVisibleRow + 1) * rowHeight);
         istree = true;
 
-        RefPtr<nsTreeColumns> cols;
-        tree->GetColumns(getter_AddRefs(cols));
+        RefPtr<nsTreeColumns> cols = tree->GetColumns();
         if (cols) {
           nsTreeColumn* col = cols->GetFirstColumn();
           if (col) {
             RefPtr<Element> colElement = col->Element();
             nsIFrame* frame = colElement->GetPrimaryFrame();
             if (frame) {
               extraTreeY += frame->GetSize().height;
             }
--- a/layout/xul/nsXULTooltipListener.cpp
+++ b/layout/xul/nsXULTooltipListener.cpp
@@ -28,16 +28,17 @@
 #include "mozilla/ErrorResult.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/LookAndFeel.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/Event.h"  // for Event
 #include "mozilla/dom/BoxObject.h"
 #include "mozilla/dom/MouseEvent.h"
 #include "mozilla/dom/TreeColumnBinding.h"
+#include "mozilla/dom/XULTreeElementBinding.h"
 #include "mozilla/TextEvents.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 nsXULTooltipListener* nsXULTooltipListener::sInstance = nullptr;
 
 //////////////////////////////////////////////////////////////////////////
@@ -332,39 +333,40 @@ void nsXULTooltipListener::CheckTreeBody
     bx = doc->GetBoxObjectFor(doc->GetRootElement(), ignored);
   }
 
   RefPtr<XULTreeElement> tree = GetSourceTree();
   if (bx && tree) {
     int32_t x = aMouseEvent->ScreenX(CallerType::System);
     int32_t y = aMouseEvent->ScreenY(CallerType::System);
 
-    int32_t row;
-    RefPtr<nsTreeColumn> col;
-    nsAutoString obj;
-
     // subtract off the documentElement's boxObject
     int32_t boxX, boxY;
     bx->GetScreenX(&boxX);
     bx->GetScreenY(&boxY);
     x -= boxX;
     y -= boxY;
 
-    tree->GetCellAt(x, y, &row, getter_AddRefs(col), obj);
+    ErrorResult rv;
+    TreeCellInfo cellInfo;
+    tree->GetCellAt(x, y, cellInfo, rv);
+
+    int32_t row = cellInfo.mRow;
+    RefPtr<nsTreeColumn> col = cellInfo.mCol;
 
     // determine if we are going to need a titletip
     // XXX check the disabletitletips attribute on the tree content
     mNeedTitletip = false;
     int16_t colType = -1;
     if (col) {
       colType = col->Type();
     }
-    if (row >= 0 && obj.EqualsLiteral("text") &&
+    if (row >= 0 && cellInfo.mChildElt.EqualsLiteral("text") &&
         colType != TreeColumn_Binding::TYPE_PASSWORD) {
-      tree->IsCellCropped(row, col, &mNeedTitletip);
+      mNeedTitletip = tree->IsCellCropped(row, col, rv);
     }
 
     nsCOMPtr<nsIContent> currentTooltip = do_QueryReferent(mCurrentTooltip);
     if (currentTooltip && (row != mLastTreeRow || col != mLastTreeCol)) {
       HideTooltip();
     }
 
     mLastTreeRow = row;
@@ -430,18 +432,17 @@ nsresult nsXULTooltipListener::ShowToolt
   }
 
   return NS_OK;
 }
 
 #ifdef MOZ_XUL
 static void SetTitletipLabel(XULTreeElement* aTree, Element* aTooltip,
                              int32_t aRow, nsTreeColumn* aCol) {
-  nsCOMPtr<nsITreeView> view;
-  aTree->GetView(getter_AddRefs(view));
+  nsCOMPtr<nsITreeView> view = aTree->GetView();
   if (view) {
     nsAutoString label;
 #ifdef DEBUG
     nsresult rv =
 #endif
         view->GetCellText(aRow, aCol, label);
     NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "Couldn't get the cell text!");
     aTooltip->SetAttr(kNameSpaceID_None, nsGkAtoms::label, label, true);
--- a/layout/xul/tree/nsTreeBodyFrame.cpp
+++ b/layout/xul/tree/nsTreeBodyFrame.cpp
@@ -272,18 +272,17 @@ void nsTreeBodyFrame::EnsureView() {
       }
       return;
     }
 
     AutoWeakFrame weakFrame(this);
 
     RefPtr<XULTreeElement> tree = GetBaseElement();
     if (tree) {
-      nsCOMPtr<nsITreeView> treeView;
-      tree->GetView(getter_AddRefs(treeView));
+      nsCOMPtr<nsITreeView> treeView = tree->GetView();
       if (treeView && weakFrame.IsAlive()) {
         int32_t rowIndex = tree->GetCachedTopVisibleRow();
 
         // Set our view.
         SetView(treeView);
         NS_ENSURE_TRUE_VOID(weakFrame.IsAlive());
 
         // Scroll to the given row.
--- a/layout/xul/tree/nsTreeColFrame.cpp
+++ b/layout/xul/tree/nsTreeColFrame.cpp
@@ -150,17 +150,17 @@ XULTreeElement* nsTreeColFrame::GetTree(
 }
 
 void nsTreeColFrame::InvalidateColumns(bool aCanWalkFrameTree) {
   RefPtr<XULTreeElement> tree = GetTree();
   if (tree) {
     RefPtr<nsTreeColumns> columns;
 
     if (aCanWalkFrameTree) {
-      tree->GetColumns(getter_AddRefs(columns));
+      columns = tree->GetColumns();
     } else {
       nsTreeBodyFrame* body = tree->GetCachedTreeBodyFrame();
       if (body) {
         columns = body->Columns();
       }
     }
 
     if (columns) columns->InvalidateColumns();
--- a/layout/xul/tree/nsTreeContentView.cpp
+++ b/layout/xul/tree/nsTreeContentView.cpp
@@ -513,18 +513,17 @@ nsTreeContentView::SetTree(XULTreeElemen
   if (aTree) {
     // Add ourselves to document's observers.
     Document* document = mTree->GetComposedDoc();
     if (document) {
       document->AddObserver(this);
       mDocument = document;
     }
 
-    RefPtr<dom::Element> bodyElement;
-    mTree->GetTreeBody(getter_AddRefs(bodyElement));
+    RefPtr<dom::Element> bodyElement = mTree->GetTreeBody();
     if (bodyElement) {
       mBody = bodyElement.forget();
       int32_t index = 0;
       Serialize(mBody, -1, &index, mRows);
     }
   }
 
   return NS_OK;
@@ -774,18 +773,17 @@ void nsTreeContentView::AttributeChanged
     }
 
     return;
   }
 
   if (aElement->IsXULElement(nsGkAtoms::treecol)) {
     if (aAttribute == nsGkAtoms::properties) {
       if (mTree) {
-        RefPtr<nsTreeColumns> cols;
-        mTree->GetColumns(getter_AddRefs(cols));
+        RefPtr<nsTreeColumns> cols = mTree->GetColumns();
         if (cols) {
           RefPtr<nsTreeColumn> col = cols->GetColumnFor(aElement);
           mTree->InvalidateColumn(col);
         }
       }
     }
   } else if (aElement->IsXULElement(nsGkAtoms::treeitem)) {
     int32_t index = FindContent(aElement);
--- a/layout/xul/tree/nsTreeSelection.cpp
+++ b/layout/xul/tree/nsTreeSelection.cpp
@@ -461,18 +461,17 @@ NS_IMETHODIMP nsTreeSelection::ClearSele
 
 NS_IMETHODIMP nsTreeSelection::InvertSelection() {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP nsTreeSelection::SelectAll() {
   if (!mTree) return NS_OK;
 
-  nsCOMPtr<nsITreeView> view;
-  mTree->GetView(getter_AddRefs(view));
+  nsCOMPtr<nsITreeView> view = mTree->GetView();
   if (!view) return NS_OK;
 
   int32_t rowCount;
   view->GetRowCount(&rowCount);
   bool single;
   nsresult rv = GetSingle(&single);
   if (NS_FAILED(rv)) return rv;