Bug 1109263 - Clamp the reftest drawWindow call to the canvas. r=dbaron

In some cases the area reported by MozAfterPaint can be extremely large. Since
that area determines what we pass to drawWindow, we could end up trying to
drawWindow an area that is too large for drawWindow to handle. Instead, this
patch clamps that area to the canvas size so that we don't unnecessarily try to
paint (and fail at painting) the whole invalid area.
This commit is contained in:
Kartikaya Gupta 2014-12-10 07:50:47 -05:00
Родитель 0ea8e1da1f
Коммит 239293451e
1 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -1480,6 +1480,12 @@ function UpdateCurrentCanvasForInvalidation(rects)
var right = Math.ceil(r.right);
var bottom = Math.ceil(r.bottom);
// Clamp the values to the canvas size
left = Math.max(0, Math.min(left, gCurrentCanvas.width));
top = Math.max(0, Math.min(top, gCurrentCanvas.height));
right = Math.max(0, Math.min(right, gCurrentCanvas.width));
bottom = Math.max(0, Math.min(bottom, gCurrentCanvas.height));
ctx.save();
ctx.translate(left, top);
DoDrawWindow(ctx, left, top, right - left, bottom - top);