Bug 296315. Remove unimplemented nsIScrollableView::GetScrollbarVisibility, implement nsDocShell::GetScrollbarVisibiilty to use nsIScrollableFrame::GetActualScrollbarSizes, which actually works. r+sr=bzbarsky,a=asa

This commit is contained in:
roc+%cs.cmu.edu 2005-06-17 02:48:29 +00:00
parent 26ce4cd8a3
commit 3876d7f8c7
5 changed files with 16 additions and 27 deletions

View File

@ -77,6 +77,7 @@
#include "nsIScriptObjectPrincipal.h"
#include "nsDocumentCharsetInfoCID.h"
#include "nsICanvasFrame.h"
#include "nsIScrollableFrame.h"
#include "nsContentPolicyUtils.h" // NS_CheckContentLoadPolicy(...)
#include "nsICategoryManager.h"
#include "nsXPCOMCID.h"
@ -3955,21 +3956,25 @@ nsDocShell::GetScrollbarVisibility(PRBool * verticalVisible,
nsIScrollableView* scrollView;
NS_ENSURE_SUCCESS(GetRootScrollableView(&scrollView),
NS_ERROR_FAILURE);
if (!scrollView) {
if (!scrollView)
return NS_ERROR_FAILURE;
}
PRBool vertVisible;
PRBool horizVisible;
NS_ENSURE_SUCCESS(scrollView->GetScrollbarVisibility(&vertVisible,
&horizVisible),
NS_ERROR_FAILURE);
// We should now call nsLayoutUtils::GetScrollableFrameFor,
// but we can't because of stupid linkage!
nsIFrame* scrollFrame =
NS_STATIC_CAST(nsIFrame*, scrollView->View()->GetParent()->GetClientData());
if (!scrollFrame)
return NS_ERROR_FAILURE;
nsIScrollableFrame* scrollable = nsnull;
CallQueryInterface(scrollFrame, &scrollable);
if (!scrollable)
return NS_ERROR_FAILURE;
nsMargin scrollbars = scrollable->GetActualScrollbarSizes();
if (verticalVisible)
*verticalVisible = vertVisible;
*verticalVisible = scrollbars.left != 0 || scrollbars.right != 0;
if (horizontalVisible)
*horizontalVisible = horizVisible;
*horizontalVisible = scrollbars.top != 0 || scrollbars.bottom != 0;
return NS_OK;
}

View File

@ -43,8 +43,8 @@
#include "nsIViewManager.h"
#include "nsIScrollableViewProvider.h"
#include "nsPresContext.h"
#include "nsIFrame.h" // to get nsIBox, which is a typedef
class nsIFrame;
class nsBoxLayoutState;
// IID for the nsIScrollableFrame interface

View File

@ -108,13 +108,6 @@ public:
*/
NS_IMETHOD ScrollTo(nscoord aX, nscoord aY, PRUint32 aUpdateFlags) = 0;
/**
* Get information about whether the vertical and horizontal scrollbars
* are currently visible
*/
NS_IMETHOD GetScrollbarVisibility(PRBool *aVerticalVisible,
PRBool *aHorizontalVisible) const = 0;
/**
* Set the properties describing how scrolling can be performed
* in this scrollable.

View File

@ -328,13 +328,6 @@ NS_IMETHODIMP nsScrollPortView::ScrollTo(nscoord aDestinationX, nscoord aDestina
return NS_OK;
}
NS_IMETHODIMP nsScrollPortView::GetScrollbarVisibility(PRBool *aVerticalVisible,
PRBool *aHorizontalVisible) const
{
NS_WARNING("Attempt to get scrollbars visibility this is not xp!");
return NS_OK;
}
static void AdjustChildWidgets(nsView *aView,
nsPoint aWidgetToParentViewOrigin, float aScale, PRBool aInvalidate)
{

View File

@ -69,8 +69,6 @@ public:
NS_IMETHOD GetScrollPosition(nscoord &aX, nscoord &aY) const;
NS_IMETHOD ScrollTo(nscoord aX, nscoord aY, PRUint32 aUpdateFlags);
NS_IMETHOD GetScrollbarVisibility(PRBool *aVerticalVisible,
PRBool *aHorizontalVisible) const;
NS_IMETHOD SetScrollProperties(PRUint32 aProperties);
NS_IMETHOD GetScrollProperties(PRUint32 *aProperties);
NS_IMETHOD SetLineHeight(nscoord aHeight);