diff --git a/view/src/nsView.cpp b/view/src/nsView.cpp index c1ddaec16956..20ec62624f32 100644 --- a/view/src/nsView.cpp +++ b/view/src/nsView.cpp @@ -820,7 +820,7 @@ nsIWidget* nsIView::GetNearestWidget(nsPoint* aOffset) const // not coincide with v's origin if (aOffset) { nsRect vBounds = v->GetBounds(); - *aOffset = pt + v->GetPosition() - nsPoint(vBounds.x, vBounds.y) - + *aOffset = pt + v->GetPosition() - nsPoint(vBounds.x, vBounds.y) + v->ViewToWidgetOffset(); } return v->GetWidget(); diff --git a/view/src/nsViewManager.cpp b/view/src/nsViewManager.cpp index d73e3ab3ddf7..533e6b8232c6 100644 --- a/view/src/nsViewManager.cpp +++ b/view/src/nsViewManager.cpp @@ -847,6 +847,7 @@ NS_IMETHODIMP nsViewManager::UpdateView(nsIView *aView, const nsRect &aRect, PRU nsView* view = NS_STATIC_CAST(nsView*, aView); nsRect damagedRect(aRect); + NS_ASSERTION(damagedRect.IsEmpty() || view->GetDimensions().Contains(damagedRect),""); // If the rectangle is not visible then abort // without invalidating. This is a performance @@ -1939,7 +1940,9 @@ void nsViewManager::ViewToWidget(nsView *aView, nsView* aWidgetView, nsRect &aRe // account for the view's origin not lining up with the widget's aRect.x -= bounds.x; aRect.y -= bounds.y; - + + aRect += aView->ViewToWidgetOffset(); + // finally, convert to device coordinates. aRect.ScaleRoundOut(1.0f / mContext->AppUnitsPerDevPixel()); }