Bug 1066713 - Fix scaled up layer sizing bug that occurs due to scaled up assign-to-int rounding error. r=mattwoodrow

--HG--
extra : rebase_source : a175e92ab7842ca650ae00d995cc3548f9d188f0
This commit is contained in:
Jonathan Watt 2014-12-03 21:21:42 -08:00
parent e3074d441d
commit b52a3ad5cb

View File

@ -54,6 +54,7 @@
#include "nsICanvasRenderingContextInternal.h"
#include "gfxPlatform.h"
#include <algorithm>
#include <limits>
#include "mozilla/dom/HTMLVideoElement.h"
#include "mozilla/dom/HTMLImageElement.h"
#include "mozilla/dom/DOMRect.h"
@ -552,14 +553,21 @@ GetMinAndMaxScaleForAnimationProperty(nsIContent* aContent,
gfxSize
nsLayoutUtils::ComputeSuitableScaleForAnimation(nsIContent* aContent)
{
gfxSize maxScale(1.0f, 1.0f);
gfxSize minScale(1.0f, 1.0f);
gfxSize maxScale(std::numeric_limits<gfxFloat>::min(),
std::numeric_limits<gfxFloat>::min());
gfxSize minScale(std::numeric_limits<gfxFloat>::max(),
std::numeric_limits<gfxFloat>::max());
GetMinAndMaxScaleForAnimationProperty(aContent,
nsGkAtoms::animationsProperty, maxScale, minScale);
GetMinAndMaxScaleForAnimationProperty(aContent,
nsGkAtoms::transitionsProperty, maxScale, minScale);
if (maxScale.width == std::numeric_limits<gfxFloat>::min()) {
// We didn't encounter a transform
aMaxScale = aMinScale = gfxSize(1.0, 1.0);
}
return gfxSize(GetSuitableScale(maxScale.width, minScale.width),
GetSuitableScale(maxScale.height, minScale.height));
}