From 6a4f37de6b89ef07f8b44233c7f7c5d5d102b896 Mon Sep 17 00:00:00 2001 From: "neil%parkwaycc.co.uk" Date: Mon, 20 Sep 2004 22:25:07 +0000 Subject: [PATCH] Don't use QueryInterface to get a view from a scrollable view b=258521 r+sr=roc --- accessible/src/base/nsDocAccessible.cpp | 6 +-- content/base/src/nsSelection.cpp | 52 +++---------------- content/events/src/nsEventStateManager.cpp | 19 ++----- .../html/content/src/nsGenericHTMLElement.cpp | 10 +--- content/html/document/src/nsImageDocument.cpp | 6 +-- dom/src/base/nsGlobalWindow.cpp | 6 +-- layout/base/nsCaret.cpp | 6 +-- layout/base/nsPresShell.cpp | 5 +- layout/base/src/nsCaret.cpp | 6 +-- layout/forms/nsListControlFrame.cpp | 4 +- layout/generic/nsHTMLFrame.cpp | 4 +- layout/generic/nsSelection.cpp | 52 +++---------------- layout/html/base/src/nsHTMLFrame.cpp | 4 +- layout/html/base/src/nsPresShell.cpp | 5 +- layout/html/forms/src/nsListControlFrame.cpp | 4 +- layout/xul/base/src/nsMenuPopupFrame.cpp | 28 +++++----- view/public/nsIScrollableView.h | 7 +-- view/src/nsScrollPortView.cpp | 5 +- view/src/nsScrollPortView.h | 2 +- view/src/nsViewManager.cpp | 9 +--- 20 files changed, 51 insertions(+), 189 deletions(-) diff --git a/accessible/src/base/nsDocAccessible.cpp b/accessible/src/base/nsDocAccessible.cpp index db91cf4dae8a..0a8dd1634f31 100644 --- a/accessible/src/base/nsDocAccessible.cpp +++ b/accessible/src/base/nsDocAccessible.cpp @@ -443,11 +443,7 @@ void nsDocAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** aRelativeFrame) nsRect viewBounds(0, 0, 0, 0); if (scrollableView) { - const nsIView *view = nsnull; - scrollableView->GetClipView(&view); - if (view) { - viewBounds = view->GetBounds(); - } + viewBounds = scrollableView->View()->GetBounds(); } else { nsIView *view; diff --git a/content/base/src/nsSelection.cpp b/content/base/src/nsSelection.cpp index 6d3560a47326..b154d9f4e70a 100644 --- a/content/base/src/nsSelection.cpp +++ b/content/base/src/nsSelection.cpp @@ -2903,7 +2903,6 @@ nsSelection::CommonPageMove(PRBool aForward, // and remain relative position of the caret in view. see Bug 4302. nsresult result; - const nsIView* clipView; //get the frame from the scrollable view nsIFrame* mainframe = nsnull; @@ -2922,9 +2921,7 @@ nsSelection::CommonPageMove(PRBool aForward, return NS_ERROR_FAILURE; // find out where we are; determine amount to page up/down - if (NS_FAILED(result = aScrollableView->GetClipView(&clipView))) - return result; - nsRect viewRect = clipView->GetBounds(); + nsRect viewRect = aScrollableView->View()->GetBounds(); // find out where the caret is. // we should know mDesiredX value of nsSelection, but I havent seen that behavior in other windows applications yet. @@ -5251,17 +5248,6 @@ nsTypedSelection::ScrollPointIntoClipView(nsPresContext *aPresContext, nsIView * if (!scrollableView) return NS_OK; // Nothing to do! - // - // Get the clip view. - // - - const nsIView *cView = 0; - - result = scrollableView->GetClipView(&cView); - - if (NS_FAILED(result)) - return result; - // // Get the view that is being scrolled. // @@ -5269,8 +5255,6 @@ nsTypedSelection::ScrollPointIntoClipView(nsPresContext *aPresContext, nsIView * nsIView *scrolledView = 0; result = scrollableView->GetScrolledView(scrolledView); - if (!cView) - return NS_ERROR_FAILURE; // // Now walk up aView's hierarchy, this time keeping track of @@ -5289,7 +5273,7 @@ nsTypedSelection::ScrollPointIntoClipView(nsPresContext *aPresContext, nsIView * // If it is, scroll the view till it is inside the visible area! // - nsRect bounds = cView->GetBounds(); + nsRect bounds = scrollableView->View()->GetBounds(); result = scrollableView->GetScrollPosition(bounds.x,bounds.y); @@ -5445,9 +5429,7 @@ nsTypedSelection::ScrollPointIntoView(nsPresContext *aPresContext, nsIView *aVie // nsIView *scrolledView = 0; - nsIView *view = 0; - - CallQueryInterface(scrollableView, &view); + nsIView *view = scrollableView->View(); if (view) { @@ -5500,12 +5482,7 @@ nsTypedSelection::ScrollPointIntoView(nsPresContext *aPresContext, nsIView *aVie // can scroll the next parent view. // - view = 0; - result = CallQueryInterface(scrollableView, &view); - if (!view) - return result; - - view = view->GetParent(); + view = scrollableView->View()->GetParent(); } } } @@ -6976,14 +6953,7 @@ nsTypedSelection::GetSelectionRegionRectAndScrollableView(SelectionRegion aRegio // padding! // - const nsIView* clipView = 0; - - result = (*aScrollableView)->GetClipView(&clipView); - - if (NS_FAILED(result)) - return result; - - nsRect clipRect = clipView->GetBounds(); + nsRect clipRect = (*aScrollableView)->View()->GetBounds(); result = (*aScrollableView)->GetScrollPosition(clipRect.x, clipRect.y); @@ -7072,10 +7042,7 @@ nsTypedSelection::ScrollRectIntoView(nsIScrollableView *aScrollableView, // Determine the visible rect in the scrolled view's coordinate space. // The size of the visible area is the clip view size - const nsIView* clipView; - - aScrollableView->GetClipView(&clipView); - nsRect visibleRect = clipView->GetBounds(); + nsRect visibleRect = aScrollableView->View()->GetBounds(); aScrollableView->GetScrollPosition(visibleRect.x, visibleRect.y); // The actual scroll offsets @@ -7147,12 +7114,7 @@ nsTypedSelection::ScrollRectIntoView(nsIScrollableView *aScrollableView, // Check if aScrollableRect has a parent scrollable view! // - nsIView *view = 0; - rv = CallQueryInterface(aScrollableView, &view); - if (!view) - return rv; - - view = view->GetParent(); + nsIView *view = aScrollableView->View()->GetParent(); if (view) { diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index 8da2676cb181..99232bce4d0d 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -1690,17 +1690,11 @@ nsEventStateManager::DoScrollText(nsPresContext* aPresContext, nsSize scrolledSize; scrollView->GetContainerSize(&scrolledSize.width, &scrolledSize.height); - nsIView* portView = nsnull; - CallQueryInterface(scrollView, &portView); - if (portView) { - nsRect portRect = portView->GetBounds(); + nsRect portRect = scrollView->View()->GetBounds(); - passToParent = (aScrollHorizontal ? - (xPos + portRect.width >= scrolledSize.width) : - (yPos + portRect.height >= scrolledSize.height)); - } else { - NS_WARNING("failed to get view from scrollview"); - } + passToParent = (aScrollHorizontal ? + (xPos + portRect.width >= scrolledSize.width) : + (yPos + portRect.height >= scrolledSize.height)); } // Comboboxes need special care. @@ -1742,10 +1736,7 @@ nsEventStateManager::DoScrollText(nsPresContext* aPresContext, else scrollView->ScrollByLines(scrollX, scrollY); - nsIView* updateView = nsnull; - CallQueryInterface(scrollView, &updateView); - if (updateView) - ForceViewUpdate(updateView); + ForceViewUpdate(scrollView->View()); } if (passToParent) { nsresult rv; diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp index 318ee4ab77a6..3f5312dd9a61 100644 --- a/content/html/content/src/nsGenericHTMLElement.cpp +++ b/content/html/content/src/nsGenericHTMLElement.cpp @@ -1209,10 +1209,7 @@ nsGenericHTMLElement::GetClientHeight(PRInt32* aClientHeight) GetScrollInfo(&scrollView, &p2t, &t2p, &frame); if (scrollView) { - const nsIView *view = nsnull; - - scrollView->GetClipView(&view); - nsRect r = view->GetBounds(); + nsRect r = scrollView->View()->GetBounds(); *aClientHeight = NSTwipsToIntPixels(r.height, t2p); } else if (frame && @@ -1240,10 +1237,7 @@ nsGenericHTMLElement::GetClientWidth(PRInt32* aClientWidth) GetScrollInfo(&scrollView, &p2t, &t2p, &frame); if (scrollView) { - const nsIView *view = nsnull; - - scrollView->GetClipView(&view); - nsRect r = view->GetBounds(); + nsRect r = scrollView->View()->GetBounds(); *aClientWidth = NSTwipsToIntPixels(r.width, t2p); } else if (frame && diff --git a/content/html/document/src/nsImageDocument.cpp b/content/html/document/src/nsImageDocument.cpp index e9abc2cbd763..1eb411951afb 100644 --- a/content/html/document/src/nsImageDocument.cpp +++ b/content/html/document/src/nsImageDocument.cpp @@ -391,15 +391,11 @@ nsImageDocument::RestoreImageTo(PRInt32 aX, PRInt32 aY) if (!view) return NS_OK; - nsIView* portView; - if (NS_FAILED(CallQueryInterface(view, &portView))) - return NS_OK; - nsSize scrolledSize; if (NS_FAILED(view->GetContainerSize(&scrolledSize.width, &scrolledSize.height))) return NS_OK; - nsRect portRect = portView->GetBounds(); + nsRect portRect = view->View()->GetBounds(); view->ScrollTo((nscoord)(aX / (ratio * mImageWidth) * PR_MAX(0, scrolledSize.width - portRect.width) + 0.5), (nscoord)(aY / (ratio * mImageHeight) * PR_MAX(0, scrolledSize.height - portRect.height) + 0.5), NS_VMREFRESH_IMMEDIATE); diff --git a/dom/src/base/nsGlobalWindow.cpp b/dom/src/base/nsGlobalWindow.cpp index b2eb3ab570e9..552831b91efd 100644 --- a/dom/src/base/nsGlobalWindow.cpp +++ b/dom/src/base/nsGlobalWindow.cpp @@ -1958,11 +1958,7 @@ GlobalWindowImpl::GetScrollMaxXY(PRInt32* aScrollMaxX, PRInt32* aScrollMaxY) rv = view->GetContainerSize(&scrolledSize.width, &scrolledSize.height); NS_ENSURE_SUCCESS(rv, rv); - nsIView* portView; - rv = CallQueryInterface(view, &portView); - NS_ENSURE_SUCCESS(rv, rv); - - nsRect portRect = portView->GetBounds(); + nsRect portRect = view->View()->GetBounds(); if (aScrollMaxX) *aScrollMaxX = PR_MAX(0, diff --git a/layout/base/nsCaret.cpp b/layout/base/nsCaret.cpp index 1d6291517872..6a540eaa5776 100644 --- a/layout/base/nsCaret.cpp +++ b/layout/base/nsCaret.cpp @@ -784,11 +784,7 @@ void nsCaret::GetViewForRendering(nsIFrame *caretFrame, EViewCoordinates coordTy if (scrollableView) { - const nsIView* clipView = nsnull; - scrollableView->GetClipView(&clipView); - if (!clipView) return; // should always have one - - nsRect bounds = clipView->GetBounds(); + nsRect bounds = scrollableView->View()->GetBounds(); scrollableView->GetScrollPosition(bounds.x, bounds.y); bounds += drawViewOffset; // offset to coords of returned view diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 3d9aa8ac4750..7de231409ea0 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -4040,10 +4040,7 @@ static void ScrollViewToShowRect(nsIScrollableView* aScrollingView, { // Determine the visible rect in the scrolling view's coordinate space. // The size of the visible area is the clip view size - const nsIView* clipView; - - aScrollingView->GetClipView(&clipView); - nsRect visibleRect = clipView->GetBounds(); // get width and height + nsRect visibleRect = aScrollingView->View()->GetBounds(); // get width and height aScrollingView->GetScrollPosition(visibleRect.x, visibleRect.y); // The actual scroll offsets diff --git a/layout/base/src/nsCaret.cpp b/layout/base/src/nsCaret.cpp index 1d6291517872..6a540eaa5776 100644 --- a/layout/base/src/nsCaret.cpp +++ b/layout/base/src/nsCaret.cpp @@ -784,11 +784,7 @@ void nsCaret::GetViewForRendering(nsIFrame *caretFrame, EViewCoordinates coordTy if (scrollableView) { - const nsIView* clipView = nsnull; - scrollableView->GetClipView(&clipView); - if (!clipView) return; // should always have one - - nsRect bounds = clipView->GetBounds(); + nsRect bounds = scrollableView->View()->GetBounds(); scrollableView->GetScrollPosition(bounds.x, bounds.y); bounds += drawViewOffset; // offset to coords of returned view diff --git a/layout/forms/nsListControlFrame.cpp b/layout/forms/nsListControlFrame.cpp index 8e0472ec1e8e..c77030fe8caf 100644 --- a/layout/forms/nsListControlFrame.cpp +++ b/layout/forms/nsListControlFrame.cpp @@ -2776,13 +2776,11 @@ nsListControlFrame::ScrollToFrame(nsIContent* aOptElement) if (NS_SUCCEEDED(result) && childframe) { if (NS_SUCCEEDED(result) && scrollableView) { - const nsIView * clippedView; - scrollableView->GetClipView(&clippedView); nscoord x; nscoord y; scrollableView->GetScrollPosition(x,y); // get the clipped rect - nsRect rect = clippedView->GetBounds(); + nsRect rect = scrollableView->View()->GetBounds(); // now move it by the offset of the scroll position rect.x = x; rect.y = y; diff --git a/layout/generic/nsHTMLFrame.cpp b/layout/generic/nsHTMLFrame.cpp index 8a88e8aa89c9..baf4d58026f8 100644 --- a/layout/generic/nsHTMLFrame.cpp +++ b/layout/generic/nsHTMLFrame.cpp @@ -426,9 +426,7 @@ CanvasFrame::Paint(nsPresContext* aPresContext, if (NS_SUCCEEDED(CallQueryInterface(parentView, &scrollableView))) { nscoord width, height; scrollableView->GetContainerSize(&width, &height); - const nsIView* clippedView; - scrollableView->GetClipView(&clippedView); - nsRect vcr = clippedView->GetBounds(); + nsRect vcr = scrollableView->View()->GetBounds(); focusRect.width = vcr.width; focusRect.height = vcr.height; nscoord x,y; diff --git a/layout/generic/nsSelection.cpp b/layout/generic/nsSelection.cpp index 6d3560a47326..b154d9f4e70a 100644 --- a/layout/generic/nsSelection.cpp +++ b/layout/generic/nsSelection.cpp @@ -2903,7 +2903,6 @@ nsSelection::CommonPageMove(PRBool aForward, // and remain relative position of the caret in view. see Bug 4302. nsresult result; - const nsIView* clipView; //get the frame from the scrollable view nsIFrame* mainframe = nsnull; @@ -2922,9 +2921,7 @@ nsSelection::CommonPageMove(PRBool aForward, return NS_ERROR_FAILURE; // find out where we are; determine amount to page up/down - if (NS_FAILED(result = aScrollableView->GetClipView(&clipView))) - return result; - nsRect viewRect = clipView->GetBounds(); + nsRect viewRect = aScrollableView->View()->GetBounds(); // find out where the caret is. // we should know mDesiredX value of nsSelection, but I havent seen that behavior in other windows applications yet. @@ -5251,17 +5248,6 @@ nsTypedSelection::ScrollPointIntoClipView(nsPresContext *aPresContext, nsIView * if (!scrollableView) return NS_OK; // Nothing to do! - // - // Get the clip view. - // - - const nsIView *cView = 0; - - result = scrollableView->GetClipView(&cView); - - if (NS_FAILED(result)) - return result; - // // Get the view that is being scrolled. // @@ -5269,8 +5255,6 @@ nsTypedSelection::ScrollPointIntoClipView(nsPresContext *aPresContext, nsIView * nsIView *scrolledView = 0; result = scrollableView->GetScrolledView(scrolledView); - if (!cView) - return NS_ERROR_FAILURE; // // Now walk up aView's hierarchy, this time keeping track of @@ -5289,7 +5273,7 @@ nsTypedSelection::ScrollPointIntoClipView(nsPresContext *aPresContext, nsIView * // If it is, scroll the view till it is inside the visible area! // - nsRect bounds = cView->GetBounds(); + nsRect bounds = scrollableView->View()->GetBounds(); result = scrollableView->GetScrollPosition(bounds.x,bounds.y); @@ -5445,9 +5429,7 @@ nsTypedSelection::ScrollPointIntoView(nsPresContext *aPresContext, nsIView *aVie // nsIView *scrolledView = 0; - nsIView *view = 0; - - CallQueryInterface(scrollableView, &view); + nsIView *view = scrollableView->View(); if (view) { @@ -5500,12 +5482,7 @@ nsTypedSelection::ScrollPointIntoView(nsPresContext *aPresContext, nsIView *aVie // can scroll the next parent view. // - view = 0; - result = CallQueryInterface(scrollableView, &view); - if (!view) - return result; - - view = view->GetParent(); + view = scrollableView->View()->GetParent(); } } } @@ -6976,14 +6953,7 @@ nsTypedSelection::GetSelectionRegionRectAndScrollableView(SelectionRegion aRegio // padding! // - const nsIView* clipView = 0; - - result = (*aScrollableView)->GetClipView(&clipView); - - if (NS_FAILED(result)) - return result; - - nsRect clipRect = clipView->GetBounds(); + nsRect clipRect = (*aScrollableView)->View()->GetBounds(); result = (*aScrollableView)->GetScrollPosition(clipRect.x, clipRect.y); @@ -7072,10 +7042,7 @@ nsTypedSelection::ScrollRectIntoView(nsIScrollableView *aScrollableView, // Determine the visible rect in the scrolled view's coordinate space. // The size of the visible area is the clip view size - const nsIView* clipView; - - aScrollableView->GetClipView(&clipView); - nsRect visibleRect = clipView->GetBounds(); + nsRect visibleRect = aScrollableView->View()->GetBounds(); aScrollableView->GetScrollPosition(visibleRect.x, visibleRect.y); // The actual scroll offsets @@ -7147,12 +7114,7 @@ nsTypedSelection::ScrollRectIntoView(nsIScrollableView *aScrollableView, // Check if aScrollableRect has a parent scrollable view! // - nsIView *view = 0; - rv = CallQueryInterface(aScrollableView, &view); - if (!view) - return rv; - - view = view->GetParent(); + nsIView *view = aScrollableView->View()->GetParent(); if (view) { diff --git a/layout/html/base/src/nsHTMLFrame.cpp b/layout/html/base/src/nsHTMLFrame.cpp index 8a88e8aa89c9..baf4d58026f8 100644 --- a/layout/html/base/src/nsHTMLFrame.cpp +++ b/layout/html/base/src/nsHTMLFrame.cpp @@ -426,9 +426,7 @@ CanvasFrame::Paint(nsPresContext* aPresContext, if (NS_SUCCEEDED(CallQueryInterface(parentView, &scrollableView))) { nscoord width, height; scrollableView->GetContainerSize(&width, &height); - const nsIView* clippedView; - scrollableView->GetClipView(&clippedView); - nsRect vcr = clippedView->GetBounds(); + nsRect vcr = scrollableView->View()->GetBounds(); focusRect.width = vcr.width; focusRect.height = vcr.height; nscoord x,y; diff --git a/layout/html/base/src/nsPresShell.cpp b/layout/html/base/src/nsPresShell.cpp index 3d9aa8ac4750..7de231409ea0 100644 --- a/layout/html/base/src/nsPresShell.cpp +++ b/layout/html/base/src/nsPresShell.cpp @@ -4040,10 +4040,7 @@ static void ScrollViewToShowRect(nsIScrollableView* aScrollingView, { // Determine the visible rect in the scrolling view's coordinate space. // The size of the visible area is the clip view size - const nsIView* clipView; - - aScrollingView->GetClipView(&clipView); - nsRect visibleRect = clipView->GetBounds(); // get width and height + nsRect visibleRect = aScrollingView->View()->GetBounds(); // get width and height aScrollingView->GetScrollPosition(visibleRect.x, visibleRect.y); // The actual scroll offsets diff --git a/layout/html/forms/src/nsListControlFrame.cpp b/layout/html/forms/src/nsListControlFrame.cpp index 8e0472ec1e8e..c77030fe8caf 100644 --- a/layout/html/forms/src/nsListControlFrame.cpp +++ b/layout/html/forms/src/nsListControlFrame.cpp @@ -2776,13 +2776,11 @@ nsListControlFrame::ScrollToFrame(nsIContent* aOptElement) if (NS_SUCCEEDED(result) && childframe) { if (NS_SUCCEEDED(result) && scrollableView) { - const nsIView * clippedView; - scrollableView->GetClipView(&clippedView); nscoord x; nscoord y; scrollableView->GetScrollPosition(x,y); // get the clipped rect - nsRect rect = clippedView->GetBounds(); + nsRect rect = scrollableView->View()->GetBounds(); // now move it by the offset of the scroll position rect.x = x; rect.y = y; diff --git a/layout/xul/base/src/nsMenuPopupFrame.cpp b/layout/xul/base/src/nsMenuPopupFrame.cpp index 9eb27181c90a..6dceec9dcbef 100644 --- a/layout/xul/base/src/nsMenuPopupFrame.cpp +++ b/layout/xul/base/src/nsMenuPopupFrame.cpp @@ -1407,23 +1407,19 @@ void nsMenuPopupFrame::EnsureMenuItemIsVisible(nsIMenuFrame* aMenuItem) nsIScrollableView *scrollableView; scrollableView=GetScrollableView(childFrame); if ( scrollableView ) { - nsIView* view=nsnull; - scrollableView->QueryInterface(NS_GET_IID(nsIView), (void**)&view); - if ( view ) { - nscoord scrollX, scrollY; + nscoord scrollX, scrollY; - nsRect viewRect = view->GetBounds(); - nsRect itemRect = frame->GetRect(); - scrollableView->GetScrollPosition(scrollX, scrollY); - - // scroll down - if ( itemRect.y + itemRect.height > scrollY + viewRect.height ) - scrollableView->ScrollTo(scrollX, itemRect.y + itemRect.height - viewRect.height, NS_SCROLL_PROPERTY_ALWAYS_BLIT); - - // scroll up - else if ( itemRect.y < scrollY ) - scrollableView->ScrollTo(scrollX, itemRect.y, NS_SCROLL_PROPERTY_ALWAYS_BLIT); - } + nsRect viewRect = scrollableView->View()->GetBounds(); + nsRect itemRect = frame->GetRect(); + scrollableView->GetScrollPosition(scrollX, scrollY); + + // scroll down + if ( itemRect.y + itemRect.height > scrollY + viewRect.height ) + scrollableView->ScrollTo(scrollX, itemRect.y + itemRect.height - viewRect.height, NS_SCROLL_PROPERTY_ALWAYS_BLIT); + + // scroll up + else if ( itemRect.y < scrollY ) + scrollableView->ScrollTo(scrollX, itemRect.y, NS_SCROLL_PROPERTY_ALWAYS_BLIT); } } } diff --git a/view/public/nsIScrollableView.h b/view/public/nsIScrollableView.h index 7d1253b22085..32f7a372862e 100644 --- a/view/public/nsIScrollableView.h +++ b/view/public/nsIScrollableView.h @@ -68,8 +68,6 @@ class nsIScrollableView { public: NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISCROLLABLEVIEW_IID) - NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) = 0; - /** * Create the controls used to allow scrolling. Call this method * before anything else is done with the scrollable view. @@ -192,10 +190,9 @@ public: NS_IMETHOD ScrollByWhole(PRBool aTop) = 0; /** - * Returns the clip view - * XXX Obsolete; with nsScrollingView gone, this always returns 'this' + * Returns the view as an nsIView* */ - NS_IMETHOD GetClipView(const nsIView** aClipView) const = 0; + NS_IMETHOD_(nsIView*) View() = 0; /** * Adds a scroll position listener. diff --git a/view/src/nsScrollPortView.cpp b/view/src/nsScrollPortView.cpp index 647aacfd14de..f51fb9b5bff8 100644 --- a/view/src/nsScrollPortView.cpp +++ b/view/src/nsScrollPortView.cpp @@ -123,10 +123,9 @@ nsresult nsScrollPortView::QueryInterface(const nsIID& aIID, void** aInstancePtr return nsView::QueryInterface(aIID, aInstancePtr); } -NS_IMETHODIMP nsScrollPortView::GetClipView(const nsIView** aClipView) const +NS_IMETHODIMP_(nsIView*) nsScrollPortView::View() { - *aClipView = this; - return NS_OK; + return this; } NS_IMETHODIMP nsScrollPortView::AddScrollPositionListener(nsIScrollPositionListener* aListener) diff --git a/view/src/nsScrollPortView.h b/view/src/nsScrollPortView.h index 753bff68a011..438603ac107d 100644 --- a/view/src/nsScrollPortView.h +++ b/view/src/nsScrollPortView.h @@ -78,7 +78,7 @@ public: NS_IMETHOD ScrollByPages(PRInt32 aNumPagesX, PRInt32 aNumPagesY); NS_IMETHOD ScrollByWhole(PRBool aTop); - NS_IMETHOD GetClipView(const nsIView** aClipView) const; + NS_IMETHOD_(nsIView*) View(); NS_IMETHOD AddScrollPositionListener(nsIScrollPositionListener* aListener); NS_IMETHOD RemoveScrollPositionListener(nsIScrollPositionListener* aListener); diff --git a/view/src/nsViewManager.cpp b/view/src/nsViewManager.cpp index 1cb3d693a9c0..2ccf789283cc 100644 --- a/view/src/nsViewManager.cpp +++ b/view/src/nsViewManager.cpp @@ -2834,9 +2834,7 @@ PRBool nsViewManager::CanScrollWithBitBlt(nsView* aView) // the root scrollable) are on top. nsRegion opaqueRegion; if (mRootScrollable != nsnull) { - const nsIView* scrollableClipView; - mRootScrollable->GetClipView(&scrollableClipView); - if (IsAncestorOf(NS_STATIC_CAST(const nsView*, scrollableClipView), aView)) { + if (IsAncestorOf(NS_STATIC_CAST(const nsScrollPortView*, mRootScrollable), aView)) { // add areas of fixed views to the opaque area. // This is a bit of a hack. We should not be doing special case processing for fixed views. nsView* fixedView = mRootView->GetFirstChild(); @@ -3898,10 +3896,7 @@ nsresult nsViewManager::GetVisibleRect(nsRect& aVisibleRect) if (scrollingView) { // Determine the visible rect in the scrolled view's coordinate space. // The size of the visible area is the clip view size - const nsIView* clipViewI; - scrollingView->GetClipView(&clipViewI); - - const nsView* clipView = NS_STATIC_CAST(const nsView*, clipViewI); + nsScrollPortView* clipView = NS_STATIC_CAST(nsScrollPortView*, scrollingView); clipView->GetDimensions(aVisibleRect); scrollingView->GetScrollPosition(aVisibleRect.x, aVisibleRect.y);