Bug 1416540 - Convert AnimationValue::GetStyleValue to return a float-based Size. r=mattwoodrow

This follows from the previous patch; these values feed into UpdateMinMaxScale
as well, which explicitly wants to use floats, so there's no point in creating
doubles. The source of this information is also a float-based matrix.

MozReview-Commit-ID: LPk4Xm9AaJJ

--HG--
extra : rebase_source : d7714755fb1078880133d6f044cc9bc7743439ee
This commit is contained in:
Kartikaya Gupta 2017-11-12 18:37:33 -05:00
parent 92c112278f
commit 87186734ba
6 changed files with 17 additions and 17 deletions

View File

@ -1928,8 +1928,8 @@ KeyframeEffectReadOnly::ContainsAnimatedScale(const nsIFrame* aFrame) const
// here just to be safe.
return true;
}
gfxSize size = baseStyle.GetScaleValue(aFrame);
if (size != gfxSize(1.0f, 1.0f)) {
gfx::Size size = baseStyle.GetScaleValue(aFrame);
if (size != gfx::Size(1.0f, 1.0f)) {
return true;
}
@ -1938,14 +1938,14 @@ KeyframeEffectReadOnly::ContainsAnimatedScale(const nsIFrame* aFrame) const
// really matter.
for (const AnimationPropertySegment& segment : prop.mSegments) {
if (!segment.mFromValue.IsNull()) {
gfxSize from = segment.mFromValue.GetScaleValue(aFrame);
if (from != gfxSize(1.0f, 1.0f)) {
gfx::Size from = segment.mFromValue.GetScaleValue(aFrame);
if (from != gfx::Size(1.0f, 1.0f)) {
return true;
}
}
if (!segment.mToValue.IsNull()) {
gfxSize to = segment.mToValue.GetScaleValue(aFrame);
if (to != gfxSize(1.0f, 1.0f)) {
gfx::Size to = segment.mToValue.GetScaleValue(aFrame);
if (to != gfx::Size(1.0f, 1.0f)) {
return true;
}
}

View File

@ -546,7 +546,7 @@ UpdateMinMaxScale(const nsIFrame* aFrame,
Size& aMinScale,
Size& aMaxScale)
{
gfxSize size = aValue.GetScaleValue(aFrame);
Size size = aValue.GetScaleValue(aFrame);
aMaxScale.width = std::max<float>(aMaxScale.width, size.width);
aMaxScale.height = std::max<float>(aMaxScale.height, size.height);
aMinScale.width = std::min<float>(aMinScale.width, size.width);

View File

@ -4891,7 +4891,7 @@ StyleAnimationValue::ExtractComputedValue(nsCSSPropertyID aProperty,
return false;
}
gfxSize
Size
StyleAnimationValue::GetScaleValue(const nsIFrame* aForFrame) const
{
MOZ_ASSERT(GetUnit() == StyleAnimationValue::eUnit_Transform);
@ -5361,7 +5361,7 @@ AnimationValue::GetTransformList() const
return transform.forget();
}
gfxSize
Size
AnimationValue::GetScaleValue(const nsIFrame* aFrame) const
{
MOZ_ASSERT(!mServo != mGecko.IsNull());

View File

@ -9,8 +9,8 @@
#ifndef mozilla_StyleAnimationValue_h_
#define mozilla_StyleAnimationValue_h_
#include "gfxPoint.h"
#include "mozilla/gfx/MatrixFwd.h"
#include "mozilla/gfx/Point.h"
#include "mozilla/ServoBindingTypes.h"
#include "mozilla/UniquePtr.h"
#include "nsStringFwd.h"
@ -424,7 +424,7 @@ public:
}
/// @return the scale for this value, calculated with reference to @aForFrame.
gfxSize GetScaleValue(const nsIFrame* aForFrame) const;
mozilla::gfx::Size GetScaleValue(const nsIFrame* aForFrame) const;
const css::ComplexColorData& GetComplexColorData() const {
MOZ_ASSERT(mUnit == eUnit_ComplexColor, "unit mismatch");
@ -612,7 +612,7 @@ struct AnimationValue
// Return the scale for mGecko or mServo, which are calculated with
// reference to aFrame.
gfxSize GetScaleValue(const nsIFrame* aFrame) const;
mozilla::gfx::Size GetScaleValue(const nsIFrame* aFrame) const;
// Uncompute this AnimationValue and then serialize it.
void SerializeSpecifiedValue(nsCSSPropertyID aProperty,

View File

@ -1401,7 +1401,7 @@ CSSValueArrayTo3DMatrix(nsCSSValue::Array* aArray)
return m;
}
gfxSize
Size
GetScaleValue(const nsCSSValueSharedList* aList,
const nsIFrame* aForFrame)
{
@ -1420,10 +1420,10 @@ GetScaleValue(const nsCSSValueSharedList* aList,
Matrix transform2d;
bool canDraw2D = transform.CanDraw2D(&transform2d);
if (!canDraw2D) {
return gfxSize();
return Size();
}
return ThebesMatrix(transform2d).ScaleFactors(true);
return transform2d.ScaleFactors(true);
}
} // namespace nsStyleTransformMatrix

View File

@ -249,8 +249,8 @@ namespace nsStyleTransformMatrix {
mozilla::gfx::Matrix CSSValueArrayTo2DMatrix(nsCSSValue::Array* aArray);
mozilla::gfx::Matrix4x4 CSSValueArrayTo3DMatrix(nsCSSValue::Array* aArray);
gfxSize GetScaleValue(const nsCSSValueSharedList* aList,
const nsIFrame* aForFrame);
mozilla::gfx::Size GetScaleValue(const nsCSSValueSharedList* aList,
const nsIFrame* aForFrame);
} // namespace nsStyleTransformMatrix
#endif