Bug 1466643 part 2. Remove nsITreeContentView. r=mosssop
authorBoris Zbarsky <bzbarsky@mit.edu>
Tue, 05 Jun 2018 13:30:17 -0400
changeset 421445 cc5f600eebd69ea445aef8a666363e44b3b5e299
parent 421444 189125be1c9baddeb257771511acaeccc6c4dcb7
child 421446 34467aba539360aacb189d13541c5df49e2b38fa
push id34093
push useraiakab@mozilla.com
push dateTue, 05 Jun 2018 21:58:58 +0000
treeherdermozilla-central@da28b92efe6f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmosssop
bugs1466643
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 1466643 part 2. Remove nsITreeContentView. r=mosssop
layout/xul/tree/moz.build
layout/xul/tree/nsITreeContentView.idl
layout/xul/tree/nsTreeContentView.cpp
layout/xul/tree/nsTreeContentView.h
toolkit/content/widgets/tree.xml
--- a/layout/xul/tree/moz.build
+++ b/layout/xul/tree/moz.build
@@ -5,17 +5,16 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 with Files('**'):
     BUG_COMPONENT = ('Core', 'XUL')
 
 XPIDL_SOURCES += [
     'nsITreeBoxObject.idl',
     'nsITreeColumns.idl',
-    'nsITreeContentView.idl',
     'nsITreeSelection.idl',
     'nsITreeView.idl',
 ]
 
 XPIDL_MODULE = 'layout_xul_tree'
 
 EXPORTS += [
     'nsTreeColFrame.h',
deleted file mode 100644
--- a/layout/xul/tree/nsITreeContentView.idl
+++ /dev/null
@@ -1,22 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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"
-
-webidl Element;
-
-[scriptable, builtinclass, uuid(5ef62896-0c0a-41f1-bb3c-44a60f5dfdab)]
-interface nsITreeContentView : nsISupports
-{
-  /**
-   * Retrieve the content item associated with the specified index.
-   */
-  Element getItemAtIndex(in long index);
-
-  /**
-   * Retrieve the index associated with the specified content item.
-   */
-  long getIndexOfItem(in Element item);
-};
--- a/layout/xul/tree/nsTreeContentView.cpp
+++ b/layout/xul/tree/nsTreeContentView.cpp
@@ -111,20 +111,19 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(ns
                                       mRoot,
                                       mBody)
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(nsTreeContentView)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(nsTreeContentView)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsTreeContentView)
   NS_INTERFACE_MAP_ENTRY(nsITreeView)
-  NS_INTERFACE_MAP_ENTRY(nsITreeContentView)
   NS_INTERFACE_MAP_ENTRY(nsIDocumentObserver)
   NS_INTERFACE_MAP_ENTRY(nsIMutationObserver)
-  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsITreeContentView)
+  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsITreeView)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
 NS_INTERFACE_MAP_END
 
 JSObject*
 nsTreeContentView::WrapObject(JSContext* aCx,
                               JS::Handle<JSObject*> aGivenProto)
 {
   return TreeContentViewBinding::Wrap(aCx, this, aGivenProto);
@@ -870,42 +869,22 @@ nsTreeContentView::GetItemAtIndex(int32_
   if (!IsValidRowIndex(aIndex)) {
     aError.Throw(NS_ERROR_INVALID_ARG);
     return nullptr;
   }
 
   return mRows[aIndex]->mContent;
 }
 
-NS_IMETHODIMP
-nsTreeContentView::GetItemAtIndex(int32_t aIndex, Element** _retval)
-{
-  ErrorResult rv;
-  RefPtr<Element> element = GetItemAtIndex(aIndex, rv);
-  if (rv.Failed()) {
-    return rv.StealNSResult();
-  }
-
-  element.forget(_retval);
-  return NS_OK;
-}
-
 int32_t
 nsTreeContentView::GetIndexOfItem(Element* aItem)
 {
   return FindContent(aItem);
 }
 
-NS_IMETHODIMP
-nsTreeContentView::GetIndexOfItem(Element* aItem, int32_t* _retval)
-{
-  *_retval = GetIndexOfItem(aItem);
-  return NS_OK;
-}
-
 void
 nsTreeContentView::AttributeChanged(dom::Element* aElement,
                                     int32_t       aNameSpaceID,
                                     nsAtom*      aAttribute,
                                     int32_t       aModType,
                                     const nsAttrValue* aOldValue)
 {
   // Lots of codepaths under here that do all sorts of stuff, so be safe.
--- a/layout/xul/tree/nsTreeContentView.h
+++ b/layout/xul/tree/nsTreeContentView.h
@@ -7,17 +7,16 @@
 #ifndef nsTreeContentView_h__
 #define nsTreeContentView_h__
 
 #include "nsCycleCollectionParticipant.h"
 #include "nsTArray.h"
 #include "nsStubDocumentObserver.h"
 #include "nsITreeBoxObject.h"
 #include "nsITreeView.h"
-#include "nsITreeContentView.h"
 #include "nsITreeSelection.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/UniquePtr.h"
 
 class nsIDocument;
 class nsSelection;
 class nsTreeColumn;
 class Row;
@@ -28,17 +27,16 @@ 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
@@ -114,18 +112,16 @@ class nsTreeContentView final : public n
                              nsTreeColumn& aColumn)
     {
     }
     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
     NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
     NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
     NS_DECL_NSIMUTATIONOBSERVER_NODEWILLBEDESTROYED
 
     static bool CanTrustTreeSelection(nsISupports* aValue);
--- a/toolkit/content/widgets/tree.xml
+++ b/toolkit/content/widgets/tree.xml
@@ -79,17 +79,17 @@
                 onget="return this.view ? this.view.selection.currentIndex: - 1;"
                 onset="if (this.view) return this.view.selection.currentIndex = val; return val;"/>
 
       <property name="treeBoxObject"
                 onget="return this.boxObject;"
                 readonly="true"/>
 # contentView is obsolete (see bug 202391)
       <property name="contentView"
-                onget="return this.view; /*.QueryInterface(Components.interfaces.nsITreeContentView)*/"
+                onget="return this.view;"
                 readonly="true"/>
 # builderView is obsolete (see bug 202393)
       <property name="builderView"
                 onget="return this.view; /*.QueryInterface(Components.interfaces.nsIXULTreeBuilder)*/"
                 readonly="true"/>
       <field name="pageUpOrDownMovesSelection">
         !/Mac/.test(navigator.platform)
       </field>