Bug 1482389, remove deprecated getCellAt and getCoordsForCellItem methods from TreeBoxObject, r=peterv
authorNeil Deakin <neil@mozilla.com>
Tue, 04 Dec 2018 11:24:16 -0500
changeset 510957 28294d20a81b2eb48e6536574810f5e0c8713f58
parent 510956 382bf54cf7cfe27ba2efe75e8bc2a5f46cd64534
child 510958 b0ae73c11374d34f061ef138a63fd758358b5949
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspeterv
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 deprecated getCellAt and getCoordsForCellItem methods from TreeBoxObject, r=peterv
browser/components/preferences/in-content/search.js
dom/webidl/TreeBoxObject.webidl
layout/xul/tree/TreeBoxObject.cpp
layout/xul/tree/TreeBoxObject.h
--- a/browser/components/preferences/in-content/search.js
+++ b/browser/components/preferences/in-content/search.js
@@ -395,19 +395,18 @@ var gSearchPane = {
       document.getElementById("defaultEngine").selectedItem.engine;
     ExtensionSettingsStore.setByUser(SEARCH_TYPE, SEARCH_KEY);
   },
 };
 
 function onDragEngineStart(event) {
   var selectedIndex = gEngineView.selectedIndex;
   var tree = document.getElementById("engineList");
-  var row = { }, col = { }, child = { };
-  tree.treeBoxObject.getCellAt(event.clientX, event.clientY, row, col, child);
-  if (selectedIndex >= 0 && !gEngineView.isCheckBox(row.value, col.value)) {
+  let cell = tree.treeBoxObject.getCellAt(event.clientX, event.clientY);
+  if (selectedIndex >= 0 && !gEngineView.isCheckBox(cell.row, cell.col)) {
     event.dataTransfer.setData(ENGINE_FLAVOR, selectedIndex.toString());
     event.dataTransfer.effectAllowed = "move";
   }
 }
 
 
 function EngineStore() {
   let pref = Preferences.get("browser.search.hiddenOneOffs").value;
--- a/dom/webidl/TreeBoxObject.webidl
+++ b/dom/webidl/TreeBoxObject.webidl
@@ -127,35 +127,22 @@ interface TreeBoxObject : BoxObject {
    *
    * The coordinate system is the client coordinate system for the
    * document this boxObject lives in, and the units are CSS pixels.
    */
   [Throws]
   TreeCellInfo getCellAt(long x, long y);
 
   /**
-   * DEPRECATED: please use above version
-   */
-  [Throws]
-  void getCellAt(long x, long y, object row, object column, object childElt);
-
-  /**
    * Find the coordinates of an element within a specific cell.
    */
   [Throws]
   DOMRect? getCoordsForCellItem(long row, TreeColumn col, DOMString element);
 
   /**
-   * DEPRECATED: Please use above version
-   */
-  [Throws]
-  void getCoordsForCellItem(long row, TreeColumn col, DOMString element,
-                            object x, object y, object width, object height);
-
-  /**
    * Determine if the text of a cell is being cropped or not.
    */
   [Throws]
   boolean isCellCropped(long row, TreeColumn? col);
 
   /**
    * The view is responsible for calling these notification methods when
    * rows are added or removed.  Index is the position at which the new
--- a/layout/xul/tree/TreeBoxObject.cpp
+++ b/layout/xul/tree/TreeBoxObject.cpp
@@ -357,44 +357,16 @@ TreeBoxObject::GetCellAt(int32_t aX, int
 }
 
 void TreeBoxObject::GetCellAt(int32_t x, int32_t y, TreeCellInfo& aRetVal,
                               ErrorResult& aRv) {
   GetCellAt(x, y, &aRetVal.mRow, getter_AddRefs(aRetVal.mCol),
             aRetVal.mChildElt);
 }
 
-void TreeBoxObject::GetCellAt(JSContext* cx, int32_t x, int32_t y,
-                              JS::Handle<JSObject*> rowOut,
-                              JS::Handle<JSObject*> colOut,
-                              JS::Handle<JSObject*> childEltOut,
-                              ErrorResult& aRv) {
-  int32_t row;
-  RefPtr<nsTreeColumn> col;
-  nsAutoString childElt;
-  GetCellAt(x, y, &row, getter_AddRefs(col), childElt);
-
-  JS::Rooted<JS::Value> v(cx);
-
-  if (!ToJSValue(cx, row, &v) || !JS_SetProperty(cx, rowOut, "value", v)) {
-    aRv.Throw(NS_ERROR_XPC_CANT_SET_OUT_VAL);
-    return;
-  }
-  if (!dom::WrapObject(cx, col, &v) ||
-      !JS_SetProperty(cx, colOut, "value", v)) {
-    aRv.Throw(NS_ERROR_XPC_CANT_SET_OUT_VAL);
-    return;
-  }
-  if (!ToJSValue(cx, childElt, &v) ||
-      !JS_SetProperty(cx, childEltOut, "value", v)) {
-    aRv.Throw(NS_ERROR_XPC_CANT_SET_OUT_VAL);
-    return;
-  }
-}
-
 NS_IMETHODIMP
 TreeBoxObject::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;
   nsTreeBodyFrame* body = GetTreeBodyFrame();
   NS_ConvertUTF16toUTF8 element(aElement);
@@ -408,45 +380,16 @@ already_AddRefed<DOMRect> TreeBoxObject:
     int32_t row, nsTreeColumn& col, const nsAString& element,
     ErrorResult& aRv) {
   int32_t x, y, w, h;
   GetCoordsForCellItem(row, &col, element, &x, &y, &w, &h);
   RefPtr<DOMRect> rect = new DOMRect(mContent, x, y, w, h);
   return rect.forget();
 }
 
-void TreeBoxObject::GetCoordsForCellItem(
-    JSContext* cx, int32_t row, nsTreeColumn& col, const nsAString& element,
-    JS::Handle<JSObject*> xOut, JS::Handle<JSObject*> yOut,
-    JS::Handle<JSObject*> widthOut, JS::Handle<JSObject*> heightOut,
-    ErrorResult& aRv) {
-  int32_t x, y, w, h;
-  GetCoordsForCellItem(row, &col, element, &x, &y, &w, &h);
-  JS::Rooted<JS::Value> v(cx, JS::Int32Value(x));
-  if (!JS_SetProperty(cx, xOut, "value", v)) {
-    aRv.Throw(NS_ERROR_XPC_CANT_SET_OUT_VAL);
-    return;
-  }
-  v.setInt32(y);
-  if (!JS_SetProperty(cx, yOut, "value", v)) {
-    aRv.Throw(NS_ERROR_XPC_CANT_SET_OUT_VAL);
-    return;
-  }
-  v.setInt32(w);
-  if (!JS_SetProperty(cx, widthOut, "value", v)) {
-    aRv.Throw(NS_ERROR_XPC_CANT_SET_OUT_VAL);
-    return;
-  }
-  v.setInt32(h);
-  if (!JS_SetProperty(cx, heightOut, "value", v)) {
-    aRv.Throw(NS_ERROR_XPC_CANT_SET_OUT_VAL);
-    return;
-  }
-}
-
 NS_IMETHODIMP
 TreeBoxObject::IsCellCropped(int32_t aRow, nsTreeColumn* aCol,
                              bool* aIsCropped) {
   *aIsCropped = false;
   nsTreeBodyFrame* body = GetTreeBodyFrame();
   if (body) return body->IsCellCropped(aRow, aCol, aIsCropped);
   return NS_OK;
 }
--- a/layout/xul/tree/TreeBoxObject.h
+++ b/layout/xul/tree/TreeBoxObject.h
@@ -78,28 +78,16 @@ class TreeBoxObject final : public BoxOb
   already_AddRefed<DOMRect> GetCoordsForCellItem(int32_t row, nsTreeColumn& col,
                                                  const nsAString& element,
                                                  ErrorResult& aRv);
 
   bool IsCellCropped(int32_t row, nsTreeColumn* col, ErrorResult& aRv);
 
   void RemoveImageCacheEntry(int32_t row, nsTreeColumn& col, ErrorResult& aRv);
 
-  // Deprecated APIs from old IDL
-  void GetCellAt(JSContext* cx, int32_t x, int32_t y,
-                 JS::Handle<JSObject*> rowOut, JS::Handle<JSObject*> colOut,
-                 JS::Handle<JSObject*> childEltOut, ErrorResult& aRv);
-
-  void GetCoordsForCellItem(JSContext* cx, int32_t row, nsTreeColumn& col,
-                            const nsAString& element,
-                            JS::Handle<JSObject*> xOut,
-                            JS::Handle<JSObject*> yOut,
-                            JS::Handle<JSObject*> widthOut,
-                            JS::Handle<JSObject*> heightOut, ErrorResult& aRv);
-
   // Same signature (except for nsresult return type) as the XPIDL impls
   // void Invalidate();
   // void BeginUpdateBatch();
   // void EndUpdateBatch();
   // void ClearStyleAndImageCaches();
   // void SetFocused(bool arg);
   // void EnsureRowIsVisible(int32_t index);
   // void InvalidateColumn(nsTreeColumn* col);