Bug 952827 - Remove unused methods from nsIScrollable. r=roc
authorMats Palmgren <matspal@gmail.com>
Fri, 03 Jan 2014 21:08:50 +0000
changeset 162142 d4015132ceda9523ef172ee10c204873ee9265ec
parent 162141 3919ce6f5b0c944869cf503671028aecf0fcbf75
child 162143 4abc092e62c502e99cbd3dc41cdea3061d2c3bc6
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersroc
bugs952827
milestone29.0a1
Bug 952827 - Remove unused methods from nsIScrollable. r=roc
docshell/base/nsDocShell.cpp
docshell/base/nsDocShell.h
docshell/base/nsIScrollable.idl
embedding/browser/webBrowser/nsWebBrowser.cpp
embedding/browser/webBrowser/nsWebBrowser.h
layout/base/nsCSSFrameConstructor.cpp
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -5791,21 +5791,17 @@ nsDocShell::SetTitle(const PRUnichar * a
         mLoadType != LOAD_ERROR_PAGE) {
 
         mOSHE->SetTitle(mTitle);    
     }
 
     return NS_OK;
 }
 
-//*****************************************************************************
-// nsDocShell::nsIScrollable
-//*****************************************************************************   
-
-NS_IMETHODIMP
+nsresult
 nsDocShell::GetCurScrollPos(int32_t scrollOrientation, int32_t * curPos)
 {
     NS_ENSURE_ARG_POINTER(curPos);
 
     nsIScrollableFrame* sf = GetRootScrollFrame();
     NS_ENSURE_TRUE(sf, NS_ERROR_FAILURE);
 
     nsPoint pt = sf->GetScrollPosition();
@@ -5819,115 +5815,31 @@ nsDocShell::GetCurScrollPos(int32_t scro
         *curPos = pt.y;
         return NS_OK;
 
     default:
         NS_ENSURE_TRUE(false, NS_ERROR_INVALID_ARG);
     }
 }
 
-NS_IMETHODIMP
-nsDocShell::SetCurScrollPos(int32_t scrollOrientation, int32_t curPos)
-{
-    nsIScrollableFrame* sf = GetRootScrollFrame();
-    NS_ENSURE_TRUE(sf, NS_ERROR_FAILURE);
-
-    nsPoint pt = sf->GetScrollPosition();
-
-    switch (scrollOrientation) {
-    case ScrollOrientation_X:
-        pt.x = curPos;
-        break;
-
-    case ScrollOrientation_Y:
-        pt.y = curPos;
-        break;
-
-    default:
-        NS_ENSURE_TRUE(false, NS_ERROR_INVALID_ARG);
-    }
-
-    sf->ScrollTo(pt, nsIScrollableFrame::INSTANT);
-    return NS_OK;
-}
-
-NS_IMETHODIMP
+nsresult
 nsDocShell::SetCurScrollPosEx(int32_t curHorizontalPos, int32_t curVerticalPos)
 {
     nsIScrollableFrame* sf = GetRootScrollFrame();
     NS_ENSURE_TRUE(sf, NS_ERROR_FAILURE);
 
     sf->ScrollTo(nsPoint(curHorizontalPos, curVerticalPos),
                  nsIScrollableFrame::INSTANT);
     return NS_OK;
 }
 
