Bug 809181 - SVGDocumentWrapper::UpdateViewportBounds() should check if anything has changed instead of relying on callers. r=dholbert

This commit is contained in:
Seth Fowler 2012-11-08 14:54:47 -05:00
parent 91897bc0f6
commit bd282adc07
3 changed files with 11 additions and 12 deletions

View File

@ -122,8 +122,16 @@ SVGDocumentWrapper::UpdateViewportBounds(const nsIntSize& aViewportSize)
{
NS_ABORT_IF_FALSE(!mIgnoreInvalidation, "shouldn't be reentrant");
mIgnoreInvalidation = true;
mViewer->SetBounds(nsIntRect(nsIntPoint(0, 0), aViewportSize));
FlushLayout();
nsIntRect currentBounds;
mViewer->GetBounds(currentBounds);
// If the bounds have changed, we need to do a layout flush.
if (currentBounds.Size() != aViewportSize) {
mViewer->SetBounds(nsIntRect(nsIntPoint(0, 0), aViewportSize));
FlushLayout();
}
mIgnoreInvalidation = false;
}

View File

@ -171,7 +171,6 @@ NS_IMPL_ISUPPORTS3(VectorImage,
VectorImage::VectorImage(imgStatusTracker* aStatusTracker) :
Image(aStatusTracker), // invoke superclass's constructor
mRestrictedRegion(0, 0, 0, 0),
mLastRenderedSize(0, 0),
mIsInitialized(false),
mIsFullyLoaded(false),
mIsDrawing(false),
@ -526,10 +525,7 @@ VectorImage::Draw(gfxContext* aContext,
}
mIsDrawing = true;
if (aViewportSize != mLastRenderedSize) {
mSVGDocumentWrapper->UpdateViewportBounds(aViewportSize);
mLastRenderedSize = aViewportSize;
}
mSVGDocumentWrapper->UpdateViewportBounds(aViewportSize);
mSVGDocumentWrapper->FlushImageTransformInvalidation();
nsIntSize imageSize = mHaveRestrictedRegion ?

View File

@ -65,11 +65,6 @@ private:
// that we're restricted to using.
// Otherwise, this is ignored.
nsIntSize mLastRenderedSize; // The viewport-size that we've
// most recently passed to
// mSVGDocumentWrapper as its
// viewport-bounds.
bool mIsInitialized:1; // Have we been initalized?
bool mIsFullyLoaded:1; // Has OnStopRequest been called?
bool mIsDrawing:1; // Are we currently drawing?