зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
fe3852bbf0
Коммит
5e57c3c681
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче