mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Don't use QueryInterface to get a scrollable view from a view b=258521 r+sr=roc
This commit is contained in:
parent
17c0f509c9
commit
a45fb5a046
@ -2500,8 +2500,7 @@ nsHTMLDocument::GetPixelDimensions(nsIPresShell* aShell,
|
||||
// If we have a view check if it's scrollable. If not,
|
||||
// just use the view size itself
|
||||
if (view) {
|
||||
nsIScrollableView* scrollableView = nsnull;
|
||||
CallQueryInterface(view, &scrollableView);
|
||||
nsIScrollableView* scrollableView = view->ToScrollableView();
|
||||
|
||||
if (scrollableView) {
|
||||
scrollableView->GetScrolledView(view);
|
||||
|
@ -1592,9 +1592,9 @@ nsXULDocument::GetPixelDimensions(nsIPresShell* aShell, PRInt32* aWidth,
|
||||
// If we have a view check if it's scrollable. If not,
|
||||
// just use the view size itself
|
||||
if (view) {
|
||||
nsIScrollableView* scrollableView;
|
||||
nsIScrollableView* scrollableView = view->ToScrollableView();
|
||||
|
||||
if (NS_SUCCEEDED(CallQueryInterface(view, &scrollableView))) {
|
||||
if (scrollableView) {
|
||||
scrollableView->GetScrolledView(view);
|
||||
}
|
||||
|
||||
|
@ -4293,8 +4293,8 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
|
||||
nsIView* view = newScrollableFrame->GetView();
|
||||
NS_ENSURE_TRUE(view, NS_ERROR_FAILURE);
|
||||
|
||||
nsIScrollableView* scrollableView = nsnull;
|
||||
NS_ENSURE_SUCCESS(CallQueryInterface(view, &scrollableView), NS_ERROR_FAILURE);
|
||||
nsIScrollableView* scrollableView = view->ToScrollableView();
|
||||
NS_ENSURE_TRUE(scrollableView, NS_ERROR_FAILURE);
|
||||
|
||||
viewManager->SetRootScrollableView(scrollableView);
|
||||
parentFrame = newScrollableFrame;
|
||||
@ -4333,8 +4333,8 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
|
||||
nsIView* view = scrollFrame->GetView();
|
||||
NS_ENSURE_TRUE(view, NS_ERROR_FAILURE);
|
||||
|
||||
nsIScrollableView* scrollableView = nsnull;
|
||||
NS_ENSURE_SUCCESS(CallQueryInterface(view, &scrollableView), NS_ERROR_FAILURE);
|
||||
nsIScrollableView* scrollableView = view->ToScrollableView();
|
||||
NS_ENSURE_TRUE(scrollableView, NS_ERROR_FAILURE);
|
||||
|
||||
viewManager->SetRootScrollableView(scrollableView);
|
||||
|
||||
|
@ -767,7 +767,7 @@ void nsCaret::GetViewForRendering(nsIFrame *caretFrame, EViewCoordinates coordTy
|
||||
do {
|
||||
//is this a scrollable view?
|
||||
if (!scrollableView)
|
||||
theView->QueryInterface(NS_GET_IID(nsIScrollableView), (void **)&scrollableView);
|
||||
scrollableView = theView->ToScrollableView();
|
||||
|
||||
if (theView->HasWidget())
|
||||
{
|
||||
|
@ -401,7 +401,7 @@ nsLayoutUtils::GetNearestScrollingView(nsIView* aView, Direction aDirection)
|
||||
NS_ASSERTION(aView, "GetNearestScrollingView expects a non-null view");
|
||||
nsIScrollableView* scrollableView = nsnull;
|
||||
for (; aView; aView = aView->GetParent()) {
|
||||
CallQueryInterface(aView, &scrollableView);
|
||||
scrollableView = aView->ToScrollableView();
|
||||
if (scrollableView) {
|
||||
nsPresContext::ScrollbarStyles ss =
|
||||
nsLayoutUtils::ScrollbarStylesOfView(scrollableView);
|
||||
|
@ -4247,15 +4247,9 @@ PresShell::ScrollFrameIntoView(nsIFrame *aFrame,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
if (closestView) {
|
||||
nsIScrollableView* _testView = nsnull;
|
||||
CallQueryInterface(closestView, &_testView);
|
||||
NS_ASSERTION(!_testView,
|
||||
"What happened to the scrolled view? "
|
||||
"The frame should not be directly in the scrolling view!");
|
||||
}
|
||||
#endif
|
||||
NS_ASSERTION(closestView && !closestView->ToScrollableView(),
|
||||
"What happened to the scrolled view? "
|
||||
"The frame should not be directly in the scrolling view!");
|
||||
|
||||
// Walk up the view hierarchy. Make sure to add the view's position
|
||||
// _after_ we get the parent and see whether it's scrollable. We want to
|
||||
@ -4264,7 +4258,7 @@ PresShell::ScrollFrameIntoView(nsIFrame *aFrame,
|
||||
while (closestView) {
|
||||
nsIView* parent = closestView->GetParent();
|
||||
if (parent) {
|
||||
CallQueryInterface(parent, &scrollingView);
|
||||
scrollingView = parent->ToScrollableView();
|
||||
if (scrollingView) {
|
||||
ScrollViewToShowRect(scrollingView, frameBounds, aVPercent, aHPercent);
|
||||
}
|
||||
@ -6608,7 +6602,6 @@ PresShell::Observe(nsISupports* aSubject,
|
||||
#ifdef NS_DEBUG
|
||||
#include "nsViewsCID.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsIScrollableView.h"
|
||||
#include "nsIDeviceContext.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsILinkHandler.h"
|
||||
|
@ -767,7 +767,7 @@ void nsCaret::GetViewForRendering(nsIFrame *caretFrame, EViewCoordinates coordTy
|
||||
do {
|
||||
//is this a scrollable view?
|
||||
if (!scrollableView)
|
||||
theView->QueryInterface(NS_GET_IID(nsIScrollableView), (void **)&scrollableView);
|
||||
scrollableView = theView->ToScrollableView();
|
||||
|
||||
if (theView->HasWidget())
|
||||
{
|
||||
|
@ -401,7 +401,7 @@ nsLayoutUtils::GetNearestScrollingView(nsIView* aView, Direction aDirection)
|
||||
NS_ASSERTION(aView, "GetNearestScrollingView expects a non-null view");
|
||||
nsIScrollableView* scrollableView = nsnull;
|
||||
for (; aView; aView = aView->GetParent()) {
|
||||
CallQueryInterface(aView, &scrollableView);
|
||||
scrollableView = aView->ToScrollableView();
|
||||
if (scrollableView) {
|
||||
nsPresContext::ScrollbarStyles ss =
|
||||
nsLayoutUtils::ScrollbarStylesOfView(scrollableView);
|
||||
|
@ -73,7 +73,6 @@
|
||||
#include "nsIDocument.h"
|
||||
#include "nsINodeInfo.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "nsIScrollableView.h"
|
||||
#include "nsListControlFrame.h"
|
||||
#include "nsContentCID.h"
|
||||
#ifdef ACCESSIBILITY
|
||||
@ -529,8 +528,8 @@ nsComboboxControlFrame::ShowPopup(PRBool aShowPopup)
|
||||
nsRect rect = mDropdownFrame->GetRect();
|
||||
rect.x = rect.y = 0;
|
||||
viewManager->ResizeView(view, rect);
|
||||
nsIScrollableView* scrollingView;
|
||||
if (NS_SUCCEEDED(view->QueryInterface(NS_GET_IID(nsIScrollableView), (void**)&scrollingView))) {
|
||||
nsIScrollableView* scrollingView = view->ToScrollableView();
|
||||
if (scrollingView) {
|
||||
scrollingView->ComputeScrollOffsets(PR_TRUE);
|
||||
}
|
||||
viewManager->SetViewVisibility(view, nsViewVisibility_kShow);
|
||||
|
@ -3190,8 +3190,8 @@ nsTextControlFrame::SetInitialChildList(nsPresContext* aPresContext,
|
||||
nsIView *view = first->GetView();
|
||||
if (view)
|
||||
{
|
||||
nsIScrollableView *scrollView;
|
||||
if (NS_SUCCEEDED(CallQueryInterface(view, &scrollView)))
|
||||
nsIScrollableView *scrollView = view->ToScrollableView();
|
||||
if (scrollView)
|
||||
{
|
||||
mScrollableView = scrollView; // Note: views are not addref'd
|
||||
mTextSelImpl->SetScrollableView(scrollView);
|
||||
|
@ -494,8 +494,7 @@ nsContainerFrame::PositionFrameView(nsPresContext* aPresContext,
|
||||
if (parentView) {
|
||||
// If the parent view is scrollable, then adjust the origin by
|
||||
// the parent's scroll position.
|
||||
nsIScrollableView* scrollable = nsnull;
|
||||
CallQueryInterface(parentView, &scrollable);
|
||||
nsIScrollableView* scrollable = parentView->ToScrollableView();
|
||||
if (scrollable) {
|
||||
nscoord scrollX = 0, scrollY = 0;
|
||||
scrollable->GetScrollPosition(scrollX, scrollY);
|
||||
|
@ -1518,12 +1518,8 @@ nsGfxScrollFrameInner::GetScrollableView() const
|
||||
nsIView* view = mScrollAreaBox->GetView();
|
||||
if (!view) return nsnull;
|
||||
|
||||
nsIScrollableView* scrollingView;
|
||||
#ifdef DEBUG
|
||||
nsresult result =
|
||||
#endif
|
||||
CallQueryInterface(view, &scrollingView);
|
||||
NS_ASSERTION(NS_SUCCEEDED(result),
|
||||
nsIScrollableView* scrollingView = view->ToScrollableView();
|
||||
NS_ASSERTION(scrollingView,
|
||||
"assertion gfx scrollframe does not contain a scrollframe");
|
||||
return scrollingView;
|
||||
}
|
||||
|
@ -559,8 +559,8 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIFrame* aFrame,
|
||||
|
||||
// Insert the view into the view hierarchy. If the parent view is a
|
||||
// scrolling view we need to do this differently
|
||||
nsIScrollableView* scrollingView;
|
||||
if (NS_SUCCEEDED(CallQueryInterface(parentView, &scrollingView))) {
|
||||
nsIScrollableView* scrollingView = parentView->ToScrollableView();
|
||||
if (scrollingView) {
|
||||
scrollingView->SetScrolledView(view);
|
||||
} else {
|
||||
nsIView* insertBefore = nsLayoutUtils::FindSiblingViewFor(parentView, aFrame);
|
||||
|
@ -55,7 +55,6 @@
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
#include "nsIDeviceContext.h"
|
||||
#include "nsIScrollableView.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIScrollPositionListener.h"
|
||||
@ -422,11 +421,11 @@ CanvasFrame::Paint(nsPresContext* aPresContext,
|
||||
nsIFrame * parentFrame = GetParent();
|
||||
nsIView* parentView = parentFrame->GetView();
|
||||
|
||||
nsIScrollableView* scrollableView;
|
||||
if (NS_SUCCEEDED(CallQueryInterface(parentView, &scrollableView))) {
|
||||
nsIScrollableView* scrollableView = parentView->ToScrollableView();
|
||||
if (scrollableView) {
|
||||
nscoord width, height;
|
||||
scrollableView->GetContainerSize(&width, &height);
|
||||
nsRect vcr = scrollableView->View()->GetBounds();
|
||||
nsRect vcr = parentView->GetBounds();
|
||||
focusRect.width = vcr.width;
|
||||
focusRect.height = vcr.height;
|
||||
nscoord x,y;
|
||||
|
@ -3586,8 +3586,8 @@ nsPluginInstanceOwner::Destroy()
|
||||
nsIView* curView = parentWithView ? parentWithView->GetView() : nsnull;
|
||||
while (curView)
|
||||
{
|
||||
nsIScrollableView* scrollingView;
|
||||
if (NS_SUCCEEDED(CallQueryInterface(curView, &scrollingView)))
|
||||
nsIScrollableView* scrollingView = curView->ToScrollableView();
|
||||
if (scrollingView)
|
||||
scrollingView->RemoveScrollPositionListener((nsIScrollPositionListener *)this);
|
||||
|
||||
curView = curView->GetParent();
|
||||
@ -3816,8 +3816,8 @@ NS_IMETHODIMP nsPluginInstanceOwner::Init(nsPresContext* aPresContext, nsObjectF
|
||||
nsIView* curView = parentWithView ? parentWithView->GetView() : nsnull;
|
||||
while (curView)
|
||||
{
|
||||
nsIScrollableView* scrollingView;
|
||||
if (NS_SUCCEEDED(CallQueryInterface(curView, &scrollingView)))
|
||||
nsIScrollableView* scrollingView = curView->ToScrollableView();
|
||||
if (scrollingView)
|
||||
scrollingView->AddScrollPositionListener((nsIScrollPositionListener *)this);
|
||||
|
||||
curView = curView->GetParent();
|
||||
|
@ -494,8 +494,7 @@ nsContainerFrame::PositionFrameView(nsPresContext* aPresContext,
|
||||
if (parentView) {
|
||||
// If the parent view is scrollable, then adjust the origin by
|
||||
// the parent's scroll position.
|
||||
nsIScrollableView* scrollable = nsnull;
|
||||
CallQueryInterface(parentView, &scrollable);
|
||||
nsIScrollableView* scrollable = parentView->ToScrollableView();
|
||||
if (scrollable) {
|
||||
nscoord scrollX = 0, scrollY = 0;
|
||||
scrollable->GetScrollPosition(scrollX, scrollY);
|
||||
|
@ -1518,12 +1518,8 @@ nsGfxScrollFrameInner::GetScrollableView() const
|
||||
nsIView* view = mScrollAreaBox->GetView();
|
||||
if (!view) return nsnull;
|
||||
|
||||
nsIScrollableView* scrollingView;
|
||||
#ifdef DEBUG
|
||||
nsresult result =
|
||||
#endif
|
||||
CallQueryInterface(view, &scrollingView);
|
||||
NS_ASSERTION(NS_SUCCEEDED(result),
|
||||
nsIScrollableView* scrollingView = view->ToScrollableView();
|
||||
NS_ASSERTION(scrollingView,
|
||||
"assertion gfx scrollframe does not contain a scrollframe");
|
||||
return scrollingView;
|
||||
}
|
||||
|
@ -559,8 +559,8 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIFrame* aFrame,
|
||||
|
||||
// Insert the view into the view hierarchy. If the parent view is a
|
||||
// scrolling view we need to do this differently
|
||||
nsIScrollableView* scrollingView;
|
||||
if (NS_SUCCEEDED(CallQueryInterface(parentView, &scrollingView))) {
|
||||
nsIScrollableView* scrollingView = parentView->ToScrollableView();
|
||||
if (scrollingView) {
|
||||
scrollingView->SetScrolledView(view);
|
||||
} else {
|
||||
nsIView* insertBefore = nsLayoutUtils::FindSiblingViewFor(parentView, aFrame);
|
||||
|
@ -55,7 +55,6 @@
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
#include "nsIDeviceContext.h"
|
||||
#include "nsIScrollableView.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIScrollPositionListener.h"
|
||||
@ -422,11 +421,11 @@ CanvasFrame::Paint(nsPresContext* aPresContext,
|
||||
nsIFrame * parentFrame = GetParent();
|
||||
nsIView* parentView = parentFrame->GetView();
|
||||
|
||||
nsIScrollableView* scrollableView;
|
||||
if (NS_SUCCEEDED(CallQueryInterface(parentView, &scrollableView))) {
|
||||
nsIScrollableView* scrollableView = parentView->ToScrollableView();
|
||||
if (scrollableView) {
|
||||
nscoord width, height;
|
||||
scrollableView->GetContainerSize(&width, &height);
|
||||
nsRect vcr = scrollableView->View()->GetBounds();
|
||||
nsRect vcr = parentView->GetBounds();
|
||||
focusRect.width = vcr.width;
|
||||
focusRect.height = vcr.height;
|
||||
nscoord x,y;
|
||||
|
@ -3586,8 +3586,8 @@ nsPluginInstanceOwner::Destroy()
|
||||
nsIView* curView = parentWithView ? parentWithView->GetView() : nsnull;
|
||||
while (curView)
|
||||
{
|
||||
nsIScrollableView* scrollingView;
|
||||
if (NS_SUCCEEDED(CallQueryInterface(curView, &scrollingView)))
|
||||
nsIScrollableView* scrollingView = curView->ToScrollableView();
|
||||
if (scrollingView)
|
||||
scrollingView->RemoveScrollPositionListener((nsIScrollPositionListener *)this);
|
||||
|
||||
curView = curView->GetParent();
|
||||
@ -3816,8 +3816,8 @@ NS_IMETHODIMP nsPluginInstanceOwner::Init(nsPresContext* aPresContext, nsObjectF
|
||||
nsIView* curView = parentWithView ? parentWithView->GetView() : nsnull;
|
||||
while (curView)
|
||||
{
|
||||
nsIScrollableView* scrollingView;
|
||||
if (NS_SUCCEEDED(CallQueryInterface(curView, &scrollingView)))
|
||||
nsIScrollableView* scrollingView = curView->ToScrollableView();
|
||||
if (scrollingView)
|
||||
scrollingView->AddScrollPositionListener((nsIScrollPositionListener *)this);
|
||||
|
||||
curView = curView->GetParent();
|
||||
|
@ -4247,15 +4247,9 @@ PresShell::ScrollFrameIntoView(nsIFrame *aFrame,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
if (closestView) {
|
||||
nsIScrollableView* _testView = nsnull;
|
||||
CallQueryInterface(closestView, &_testView);
|
||||
NS_ASSERTION(!_testView,
|
||||
"What happened to the scrolled view? "
|
||||
"The frame should not be directly in the scrolling view!");
|
||||
}
|
||||
#endif
|
||||
NS_ASSERTION(closestView && !closestView->ToScrollableView(),
|
||||
"What happened to the scrolled view? "
|
||||
"The frame should not be directly in the scrolling view!");
|
||||
|
||||
// Walk up the view hierarchy. Make sure to add the view's position
|
||||
// _after_ we get the parent and see whether it's scrollable. We want to
|
||||
@ -4264,7 +4258,7 @@ PresShell::ScrollFrameIntoView(nsIFrame *aFrame,
|
||||
while (closestView) {
|
||||
nsIView* parent = closestView->GetParent();
|
||||
if (parent) {
|
||||
CallQueryInterface(parent, &scrollingView);
|
||||
scrollingView = parent->ToScrollableView();
|
||||
if (scrollingView) {
|
||||
ScrollViewToShowRect(scrollingView, frameBounds, aVPercent, aHPercent);
|
||||
}
|
||||
@ -6608,7 +6602,6 @@ PresShell::Observe(nsISupports* aSubject,
|
||||
#ifdef NS_DEBUG
|
||||
#include "nsViewsCID.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsIScrollableView.h"
|
||||
#include "nsIDeviceContext.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsILinkHandler.h"
|
||||
|
@ -73,7 +73,6 @@
|
||||
#include "nsIDocument.h"
|
||||
#include "nsINodeInfo.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "nsIScrollableView.h"
|
||||
#include "nsListControlFrame.h"
|
||||
#include "nsContentCID.h"
|
||||
#ifdef ACCESSIBILITY
|
||||
@ -529,8 +528,8 @@ nsComboboxControlFrame::ShowPopup(PRBool aShowPopup)
|
||||
nsRect rect = mDropdownFrame->GetRect();
|
||||
rect.x = rect.y = 0;
|
||||
viewManager->ResizeView(view, rect);
|
||||
nsIScrollableView* scrollingView;
|
||||
if (NS_SUCCEEDED(view->QueryInterface(NS_GET_IID(nsIScrollableView), (void**)&scrollingView))) {
|
||||
nsIScrollableView* scrollingView = view->ToScrollableView();
|
||||
if (scrollingView) {
|
||||
scrollingView->ComputeScrollOffsets(PR_TRUE);
|
||||
}
|
||||
viewManager->SetViewVisibility(view, nsViewVisibility_kShow);
|
||||
|
@ -3190,8 +3190,8 @@ nsTextControlFrame::SetInitialChildList(nsPresContext* aPresContext,
|
||||
nsIView *view = first->GetView();
|
||||
if (view)
|
||||
{
|
||||
nsIScrollableView *scrollView;
|
||||
if (NS_SUCCEEDED(CallQueryInterface(view, &scrollView)))
|
||||
nsIScrollableView *scrollView = view->ToScrollableView();
|
||||
if (scrollView)
|
||||
{
|
||||
mScrollableView = scrollView; // Note: views are not addref'd
|
||||
mTextSelImpl->SetScrollableView(scrollView);
|
||||
|
@ -4293,8 +4293,8 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
|
||||
nsIView* view = newScrollableFrame->GetView();
|
||||
NS_ENSURE_TRUE(view, NS_ERROR_FAILURE);
|
||||
|
||||
nsIScrollableView* scrollableView = nsnull;
|
||||
NS_ENSURE_SUCCESS(CallQueryInterface(view, &scrollableView), NS_ERROR_FAILURE);
|
||||
nsIScrollableView* scrollableView = view->ToScrollableView();
|
||||
NS_ENSURE_TRUE(scrollableView, NS_ERROR_FAILURE);
|
||||
|
||||
viewManager->SetRootScrollableView(scrollableView);
|
||||
parentFrame = newScrollableFrame;
|
||||
@ -4333,8 +4333,8 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
|
||||
nsIView* view = scrollFrame->GetView();
|
||||
NS_ENSURE_TRUE(view, NS_ERROR_FAILURE);
|
||||
|
||||
nsIScrollableView* scrollableView = nsnull;
|
||||
NS_ENSURE_SUCCESS(CallQueryInterface(view, &scrollableView), NS_ERROR_FAILURE);
|
||||
nsIScrollableView* scrollableView = view->ToScrollableView();
|
||||
NS_ENSURE_TRUE(scrollableView, NS_ERROR_FAILURE);
|
||||
|
||||
viewManager->SetRootScrollableView(scrollableView);
|
||||
|
||||
|
@ -2453,8 +2453,8 @@ nsBoxFrame::CreateViewForFrame(nsPresContext* aPresContext,
|
||||
|
||||
// Insert the view into the view hierarchy. If the parent view is a
|
||||
// scrolling view we need to do this differently
|
||||
nsIScrollableView* scrollingView;
|
||||
if (NS_SUCCEEDED(CallQueryInterface(parentView, &scrollingView))) {
|
||||
nsIScrollableView* scrollingView = parentView->ToScrollableView();
|
||||
if (scrollingView) {
|
||||
scrollingView->SetScrolledView(view);
|
||||
} else {
|
||||
viewManager->SetViewZIndex(view, autoZIndex, zIndex);
|
||||
|
@ -375,10 +375,7 @@ PRBool ParentIsScrollableView(nsIView* aStartView);
|
||||
PRBool ParentIsScrollableView(nsIView* aStartView)
|
||||
{
|
||||
nsIView* scrollportView = aStartView->GetParent();
|
||||
nsIScrollableView* scrollableView = nsnull;
|
||||
if (scrollportView)
|
||||
scrollportView->QueryInterface(NS_GET_IID(nsIScrollableView), (void**) &scrollableView);
|
||||
return scrollableView != nsnull;
|
||||
return scrollportView != nsnull && scrollportView->ToScrollableView() != nsnull;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -1373,7 +1370,7 @@ nsIScrollableView* nsMenuPopupFrame::GetScrollableView(nsIFrame* aStart)
|
||||
do {
|
||||
nsIView* view = currFrame->GetView();
|
||||
if ( view )
|
||||
CallQueryInterface(view, &scrollableView);
|
||||
scrollableView = view->ToScrollableView();
|
||||
if ( scrollableView )
|
||||
return scrollableView;
|
||||
currFrame = currFrame->GetNextSibling();
|
||||
|
@ -206,12 +206,8 @@ nsScrollBoxFrame::GetScrollingParentView(nsPresContext* aPresContext,
|
||||
nsIView*
|
||||
nsScrollBoxFrame::GetMouseCapturer() const
|
||||
{
|
||||
nsIScrollableView* scrollingView;
|
||||
#ifdef DEBUG
|
||||
nsresult result =
|
||||
#endif
|
||||
CallQueryInterface(GetView(), &scrollingView);
|
||||
NS_ASSERTION(NS_SUCCEEDED(result),
|
||||
nsIScrollableView* scrollingView = GetView()->ToScrollableView();
|
||||
NS_ASSERTION(scrollingView,
|
||||
"Scrollbox does not contain a scrolling view?");
|
||||
nsIView* view;
|
||||
scrollingView->GetScrolledView(view);
|
||||
@ -368,8 +364,8 @@ nsScrollBoxFrame::DoLayout(nsBoxLayoutState& aState)
|
||||
}
|
||||
|
||||
nsIView* view = GetView();
|
||||
nsIScrollableView* scrollingView;
|
||||
if (NS_SUCCEEDED(CallQueryInterface(view, &scrollingView))) {
|
||||
nsIScrollableView* scrollingView = view->ToScrollableView();
|
||||
if (scrollingView) {
|
||||
scrollingView->ComputeScrollOffsets(PR_TRUE);
|
||||
}
|
||||
|
||||
|
@ -543,9 +543,8 @@ nsSplitterFrameInner::MouseDrag(nsPresContext* aPresContext, nsGUIEvent* aEvent)
|
||||
// how much we are scrolled.
|
||||
nsIView* view = parent->GetView();
|
||||
if (view) {
|
||||
nsIScrollableView* scrollingView;
|
||||
nsresult result = CallQueryInterface(view, &scrollingView);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsIScrollableView* scrollingView = view->ToScrollableView();
|
||||
if (scrollingView) {
|
||||
nscoord xoff = 0;
|
||||
nscoord yoff = 0;
|
||||
scrollingView->GetScrollPosition(xoff, yoff);
|
||||
|
@ -840,8 +840,7 @@ nsTreeBodyFrame::AdjustEventCoordsToBoxCoordSpace (PRInt32 aX, PRInt32 aY, PRInt
|
||||
nsIView* parentView = nsLeafBoxFrame::GetView()->GetParent()->GetParent();
|
||||
|
||||
if (parentView) {
|
||||
nsIScrollableView* scrollView = nsnull;
|
||||
CallQueryInterface(parentView, &scrollView);
|
||||
nsIScrollableView* scrollView = parentView->ToScrollableView();
|
||||
if (scrollView) {
|
||||
nscoord scrollX = 0, scrollY = 0;
|
||||
scrollView->GetScrollPosition(scrollX, scrollY);
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "nsIWidget.h"
|
||||
|
||||
class nsIViewManager;
|
||||
class nsIScrollableView;
|
||||
class nsViewManager;
|
||||
class nsView;
|
||||
struct nsRect;
|
||||
@ -113,18 +114,17 @@ struct nsViewZIndex {
|
||||
* of a view, go through nsIViewManager.
|
||||
*/
|
||||
|
||||
// hack to make egcs / gcc 2.95.2 happy
|
||||
class nsIView_base
|
||||
class nsIView
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IVIEW_IID)
|
||||
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) = 0;
|
||||
};
|
||||
/**
|
||||
* See if this view is scrollable.
|
||||
* @result an nsIScrollableView* if the view is scrollable, or nsnull if not.
|
||||
*/
|
||||
virtual nsIScrollableView* ToScrollableView() { return nsnull; }
|
||||
|
||||
class nsIView : public nsIView_base
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Get the view manager which "owns" the view.
|
||||
* This method might require some expensive traversal work in the future. If you can get the
|
||||
|
@ -54,6 +54,8 @@ class nsScrollPortView : public nsView, public nsIScrollableView
|
||||
public:
|
||||
nsScrollPortView(nsViewManager* aViewManager = nsnull);
|
||||
|
||||
virtual nsIScrollableView* ToScrollableView() { return this; }
|
||||
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID,
|
||||
void** aInstancePtr);
|
||||
|
||||
|
@ -120,7 +120,15 @@ NS_IMETHODIMP ViewWrapper::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
|
||||
NS_IMETHODIMP ViewWrapper::GetInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
return mView->QueryInterface(aIID, aInstancePtr);
|
||||
if (aIID.Equals(NS_GET_IID(nsIScrollableView))) {
|
||||
*aInstancePtr = mView->ToScrollableView();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(NS_GET_IID(nsIView))) {
|
||||
*aInstancePtr = mView;
|
||||
return NS_OK;
|
||||
}
|
||||
return QueryInterface(aIID, aInstancePtr);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user