diff --git a/mozilla/view/public/nsIViewManager.h b/mozilla/view/public/nsIViewManager.h index cb6cc86e363..0074540b975 100644 --- a/mozilla/view/public/nsIViewManager.h +++ b/mozilla/view/public/nsIViewManager.h @@ -100,22 +100,12 @@ public: NS_IMETHOD SetWindowDimensions(nscoord width, nscoord height) = 0; /** - * Get the position of the root window relative to the - * composited area. This indicates the scrolled position of the - * root window. + * Get the position of the window relative to the composited + * area. This indicates the scrolled position of the window. * @param xoffset out parameter for X scroll position of window in twips * @param yoffset out parameter for Y scroll position of window in twips */ - NS_IMETHOD GetWindowOffsets(nscoord *xoffset, nscoord *yoffset) = 0; - - /** - * Set the position of the root window relative to the - * composited area. This indicates the scrolled position of the - * root window. Called when the root window is scrolled. - * @param xoffset X scroll position of window in twips - * @param yoffset Y scroll position of window in twips - */ - NS_IMETHOD SetWindowOffsets(nscoord xoffset, nscoord yoffset) = 0; + NS_IMETHOD GetWindowOffsets(nsIView *aView, nscoord *xoffset, nscoord *yoffset) const = 0; /** * Reset the state of scrollbars and the scrolling region diff --git a/mozilla/view/src/nsViewManager.cpp b/mozilla/view/src/nsViewManager.cpp index 00b290c9a62..ac78c8b61e0 100644 --- a/mozilla/view/src/nsViewManager.cpp +++ b/mozilla/view/src/nsViewManager.cpp @@ -236,13 +236,13 @@ NS_IMETHODIMP nsViewManager :: SetWindowDimensions(nscoord width, nscoord height return NS_OK; } -NS_IMETHODIMP nsViewManager :: GetWindowOffsets(nscoord *xoffset, nscoord *yoffset) +NS_IMETHODIMP nsViewManager :: GetWindowOffsets(nsIView *aView, nscoord *xoffset, nscoord *yoffset) const { if (nsnull != mRootView) { nsIScrollableView *scroller; - if (NS_OK == mRootView->QueryInterface(kIScrollableViewIID, (void **)&scroller)) + if (NS_OK == aView->QueryInterface(kIScrollableViewIID, (void **)&scroller)) scroller->GetVisibleOffset(xoffset, yoffset); else *xoffset = *yoffset = 0; @@ -252,24 +252,6 @@ NS_IMETHODIMP nsViewManager :: GetWindowOffsets(nscoord *xoffset, nscoord *yoffs return NS_OK; } -NS_IMETHODIMP nsViewManager :: SetWindowOffsets(nscoord xoffset, nscoord yoffset) -{ - if (nsnull != mRootView) - { - nsIScrollableView *scroller; - nsresult retval; - - retval = mRootView->QueryInterface(kIScrollableViewIID, (void **)&scroller); - - if (NS_SUCCEEDED(retval)) - scroller->SetVisibleOffset(xoffset, yoffset); - - return retval; - } - - return NS_OK; -} - NS_IMETHODIMP nsViewManager :: ResetScrolling(void) { if (nsnull != mRootView) @@ -334,7 +316,7 @@ void nsViewManager :: Refresh(nsIView *aView, nsIRenderingContext *aContext, nsI mContext->GetAppUnitsToDevUnits(scale); - GetWindowOffsets(&xoff, &yoff); + GetWindowOffsets(aView, &xoff, &yoff); region->Offset(NSTwipsToIntPixels(-xoff, scale), NSTwipsToIntPixels(-yoff, scale)); // localcx->SetClipRegion(*region, nsClipCombine_kIntersect); @@ -423,7 +405,7 @@ void nsViewManager :: Refresh(nsIView *aView, nsIRenderingContext *aContext, con if (aUpdateFlags & NS_VMREFRESH_SCREEN_RECT) localcx->SetClipRect(*rect, nsClipCombine_kReplace); - GetWindowOffsets(&xoff, &yoff); + GetWindowOffsets(aView, &xoff, &yoff); nsRect trect = *rect; @@ -572,15 +554,9 @@ NS_IMETHODIMP nsViewManager :: UpdateView(nsIView *aView, const nsRect &aRect, P while ((nsnull != par) && (par != widgetView)); } - // If widgetView is a scrolling view, then offset the rect by the visible - // offset - nsIScrollableView *scroller; - if (NS_OK == widgetView->QueryInterface(kIScrollableViewIID, (void **)&scroller)) - { - nscoord xoffset, yoffset; - scroller->GetVisibleOffset(&xoffset, &yoffset); - trect.MoveBy(-xoffset, -yoffset); - } + nscoord xoffset, yoffset; + GetWindowOffsets(widgetView, &xoffset, &yoffset); + trect.MoveBy(-xoffset, -yoffset); // Add this rect to the widgetView's dirty region. AddRectToDirtyRegion(widgetView, trect); @@ -675,15 +651,9 @@ NS_IMETHODIMP nsViewManager :: DispatchEvent(nsGUIEvent *aEvent, nsEventStatus & mContext->GetDevUnitsToAppUnits(p2t); trect.ScaleRoundOut(p2t); - // If the view is a scrolling view, then offset the rect by the visible - // offset - nsIScrollableView *scroller; - if (NS_OK == view->QueryInterface(kIScrollableViewIID, (void **)&scroller)) - { - nscoord xoffset, yoffset; - scroller->GetVisibleOffset(&xoffset, &yoffset); - trect.MoveBy(xoffset, yoffset); - } + nscoord xoffset, yoffset; + GetWindowOffsets(view, &xoffset, &yoffset); + trect.MoveBy(xoffset, yoffset); // Add the rect to the existing dirty region AddRectToDirtyRegion(view, trect); diff --git a/mozilla/view/src/nsViewManager.h b/mozilla/view/src/nsViewManager.h index b8fd3a5e2dd..b4eff710a7e 100644 --- a/mozilla/view/src/nsViewManager.h +++ b/mozilla/view/src/nsViewManager.h @@ -50,8 +50,7 @@ public: NS_IMETHOD GetWindowDimensions(nscoord *width, nscoord *height); NS_IMETHOD SetWindowDimensions(nscoord width, nscoord height); - NS_IMETHOD GetWindowOffsets(nscoord *xoffset, nscoord *yoffset); - NS_IMETHOD SetWindowOffsets(nscoord xoffset, nscoord yoffset); + NS_IMETHOD GetWindowOffsets(nsIView *aView, nscoord *xoffset, nscoord *yoffset) const; NS_IMETHOD ResetScrolling(void);