Bug 503177. Don't assert when invalidating on dirty geometry from canvas. r+sr=roc

This commit is contained in:
Boris Zbarsky 2009-07-09 14:09:43 -07:00
Родитель 8a8c7231cb
Коммит edd4d9594a
1 изменённых файлов: 23 добавлений и 2 удалений

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

@ -59,6 +59,8 @@
#include "nsICanvasRenderingContextInternal.h"
#include "nsLayoutUtils.h"
#define DEFAULT_CANVAS_WIDTH 300
#define DEFAULT_CANVAS_HEIGHT 150
@ -544,7 +546,14 @@ nsHTMLCanvasElement::SetWriteOnly()
NS_IMETHODIMP
nsHTMLCanvasElement::InvalidateFrame()
{
nsIFrame *frame = GetPrimaryFrame(Flush_Frames);
nsIDocument* doc = GetCurrentDoc();
if (!doc) {
return NS_OK;
}
// We don't need to flush anything here; if there's no frame or if
// we plan to reframe we don't need to invalidate it anyway.
nsIFrame *frame = GetPrimaryFrameFor(this, doc);
if (frame) {
nsRect r = frame->GetRect();
r.x = r.y = 0;
@ -557,8 +566,20 @@ nsHTMLCanvasElement::InvalidateFrame()
NS_IMETHODIMP
nsHTMLCanvasElement::InvalidateFrameSubrect(const gfxRect& damageRect)
{
nsIFrame *frame = GetPrimaryFrame(Flush_Frames);
nsIDocument* doc = GetCurrentDoc();
if (!doc) {
return NS_OK;
}
// We don't need to flush anything here; if there's no frame or if
// we plan to reframe we don't need to invalidate it anyway.
nsIFrame *frame = GetPrimaryFrameFor(this, doc);
if (frame) {
// Frame might be dirty, but we don't care about that; if the geometry
// changes the right invalidates will happen anyway. Don't assert on our
// geometry getters.
nsAutoDisableGetUsedXAssertions noAssert;
nsRect contentArea(frame->GetContentRect());
nsIntSize size = GetWidthHeight();