mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1010067 part 1 - Rename nsStyleAnimation::Value to mozilla::StyleAnimationValue; r=dbaron
This patch also moves the static methods defined on nsStyleAnimation so that they are part of StyleAnimationValue class. Renaming nsStyleAnimation.h to StyleAnimationValue.h is performed in a separate patch to simplify the diff (since some tools may not handle file renames elegantly).
This commit is contained in:
parent
c171a38d22
commit
9fe1178360
@ -2514,20 +2514,20 @@ static bool
|
||||
ComputeAnimationValue(nsCSSProperty aProperty,
|
||||
Element* aElement,
|
||||
const nsAString& aInput,
|
||||
nsStyleAnimation::Value& aOutput)
|
||||
StyleAnimationValue& aOutput)
|
||||
{
|
||||
|
||||
if (!nsStyleAnimation::ComputeValue(aProperty, aElement, aInput,
|
||||
if (!StyleAnimationValue::ComputeValue(aProperty, aElement, aInput,
|
||||
false, aOutput)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// This matches TransExtractComputedValue in nsTransitionManager.cpp.
|
||||
if (aProperty == eCSSProperty_visibility) {
|
||||
NS_ABORT_IF_FALSE(aOutput.GetUnit() == nsStyleAnimation::eUnit_Enumerated,
|
||||
MOZ_ASSERT(aOutput.GetUnit() == StyleAnimationValue::eUnit_Enumerated,
|
||||
"unexpected unit");
|
||||
aOutput.SetIntValue(aOutput.GetIntValue(),
|
||||
nsStyleAnimation::eUnit_Visibility);
|
||||
StyleAnimationValue::eUnit_Visibility);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -2660,14 +2660,14 @@ nsDOMWindowUtils::ComputeAnimationDistance(nsIDOMElement* aElement,
|
||||
!nsCSSProps::IsShorthand(property),
|
||||
"should not have shorthand");
|
||||
|
||||
nsStyleAnimation::Value v1, v2;
|
||||
StyleAnimationValue v1, v2;
|
||||
if (property == eCSSProperty_UNKNOWN ||
|
||||
!ComputeAnimationValue(property, content->AsElement(), aValue1, v1) ||
|
||||
!ComputeAnimationValue(property, content->AsElement(), aValue2, v2)) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
if (!nsStyleAnimation::ComputeDistance(property, v1, v2, *aResult)) {
|
||||
if (!StyleAnimationValue::ComputeDistance(property, v1, v2, *aResult)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -1385,10 +1385,10 @@ interface nsIDOMWindowUtils : nsISupports {
|
||||
void setAsyncScrollOffset(in nsIDOMNode aNode, in int32_t aX, in int32_t aY);
|
||||
|
||||
/**
|
||||
* Method for testing nsStyleAnimation::ComputeDistance.
|
||||
* Method for testing StyleAnimationValue::ComputeDistance.
|
||||
*
|
||||
* Returns the distance between the two values as reported by
|
||||
* nsStyleAnimation::ComputeDistance for the given element and
|
||||
* StyleAnimationValue::ComputeDistance for the given element and
|
||||
* property.
|
||||
*/
|
||||
double computeAnimationDistance(in nsIDOMElement element,
|
||||
|
@ -19,41 +19,42 @@
|
||||
#include "nsIDocument.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
using mozilla::StyleAnimationValue;
|
||||
|
||||
/*static*/ nsSMILCSSValueType nsSMILCSSValueType::sSingleton;
|
||||
|
||||
struct ValueWrapper {
|
||||
ValueWrapper(nsCSSProperty aPropID, const nsStyleAnimation::Value& aValue) :
|
||||
ValueWrapper(nsCSSProperty aPropID, const StyleAnimationValue& aValue) :
|
||||
mPropID(aPropID), mCSSValue(aValue) {}
|
||||
|
||||
nsCSSProperty mPropID;
|
||||
nsStyleAnimation::Value mCSSValue;
|
||||
StyleAnimationValue mCSSValue;
|
||||
};
|
||||
|
||||
// Helper Methods
|
||||
// --------------
|
||||
static const nsStyleAnimation::Value*
|
||||
GetZeroValueForUnit(nsStyleAnimation::Unit aUnit)
|
||||
static const StyleAnimationValue*
|
||||
GetZeroValueForUnit(StyleAnimationValue::Unit aUnit)
|
||||
{
|
||||
static const nsStyleAnimation::Value
|
||||
sZeroCoord(0, nsStyleAnimation::Value::CoordConstructor);
|
||||
static const nsStyleAnimation::Value
|
||||
sZeroPercent(0.0f, nsStyleAnimation::Value::PercentConstructor);
|
||||
static const nsStyleAnimation::Value
|
||||
sZeroFloat(0.0f, nsStyleAnimation::Value::FloatConstructor);
|
||||
static const nsStyleAnimation::Value
|
||||
sZeroColor(NS_RGB(0,0,0), nsStyleAnimation::Value::ColorConstructor);
|
||||
static const StyleAnimationValue
|
||||
sZeroCoord(0, StyleAnimationValue::CoordConstructor);
|
||||
static const StyleAnimationValue
|
||||
sZeroPercent(0.0f, StyleAnimationValue::PercentConstructor);
|
||||
static const StyleAnimationValue
|
||||
sZeroFloat(0.0f, StyleAnimationValue::FloatConstructor);
|
||||
static const StyleAnimationValue
|
||||
sZeroColor(NS_RGB(0,0,0), StyleAnimationValue::ColorConstructor);
|
||||
|
||||
NS_ABORT_IF_FALSE(aUnit != nsStyleAnimation::eUnit_Null,
|
||||
NS_ABORT_IF_FALSE(aUnit != StyleAnimationValue::eUnit_Null,
|
||||
"Need non-null unit for a zero value");
|
||||
switch (aUnit) {
|
||||
case nsStyleAnimation::eUnit_Coord:
|
||||
case StyleAnimationValue::eUnit_Coord:
|
||||
return &sZeroCoord;
|
||||
case nsStyleAnimation::eUnit_Percent:
|
||||
case StyleAnimationValue::eUnit_Percent:
|
||||
return &sZeroPercent;
|
||||
case nsStyleAnimation::eUnit_Float:
|
||||
case StyleAnimationValue::eUnit_Float:
|
||||
return &sZeroFloat;
|
||||
case nsStyleAnimation::eUnit_Color:
|
||||
case StyleAnimationValue::eUnit_Color:
|
||||
return &sZeroColor;
|
||||
default:
|
||||
return nullptr;
|
||||
@ -71,8 +72,8 @@ GetZeroValueForUnit(nsStyleAnimation::Unit aUnit)
|
||||
//
|
||||
// Returns true on success, or false.
|
||||
static const bool
|
||||
FinalizeStyleAnimationValues(const nsStyleAnimation::Value*& aValue1,
|
||||
const nsStyleAnimation::Value*& aValue2)
|
||||
FinalizeStyleAnimationValues(const StyleAnimationValue*& aValue1,
|
||||
const StyleAnimationValue*& aValue2)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(aValue1 || aValue2,
|
||||
"expecting at least one non-null value");
|
||||
@ -90,32 +91,32 @@ FinalizeStyleAnimationValues(const nsStyleAnimation::Value*& aValue1,
|
||||
// Ok, both values were specified.
|
||||
// Need to handle a special-case, though: unitless nonzero length (parsed as
|
||||
// eUnit_Float) mixed with unitless 0 length (parsed as eUnit_Coord). These
|
||||
// won't interoperate in nsStyleAnimation, since their Units don't match.
|
||||
// won't interoperate in StyleAnimationValue, since their Units don't match.
|
||||
// In this case, we replace the eUnit_Coord 0 value with eUnit_Float 0 value.
|
||||
const nsStyleAnimation::Value& zeroCoord =
|
||||
*GetZeroValueForUnit(nsStyleAnimation::eUnit_Coord);
|
||||
const StyleAnimationValue& zeroCoord =
|
||||
*GetZeroValueForUnit(StyleAnimationValue::eUnit_Coord);
|
||||
if (*aValue1 == zeroCoord &&
|
||||
aValue2->GetUnit() == nsStyleAnimation::eUnit_Float) {
|
||||
aValue1 = GetZeroValueForUnit(nsStyleAnimation::eUnit_Float);
|
||||
aValue2->GetUnit() == StyleAnimationValue::eUnit_Float) {
|
||||
aValue1 = GetZeroValueForUnit(StyleAnimationValue::eUnit_Float);
|
||||
} else if (*aValue2 == zeroCoord &&
|
||||
aValue1->GetUnit() == nsStyleAnimation::eUnit_Float) {
|
||||
aValue2 = GetZeroValueForUnit(nsStyleAnimation::eUnit_Float);
|
||||
aValue1->GetUnit() == StyleAnimationValue::eUnit_Float) {
|
||||
aValue2 = GetZeroValueForUnit(StyleAnimationValue::eUnit_Float);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
InvertSign(nsStyleAnimation::Value& aValue)
|
||||
InvertSign(StyleAnimationValue& aValue)
|
||||
{
|
||||
switch (aValue.GetUnit()) {
|
||||
case nsStyleAnimation::eUnit_Coord:
|
||||
case StyleAnimationValue::eUnit_Coord:
|
||||
aValue.SetCoordValue(-aValue.GetCoordValue());
|
||||
break;
|
||||
case nsStyleAnimation::eUnit_Percent:
|
||||
case StyleAnimationValue::eUnit_Percent:
|
||||
aValue.SetPercentValue(-aValue.GetPercentValue());
|
||||
break;
|
||||
case nsStyleAnimation::eUnit_Float:
|
||||
case StyleAnimationValue::eUnit_Float:
|
||||
aValue.SetFloatValue(-aValue.GetFloatValue());
|
||||
break;
|
||||
default:
|
||||
@ -224,15 +225,15 @@ nsSMILCSSValueType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
|
||||
nsCSSProperty property = (valueToAddWrapper ? valueToAddWrapper->mPropID :
|
||||
destWrapper->mPropID);
|
||||
// Special case: font-size-adjust and stroke-dasharray are explicitly
|
||||
// non-additive (even though nsStyleAnimation *could* support adding them)
|
||||
// non-additive (even though StyleAnimationValue *could* support adding them)
|
||||
if (property == eCSSProperty_font_size_adjust ||
|
||||
property == eCSSProperty_stroke_dasharray) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
const nsStyleAnimation::Value* valueToAdd = valueToAddWrapper ?
|
||||
const StyleAnimationValue* valueToAdd = valueToAddWrapper ?
|
||||
&valueToAddWrapper->mCSSValue : nullptr;
|
||||
const nsStyleAnimation::Value* destValue = destWrapper ?
|
||||
const StyleAnimationValue* destValue = destWrapper ?
|
||||
&destWrapper->mCSSValue : nullptr;
|
||||
if (!FinalizeStyleAnimationValues(valueToAdd, destValue)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -249,7 +250,7 @@ nsSMILCSSValueType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
|
||||
new ValueWrapper(property, *destValue);
|
||||
}
|
||||
|
||||
return nsStyleAnimation::Add(property,
|
||||
return StyleAnimationValue::Add(property,
|
||||
destWrapper->mCSSValue, *valueToAdd, aCount) ?
|
||||
NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
@ -267,14 +268,14 @@ nsSMILCSSValueType::ComputeDistance(const nsSMILValue& aFrom,
|
||||
const ValueWrapper* toWrapper = ExtractValueWrapper(aTo);
|
||||
NS_ABORT_IF_FALSE(toWrapper, "expecting non-null endpoint");
|
||||
|
||||
const nsStyleAnimation::Value* fromCSSValue = fromWrapper ?
|
||||
const StyleAnimationValue* fromCSSValue = fromWrapper ?
|
||||
&fromWrapper->mCSSValue : nullptr;
|
||||
const nsStyleAnimation::Value* toCSSValue = &toWrapper->mCSSValue;
|
||||
const StyleAnimationValue* toCSSValue = &toWrapper->mCSSValue;
|
||||
if (!FinalizeStyleAnimationValues(fromCSSValue, toCSSValue)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return nsStyleAnimation::ComputeDistance(toWrapper->mPropID,
|
||||
return StyleAnimationValue::ComputeDistance(toWrapper->mPropID,
|
||||
*fromCSSValue, *toCSSValue,
|
||||
aDistance) ?
|
||||
NS_OK : NS_ERROR_FAILURE;
|
||||
@ -299,15 +300,15 @@ nsSMILCSSValueType::Interpolate(const nsSMILValue& aStartVal,
|
||||
const ValueWrapper* endWrapper = ExtractValueWrapper(aEndVal);
|
||||
NS_ABORT_IF_FALSE(endWrapper, "expecting non-null endpoint");
|
||||
|
||||
const nsStyleAnimation::Value* startCSSValue = startWrapper ?
|
||||
const StyleAnimationValue* startCSSValue = startWrapper ?
|
||||
&startWrapper->mCSSValue : nullptr;
|
||||
const nsStyleAnimation::Value* endCSSValue = &endWrapper->mCSSValue;
|
||||
const StyleAnimationValue* endCSSValue = &endWrapper->mCSSValue;
|
||||
if (!FinalizeStyleAnimationValues(startCSSValue, endCSSValue)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsStyleAnimation::Value resultValue;
|
||||
if (nsStyleAnimation::Interpolate(endWrapper->mPropID,
|
||||
StyleAnimationValue resultValue;
|
||||
if (StyleAnimationValue::Interpolate(endWrapper->mPropID,
|
||||
*startCSSValue, *endCSSValue,
|
||||
aUnitDistance, resultValue)) {
|
||||
aResult.mU.mPtr = new ValueWrapper(endWrapper->mPropID, resultValue);
|
||||
@ -331,13 +332,13 @@ GetPresContextForElement(Element* aElem)
|
||||
return shell ? shell->GetPresContext() : nullptr;
|
||||
}
|
||||
|
||||
// Helper function to parse a string into a nsStyleAnimation::Value
|
||||
// Helper function to parse a string into a StyleAnimationValue
|
||||
static bool
|
||||
ValueFromStringHelper(nsCSSProperty aPropID,
|
||||
Element* aTargetElement,
|
||||
nsPresContext* aPresContext,
|
||||
const nsAString& aString,
|
||||
nsStyleAnimation::Value& aStyleAnimValue,
|
||||
StyleAnimationValue& aStyleAnimValue,
|
||||
bool* aIsContextSensitive)
|
||||
{
|
||||
// If value is negative, we'll strip off the "-" so the CSS parser won't
|
||||
@ -358,7 +359,7 @@ ValueFromStringHelper(nsCSSProperty aPropID,
|
||||
}
|
||||
}
|
||||
nsDependentSubstring subString(aString, subStringBegin);
|
||||
if (!nsStyleAnimation::ComputeValue(aPropID, aTargetElement, subString,
|
||||
if (!StyleAnimationValue::ComputeValue(aPropID, aTargetElement, subString,
|
||||
true, aStyleAnimValue,
|
||||
aIsContextSensitive)) {
|
||||
return false;
|
||||
@ -370,7 +371,7 @@ ValueFromStringHelper(nsCSSProperty aPropID,
|
||||
if (aPropID == eCSSProperty_font_size) {
|
||||
// Divide out text-zoom, since SVG is supposed to ignore it
|
||||
NS_ABORT_IF_FALSE(aStyleAnimValue.GetUnit() ==
|
||||
nsStyleAnimation::eUnit_Coord,
|
||||
StyleAnimationValue::eUnit_Coord,
|
||||
"'font-size' value with unexpected style unit");
|
||||
aStyleAnimValue.SetCoordValue(aStyleAnimValue.GetCoordValue() /
|
||||
aPresContext->TextZoom());
|
||||
@ -401,7 +402,7 @@ nsSMILCSSValueType::ValueFromString(nsCSSProperty aPropID,
|
||||
return;
|
||||
}
|
||||
|
||||
nsStyleAnimation::Value parsedValue;
|
||||
StyleAnimationValue parsedValue;
|
||||
if (ValueFromStringHelper(aPropID, aTargetElement, presContext,
|
||||
aString, parsedValue, aIsContextSensitive)) {
|
||||
sSingleton.Init(aValue);
|
||||
@ -418,6 +419,6 @@ nsSMILCSSValueType::ValueToString(const nsSMILValue& aValue,
|
||||
"Unexpected SMIL value type");
|
||||
const ValueWrapper* wrapper = ExtractValueWrapper(aValue);
|
||||
return !wrapper ||
|
||||
nsStyleAnimation::UncomputeValue(wrapper->mPropID,
|
||||
StyleAnimationValue::UncomputeValue(wrapper->mPropID,
|
||||
wrapper->mCSSValue, aString);
|
||||
}
|
||||
|
@ -247,28 +247,32 @@ CreateCSSValueList(const InfallibleTArray<TransformFunction>& aFunctions)
|
||||
case TransformFunction::TRotationX:
|
||||
{
|
||||
float theta = aFunctions[i].get_RotationX().radians();
|
||||
arr = nsStyleAnimation::AppendTransformFunction(eCSSKeyword_rotatex, resultTail);
|
||||
arr = StyleAnimationValue::AppendTransformFunction(eCSSKeyword_rotatex,
|
||||
resultTail);
|
||||
arr->Item(1).SetFloatValue(theta, eCSSUnit_Radian);
|
||||
break;
|
||||
}
|
||||
case TransformFunction::TRotationY:
|
||||
{
|
||||
float theta = aFunctions[i].get_RotationY().radians();
|
||||
arr = nsStyleAnimation::AppendTransformFunction(eCSSKeyword_rotatey, resultTail);
|
||||
arr = StyleAnimationValue::AppendTransformFunction(eCSSKeyword_rotatey,
|
||||
resultTail);
|
||||
arr->Item(1).SetFloatValue(theta, eCSSUnit_Radian);
|
||||
break;
|
||||
}
|
||||
case TransformFunction::TRotationZ:
|
||||
{
|
||||
float theta = aFunctions[i].get_RotationZ().radians();
|
||||
arr = nsStyleAnimation::AppendTransformFunction(eCSSKeyword_rotatez, resultTail);
|
||||
arr = StyleAnimationValue::AppendTransformFunction(eCSSKeyword_rotatez,
|
||||
resultTail);
|
||||
arr->Item(1).SetFloatValue(theta, eCSSUnit_Radian);
|
||||
break;
|
||||
}
|
||||
case TransformFunction::TRotation:
|
||||
{
|
||||
float theta = aFunctions[i].get_Rotation().radians();
|
||||
arr = nsStyleAnimation::AppendTransformFunction(eCSSKeyword_rotate, resultTail);
|
||||
arr = StyleAnimationValue::AppendTransformFunction(eCSSKeyword_rotate,
|
||||
resultTail);
|
||||
arr->Item(1).SetFloatValue(theta, eCSSUnit_Radian);
|
||||
break;
|
||||
}
|
||||
@ -278,7 +282,9 @@ CreateCSSValueList(const InfallibleTArray<TransformFunction>& aFunctions)
|
||||
float y = aFunctions[i].get_Rotation3D().y();
|
||||
float z = aFunctions[i].get_Rotation3D().z();
|
||||
float theta = aFunctions[i].get_Rotation3D().radians();
|
||||
arr = nsStyleAnimation::AppendTransformFunction(eCSSKeyword_rotate3d, resultTail);
|
||||
arr =
|
||||
StyleAnimationValue::AppendTransformFunction(eCSSKeyword_rotate3d,
|
||||
resultTail);
|
||||
arr->Item(1).SetFloatValue(x, eCSSUnit_Number);
|
||||
arr->Item(2).SetFloatValue(y, eCSSUnit_Number);
|
||||
arr->Item(3).SetFloatValue(z, eCSSUnit_Number);
|
||||
@ -287,7 +293,9 @@ CreateCSSValueList(const InfallibleTArray<TransformFunction>& aFunctions)
|
||||
}
|
||||
case TransformFunction::TScale:
|
||||
{
|
||||
arr = nsStyleAnimation::AppendTransformFunction(eCSSKeyword_scale3d, resultTail);
|
||||
arr =
|
||||
StyleAnimationValue::AppendTransformFunction(eCSSKeyword_scale3d,
|
||||
resultTail);
|
||||
arr->Item(1).SetFloatValue(aFunctions[i].get_Scale().x(), eCSSUnit_Number);
|
||||
arr->Item(2).SetFloatValue(aFunctions[i].get_Scale().y(), eCSSUnit_Number);
|
||||
arr->Item(3).SetFloatValue(aFunctions[i].get_Scale().z(), eCSSUnit_Number);
|
||||
@ -295,7 +303,9 @@ CreateCSSValueList(const InfallibleTArray<TransformFunction>& aFunctions)
|
||||
}
|
||||
case TransformFunction::TTranslation:
|
||||
{
|
||||
arr = nsStyleAnimation::AppendTransformFunction(eCSSKeyword_translate3d, resultTail);
|
||||
arr =
|
||||
StyleAnimationValue::AppendTransformFunction(eCSSKeyword_translate3d,
|
||||
resultTail);
|
||||
arr->Item(1).SetFloatValue(aFunctions[i].get_Translation().x(), eCSSUnit_Pixel);
|
||||
arr->Item(2).SetFloatValue(aFunctions[i].get_Translation().y(), eCSSUnit_Pixel);
|
||||
arr->Item(3).SetFloatValue(aFunctions[i].get_Translation().z(), eCSSUnit_Pixel);
|
||||
@ -304,27 +314,32 @@ CreateCSSValueList(const InfallibleTArray<TransformFunction>& aFunctions)
|
||||
case TransformFunction::TSkewX:
|
||||
{
|
||||
float x = aFunctions[i].get_SkewX().x();
|
||||
arr = nsStyleAnimation::AppendTransformFunction(eCSSKeyword_skewx, resultTail);
|
||||
arr = StyleAnimationValue::AppendTransformFunction(eCSSKeyword_skewx,
|
||||
resultTail);
|
||||
arr->Item(1).SetFloatValue(x, eCSSUnit_Radian);
|
||||
break;
|
||||
}
|
||||
case TransformFunction::TSkewY:
|
||||
{
|
||||
float y = aFunctions[i].get_SkewY().y();
|
||||
arr = nsStyleAnimation::AppendTransformFunction(eCSSKeyword_skewy, resultTail);
|
||||
arr = StyleAnimationValue::AppendTransformFunction(eCSSKeyword_skewy,
|
||||
resultTail);
|
||||
arr->Item(1).SetFloatValue(y, eCSSUnit_Radian);
|
||||
break;
|
||||
}
|
||||
case TransformFunction::TSkew:
|
||||
{
|
||||
arr = nsStyleAnimation::AppendTransformFunction(eCSSKeyword_skew, resultTail);
|
||||
arr = StyleAnimationValue::AppendTransformFunction(eCSSKeyword_skew,
|
||||
resultTail);
|
||||
arr->Item(1).SetFloatValue(aFunctions[i].get_Skew().x(), eCSSUnit_Radian);
|
||||
arr->Item(2).SetFloatValue(aFunctions[i].get_Skew().y(), eCSSUnit_Radian);
|
||||
break;
|
||||
}
|
||||
case TransformFunction::TTransformMatrix:
|
||||
{
|
||||
arr = nsStyleAnimation::AppendTransformFunction(eCSSKeyword_matrix3d, resultTail);
|
||||
arr =
|
||||
StyleAnimationValue::AppendTransformFunction(eCSSKeyword_matrix3d,
|
||||
resultTail);
|
||||
const gfx::Matrix4x4& matrix = aFunctions[i].get_TransformMatrix().value();
|
||||
arr->Item(1).SetFloatValue(matrix._11, eCSSUnit_Number);
|
||||
arr->Item(2).SetFloatValue(matrix._12, eCSSUnit_Number);
|
||||
@ -347,7 +362,9 @@ CreateCSSValueList(const InfallibleTArray<TransformFunction>& aFunctions)
|
||||
case TransformFunction::TPerspective:
|
||||
{
|
||||
float perspective = aFunctions[i].get_Perspective().value();
|
||||
arr = nsStyleAnimation::AppendTransformFunction(eCSSKeyword_perspective, resultTail);
|
||||
arr =
|
||||
StyleAnimationValue::AppendTransformFunction(eCSSKeyword_perspective,
|
||||
resultTail);
|
||||
arr->Item(1).SetFloatValue(perspective, eCSSUnit_Pixel);
|
||||
break;
|
||||
}
|
||||
@ -396,14 +413,14 @@ Layer::SetAnimations(const AnimationArray& aAnimations)
|
||||
functions.AppendElement(ctf);
|
||||
}
|
||||
|
||||
// Precompute the nsStyleAnimation::Values that we need if this is a transform
|
||||
// Precompute the StyleAnimationValues that we need if this is a transform
|
||||
// animation.
|
||||
InfallibleTArray<nsStyleAnimation::Value>& startValues = data->mStartValues;
|
||||
InfallibleTArray<nsStyleAnimation::Value>& endValues = data->mEndValues;
|
||||
InfallibleTArray<StyleAnimationValue>& startValues = data->mStartValues;
|
||||
InfallibleTArray<StyleAnimationValue>& endValues = data->mEndValues;
|
||||
for (uint32_t j = 0; j < mAnimations[i].segments().Length(); j++) {
|
||||
const AnimationSegment& segment = mAnimations[i].segments()[j];
|
||||
nsStyleAnimation::Value* startValue = startValues.AppendElement();
|
||||
nsStyleAnimation::Value* endValue = endValues.AppendElement();
|
||||
StyleAnimationValue* startValue = startValues.AppendElement();
|
||||
StyleAnimationValue* endValue = endValues.AppendElement();
|
||||
if (segment.endState().type() == Animatable::TArrayOfTransformFunction) {
|
||||
const InfallibleTArray<TransformFunction>& startFunctions =
|
||||
segment.startState().get_ArrayOfTransformFunction();
|
||||
|
@ -54,6 +54,7 @@ extern uint8_t gLayerManagerLayerBuilder;
|
||||
namespace mozilla {
|
||||
|
||||
class FrameLayerBuilder;
|
||||
class StyleAnimationValue;
|
||||
class WebGLContext;
|
||||
|
||||
namespace gl {
|
||||
@ -686,8 +687,8 @@ private:
|
||||
typedef InfallibleTArray<Animation> AnimationArray;
|
||||
|
||||
struct AnimData {
|
||||
InfallibleTArray<nsStyleAnimation::Value> mStartValues;
|
||||
InfallibleTArray<nsStyleAnimation::Value> mEndValues;
|
||||
InfallibleTArray<mozilla::StyleAnimationValue> mStartValues;
|
||||
InfallibleTArray<mozilla::StyleAnimationValue> mEndValues;
|
||||
InfallibleTArray<nsAutoPtr<mozilla::css::ComputedTimingFunction> > mFunctions;
|
||||
};
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include "nsPoint.h" // for nsPoint
|
||||
#include "nsRect.h" // for nsIntRect
|
||||
#include "nsRegion.h" // for nsIntRegion
|
||||
#include "nsStyleAnimation.h" // for nsStyleAnimation::Value, etc
|
||||
#include "nsStyleAnimation.h" // for StyleAnimationValue, etc
|
||||
#include "nsTArray.h" // for nsTArray, nsTArray_Impl, etc
|
||||
#include "nsTArrayForwardDeclare.h" // for InfallibleTArray
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
@ -354,14 +354,15 @@ AsyncCompositionManager::AlignFixedAndStickyLayers(Layer* aLayer,
|
||||
}
|
||||
|
||||
static void
|
||||
SampleValue(float aPortion, Animation& aAnimation, nsStyleAnimation::Value& aStart,
|
||||
nsStyleAnimation::Value& aEnd, Animatable* aValue)
|
||||
SampleValue(float aPortion, Animation& aAnimation, StyleAnimationValue& aStart,
|
||||
StyleAnimationValue& aEnd, Animatable* aValue)
|
||||
{
|
||||
nsStyleAnimation::Value interpolatedValue;
|
||||
StyleAnimationValue interpolatedValue;
|
||||
NS_ASSERTION(aStart.GetUnit() == aEnd.GetUnit() ||
|
||||
aStart.GetUnit() == nsStyleAnimation::eUnit_None ||
|
||||
aEnd.GetUnit() == nsStyleAnimation::eUnit_None, "Must have same unit");
|
||||
nsStyleAnimation::Interpolate(aAnimation.property(), aStart, aEnd,
|
||||
aStart.GetUnit() == StyleAnimationValue::eUnit_None ||
|
||||
aEnd.GetUnit() == StyleAnimationValue::eUnit_None,
|
||||
"Must have same unit");
|
||||
StyleAnimationValue::Interpolate(aAnimation.property(), aStart, aEnd,
|
||||
aPortion, interpolatedValue);
|
||||
if (aAnimation.property() == eCSSProperty_opacity) {
|
||||
*aValue = interpolatedValue.GetFloatValue();
|
||||
|
@ -335,14 +335,13 @@ nsLayoutUtils::HasCurrentAnimations(nsIContent* aContent,
|
||||
}
|
||||
|
||||
static gfxSize
|
||||
GetScaleForValue(const nsStyleAnimation::Value& aValue,
|
||||
nsIFrame* aFrame)
|
||||
GetScaleForValue(const StyleAnimationValue& aValue, nsIFrame* aFrame)
|
||||
{
|
||||
if (!aFrame) {
|
||||
NS_WARNING("No frame.");
|
||||
return gfxSize();
|
||||
}
|
||||
if (aValue.GetUnit() != nsStyleAnimation::eUnit_Transform) {
|
||||
if (aValue.GetUnit() != StyleAnimationValue::eUnit_Transform) {
|
||||
NS_WARNING("Expected a transform.");
|
||||
return gfxSize();
|
||||
}
|
||||
|
@ -166,17 +166,17 @@ CommonAnimationManager::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
|
||||
CommonAnimationManager::ExtractComputedValueForTransition(
|
||||
nsCSSProperty aProperty,
|
||||
nsStyleContext* aStyleContext,
|
||||
nsStyleAnimation::Value& aComputedValue)
|
||||
StyleAnimationValue& aComputedValue)
|
||||
{
|
||||
bool result =
|
||||
nsStyleAnimation::ExtractComputedValue(aProperty, aStyleContext,
|
||||
bool result = StyleAnimationValue::ExtractComputedValue(aProperty,
|
||||
aStyleContext,
|
||||
aComputedValue);
|
||||
if (aProperty == eCSSProperty_visibility) {
|
||||
NS_ABORT_IF_FALSE(aComputedValue.GetUnit() ==
|
||||
nsStyleAnimation::eUnit_Enumerated,
|
||||
StyleAnimationValue::eUnit_Enumerated,
|
||||
"unexpected unit");
|
||||
aComputedValue.SetIntValue(aComputedValue.GetIntValue(),
|
||||
nsStyleAnimation::eUnit_Visibility);
|
||||
StyleAnimationValue::eUnit_Visibility);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -331,7 +331,7 @@ AnimValuesStyleRule::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
#ifdef DEBUG
|
||||
bool ok =
|
||||
#endif
|
||||
nsStyleAnimation::UncomputeValue(cv.mProperty, cv.mValue, *prop);
|
||||
StyleAnimationValue::UncomputeValue(cv.mProperty, cv.mValue, *prop);
|
||||
NS_ABORT_IF_FALSE(ok, "could not store computed value");
|
||||
}
|
||||
}
|
||||
@ -347,7 +347,7 @@ AnimValuesStyleRule::List(FILE* out, int32_t aIndent) const
|
||||
for (uint32_t i = 0, i_end = mPropertyValuePairs.Length(); i < i_end; ++i) {
|
||||
const PropertyValuePair &pair = mPropertyValuePairs[i];
|
||||
nsAutoString value;
|
||||
nsStyleAnimation::UncomputeValue(pair.mProperty, pair.mValue, value);
|
||||
StyleAnimationValue::UncomputeValue(pair.mProperty, pair.mValue, value);
|
||||
fprintf(out, "%s: %s; ", nsCSSProps::GetStringValue(pair.mProperty).get(),
|
||||
NS_ConvertUTF16toUTF8(value).get());
|
||||
}
|
||||
@ -889,14 +889,15 @@ CommonElementAnimationData::EnsureStyleRuleFor(TimeStamp aRefreshTime,
|
||||
double valuePosition =
|
||||
segment->mTimingFunction.GetValue(positionInSegment);
|
||||
|
||||
nsStyleAnimation::Value *val =
|
||||
StyleAnimationValue *val =
|
||||
mStyleRule->AddEmptyValue(prop.mProperty);
|
||||
|
||||
#ifdef DEBUG
|
||||
bool result =
|
||||
#endif
|
||||
nsStyleAnimation::Interpolate(prop.mProperty,
|
||||
segment->mFromValue, segment->mToValue,
|
||||
StyleAnimationValue::Interpolate(prop.mProperty,
|
||||
segment->mFromValue,
|
||||
segment->mToValue,
|
||||
valuePosition, *val);
|
||||
NS_ABORT_IF_FALSE(result, "interpolate must succeed now");
|
||||
}
|
||||
|
@ -27,6 +27,9 @@ struct ElementPropertyTransition;
|
||||
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class StyleAnimationValue;
|
||||
|
||||
namespace css {
|
||||
|
||||
bool IsGeometricProperty(nsCSSProperty aProperty);
|
||||
@ -66,7 +69,7 @@ public:
|
||||
static bool ExtractComputedValueForTransition(
|
||||
nsCSSProperty aProperty,
|
||||
nsStyleContext* aStyleContext,
|
||||
nsStyleAnimation::Value& aComputedValue);
|
||||
mozilla::StyleAnimationValue& aComputedValue);
|
||||
protected:
|
||||
virtual ~CommonAnimationManager();
|
||||
|
||||
@ -160,7 +163,7 @@ class_::UpdateAllThrottledStylesInternal() \
|
||||
}
|
||||
|
||||
/**
|
||||
* A style rule that maps property-nsStyleAnimation::Value pairs.
|
||||
* A style rule that maps property-StyleAnimationValue pairs.
|
||||
*/
|
||||
class AnimValuesStyleRule MOZ_FINAL : public nsIStyleRule
|
||||
{
|
||||
@ -174,14 +177,15 @@ public:
|
||||
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const MOZ_OVERRIDE;
|
||||
#endif
|
||||
|
||||
void AddValue(nsCSSProperty aProperty, nsStyleAnimation::Value &aStartValue)
|
||||
void AddValue(nsCSSProperty aProperty,
|
||||
mozilla::StyleAnimationValue &aStartValue)
|
||||
{
|
||||
PropertyValuePair v = { aProperty, aStartValue };
|
||||
mPropertyValuePairs.AppendElement(v);
|
||||
}
|
||||
|
||||
// Caller must fill in returned value.
|
||||
nsStyleAnimation::Value* AddEmptyValue(nsCSSProperty aProperty)
|
||||
mozilla::StyleAnimationValue* AddEmptyValue(nsCSSProperty aProperty)
|
||||
{
|
||||
PropertyValuePair *p = mPropertyValuePairs.AppendElement();
|
||||
p->mProperty = aProperty;
|
||||
@ -190,7 +194,7 @@ public:
|
||||
|
||||
struct PropertyValuePair {
|
||||
nsCSSProperty mProperty;
|
||||
nsStyleAnimation::Value mValue;
|
||||
mozilla::StyleAnimationValue mValue;
|
||||
};
|
||||
|
||||
private:
|
||||
@ -221,7 +225,7 @@ private:
|
||||
struct AnimationPropertySegment
|
||||
{
|
||||
float mFromKey, mToKey;
|
||||
nsStyleAnimation::Value mFromValue, mToValue;
|
||||
mozilla::StyleAnimationValue mFromValue, mToValue;
|
||||
mozilla::css::ComputedTimingFunction mTimingFunction;
|
||||
};
|
||||
|
||||
|
@ -392,7 +392,7 @@ ResolvedStyleCache::Get(nsPresContext *aPresContext,
|
||||
// whether they are resolved relative to other animations: I assume
|
||||
// that they're not, since that would prevent us from caching a lot of
|
||||
// data that we'd really like to cache (in particular, the
|
||||
// nsStyleAnimation::Value values in AnimationPropertySegment).
|
||||
// StyleAnimationValue values in AnimationPropertySegment).
|
||||
nsStyleContext *result = mCache.GetWeak(aKeyframe);
|
||||
if (!result) {
|
||||
nsCOMArray<nsIStyleRule> rules;
|
||||
@ -602,13 +602,13 @@ nsAnimationManager::BuildSegment(InfallibleTArray<AnimationPropertySegment>&
|
||||
mozilla::css::Declaration* aFromDeclaration,
|
||||
float aToKey, nsStyleContext* aToContext)
|
||||
{
|
||||
nsStyleAnimation::Value fromValue, toValue, dummyValue;
|
||||
StyleAnimationValue fromValue, toValue, dummyValue;
|
||||
if (!ExtractComputedValueForTransition(aProperty, aFromContext, fromValue) ||
|
||||
!ExtractComputedValueForTransition(aProperty, aToContext, toValue) ||
|
||||
// Check that we can interpolate between these values
|
||||
// (If this is ever a performance problem, we could add a
|
||||
// CanInterpolate method, but it seems fine for now.)
|
||||
!nsStyleAnimation::Interpolate(aProperty, fromValue, toValue,
|
||||
!StyleAnimationValue::Interpolate(aProperty, fromValue, toValue,
|
||||
0.5, dummyValue)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ static_assert((CSS_PROPERTY_PARSE_PROPERTY_MASK &
|
||||
*/
|
||||
enum nsStyleAnimType {
|
||||
// requires a custom implementation in
|
||||
// nsStyleAnimation::ExtractComputedValue
|
||||
// StyleAnimationValue::ExtractComputedValue
|
||||
eStyleAnimType_Custom,
|
||||
|
||||
// nsStyleCoord with animatable values
|
||||
|
@ -45,23 +45,23 @@ using namespace mozilla;
|
||||
* eUnit_Null if that's not possible.
|
||||
*/
|
||||
static
|
||||
nsStyleAnimation::Unit
|
||||
StyleAnimationValue::Unit
|
||||
GetCommonUnit(nsCSSProperty aProperty,
|
||||
nsStyleAnimation::Unit aFirstUnit,
|
||||
nsStyleAnimation::Unit aSecondUnit)
|
||||
StyleAnimationValue::Unit aFirstUnit,
|
||||
StyleAnimationValue::Unit aSecondUnit)
|
||||
{
|
||||
if (aFirstUnit != aSecondUnit) {
|
||||
if (nsCSSProps::PropHasFlags(aProperty, CSS_PROPERTY_STORES_CALC) &&
|
||||
(aFirstUnit == nsStyleAnimation::eUnit_Coord ||
|
||||
aFirstUnit == nsStyleAnimation::eUnit_Percent ||
|
||||
aFirstUnit == nsStyleAnimation::eUnit_Calc) &&
|
||||
(aSecondUnit == nsStyleAnimation::eUnit_Coord ||
|
||||
aSecondUnit == nsStyleAnimation::eUnit_Percent ||
|
||||
aSecondUnit == nsStyleAnimation::eUnit_Calc)) {
|
||||
(aFirstUnit == StyleAnimationValue::eUnit_Coord ||
|
||||
aFirstUnit == StyleAnimationValue::eUnit_Percent ||
|
||||
aFirstUnit == StyleAnimationValue::eUnit_Calc) &&
|
||||
(aSecondUnit == StyleAnimationValue::eUnit_Coord ||
|
||||
aSecondUnit == StyleAnimationValue::eUnit_Percent ||
|
||||
aSecondUnit == StyleAnimationValue::eUnit_Calc)) {
|
||||
// We can use calc() as the common unit.
|
||||
return nsStyleAnimation::eUnit_Calc;
|
||||
return StyleAnimationValue::eUnit_Calc;
|
||||
}
|
||||
return nsStyleAnimation::eUnit_Null;
|
||||
return StyleAnimationValue::eUnit_Null;
|
||||
}
|
||||
return aFirstUnit;
|
||||
}
|
||||
@ -316,23 +316,23 @@ ExtractCalcValueInternal(const nsCSSValue& aValue)
|
||||
|
||||
// Requires a canonical calc() value that we generated.
|
||||
static PixelCalcValue
|
||||
ExtractCalcValue(const nsStyleAnimation::Value& aValue)
|
||||
ExtractCalcValue(const StyleAnimationValue& aValue)
|
||||
{
|
||||
PixelCalcValue result;
|
||||
if (aValue.GetUnit() == nsStyleAnimation::eUnit_Coord) {
|
||||
if (aValue.GetUnit() == StyleAnimationValue::eUnit_Coord) {
|
||||
result.mLength =
|
||||
nsPresContext::AppUnitsToFloatCSSPixels(aValue.GetCoordValue());
|
||||
result.mPercent = 0.0f;
|
||||
result.mHasPercent = false;
|
||||
return result;
|
||||
}
|
||||
if (aValue.GetUnit() == nsStyleAnimation::eUnit_Percent) {
|
||||
if (aValue.GetUnit() == StyleAnimationValue::eUnit_Percent) {
|
||||
result.mLength = 0.0f;
|
||||
result.mPercent = aValue.GetPercentValue();
|
||||
result.mHasPercent = true;
|
||||
return result;
|
||||
}
|
||||
NS_ABORT_IF_FALSE(aValue.GetUnit() == nsStyleAnimation::eUnit_Calc,
|
||||
NS_ABORT_IF_FALSE(aValue.GetUnit() == StyleAnimationValue::eUnit_Calc,
|
||||
"unexpected unit");
|
||||
nsCSSValue *val = aValue.GetCSSValueValue();
|
||||
return ExtractCalcValueInternal(*val);
|
||||
@ -403,9 +403,9 @@ GetURIAsUtf16StringBuffer(nsIURI* aUri)
|
||||
// -------------
|
||||
|
||||
bool
|
||||
nsStyleAnimation::ComputeDistance(nsCSSProperty aProperty,
|
||||
const Value& aStartValue,
|
||||
const Value& aEndValue,
|
||||
StyleAnimationValue::ComputeDistance(nsCSSProperty aProperty,
|
||||
const StyleAnimationValue& aStartValue,
|
||||
const StyleAnimationValue& aEndValue,
|
||||
double& aDistance)
|
||||
{
|
||||
Unit commonUnit =
|
||||
@ -664,7 +664,7 @@ nsStyleAnimation::ComputeDistance(nsCSSProperty aProperty,
|
||||
// particularly useful for paced animation.
|
||||
|
||||
// Call AddWeighted to make us lists of the same length.
|
||||
Value normValue1, normValue2;
|
||||
StyleAnimationValue normValue1, normValue2;
|
||||
if (!AddWeighted(aProperty, 1.0, aStartValue, 0.0, aEndValue,
|
||||
normValue1) ||
|
||||
!AddWeighted(aProperty, 0.0, aStartValue, 1.0, aEndValue,
|
||||
@ -707,7 +707,7 @@ nsStyleAnimation::ComputeDistance(nsCSSProperty aProperty,
|
||||
}
|
||||
case eUnit_Shadow: {
|
||||
// Call AddWeighted to make us lists of the same length.
|
||||
Value normValue1, normValue2;
|
||||
StyleAnimationValue normValue1, normValue2;
|
||||
if (!AddWeighted(aProperty, 1.0, aStartValue, 0.0, aEndValue,
|
||||
normValue1) ||
|
||||
!AddWeighted(aProperty, 0.0, aStartValue, 1.0, aEndValue,
|
||||
@ -752,16 +752,16 @@ nsStyleAnimation::ComputeDistance(nsCSSProperty aProperty,
|
||||
#endif
|
||||
|
||||
if (color1.GetUnit() != eCSSUnit_Null) {
|
||||
nsStyleAnimation::Value color1Value
|
||||
(color1.GetColorValue(), nsStyleAnimation::Value::ColorConstructor);
|
||||
nsStyleAnimation::Value color2Value
|
||||
(color2.GetColorValue(), nsStyleAnimation::Value::ColorConstructor);
|
||||
StyleAnimationValue color1Value
|
||||
(color1.GetColorValue(), StyleAnimationValue::ColorConstructor);
|
||||
StyleAnimationValue color2Value
|
||||
(color2.GetColorValue(), StyleAnimationValue::ColorConstructor);
|
||||
double colorDistance;
|
||||
|
||||
#ifdef DEBUG
|
||||
bool ok =
|
||||
#endif
|
||||
nsStyleAnimation::ComputeDistance(eCSSProperty_color,
|
||||
StyleAnimationValue::ComputeDistance(eCSSProperty_color,
|
||||
color1Value, color2Value,
|
||||
colorDistance);
|
||||
NS_ABORT_IF_FALSE(ok, "should not fail");
|
||||
@ -1121,16 +1121,18 @@ AddShadowItems(double aCoeff1, const nsCSSValue &aValue1,
|
||||
}
|
||||
|
||||
if (color1.GetUnit() != eCSSUnit_Null) {
|
||||
nsStyleAnimation::Value color1Value
|
||||
(color1.GetColorValue(), nsStyleAnimation::Value::ColorConstructor);
|
||||
nsStyleAnimation::Value color2Value
|
||||
(color2.GetColorValue(), nsStyleAnimation::Value::ColorConstructor);
|
||||
nsStyleAnimation::Value resultColorValue;
|
||||
StyleAnimationValue color1Value
|
||||
(color1.GetColorValue(), StyleAnimationValue::ColorConstructor);
|
||||
StyleAnimationValue color2Value
|
||||
(color2.GetColorValue(), StyleAnimationValue::ColorConstructor);
|
||||
StyleAnimationValue resultColorValue;
|
||||
#ifdef DEBUG
|
||||
bool ok =
|
||||
#endif
|
||||
nsStyleAnimation::AddWeighted(eCSSProperty_color, aCoeff1, color1Value,
|
||||
aCoeff2, color2Value, resultColorValue);
|
||||
StyleAnimationValue::AddWeighted(eCSSProperty_color,
|
||||
aCoeff1, color1Value,
|
||||
aCoeff2, color2Value,
|
||||
resultColorValue);
|
||||
NS_ABORT_IF_FALSE(ok, "should not fail");
|
||||
resultArray->Item(4).SetColorValue(resultColorValue.GetColorValue());
|
||||
}
|
||||
@ -1193,7 +1195,7 @@ AddTransformScale(double aCoeff1, const nsCSSValue &aValue1,
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<nsCSSValue::Array>
|
||||
nsStyleAnimation::AppendTransformFunction(nsCSSKeyword aTransformFunction,
|
||||
StyleAnimationValue::AppendTransformFunction(nsCSSKeyword aTransformFunction,
|
||||
nsCSSValueList**& aListTail)
|
||||
{
|
||||
nsRefPtr<nsCSSValue::Array> arr = AppendFunction(aTransformFunction);
|
||||
@ -1498,7 +1500,7 @@ T InterpolateNumerically(const T& aOne, const T& aTwo, double aCoeff)
|
||||
|
||||
|
||||
/* static */ gfx3DMatrix
|
||||
nsStyleAnimation::InterpolateTransformMatrix(const gfx3DMatrix &aMatrix1,
|
||||
StyleAnimationValue::InterpolateTransformMatrix(const gfx3DMatrix &aMatrix1,
|
||||
const gfx3DMatrix &aMatrix2,
|
||||
double aProgress)
|
||||
{
|
||||
@ -1580,7 +1582,9 @@ AddDifferentTransformLists(double aCoeff1, const nsCSSValueList* aList1,
|
||||
nsCSSValueList **resultTail = getter_Transfers(result);
|
||||
|
||||
nsRefPtr<nsCSSValue::Array> arr;
|
||||
arr = nsStyleAnimation::AppendTransformFunction(eCSSKeyword_interpolatematrix, resultTail);
|
||||
arr =
|
||||
StyleAnimationValue::AppendTransformFunction(eCSSKeyword_interpolatematrix,
|
||||
resultTail);
|
||||
|
||||
// FIXME: We should change the other transform code to also only
|
||||
// take a single progress value, as having values that don't
|
||||
@ -1741,7 +1745,7 @@ AddTransformLists(double aCoeff1, const nsCSSValueList* aList1,
|
||||
tfunc != eCSSKeyword_interpolatematrix &&
|
||||
tfunc != eCSSKeyword_rotate3d &&
|
||||
tfunc != eCSSKeyword_perspective) {
|
||||
arr = nsStyleAnimation::AppendTransformFunction(tfunc, resultTail);
|
||||
arr = StyleAnimationValue::AppendTransformFunction(tfunc, resultTail);
|
||||
}
|
||||
|
||||
switch (tfunc) {
|
||||
@ -1852,10 +1856,12 @@ AddTransformLists(double aCoeff1, const nsCSSValueList* aList1,
|
||||
}
|
||||
|
||||
bool
|
||||
nsStyleAnimation::AddWeighted(nsCSSProperty aProperty,
|
||||
double aCoeff1, const Value& aValue1,
|
||||
double aCoeff2, const Value& aValue2,
|
||||
Value& aResultValue)
|
||||
StyleAnimationValue::AddWeighted(nsCSSProperty aProperty,
|
||||
double aCoeff1,
|
||||
const StyleAnimationValue& aValue1,
|
||||
double aCoeff2,
|
||||
const StyleAnimationValue& aValue2,
|
||||
StyleAnimationValue& aResultValue)
|
||||
{
|
||||
Unit commonUnit =
|
||||
GetCommonUnit(aProperty, aValue1.GetUnit(), aValue2.GetUnit());
|
||||
@ -2473,11 +2479,11 @@ LookupStyleContext(dom::Element* aElement)
|
||||
}
|
||||
|
||||
bool
|
||||
nsStyleAnimation::ComputeValue(nsCSSProperty aProperty,
|
||||
StyleAnimationValue::ComputeValue(nsCSSProperty aProperty,
|
||||
dom::Element* aTargetElement,
|
||||
const nsAString& aSpecifiedValue,
|
||||
bool aUseSVGMode,
|
||||
Value& aComputedValue,
|
||||
StyleAnimationValue& aComputedValue,
|
||||
bool* aIsContextSensitive)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(aTargetElement, "null target element");
|
||||
@ -2560,8 +2566,8 @@ nsStyleAnimation::ComputeValue(nsCSSProperty aProperty,
|
||||
}
|
||||
|
||||
bool
|
||||
nsStyleAnimation::UncomputeValue(nsCSSProperty aProperty,
|
||||
const Value& aComputedValue,
|
||||
StyleAnimationValue::UncomputeValue(nsCSSProperty aProperty,
|
||||
const StyleAnimationValue& aComputedValue,
|
||||
nsCSSValue& aSpecifiedValue)
|
||||
{
|
||||
switch (aComputedValue.GetUnit()) {
|
||||
@ -2653,8 +2659,8 @@ nsStyleAnimation::UncomputeValue(nsCSSProperty aProperty,
|
||||
}
|
||||
|
||||
bool
|
||||
nsStyleAnimation::UncomputeValue(nsCSSProperty aProperty,
|
||||
const Value& aComputedValue,
|
||||
StyleAnimationValue::UncomputeValue(nsCSSProperty aProperty,
|
||||
const StyleAnimationValue& aComputedValue,
|
||||
nsAString& aSpecifiedValue)
|
||||
{
|
||||
aSpecifiedValue.Truncate(); // Clear outparam, if it's not already empty
|
||||
@ -2664,7 +2670,7 @@ nsStyleAnimation::UncomputeValue(nsCSSProperty aProperty,
|
||||
return true;
|
||||
}
|
||||
nsCSSValue val;
|
||||
if (!nsStyleAnimation::UncomputeValue(aProperty, aComputedValue, val)) {
|
||||
if (!StyleAnimationValue::UncomputeValue(aProperty, aComputedValue, val)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -2686,7 +2692,8 @@ StyleDataAtOffset(void* aStyleStruct, ptrdiff_t aOffset)
|
||||
|
||||
static void
|
||||
ExtractBorderColor(nsStyleContext* aStyleContext, const void* aStyleBorder,
|
||||
mozilla::css::Side aSide, nsStyleAnimation::Value& aComputedValue)
|
||||
mozilla::css::Side aSide,
|
||||
StyleAnimationValue& aComputedValue)
|
||||
{
|
||||
nscolor color;
|
||||
bool foreground;
|
||||
@ -2700,7 +2707,7 @@ ExtractBorderColor(nsStyleContext* aStyleContext, const void* aStyleBorder,
|
||||
}
|
||||
|
||||
static bool
|
||||
StyleCoordToValue(const nsStyleCoord& aCoord, nsStyleAnimation::Value& aValue)
|
||||
StyleCoordToValue(const nsStyleCoord& aCoord, StyleAnimationValue& aValue)
|
||||
{
|
||||
switch (aCoord.GetUnit()) {
|
||||
case eStyleUnit_Normal:
|
||||
@ -2723,17 +2730,17 @@ StyleCoordToValue(const nsStyleCoord& aCoord, nsStyleAnimation::Value& aValue)
|
||||
break;
|
||||
case eStyleUnit_Enumerated:
|
||||
aValue.SetIntValue(aCoord.GetIntValue(),
|
||||
nsStyleAnimation::eUnit_Enumerated);
|
||||
StyleAnimationValue::eUnit_Enumerated);
|
||||
break;
|
||||
case eStyleUnit_Integer:
|
||||
aValue.SetIntValue(aCoord.GetIntValue(),
|
||||
nsStyleAnimation::eUnit_Integer);
|
||||
StyleAnimationValue::eUnit_Integer);
|
||||
break;
|
||||
case eStyleUnit_Calc: {
|
||||
nsAutoPtr<nsCSSValue> val(new nsCSSValue);
|
||||
SetCalcValue(aCoord.GetCalcValue(), *val);
|
||||
aValue.SetAndAdoptCSSValueValue(val.forget(),
|
||||
nsStyleAnimation::eUnit_Calc);
|
||||
StyleAnimationValue::eUnit_Calc);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -2820,9 +2827,9 @@ SubstitutePixelValues(nsStyleContext* aStyleContext,
|
||||
}
|
||||
|
||||
bool
|
||||
nsStyleAnimation::ExtractComputedValue(nsCSSProperty aProperty,
|
||||
StyleAnimationValue::ExtractComputedValue(nsCSSProperty aProperty,
|
||||
nsStyleContext* aStyleContext,
|
||||
Value& aComputedValue)
|
||||
StyleAnimationValue& aComputedValue)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(0 <= aProperty &&
|
||||
aProperty < eCSSProperty_COUNT_no_shorthands,
|
||||
@ -3461,7 +3468,7 @@ nsStyleAnimation::ExtractComputedValue(nsCSSProperty aProperty,
|
||||
return false;
|
||||
}
|
||||
|
||||
nsStyleAnimation::Value::Value(int32_t aInt, Unit aUnit,
|
||||
StyleAnimationValue::StyleAnimationValue(int32_t aInt, Unit aUnit,
|
||||
IntegerConstructorType)
|
||||
{
|
||||
NS_ASSERTION(IsIntUnit(aUnit), "unit must be of integer type");
|
||||
@ -3469,34 +3476,35 @@ nsStyleAnimation::Value::Value(int32_t aInt, Unit aUnit,
|
||||
mValue.mInt = aInt;
|
||||
}
|
||||
|
||||
nsStyleAnimation::Value::Value(nscoord aLength, CoordConstructorType)
|
||||
StyleAnimationValue::StyleAnimationValue(nscoord aLength, CoordConstructorType)
|
||||
{
|
||||
mUnit = eUnit_Coord;
|
||||
mValue.mCoord = aLength;
|
||||
}
|
||||
|
||||
nsStyleAnimation::Value::Value(float aPercent, PercentConstructorType)
|
||||
StyleAnimationValue::StyleAnimationValue(float aPercent,
|
||||
PercentConstructorType)
|
||||
{
|
||||
mUnit = eUnit_Percent;
|
||||
mValue.mFloat = aPercent;
|
||||
MOZ_ASSERT(!mozilla::IsNaN(mValue.mFloat));
|
||||
}
|
||||
|
||||
nsStyleAnimation::Value::Value(float aFloat, FloatConstructorType)
|
||||
StyleAnimationValue::StyleAnimationValue(float aFloat, FloatConstructorType)
|
||||
{
|
||||
mUnit = eUnit_Float;
|
||||
mValue.mFloat = aFloat;
|
||||
MOZ_ASSERT(!mozilla::IsNaN(mValue.mFloat));
|
||||
}
|
||||
|
||||
nsStyleAnimation::Value::Value(nscolor aColor, ColorConstructorType)
|
||||
StyleAnimationValue::StyleAnimationValue(nscolor aColor, ColorConstructorType)
|
||||
{
|
||||
mUnit = eUnit_Color;
|
||||
mValue.mColor = aColor;
|
||||
}
|
||||
|
||||
nsStyleAnimation::Value&
|
||||
nsStyleAnimation::Value::operator=(const Value& aOther)
|
||||
StyleAnimationValue&
|
||||
StyleAnimationValue::operator=(const StyleAnimationValue& aOther)
|
||||
{
|
||||
FreeValue();
|
||||
|
||||
@ -3592,28 +3600,28 @@ nsStyleAnimation::Value::operator=(const Value& aOther)
|
||||
}
|
||||
|
||||
void
|
||||
nsStyleAnimation::Value::SetNormalValue()
|
||||
StyleAnimationValue::SetNormalValue()
|
||||
{
|
||||
FreeValue();
|
||||
mUnit = eUnit_Normal;
|
||||
}
|
||||
|
||||
void
|
||||
nsStyleAnimation::Value::SetAutoValue()
|
||||
StyleAnimationValue::SetAutoValue()
|
||||
{
|
||||
FreeValue();
|
||||
mUnit = eUnit_Auto;
|
||||
}
|
||||
|
||||
void
|
||||
nsStyleAnimation::Value::SetNoneValue()
|
||||
StyleAnimationValue::SetNoneValue()
|
||||
{
|
||||
FreeValue();
|
||||
mUnit = eUnit_None;
|
||||
}
|
||||
|
||||
void
|
||||
nsStyleAnimation::Value::SetIntValue(int32_t aInt, Unit aUnit)
|
||||
StyleAnimationValue::SetIntValue(int32_t aInt, Unit aUnit)
|
||||
{
|
||||
NS_ASSERTION(IsIntUnit(aUnit), "unit must be of integer type");
|
||||
FreeValue();
|
||||
@ -3622,7 +3630,7 @@ nsStyleAnimation::Value::SetIntValue(int32_t aInt, Unit aUnit)
|
||||
}
|
||||
|
||||
void
|
||||
nsStyleAnimation::Value::SetCoordValue(nscoord aLength)
|
||||
StyleAnimationValue::SetCoordValue(nscoord aLength)
|
||||
{
|
||||
FreeValue();
|
||||
mUnit = eUnit_Coord;
|
||||
@ -3630,7 +3638,7 @@ nsStyleAnimation::Value::SetCoordValue(nscoord aLength)
|
||||
}
|
||||
|
||||
void
|
||||
nsStyleAnimation::Value::SetPercentValue(float aPercent)
|
||||
StyleAnimationValue::SetPercentValue(float aPercent)
|
||||
{
|
||||
FreeValue();
|
||||
mUnit = eUnit_Percent;
|
||||
@ -3639,7 +3647,7 @@ nsStyleAnimation::Value::SetPercentValue(float aPercent)
|
||||
}
|
||||
|
||||
void
|
||||
nsStyleAnimation::Value::SetFloatValue(float aFloat)
|
||||
StyleAnimationValue::SetFloatValue(float aFloat)
|
||||
{
|
||||
FreeValue();
|
||||
mUnit = eUnit_Float;
|
||||
@ -3648,7 +3656,7 @@ nsStyleAnimation::Value::SetFloatValue(float aFloat)
|
||||
}
|
||||
|
||||
void
|
||||
nsStyleAnimation::Value::SetColorValue(nscolor aColor)
|
||||
StyleAnimationValue::SetColorValue(nscolor aColor)
|
||||
{
|
||||
FreeValue();
|
||||
mUnit = eUnit_Color;
|
||||
@ -3656,7 +3664,7 @@ nsStyleAnimation::Value::SetColorValue(nscolor aColor)
|
||||
}
|
||||
|
||||
void
|
||||
nsStyleAnimation::Value::SetUnparsedStringValue(const nsString& aString)
|
||||
StyleAnimationValue::SetUnparsedStringValue(const nsString& aString)
|
||||
{
|
||||
FreeValue();
|
||||
mUnit = eUnit_UnparsedString;
|
||||
@ -3664,7 +3672,7 @@ nsStyleAnimation::Value::SetUnparsedStringValue(const nsString& aString)
|
||||
}
|
||||
|
||||
void
|
||||
nsStyleAnimation::Value::SetAndAdoptCSSValueValue(nsCSSValue *aValue,
|
||||
StyleAnimationValue::SetAndAdoptCSSValueValue(nsCSSValue *aValue,
|
||||
Unit aUnit)
|
||||
{
|
||||
FreeValue();
|
||||
@ -3675,8 +3683,8 @@ nsStyleAnimation::Value::SetAndAdoptCSSValueValue(nsCSSValue *aValue,
|
||||
}
|
||||
|
||||
void
|
||||
nsStyleAnimation::Value::SetAndAdoptCSSValuePairValue(
|
||||
nsCSSValuePair *aValuePair, Unit aUnit)
|
||||
StyleAnimationValue::SetAndAdoptCSSValuePairValue(nsCSSValuePair *aValuePair,
|
||||
Unit aUnit)
|
||||
{
|
||||
FreeValue();
|
||||
NS_ABORT_IF_FALSE(IsCSSValuePairUnit(aUnit), "bad unit");
|
||||
@ -3686,7 +3694,7 @@ nsStyleAnimation::Value::SetAndAdoptCSSValuePairValue(
|
||||
}
|
||||
|
||||
void
|
||||
nsStyleAnimation::Value::SetAndAdoptCSSValueTripletValue(
|
||||
StyleAnimationValue::SetAndAdoptCSSValueTripletValue(
|
||||
nsCSSValueTriplet *aValueTriplet, Unit aUnit)
|
||||
{
|
||||
FreeValue();
|
||||
@ -3697,7 +3705,7 @@ nsStyleAnimation::Value::SetAndAdoptCSSValueTripletValue(
|
||||
}
|
||||
|
||||
void
|
||||
nsStyleAnimation::Value::SetAndAdoptCSSRectValue(nsCSSRect *aRect, Unit aUnit)
|
||||
StyleAnimationValue::SetAndAdoptCSSRectValue(nsCSSRect *aRect, Unit aUnit)
|
||||
{
|
||||
FreeValue();
|
||||
NS_ABORT_IF_FALSE(IsCSSRectUnit(aUnit), "bad unit");
|
||||
@ -3707,8 +3715,8 @@ nsStyleAnimation::Value::SetAndAdoptCSSRectValue(nsCSSRect *aRect, Unit aUnit)
|
||||
}
|
||||
|
||||
void
|
||||
nsStyleAnimation::Value::SetAndAdoptCSSValueListValue(
|
||||
nsCSSValueList *aValueList, Unit aUnit)
|
||||
StyleAnimationValue::SetAndAdoptCSSValueListValue(nsCSSValueList *aValueList,
|
||||
Unit aUnit)
|
||||
{
|
||||
FreeValue();
|
||||
NS_ABORT_IF_FALSE(IsCSSValueListUnit(aUnit), "bad unit");
|
||||
@ -3720,7 +3728,7 @@ nsStyleAnimation::Value::SetAndAdoptCSSValueListValue(
|
||||
}
|
||||
|
||||
void
|
||||
nsStyleAnimation::Value::SetTransformValue(nsCSSValueSharedList* aList)
|
||||
StyleAnimationValue::SetTransformValue(nsCSSValueSharedList* aList)
|
||||
{
|
||||
FreeValue();
|
||||
mUnit = eUnit_Transform;
|
||||
@ -3729,7 +3737,7 @@ nsStyleAnimation::Value::SetTransformValue(nsCSSValueSharedList* aList)
|
||||
}
|
||||
|
||||
void
|
||||
nsStyleAnimation::Value::SetAndAdoptCSSValuePairListValue(
|
||||
StyleAnimationValue::SetAndAdoptCSSValuePairListValue(
|
||||
nsCSSValuePairList *aValuePairList)
|
||||
{
|
||||
FreeValue();
|
||||
@ -3739,7 +3747,7 @@ nsStyleAnimation::Value::SetAndAdoptCSSValuePairListValue(
|
||||
}
|
||||
|
||||
void
|
||||
nsStyleAnimation::Value::FreeValue()
|
||||
StyleAnimationValue::FreeValue()
|
||||
{
|
||||
if (IsCSSValueUnit(mUnit)) {
|
||||
delete mValue.mCSSValue;
|
||||
@ -3762,7 +3770,7 @@ nsStyleAnimation::Value::FreeValue()
|
||||
}
|
||||
|
||||
bool
|
||||
nsStyleAnimation::Value::operator==(const Value& aOther) const
|
||||
StyleAnimationValue::operator==(const StyleAnimationValue& aOther) const
|
||||
{
|
||||
if (mUnit != aOther.mUnit) {
|
||||
return false;
|
||||
|
@ -19,18 +19,16 @@ class nsStyleContext;
|
||||
class gfx3DMatrix;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace dom {
|
||||
class Element;
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
/**
|
||||
* Utility class to handle animated style values
|
||||
*/
|
||||
class nsStyleAnimation {
|
||||
class StyleAnimationValue {
|
||||
public:
|
||||
class Value;
|
||||
|
||||
// Mathematical methods
|
||||
// --------------------
|
||||
/**
|
||||
@ -45,8 +43,8 @@ public:
|
||||
* @param aCount The number of times to add aValueToAdd.
|
||||
* @return true on success, false on failure.
|
||||
*/
|
||||
static bool Add(nsCSSProperty aProperty, Value& aDest,
|
||||
const Value& aValueToAdd, uint32_t aCount) {
|
||||
static bool Add(nsCSSProperty aProperty, StyleAnimationValue& aDest,
|
||||
const StyleAnimationValue& aValueToAdd, uint32_t aCount) {
|
||||
return AddWeighted(aProperty, 1.0, aDest, aCount, aValueToAdd, aDest);
|
||||
}
|
||||
|
||||
@ -55,8 +53,8 @@ public:
|
||||
*
|
||||
* This measure of Distance is guaranteed to be proportional to
|
||||
* portions passed to Interpolate, Add, or AddWeighted. However, for
|
||||
* some types of Value it may not produce sensible results for paced
|
||||
* animation.
|
||||
* some types of StyleAnimationValue it may not produce sensible results
|
||||
* for paced animation.
|
||||
*
|
||||
* If this method succeeds, the returned distance value is guaranteed to be
|
||||
* non-negative.
|
||||
@ -69,8 +67,8 @@ public:
|
||||
* @return true on success, false on failure.
|
||||
*/
|
||||
static bool ComputeDistance(nsCSSProperty aProperty,
|
||||
const Value& aStartValue,
|
||||
const Value& aEndValue,
|
||||
const StyleAnimationValue& aStartValue,
|
||||
const StyleAnimationValue& aEndValue,
|
||||
double& aDistance);
|
||||
|
||||
/**
|
||||
@ -90,10 +88,10 @@ public:
|
||||
* @return true on success, false on failure.
|
||||
*/
|
||||
static bool Interpolate(nsCSSProperty aProperty,
|
||||
const Value& aStartValue,
|
||||
const Value& aEndValue,
|
||||
const StyleAnimationValue& aStartValue,
|
||||
const StyleAnimationValue& aEndValue,
|
||||
double aPortion,
|
||||
Value& aResultValue) {
|
||||
StyleAnimationValue& aResultValue) {
|
||||
return AddWeighted(aProperty, 1.0 - aPortion, aStartValue,
|
||||
aPortion, aEndValue, aResultValue);
|
||||
}
|
||||
@ -113,9 +111,9 @@ public:
|
||||
* positive.
|
||||
*/
|
||||
static bool AddWeighted(nsCSSProperty aProperty,
|
||||
double aCoeff1, const Value& aValue1,
|
||||
double aCoeff2, const Value& aValue2,
|
||||
Value& aResultValue);
|
||||
double aCoeff1, const StyleAnimationValue& aValue1,
|
||||
double aCoeff2, const StyleAnimationValue& aValue2,
|
||||
StyleAnimationValue& aResultValue);
|
||||
|
||||
// Type-conversion methods
|
||||
// -----------------------
|
||||
@ -147,7 +145,7 @@ public:
|
||||
mozilla::dom::Element* aTargetElement,
|
||||
const nsAString& aSpecifiedValue,
|
||||
bool aUseSVGMode,
|
||||
Value& aComputedValue,
|
||||
StyleAnimationValue& aComputedValue,
|
||||
bool* aIsContextSensitive = nullptr);
|
||||
|
||||
/**
|
||||
@ -164,10 +162,10 @@ public:
|
||||
* @return true on success, false on failure.
|
||||
*/
|
||||
static bool UncomputeValue(nsCSSProperty aProperty,
|
||||
const Value& aComputedValue,
|
||||
const StyleAnimationValue& aComputedValue,
|
||||
nsCSSValue& aSpecifiedValue);
|
||||
static bool UncomputeValue(nsCSSProperty aProperty,
|
||||
const Value& aComputedValue,
|
||||
const StyleAnimationValue& aComputedValue,
|
||||
nsAString& aSpecifiedValue);
|
||||
|
||||
/**
|
||||
@ -181,7 +179,7 @@ public:
|
||||
*/
|
||||
static bool ExtractComputedValue(nsCSSProperty aProperty,
|
||||
nsStyleContext* aStyleContext,
|
||||
Value& aComputedValue);
|
||||
StyleAnimationValue& aComputedValue);
|
||||
|
||||
/**
|
||||
* Interpolates between 2 matrices by decomposing them.
|
||||
@ -228,7 +226,6 @@ public:
|
||||
eUnit_UnparsedString // nsStringBuffer* (never null)
|
||||
};
|
||||
|
||||
class Value {
|
||||
private:
|
||||
Unit mUnit;
|
||||
union {
|
||||
@ -245,6 +242,7 @@ public:
|
||||
nsCSSValuePairList* mCSSValuePairList;
|
||||
nsStringBuffer* mString;
|
||||
} mValue;
|
||||
|
||||
public:
|
||||
Unit GetUnit() const {
|
||||
NS_ASSERTION(mUnit != eUnit_Null, "uninitialized");
|
||||
@ -317,24 +315,25 @@ public:
|
||||
mValue.mString->ToString(len, aBuffer);
|
||||
}
|
||||
|
||||
explicit Value(Unit aUnit = eUnit_Null) : mUnit(aUnit) {
|
||||
explicit StyleAnimationValue(Unit aUnit = eUnit_Null) : mUnit(aUnit) {
|
||||
NS_ASSERTION(aUnit == eUnit_Null || aUnit == eUnit_Normal ||
|
||||
aUnit == eUnit_Auto || aUnit == eUnit_None,
|
||||
"must be valueless unit");
|
||||
}
|
||||
Value(const Value& aOther) : mUnit(eUnit_Null) { *this = aOther; }
|
||||
StyleAnimationValue(const StyleAnimationValue& aOther)
|
||||
: mUnit(eUnit_Null) { *this = aOther; }
|
||||
enum IntegerConstructorType { IntegerConstructor };
|
||||
Value(int32_t aInt, Unit aUnit, IntegerConstructorType);
|
||||
StyleAnimationValue(int32_t aInt, Unit aUnit, IntegerConstructorType);
|
||||
enum CoordConstructorType { CoordConstructor };
|
||||
Value(nscoord aLength, CoordConstructorType);
|
||||
StyleAnimationValue(nscoord aLength, CoordConstructorType);
|
||||
enum PercentConstructorType { PercentConstructor };
|
||||
Value(float aPercent, PercentConstructorType);
|
||||
StyleAnimationValue(float aPercent, PercentConstructorType);
|
||||
enum FloatConstructorType { FloatConstructor };
|
||||
Value(float aFloat, FloatConstructorType);
|
||||
StyleAnimationValue(float aFloat, FloatConstructorType);
|
||||
enum ColorConstructorType { ColorConstructor };
|
||||
Value(nscolor aColor, ColorConstructorType);
|
||||
StyleAnimationValue(nscolor aColor, ColorConstructorType);
|
||||
|
||||
~Value() { FreeValue(); }
|
||||
~StyleAnimationValue() { FreeValue(); }
|
||||
|
||||
void SetNormalValue();
|
||||
void SetAutoValue();
|
||||
@ -357,10 +356,10 @@ public:
|
||||
|
||||
void SetTransformValue(nsCSSValueSharedList* aList);
|
||||
|
||||
Value& operator=(const Value& aOther);
|
||||
StyleAnimationValue& operator=(const StyleAnimationValue& aOther);
|
||||
|
||||
bool operator==(const Value& aOther) const;
|
||||
bool operator!=(const Value& aOther) const
|
||||
bool operator==(const StyleAnimationValue& aOther) const;
|
||||
bool operator!=(const StyleAnimationValue& aOther) const
|
||||
{ return !(*this == aOther); }
|
||||
|
||||
private:
|
||||
@ -401,6 +400,7 @@ public:
|
||||
return aUnit == eUnit_UnparsedString;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
@ -746,19 +746,20 @@ NS_NewStyleContext(nsStyleContext* aParentContext,
|
||||
static inline void
|
||||
ExtractAnimationValue(nsCSSProperty aProperty,
|
||||
nsStyleContext* aStyleContext,
|
||||
nsStyleAnimation::Value& aResult)
|
||||
StyleAnimationValue& aResult)
|
||||
{
|
||||
DebugOnly<bool> success =
|
||||
nsStyleAnimation::ExtractComputedValue(aProperty, aStyleContext, aResult);
|
||||
StyleAnimationValue::ExtractComputedValue(aProperty, aStyleContext,
|
||||
aResult);
|
||||
NS_ABORT_IF_FALSE(success,
|
||||
"aProperty must be extractable by nsStyleAnimation");
|
||||
"aProperty must be extractable by StyleAnimationValue");
|
||||
}
|
||||
|
||||
static nscolor
|
||||
ExtractColor(nsCSSProperty aProperty,
|
||||
nsStyleContext *aStyleContext)
|
||||
{
|
||||
nsStyleAnimation::Value val;
|
||||
StyleAnimationValue val;
|
||||
ExtractAnimationValue(aProperty, aStyleContext, val);
|
||||
return val.GetColorValue();
|
||||
}
|
||||
@ -767,9 +768,9 @@ static nscolor
|
||||
ExtractColorLenient(nsCSSProperty aProperty,
|
||||
nsStyleContext *aStyleContext)
|
||||
{
|
||||
nsStyleAnimation::Value val;
|
||||
StyleAnimationValue val;
|
||||
ExtractAnimationValue(aProperty, aStyleContext, val);
|
||||
if (val.GetUnit() == nsStyleAnimation::eUnit_Color) {
|
||||
if (val.GetUnit() == StyleAnimationValue::eUnit_Color) {
|
||||
return val.GetColorValue();
|
||||
}
|
||||
return NS_RGBA(0, 0, 0, 0);
|
||||
|
@ -293,7 +293,7 @@ public:
|
||||
* Get a color that depends on link-visitedness using this and
|
||||
* this->GetStyleIfVisited().
|
||||
*
|
||||
* aProperty must be a color-valued property that nsStyleAnimation
|
||||
* aProperty must be a color-valued property that StyleAnimationValue
|
||||
* knows how to extract. It must also be a property that we know to
|
||||
* do change handling for in nsStyleContext::CalcDifference.
|
||||
*
|
||||
|
@ -53,7 +53,7 @@ ProcessTranslatePart(const nsCSSValue& aValue,
|
||||
// Handle this here (even though nsRuleNode::CalcLength handles it
|
||||
// fine) so that callers are allowed to pass a null style context
|
||||
// and pres context to SetToTransformFunction if they know (as
|
||||
// nsStyleAnimation does) that all lengths within the transform
|
||||
// StyleAnimationValue does) that all lengths within the transform
|
||||
// function have already been computed to pixels and percents.
|
||||
//
|
||||
// Raw numbers are treated as being pixels.
|
||||
@ -180,7 +180,9 @@ ProcessInterpolateMatrix(gfx3DMatrix& aMatrix,
|
||||
}
|
||||
double progress = aData->Item(3).GetPercentValue();
|
||||
|
||||
aMatrix = nsStyleAnimation::InterpolateTransformMatrix(matrix1, matrix2, progress) * aMatrix;
|
||||
aMatrix =
|
||||
StyleAnimationValue::InterpolateTransformMatrix(matrix1, matrix2, progress)
|
||||
* aMatrix;
|
||||
}
|
||||
|
||||
/* Helper function to process a translatex function. */
|
||||
@ -502,7 +504,7 @@ MatrixForTransformFunction(gfx3DMatrix& aMatrix,
|
||||
NS_PRECONDITION(aData, "Why did you want to get data from a null array?");
|
||||
// It's OK if aContext and aPresContext are null if the caller already
|
||||
// knows that all length units have been converted to pixels (as
|
||||
// nsStyleAnimation does).
|
||||
// StyleAnimationValue does).
|
||||
|
||||
|
||||
/* Get the keyword for the transform. */
|
||||
|
@ -56,7 +56,7 @@ namespace nsStyleTransformMatrix {
|
||||
*
|
||||
* aContext and aPresContext may be null if all of the (non-percent)
|
||||
* length values in aData are already known to have been converted to
|
||||
* eCSSUnit_Pixel (as they are in an nsStyleAnimation::Value)
|
||||
* eCSSUnit_Pixel (as they are in an StyleAnimationValue)
|
||||
*/
|
||||
gfx3DMatrix ReadTransforms(const nsCSSValueList* aList,
|
||||
nsStyleContext* aContext,
|
||||
|
@ -302,7 +302,7 @@ nsTransitionManager::StyleContextChanged(dom::Element *aElement,
|
||||
ElementAnimationPtrArray& animations = et->mAnimations;
|
||||
uint32_t i = animations.Length();
|
||||
NS_ABORT_IF_FALSE(i != 0, "empty transitions list?");
|
||||
nsStyleAnimation::Value currentValue;
|
||||
StyleAnimationValue currentValue;
|
||||
do {
|
||||
--i;
|
||||
ElementAnimation* animation = animations[i];
|
||||
@ -405,7 +405,7 @@ nsTransitionManager::ConsiderStartingTransition(nsCSSProperty aProperty,
|
||||
|
||||
nsRefPtr<ElementPropertyTransition> pt = new ElementPropertyTransition();
|
||||
|
||||
nsStyleAnimation::Value startValue, endValue, dummyValue;
|
||||
StyleAnimationValue startValue, endValue, dummyValue;
|
||||
bool haveValues =
|
||||
ExtractComputedValueForTransition(aProperty, aOldStyleContext,
|
||||
startValue) &&
|
||||
@ -420,7 +420,7 @@ nsTransitionManager::ConsiderStartingTransition(nsCSSProperty aProperty,
|
||||
// Check that we can interpolate between these values
|
||||
// (If this is ever a performance problem, we could add a
|
||||
// CanInterpolate method, but it seems fine for now.)
|
||||
nsStyleAnimation::Interpolate(aProperty, startValue, endValue,
|
||||
StyleAnimationValue::Interpolate(aProperty, startValue, endValue,
|
||||
0.5, dummyValue);
|
||||
|
||||
bool haveCurrentTransition = false;
|
||||
|
@ -33,7 +33,7 @@ struct ElementPropertyTransition : public mozilla::ElementAnimation
|
||||
// mProperties[0].mSegments[0].mFromValue, except when this transition
|
||||
// started as the reversal of another in-progress transition.
|
||||
// Needed so we can handle two reverses in a row.
|
||||
nsStyleAnimation::Value mStartForReversingTest;
|
||||
mozilla::StyleAnimationValue mStartForReversingTest;
|
||||
// Likewise, the portion (in value space) of the "full" reversed
|
||||
// transition that we're actually covering. For example, if a :hover
|
||||
// effect has a transition that moves the element 10px to the right
|
||||
|
Loading…
Reference in New Issue
Block a user