Bug 382595: SVG image is covered with horizonal lines when scrolled. r+sr=roc.
authorsharparrow1@yahoo.com
Wed, 27 Jun 2007 23:02:05 -0700
changeset 2899 6ddaa58d245b2190b58b49a16804fd2af849838c
parent 2898 cafa5de3d00a29a70eba4df8e45164bf68fe59a6
child 2900 cfbaa929a76306f0396d0e1459459117128892ca
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
bugs382595
milestone1.9a6pre
Bug 382595: SVG image is covered with horizonal lines when scrolled. r+sr=roc.
view/src/nsView.cpp
view/src/nsViewManager.cpp
--- a/view/src/nsView.cpp
+++ b/view/src/nsView.cpp
@@ -815,17 +815,17 @@ nsIWidget* nsIView::GetNearestWidget(nsP
     return NS_STATIC_CAST(const nsView*, this)->GetViewManager()->GetWidget();
   }
 
   // pt is now the offset from v's origin to this's origin
   // The widget's origin is the top left corner of v's bounds, which may
   // 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();
 }
 
 PRBool nsIView::IsRoot() const
 {
   NS_ASSERTION(mViewManager != nsnull," View manager is null in nsView::IsRoot()");
--- a/view/src/nsViewManager.cpp
+++ b/view/src/nsViewManager.cpp
@@ -842,16 +842,17 @@ nsViewManager::UpdateWidgetArea(nsView *
 
 NS_IMETHODIMP nsViewManager::UpdateView(nsIView *aView, const nsRect &aRect, PRUint32 aUpdateFlags)
 {
   NS_PRECONDITION(nsnull != aView, "null view");
 
   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 
    // enhancement since invalidating a native widget
    // can be expensive.
    // This also checks for silly request like damagedRect.width = 0 or damagedRect.height = 0
   nsRectVisibility rectVisibility;
   GetRectVisibility(view, damagedRect, 0, &rectVisibility);
@@ -1934,17 +1935,19 @@ void nsViewManager::ViewToWidget(nsView 
   
   // intersect aRect with bounds of aWidgetView, to prevent generating any illegal rectangles.
   nsRect bounds;
   aWidgetView->GetDimensions(bounds);
   aRect.IntersectRect(aRect, bounds);
   // 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());
 }
 
 nsresult nsViewManager::GetVisibleRect(nsRect& aVisibleRect)
 {
   nsresult rv = NS_OK;