Bug 1149260 - Guard against trying to draw a drag image with zero length. r=enndeakin

This commit is contained in:
Kartikaya Gupta 2015-04-02 20:45:50 -04:00
parent 9cffc6129c
commit f8e5361559
2 changed files with 4 additions and 0 deletions

View File

@ -5168,6 +5168,8 @@ PresShell::PaintRangePaintInfo(nsTArray<nsAutoPtr<RangePaintInfo> >* aItems,
pixelArea.width = NSToIntFloor(float(pixelArea.width) * scale);
pixelArea.height = NSToIntFloor(float(pixelArea.height) * scale);
if (!pixelArea.width || !pixelArea.height)
return nullptr;
// adjust the screen position based on the rescaled size
nscoord left = rootScreenRect.x + pixelArea.x;

View File

@ -612,6 +612,8 @@ nsBaseDragService::DrawDragForImage(nsPresContext* aPresContext,
destSize.width = NSToIntFloor(float(destSize.width) * scale);
destSize.height = NSToIntFloor(float(destSize.height) * scale);
if (destSize.width == 0 || destSize.height == 0)
return NS_ERROR_FAILURE;
aScreenDragRect->x = NSToIntFloor(aScreenX - float(mImageX) * scale);
aScreenDragRect->y = NSToIntFloor(aScreenY - float(mImageY) * scale);