Bug 1466851 part 1. Remove some unused tree box object properties. r=mossop
authorBoris Zbarsky <bzbarsky@mit.edu>
Tue, 05 Jun 2018 23:01:49 -0400
changeset 421566 5b8e7ac3a4a51ee85ec31852935aac78eed09751
parent 421565 830e780325e49a0b9c90449e50b943bad39a09f4
child 421567 99016a1b41052d29a024b045bcfc4a6f47d6375f
push id34098
push usernbeleuzu@mozilla.com
push dateWed, 06 Jun 2018 17:00:32 +0000
treeherdermozilla-central@04cc917f68c5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmossop
bugs1466851
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 1466851 part 1. Remove some unused tree box object properties. r=mossop These properties are not used from either JS or C++, and hence can be removed from both nsITreeBoxObject and TreeBoxObject.webidl. Properties in this bucket: scrollToCell, scrollToColumn, scrollToHorizontalPosition, invalidateColumnRange.
dom/webidl/TreeBoxObject.webidl
layout/xul/tree/TreeBoxObject.cpp
layout/xul/tree/TreeBoxObject.h
layout/xul/tree/nsITreeBoxObject.idl
layout/xul/tree/nsTreeBodyFrame.cpp
layout/xul/tree/nsTreeBodyFrame.h
--- a/dom/webidl/TreeBoxObject.webidl
+++ b/dom/webidl/TreeBoxObject.webidl
@@ -101,41 +101,23 @@ interface TreeBoxObject : BoxObject {
    * Scroll the tree up or down by numPages pages. A page
    * is considered to be the amount displayed by the tree.
    * Positive values move down in the tree. Prevents scrolling
    * off the end of the tree.
    */
   void scrollByPages(long numPages);
 
   /**
-   * Scrolls such that a given cell is visible (if possible)
-   * at the top left corner of the visible view.
-   */
-  void scrollToCell(long row, TreeColumn? col);
-
-  /**
-   * Scrolls horizontally so that the specified column is
-   * at the left of the view (if possible).
-   */
-  void scrollToColumn(TreeColumn? col);
-
-  /**
-   * Scroll to a specific horizontal pixel position.
-   */
-  void scrollToHorizontalPosition(long horizontalPosition);
-
-  /**
    * Invalidation methods for fine-grained painting control.
    */
   void invalidate();
   void invalidateColumn(TreeColumn? col);
   void invalidateRow(long index);
   void invalidateCell(long row, TreeColumn? col);
   void invalidateRange(long startIndex, long endIndex);
-  void invalidateColumnRange(long startIndex, long endIndex, TreeColumn? col);
 
   /**
    * A hit test that can tell you what row the mouse is over.
    * returns -1 for invalid mouse coordinates.
    *
    * The coordinate system is the client coordinate system for the
    * document this boxObject lives in, and the units are CSS pixels.
    */
--- a/layout/xul/tree/TreeBoxObject.cpp
+++ b/layout/xul/tree/TreeBoxObject.cpp
@@ -383,43 +383,16 @@ NS_IMETHODIMP
 TreeBoxObject::ScrollByPages(int32_t aNumPages)
 {
   nsTreeBodyFrame* body = GetTreeBodyFrame();
   if (body)
     return body->ScrollByPages(aNumPages);
   return NS_OK;
 }
 
-NS_IMETHODIMP
-TreeBoxObject::ScrollToCell(int32_t aRow, nsTreeColumn* aCol)
-{
-  nsTreeBodyFrame* body = GetTreeBodyFrame();
-  if (body)
-    return body->ScrollToCell(aRow, aCol);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-TreeBoxObject::ScrollToColumn(nsTreeColumn* aCol)
-{
-  nsTreeBodyFrame* body = GetTreeBodyFrame();
-  if (body)
-    return body->ScrollToColumn(aCol);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-TreeBoxObject::ScrollToHorizontalPosition(int32_t aHorizontalPosition)
-{
-  nsTreeBodyFrame* body = GetTreeBodyFrame();
-  if (body)
-    return body->ScrollToHorizontalPosition(aHorizontalPosition);
-  return NS_OK;
-}
-
 NS_IMETHODIMP TreeBoxObject::Invalidate()
 {
   nsTreeBodyFrame* body = GetTreeBodyFrame();
   if (body)
     return body->Invalidate();
   return NS_OK;
 }
 
@@ -455,25 +428,16 @@ TreeBoxObject::InvalidateRange(int32_t a
 {
   nsTreeBodyFrame* body = GetTreeBodyFrame();
   if (body)
     return body->InvalidateRange(aStart, aEnd);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-TreeBoxObject::InvalidateColumnRange(int32_t aStart, int32_t aEnd, nsTreeColumn* aCol)
-{
-  nsTreeBodyFrame* body = GetTreeBodyFrame();
-  if (body)
-    return body->InvalidateColumnRange(aStart, aEnd, aCol);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 TreeBoxObject::GetRowAt(int32_t x, int32_t y, int32_t *aRow)
 {
   *aRow = 0;
   nsTreeBodyFrame* body = GetTreeBodyFrame();
   if (body)
     return body->GetRowAt(x, y, aRow);
   return NS_OK;
 }
--- a/layout/xul/tree/TreeBoxObject.h
+++ b/layout/xul/tree/TreeBoxObject.h
@@ -104,24 +104,20 @@ public:
   // void EndUpdateBatch();
   // void ClearStyleAndImageCaches();
   // void SetFocused(bool arg);
   // void EnsureRowIsVisible(int32_t index);
   // void EnsureCellIsVisible(int32_t row, nsTreeColumn* col);
   // void ScrollToRow(int32_t index);
   // void ScrollByLines(int32_t numLines);
   // void ScrollByPages(int32_t numPages);
-  // void ScrollToCell(int32_t row, nsTreeColumn* col);
-  // void ScrollToColumn(nsTreeColumn* col);
-  // void ScrollToHorizontalPosition(int32_t horizontalPosition);
   // void InvalidateColumn(nsTreeColumn* col);
   // void InvalidateRow(int32_t index);
   // void InvalidateCell(int32_t row, nsTreeColumn* col);
   // void InvalidateRange(int32_t startIndex, int32_t endIndex);
-  // void InvalidateColumnRange(int32_t startIndex, int32_t endIndex, nsTreeColumn* col);
   // void RowCountChanged(int32_t index, int32_t count);
 
 protected:
   nsTreeBodyFrame* mTreeBody;
   nsCOMPtr<nsITreeView> mView;
 
 private:
   ~TreeBoxObject();
--- a/layout/xul/tree/nsITreeBoxObject.idl
+++ b/layout/xul/tree/nsITreeBoxObject.idl
@@ -102,42 +102,23 @@ interface nsITreeBoxObject : nsISupports
    * Scroll the tree up or down by numPages pages. A page
    * is considered to be the amount displayed by the tree.
    * Positive values move down in the tree. Prevents scrolling
    * off the end of the tree.
    */
   void scrollByPages(in long numPages);
   
   /**
-   * Scrolls such that a given cell is visible (if possible) 
-   * at the top left corner of the visible view. 
-   */
-  void scrollToCell(in long row, in TreeColumn col);
-
-  /**
-   * Scrolls horizontally so that the specified column is 
-   * at the left of the view (if possible).
-   */
-  void scrollToColumn(in TreeColumn col);
-
-  /**
-   * Scroll to a specific horizontal pixel position.
-   */
-  void scrollToHorizontalPosition(in long horizontalPosition);
-
-  /**
    * Invalidation methods for fine-grained painting control.
    */
   void invalidate();
   void invalidateColumn(in TreeColumn col);
   void invalidateRow(in long index);
   void invalidateCell(in long row, in TreeColumn col);
   void invalidateRange(in long startIndex, in long endIndex);
-  void invalidateColumnRange(in long startIndex, in long endIndex,
-                             in TreeColumn col);
 
   /**
    * A hit test that can tell you what row the mouse is over.
    * returns -1 for invalid mouse coordinates.
    *
    * The coordinate system is the client coordinate system for the
    * document this boxObject lives in, and the units are CSS pixels.
    */
--- a/layout/xul/tree/nsTreeBodyFrame.cpp
+++ b/layout/xul/tree/nsTreeBodyFrame.cpp
@@ -737,58 +737,16 @@ nsTreeBodyFrame::InvalidateRange(int32_t
 #endif
 
   nsRect rangeRect(mInnerBox.x, mInnerBox.y+mRowHeight*(aStart-mTopRowIndex), mInnerBox.width, mRowHeight*(aEnd-aStart+1));
   InvalidateFrameWithRect(rangeRect);
 
   return NS_OK;
 }
 
-nsresult
-nsTreeBodyFrame::InvalidateColumnRange(int32_t aStart, int32_t aEnd, nsTreeColumn* aCol)
-{
-  if (mUpdateBatchNest)
-    return NS_OK;
-
-  if (!aCol)
-    return NS_ERROR_INVALID_ARG;
-
-  if (aStart == aEnd)
-    return InvalidateCell(aStart, aCol);
-
-  int32_t last = LastVisibleRow();
-  if (aStart > aEnd || aEnd < mTopRowIndex || aStart > last)
-    return NS_OK;
-
-  if (aStart < mTopRowIndex)
-    aStart = mTopRowIndex;
-
-  if (aEnd > last)
-    aEnd = last;
-
-#ifdef ACCESSIBILITY
-  if (nsIPresShell::IsAccessibilityActive()) {
-    int32_t end =
-      mRowCount > 0 ? ((mRowCount <= aEnd) ? mRowCount - 1 : aEnd) : 0;
-    FireInvalidateEvent(aStart, end, aCol, aCol);
-  }
-#endif
-
-  nsRect rangeRect;
-  nsresult rv = aCol->GetRect(this,
-                              mInnerBox.y+mRowHeight*(aStart-mTopRowIndex),
-                              mRowHeight*(aEnd-aStart+1),
-                              &rangeRect);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  InvalidateFrameWithRect(rangeRect);
-
-  return NS_OK;
-}
-
 static void
 FindScrollParts(nsIFrame* aCurrFrame, nsTreeBodyFrame::ScrollParts* aResult)
 {
   if (!aResult->mColumnsScrollFrame) {
     nsIScrollableFrame* f = do_QueryFrame(aCurrFrame);
     if (f) {
       aResult->mColumnsFrame = aCurrFrame;
       aResult->mColumnsScrollFrame = f;
@@ -4096,65 +4054,16 @@ nsTreeBodyFrame::EnsureCellIsVisible(int
 
   rv = EnsureRowIsVisibleInternal(parts, aRow);
   NS_ENSURE_SUCCESS(rv, rv);
   UpdateScrollbars(parts);
   return rv;
 }
 
 nsresult
-nsTreeBodyFrame::ScrollToCell(int32_t aRow, nsTreeColumn* aCol)
-{
-  ScrollParts parts = GetScrollParts();
-  nsresult rv = ScrollToRowInternal(parts, aRow);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  rv = ScrollToColumnInternal(parts, aCol);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  UpdateScrollbars(parts);
-  return rv;
-}
-
-nsresult
-nsTreeBodyFrame::ScrollToColumn(nsTreeColumn* aCol)
-{
-  ScrollParts parts = GetScrollParts();
-  nsresult rv = ScrollToColumnInternal(parts, aCol);
-  NS_ENSURE_SUCCESS(rv, rv);
-  UpdateScrollbars(parts);
-  return rv;
-}
-
-nsresult nsTreeBodyFrame::ScrollToColumnInternal(const ScrollParts& aParts,
-                                                 nsTreeColumn* aCol)
-{
-  if (!aCol)
-    return NS_ERROR_INVALID_ARG;
-
-  nscoord x;
-  nsresult rv = aCol->GetXInTwips(this, &x);
-  if (NS_FAILED(rv))
-    return rv;
-
-  return ScrollHorzInternal(aParts, x);
-}
-
-nsresult
-nsTreeBodyFrame::ScrollToHorizontalPosition(int32_t aHorizontalPosition)
-{
-  ScrollParts parts = GetScrollParts();
-  int32_t position = nsPresContext::CSSPixelsToAppUnits(aHorizontalPosition);
-  nsresult rv = ScrollHorzInternal(parts, position);
-  NS_ENSURE_SUCCESS(rv, rv);
-  UpdateScrollbars(parts);
-  return rv;
-}
-
-nsresult
 nsTreeBodyFrame::ScrollToRow(int32_t aRow)
 {
   ScrollParts parts = GetScrollParts();
   ScrollToRowInternal(parts, aRow);
   UpdateScrollbars(parts);
   return NS_OK;
 }
 
--- a/layout/xul/tree/nsTreeBodyFrame.h
+++ b/layout/xul/tree/nsTreeBodyFrame.h
@@ -90,26 +90,21 @@ public:
   int32_t FirstVisibleRow() const { return mTopRowIndex; }
   int32_t LastVisibleRow() const { return mTopRowIndex + mPageLength; }
   int32_t PageLength() const { return mPageLength; }
   nsresult EnsureRowIsVisible(int32_t aRow);
   nsresult EnsureCellIsVisible(int32_t aRow, nsTreeColumn *aCol);
   nsresult ScrollToRow(int32_t aRow);
   nsresult ScrollByLines(int32_t aNumLines);
   nsresult ScrollByPages(int32_t aNumPages);
-  nsresult ScrollToCell(int32_t aRow, nsTreeColumn *aCol);
-  nsresult ScrollToColumn(nsTreeColumn *aCol);
-  nsresult ScrollToHorizontalPosition(int32_t aValue);
   nsresult Invalidate();
   nsresult InvalidateColumn(nsTreeColumn *aCol);
   nsresult InvalidateRow(int32_t aRow);
   nsresult InvalidateCell(int32_t aRow, nsTreeColumn *aCol);
   nsresult InvalidateRange(int32_t aStart, int32_t aEnd);
-  nsresult InvalidateColumnRange(int32_t aStart, int32_t aEnd,
-                                 nsTreeColumn *aCol);
   nsresult GetRowAt(int32_t aX, int32_t aY, int32_t *aValue);
   nsresult GetCellAt(int32_t aX, int32_t aY, int32_t *aRow,
                      nsTreeColumn **aCol, nsACString &aChildElt);
   nsresult GetCoordsForCellItem(int32_t aRow, nsTreeColumn *aCol,
                                 const nsACString &aElt,
                                 int32_t *aX, int32_t *aY,
                                 int32_t *aWidth, int32_t *aHeight);
   nsresult IsCellCropped(int32_t aRow, nsTreeColumn *aCol, bool *aResult);
@@ -380,17 +375,16 @@ protected:
 
   // Use to auto-fill some of the common properties without the view having to do it.
   // Examples include container, open, selected, and focus.
   void PrefillPropertyArray(int32_t aRowIndex, nsTreeColumn* aCol);
 
   // Our internal scroll method, used by all the public scroll methods.
   nsresult ScrollInternal(const ScrollParts& aParts, int32_t aRow);
   nsresult ScrollToRowInternal(const ScrollParts& aParts, int32_t aRow);
-  nsresult ScrollToColumnInternal(const ScrollParts& aParts, nsTreeColumn* aCol);
   nsresult ScrollHorzInternal(const ScrollParts& aParts, int32_t aPosition);
   nsresult EnsureRowIsVisibleInternal(const ScrollParts& aParts, int32_t aRow);
 
   // Convert client pixels into appunits in our coordinate space.
   nsPoint AdjustClientCoordsToBoxCoordSpace(int32_t aX, int32_t aY);
 
   // Cache the box object
   void EnsureBoxObject();