-// XXX This is wrong
-NS_IMETHODIMP
-nsDocShell::GetScrollRange(int32_t scrollOrientation,
-                           int32_t * minPos, int32_t * maxPos)
-{
-    NS_ENSURE_ARG_POINTER(minPos && maxPos);
-
-    nsIScrollableFrame* sf = GetRootScrollFrame();
-    NS_ENSURE_TRUE(sf, NS_ERROR_FAILURE);
-
-    nsSize portSize = sf->GetScrollPortRect().Size();
-    nsRect range = sf->GetScrollRange();
-
-    switch (scrollOrientation) {
-    case ScrollOrientation_X:
-        *minPos = range.x;
-        *maxPos = range.XMost() + portSize.width;
-        return NS_OK;
-
-    case ScrollOrientation_Y:
-        *minPos = range.y;
-        *maxPos = range.YMost() + portSize.height;
-        return NS_OK;
-
-    default:
-        NS_ENSURE_TRUE(false, NS_ERROR_INVALID_ARG);
-    }
-}
-
-NS_IMETHODIMP
-nsDocShell::SetScrollRange(int32_t scrollOrientation,
-                           int32_t minPos, int32_t maxPos)
-{
-    //XXX First Check
-    /*
-       Retrieves or Sets the valid ranges for the thumb.  When maxPos is set to 
-       something less than the current thumb position, curPos is set = to maxPos.
-
-       @return NS_OK - Setting or Getting completed successfully.
-       NS_ERROR_INVALID_ARG - returned when curPos is not within the
-       minPos and maxPos.
-     */
-    return NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-nsDocShell::SetScrollRangeEx(int32_t minHorizontalPos,
-                             int32_t maxHorizontalPos, int32_t minVerticalPos,
-                             int32_t maxVerticalPos)
-{
-    //XXX First Check
-    /*
-       Retrieves or Sets the valid ranges for the thumb.  When maxPos is set to 
-       something less than the current thumb position, curPos is set = to maxPos.
-
-       @return NS_OK - Setting or Getting completed successfully.
-       NS_ERROR_INVALID_ARG - returned when curPos is not within the
-       minPos and maxPos.
-     */
-    return NS_ERROR_FAILURE;
-}
-
-// This returns setting for all documents in this docshell
+//*****************************************************************************
+// nsDocShell::nsIScrollable
+//*****************************************************************************   
+
 NS_IMETHODIMP
 nsDocShell::GetDefaultScrollbarPreferences(int32_t scrollOrientation,
                                            int32_t * scrollbarPref)
 {
     NS_ENSURE_ARG_POINTER(scrollbarPref);
     switch (scrollOrientation) {
     case ScrollOrientation_X:
         *scrollbarPref = mDefaultScrollbarPref.x;
@@ -5938,25 +5850,16 @@ nsDocShell::GetDefaultScrollbarPreferenc
         return NS_OK;
 
     default:
         NS_ENSURE_TRUE(false, NS_ERROR_INVALID_ARG);
     }
     return NS_ERROR_FAILURE;
 }
 
-// Set scrolling preference for all documents in this shell
-//
-// There are three possible values stored in the shell:
-//  1) nsIScrollable::Scrollbar_Never = no scrollbar
-//  2) nsIScrollable::Scrollbar_Auto = scrollbar appears if the document
-//     being displayed would normally have scrollbar
-//  3) nsIScrollable::Scrollbar_Always = scrollbar always appears
-//
-// One important client is nsHTMLFrameInnerFrame::CreateWebShell()
 NS_IMETHODIMP
 nsDocShell::SetDefaultScrollbarPreferences(int32_t scrollOrientation,
                                            int32_t scrollbarPref)
 {
     switch (scrollOrientation) {
     case ScrollOrientation_X:
         mDefaultScrollbarPref.x = scrollbarPref;
         return NS_OK;
--- a/docshell/base/nsDocShell.h
+++ b/docshell/base/nsDocShell.h
@@ -632,16 +632,19 @@ protected:
 
     nsIChannel* GetCurrentDocChannel();
 
     bool ShouldBlockLoadingForBackButton();
 
     // Convenience method for getting our parent docshell.  Can return null
     already_AddRefed<nsDocShell> GetParentDocshell();
 protected:
+    nsresult GetCurScrollPos(int32_t scrollOrientation, int32_t * curPos);
+    nsresult SetCurScrollPosEx(int32_t curHorizontalPos, int32_t curVerticalPos);
+
     // Override the parent setter from nsDocLoader
     virtual nsresult SetDocLoaderParent(nsDocLoader * aLoader);
 
     void ClearFrameHistory(nsISHEntry* aEntry);
 
     /**
      * Initializes mTiming if it isn't yet.
      * After calling this, mTiming is non-null.
--- a/docshell/base/nsIScrollable.idl
+++ b/docshell/base/nsIScrollable.idl
@@ -1,100 +1,55 @@
-/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ * vim: set ts=2 sw=2 et tw=78:
  *
  * 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"
 
 /**
  * The nsIScrollable is an interface that can be implemented by a control that
  * supports scrolling.  This is a generic interface without concern for the 
- * type of content that may be inside.  It simply deals blindly with scroll
- * position as a composite of the lowest possible scroll position, the highest
- * possible position and the current position lying somewhere between the 
- * min and the max.
- *
- * XXXroc in our tree, only get/setDefaultScrollbarPreferences and
- * getScrollbarVisibility are actually used externally. We should gut
- * the rest. nsDocShell is using twips for all these coordinates
- * which is going to confuse people anyway...
+ * type of content that may be inside.
  */
-
-[scriptable, uuid(919e792a-6490-40b8-bba5-f9e9ad5640c8)]
+[scriptable, uuid(3507fc93-313e-4a4c-8ca8-4d0ea0f97315)]
 interface nsIScrollable : nsISupports
 {
-	/*
-	Constants declaring the two scroll orientations a scroll bar can be in.
-        ScrollOrientation_X - Horizontal scrolling.  When passing this
-                in to a scroll position method you are requesting or
-                setting the positions for the horizontal scroll bar.
-        ScrollOrientation_Y - Vertical scrolling.  When passing this
-                in to a scroll position you are requesting or setting
-                the positions for the vertical scroll bar.
-	*/
-	const long ScrollOrientation_X = 1;
-	const long ScrollOrientation_Y = 2;
-
-	/*
-	Retrieves or Sets the current thumb position to the curPos passed in for the
-	scrolling orientation passed in.  curPos should be between minPos and maxPos.
-
-	@return	NS_OK - Setting or Getting completed successfully.
-				NS_ERROR_INVALID_ARG - returned when curPos is not within the
-					minPos and maxPos.
-	*/
-	long getCurScrollPos(in long scrollOrientation);
-	void setCurScrollPos(in long scrollOrientation, in long curPos);
-
-	/*
-	This function atomizes the ability to scroll in two dimensions at the same
-	time.
-	*/
-	void setCurScrollPosEx(in long curHorizontalPos, in long curVerticalPos);
-
-	/*
-	Retrieves or Sets the valid ranges for the thumb.  When maxPos is set to 
-	something less than the current thumb position, curPos is set = to maxPos.
+  /**
+   * Constants declaring the two scroll orientations a scrollbar can be in.
+   * ScrollOrientation_X - Horizontal scrolling.  When passing this
+   *         in to a method you are requesting or setting data for the
+   *         horizontal scrollbar.
+   * ScrollOrientation_Y - Vertical scrolling.  When passing this
+   *         in to a method you are requesting or setting data for the
+   *         vertical scrollbar.
+   */
+  const long ScrollOrientation_X = 1;
+  const long ScrollOrientation_Y = 2;
 
-	@return	NS_OK - Setting or Getting completed successfully.
-				NS_ERROR_INVALID_ARG - returned when curPos is not within the
-					minPos and maxPos.
-	*/
-	void getScrollRange(in long scrollOrientation, out long minPos, out long maxPos);
-	void setScrollRange(in long scrollOrientation, in long minPos, in long maxPos);
-
-	/*
-	This function atomizes the ability to set the ranges in two dimensions at 
-	the same time.
-	*/
-	void setScrollRangeEx(in long minHorizontalPos, in long maxHorizontalPos,
-		in long minVerticalPos, in long maxVerticalPos);
+  /**
+   * Constants declaring the states of the scrollbars.
+   * ScrollPref_Auto - bars visible only when needed.
+   * ScrollPref_Never - bars never visible, even when scrolling still possible.
+   * ScrollPref_Always - bars always visible, even when scrolling is not possible
+   */
+  const long Scrollbar_Auto = 1;
+  const long Scrollbar_Never = 2;
+  const long Scrollbar_Always = 3;
 
-	/*
-	Constants declaring the states of the scroll bars.
-	ScrollPref_Auto - bars visible only when needed.
-	ScrollPref_Never - bars never visible, even when scrolling still possible.
-	ScrollPref_Always - bars always visible, even when scrolling is not possible
-	*/
-	const long Scrollbar_Auto = 1;
-	const long Scrollbar_Never = 2;
-	const long Scrollbar_Always = 3;
+  /**
+   * Get or set the default scrollbar state for all documents in
+   * this shell.
+   */
+  long getDefaultScrollbarPreferences(in long scrollOrientation);
+  void setDefaultScrollbarPreferences(in long scrollOrientation,
+                                      in long scrollbarPref);
 
-	/*
-	Retrieves or Set the preferences for the scroll bar.
-	current is 'scrolling preference for this document'
-	default is 'scrolling preference for all documents in this shell'
-	resetScrollbarPreferences resets current to default
-	*/
-	long getDefaultScrollbarPreferences(in long scrollOrientation);
-	void setDefaultScrollbarPreferences(in long scrollOrientation, in long scrollbarPref);
-
-	/*
-	Get information about whether the vertical and horizontal scrollbars are
-	currently visible.  nullptr is a valid argument.  If you are only interested
-	in one of the visibility settings pass nullptr in for the one you aren't
-	interested in.
-	*/
-	void getScrollbarVisibility(out boolean verticalVisible, 
-		out boolean horizontalVisible);
+  /**
+   * Get information about whether the vertical and horizontal scrollbars are
+   * currently visible.  If you are only interested in one of the visibility
+   * settings pass nullptr in for the one you aren't interested in.
+   */
+  void getScrollbarVisibility(out boolean verticalVisible,
+                              out boolean horizontalVisible);
 };
--- a/embedding/browser/webBrowser/nsWebBrowser.cpp
+++ b/embedding/browser/webBrowser/nsWebBrowser.cpp
@@ -1485,68 +1485,16 @@ NS_IMETHODIMP nsWebBrowser::SetTitle(con
 
    return NS_OK;
 }
 
 //*****************************************************************************
 // nsWebBrowser::nsIScrollable
 //*****************************************************************************
 
-NS_IMETHODIMP nsWebBrowser::GetCurScrollPos(int32_t aScrollOrientation, 
-   int32_t* aCurPos)
-{
-   NS_ENSURE_STATE(mDocShell);
-
-   return mDocShellAsScrollable->GetCurScrollPos(aScrollOrientation, aCurPos);
-}
-
-NS_IMETHODIMP nsWebBrowser::SetCurScrollPos(int32_t aScrollOrientation, 
-   int32_t aCurPos)
-{
-   NS_ENSURE_STATE(mDocShell);
-
-   return mDocShellAsScrollable->SetCurScrollPos(aScrollOrientation, aCurPos);
-}
-
-NS_IMETHODIMP nsWebBrowser::SetCurScrollPosEx(int32_t aCurHorizontalPos, 
-   int32_t aCurVerticalPos)
-{
-   NS_ENSURE_STATE(mDocShell);
-
-   return mDocShellAsScrollable->SetCurScrollPosEx(aCurHorizontalPos, 
-      aCurVerticalPos);
-}
-
-NS_IMETHODIMP nsWebBrowser::GetScrollRange(int32_t aScrollOrientation,
-   int32_t* aMinPos, int32_t* aMaxPos)
-{
-   NS_ENSURE_STATE(mDocShell);
-
-   return mDocShellAsScrollable->GetScrollRange(aScrollOrientation, aMinPos,
-      aMaxPos);
-}
-
-NS_IMETHODIMP nsWebBrowser::SetScrollRange(int32_t aScrollOrientation,
-   int32_t aMinPos, int32_t aMaxPos)
-{
-   NS_ENSURE_STATE(mDocShell);
-
-   return mDocShellAsScrollable->SetScrollRange(aScrollOrientation, aMinPos,
-      aMaxPos);
-}
-
-NS_IMETHODIMP nsWebBrowser::SetScrollRangeEx(int32_t aMinHorizontalPos,
-   int32_t aMaxHorizontalPos, int32_t aMinVerticalPos, int32_t aMaxVerticalPos)
-{
-   NS_ENSURE_STATE(mDocShell);
-
-   return mDocShellAsScrollable->SetScrollRangeEx(aMinHorizontalPos,
-      aMaxHorizontalPos, aMinVerticalPos, aMaxVerticalPos);
-}
-
 NS_IMETHODIMP nsWebBrowser::GetDefaultScrollbarPreferences(int32_t aScrollOrientation,
    int32_t* aScrollbarPref)
 {
    NS_ENSURE_STATE(mDocShell);
 
    return mDocShellAsScrollable->GetDefaultScrollbarPreferences(aScrollOrientation,
       aScrollbarPref);
 }
--- a/embedding/browser/webBrowser/nsWebBrowser.h
+++ b/embedding/browser/webBrowser/nsWebBrowser.h
@@ -63,19 +63,19 @@ public:
         if (mWeakPtr.get() == aListener && mID.Equals(aID)) return true;
         return false;
     }
 
     nsWeakPtr mWeakPtr;
     nsIID mID;
 };
 
-//  {F1EAC761-87E9-11d3-AF80-00A024FFC08C} - 
+//  {cda5863a-aa9c-411e-be49-ea0d525ab4b5} - 
 #define NS_WEBBROWSER_CID \
-{0xf1eac761, 0x87e9, 0x11d3, { 0xaf, 0x80, 0x00, 0xa0, 0x24, 0xff, 0xc0, 0x8c }}
+{0xcda5863a, 0xaa9c, 0x411e, { 0xbe, 0x49, 0xea, 0x0d, 0x52, 0x5a, 0xb4, 0xb5 }}
 
 
 class nsWebBrowser : public nsIWebBrowser,
                      public nsIWebNavigation,
                      public nsIWebBrowserSetup,
                      public nsIDocShellTreeItem,
                      public nsIBaseWindow,
                      public nsIScrollable, 
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -2648,26 +2648,16 @@ nsCSSFrameConstructor::SetUpDocElementCo
 
   // --------- IF SCROLLABLE WRAP IN SCROLLFRAME --------
 
   // If the device supports scrolling (e.g., in galley mode on the screen and
   // for print-preview, but not when printing), then create a scroll frame that
   // will act as the scrolling mechanism for the viewport. 
   // XXX Do we even need a viewport when printing to a printer?
 
-  // As long as the docshell doesn't prohibit it, and the device supports
-  // it, create a scroll frame that will act as the scolling mechanism for
-  // the viewport.
-  //
-  // Threre are three possible values stored in the docshell:
-  //  1) nsIScrollable::Scrollbar_Never = no scrollbars
-  //  2) nsIScrollable::Scrollbar_Auto = scrollbars appear if needed
-  //  3) nsIScrollable::Scrollbar_Always = scrollbars always
-  // Only need to create a scroll frame/view for cases 2 and 3.
-
   bool isHTML = aDocElement->IsHTML();
   bool isXUL = false;
 
   if (!isHTML) {
     isXUL = aDocElement->IsXUL();
   }
 
   // Never create scrollbars for XUL documents