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
Родитель e13b0d19cd
Коммит 7a66508d5a
1 изменённых файлов: 10 добавлений и 2 удалений

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

@ -54,6 +54,7 @@
#include "nsICanvasRenderingContextInternal.h" #include "nsICanvasRenderingContextInternal.h"
#include "gfxPlatform.h" #include "gfxPlatform.h"
#include <algorithm> #include <algorithm>
#include <limits>
#include "mozilla/dom/HTMLVideoElement.h" #include "mozilla/dom/HTMLVideoElement.h"
#include "mozilla/dom/HTMLImageElement.h" #include "mozilla/dom/HTMLImageElement.h"
#include "mozilla/dom/DOMRect.h" #include "mozilla/dom/DOMRect.h"
@ -552,14 +553,21 @@ GetMinAndMaxScaleForAnimationProperty(nsIContent* aContent,
gfxSize gfxSize
nsLayoutUtils::ComputeSuitableScaleForAnimation(nsIContent* aContent) nsLayoutUtils::ComputeSuitableScaleForAnimation(nsIContent* aContent)
{ {
gfxSize maxScale(1.0f, 1.0f); gfxSize maxScale(std::numeric_limits<gfxFloat>::min(),
gfxSize minScale(1.0f, 1.0f); std::numeric_limits<gfxFloat>::min());
gfxSize minScale(std::numeric_limits<gfxFloat>::max(),
std::numeric_limits<gfxFloat>::max());
GetMinAndMaxScaleForAnimationProperty(aContent, GetMinAndMaxScaleForAnimationProperty(aContent,
nsGkAtoms::animationsProperty, maxScale, minScale); nsGkAtoms::animationsProperty, maxScale, minScale);
GetMinAndMaxScaleForAnimationProperty(aContent, GetMinAndMaxScaleForAnimationProperty(aContent,
nsGkAtoms::transitionsProperty, maxScale, minScale); 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), return gfxSize(GetSuitableScale(maxScale.width, minScale.width),
GetSuitableScale(maxScale.height, minScale.height)); GetSuitableScale(maxScale.height, minScale.height));
} }