From 87186734baf683a296e09132cdb78dc2a697009c Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Sun, 12 Nov 2017 18:37:33 -0500 Subject: [PATCH] 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 --- dom/animation/KeyframeEffectReadOnly.cpp | 12 ++++++------ layout/base/nsLayoutUtils.cpp | 2 +- layout/style/StyleAnimationValue.cpp | 4 ++-- layout/style/StyleAnimationValue.h | 6 +++--- layout/style/nsStyleTransformMatrix.cpp | 6 +++--- layout/style/nsStyleTransformMatrix.h | 4 ++-- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/dom/animation/KeyframeEffectReadOnly.cpp b/dom/animation/KeyframeEffectReadOnly.cpp index d81f748699da..abf51b0fd939 100644 --- a/dom/animation/KeyframeEffectReadOnly.cpp +++ b/dom/animation/KeyframeEffectReadOnly.cpp @@ -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; } } diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 9216392ad2d5..990067f1445d 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -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(aMaxScale.width, size.width); aMaxScale.height = std::max(aMaxScale.height, size.height); aMinScale.width = std::min(aMinScale.width, size.width); diff --git a/layout/style/StyleAnimationValue.cpp b/layout/style/StyleAnimationValue.cpp index 8bccd64d6db1..d780e0c4301c 100644 --- a/layout/style/StyleAnimationValue.cpp +++ b/layout/style/StyleAnimationValue.cpp @@ -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()); diff --git a/layout/style/StyleAnimationValue.h b/layout/style/StyleAnimationValue.h index 419be34feb37..e2ffd7b7e45a 100644 --- a/layout/style/StyleAnimationValue.h +++ b/layout/style/StyleAnimationValue.h @@ -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, diff --git a/layout/style/nsStyleTransformMatrix.cpp b/layout/style/nsStyleTransformMatrix.cpp index 856152a5e35a..981dd4f5e797 100644 --- a/layout/style/nsStyleTransformMatrix.cpp +++ b/layout/style/nsStyleTransformMatrix.cpp @@ -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 diff --git a/layout/style/nsStyleTransformMatrix.h b/layout/style/nsStyleTransformMatrix.h index abc8d43e1e1b..db08994c77ca 100644 --- a/layout/style/nsStyleTransformMatrix.h +++ b/layout/style/nsStyleTransformMatrix.h @@ -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