Bug 670564 - "ASSERTION: illegal left edge" in nsDisplayText::Paint. r=roc
authorMats Palmgren <matspal@gmail.com>
Mon, 11 Jul 2011 22:18:26 +0200
changeset 73048 21d1ecfeabd8597a907d83c5bbbd423e3340a439
parent 73047 748c0e1c37121689ba577df68c824f4adf4e4f78
child 73049 94bf463e00408dc4d875592387a420ac56189d0b
push idunknown
push userunknown
push dateunknown
reviewersroc
bugs670564
milestone8.0a1
Bug 670564 - "ASSERTION: illegal left edge" in nsDisplayText::Paint. r=roc
layout/generic/TextOverflow.cpp
--- a/layout/generic/TextOverflow.cpp
+++ b/layout/generic/TextOverflow.cpp
@@ -551,20 +551,30 @@ TextOverflow::PruneDisplayListContents(n
     }
 
     nsCharClipDisplayItem* charClip = itemFrame ? 
       nsCharClipDisplayItem::CheckCast(item) : nsnull;
     if (charClip && GetSelfOrNearestBlock(itemFrame) == mBlock) {
       nsRect rect = itemFrame->GetScrollableOverflowRect() +
                     itemFrame->GetOffsetTo(mBlock);
       if (mLeft.IsNeeded() && rect.x < aInsideMarkersArea.x) {
-        charClip->mLeftEdge = aInsideMarkersArea.x - rect.x;
+        nscoord left = aInsideMarkersArea.x - rect.x;
+        if (NS_UNLIKELY(left < 0)) {
+          item->~nsDisplayItem();
+          continue;
+        }
+        charClip->mLeftEdge = left;
       }
       if (mRight.IsNeeded() && rect.XMost() > aInsideMarkersArea.XMost()) {
-        charClip->mRightEdge = rect.XMost() - aInsideMarkersArea.XMost();
+        nscoord right = rect.XMost() - aInsideMarkersArea.XMost();
+        if (NS_UNLIKELY(right < 0)) {
+          item->~nsDisplayItem();
+          continue;
+        }
+        charClip->mRightEdge = right;
       }
     }
 
     saved.AppendToTop(item);
   }
   aList->AppendToTop(&saved);
 }