forked from mirrors/gecko-dev
Bug 1767126 - Change the return type of AnimationValue::GetScaleValue() to MatrixScales. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D147575
This commit is contained in:
parent
d99cb01622
commit
5370a472bc
4 changed files with 18 additions and 17 deletions
|
|
@ -1953,8 +1953,8 @@ bool KeyframeEffect::ContainsAnimatedScale(const nsIFrame* aFrame) const {
|
||||||
|
|
||||||
AnimationValue baseStyle = BaseStyle(prop.mProperty);
|
AnimationValue baseStyle = BaseStyle(prop.mProperty);
|
||||||
if (!baseStyle.IsNull()) {
|
if (!baseStyle.IsNull()) {
|
||||||
gfx::Size size = baseStyle.GetScaleValue(aFrame);
|
gfx::MatrixScales size = baseStyle.GetScaleValue(aFrame);
|
||||||
if (size != gfx::Size(1.0f, 1.0f)) {
|
if (size != gfx::MatrixScales()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1964,14 +1964,14 @@ bool KeyframeEffect::ContainsAnimatedScale(const nsIFrame* aFrame) const {
|
||||||
// really matter.
|
// really matter.
|
||||||
for (const AnimationPropertySegment& segment : prop.mSegments) {
|
for (const AnimationPropertySegment& segment : prop.mSegments) {
|
||||||
if (!segment.mFromValue.IsNull()) {
|
if (!segment.mFromValue.IsNull()) {
|
||||||
gfx::Size from = segment.mFromValue.GetScaleValue(aFrame);
|
gfx::MatrixScales from = segment.mFromValue.GetScaleValue(aFrame);
|
||||||
if (from != gfx::Size(1.0f, 1.0f)) {
|
if (from != gfx::MatrixScales()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!segment.mToValue.IsNull()) {
|
if (!segment.mToValue.IsNull()) {
|
||||||
gfx::Size to = segment.mToValue.GetScaleValue(aFrame);
|
gfx::MatrixScales to = segment.mToValue.GetScaleValue(aFrame);
|
||||||
if (to != gfx::Size(1.0f, 1.0f)) {
|
if (to != gfx::MatrixScales()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -366,12 +366,12 @@ using MinAndMaxScale = std::pair<Size, Size>;
|
||||||
static inline void UpdateMinMaxScale(const nsIFrame* aFrame,
|
static inline void UpdateMinMaxScale(const nsIFrame* aFrame,
|
||||||
const AnimationValue& aValue,
|
const AnimationValue& aValue,
|
||||||
MinAndMaxScale& aMinAndMaxScale) {
|
MinAndMaxScale& aMinAndMaxScale) {
|
||||||
Size size = aValue.GetScaleValue(aFrame);
|
MatrixScales size = aValue.GetScaleValue(aFrame);
|
||||||
Size& minScale = aMinAndMaxScale.first;
|
Size& minScale = aMinAndMaxScale.first;
|
||||||
Size& maxScale = aMinAndMaxScale.second;
|
Size& maxScale = aMinAndMaxScale.second;
|
||||||
|
|
||||||
minScale = Min(minScale, size);
|
minScale = Min(minScale, {size.xScale, size.yScale});
|
||||||
maxScale = Max(maxScale, size);
|
maxScale = Max(maxScale, {size.xScale, size.yScale});
|
||||||
}
|
}
|
||||||
|
|
||||||
// The final transform matrix is calculated by merging the final results of each
|
// The final transform matrix is calculated by merging the final results of each
|
||||||
|
|
|
||||||
|
|
@ -110,24 +110,25 @@ const mozilla::StylePositionOrAuto& AnimationValue::GetOffsetAnchorProperty()
|
||||||
return *Servo_AnimationValue_GetOffsetAnchor(mServo);
|
return *Servo_AnimationValue_GetOffsetAnchor(mServo);
|
||||||
}
|
}
|
||||||
|
|
||||||
Size AnimationValue::GetScaleValue(const nsIFrame* aFrame) const {
|
MatrixScales AnimationValue::GetScaleValue(const nsIFrame* aFrame) const {
|
||||||
using namespace nsStyleTransformMatrix;
|
using namespace nsStyleTransformMatrix;
|
||||||
|
|
||||||
switch (Servo_AnimationValue_GetPropertyId(mServo)) {
|
switch (Servo_AnimationValue_GetPropertyId(mServo)) {
|
||||||
case eCSSProperty_scale: {
|
case eCSSProperty_scale: {
|
||||||
const StyleScale& scale = GetScaleProperty();
|
const StyleScale& scale = GetScaleProperty();
|
||||||
return scale.IsNone() ? Size(1.0, 1.0)
|
return scale.IsNone()
|
||||||
: Size(scale.AsScale()._0, scale.AsScale()._1);
|
? MatrixScales()
|
||||||
|
: MatrixScales(scale.AsScale()._0, scale.AsScale()._1);
|
||||||
}
|
}
|
||||||
case eCSSProperty_rotate:
|
case eCSSProperty_rotate:
|
||||||
case eCSSProperty_translate:
|
case eCSSProperty_translate:
|
||||||
return Size(1.0, 1.0);
|
return MatrixScales();
|
||||||
case eCSSProperty_transform:
|
case eCSSProperty_transform:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
MOZ_ASSERT_UNREACHABLE(
|
MOZ_ASSERT_UNREACHABLE(
|
||||||
"Should only need to check in transform properties");
|
"Should only need to check in transform properties");
|
||||||
return Size(1.0, 1.0);
|
return MatrixScales();
|
||||||
}
|
}
|
||||||
|
|
||||||
TransformReferenceBox refBox(aFrame);
|
TransformReferenceBox refBox(aFrame);
|
||||||
|
|
@ -138,9 +139,9 @@ Size AnimationValue::GetScaleValue(const nsIFrame* aFrame) const {
|
||||||
Matrix transform2d;
|
Matrix transform2d;
|
||||||
bool canDraw2D = t.CanDraw2D(&transform2d);
|
bool canDraw2D = t.CanDraw2D(&transform2d);
|
||||||
if (!canDraw2D) {
|
if (!canDraw2D) {
|
||||||
return Size();
|
return MatrixScales(0, 0);
|
||||||
}
|
}
|
||||||
return transform2d.ScaleFactors().ToSize();
|
return transform2d.ScaleFactors();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimationValue::SerializeSpecifiedValue(nsCSSPropertyID aProperty,
|
void AnimationValue::SerializeSpecifiedValue(nsCSSPropertyID aProperty,
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ struct AnimationValue {
|
||||||
const mozilla::StylePositionOrAuto& GetOffsetAnchorProperty() const;
|
const mozilla::StylePositionOrAuto& GetOffsetAnchorProperty() const;
|
||||||
|
|
||||||
// Return the scale for mServo, which is calculated with reference to aFrame.
|
// Return the scale for mServo, which is calculated with reference to aFrame.
|
||||||
mozilla::gfx::Size GetScaleValue(const nsIFrame* aFrame) const;
|
mozilla::gfx::MatrixScales GetScaleValue(const nsIFrame* aFrame) const;
|
||||||
|
|
||||||
// Uncompute this AnimationValue and then serialize it.
|
// Uncompute this AnimationValue and then serialize it.
|
||||||
void SerializeSpecifiedValue(nsCSSPropertyID aProperty,
|
void SerializeSpecifiedValue(nsCSSPropertyID aProperty,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue