Bug 773296 - Part 16a: Followup to move to using nsCSSValueSharedList in OMTA code. r=roc

This commit is contained in:
Cameron McCormack 2013-12-12 13:09:44 +11:00
parent ae655160b2
commit a9096d4a6d
4 changed files with 14 additions and 13 deletions

View File

@ -214,7 +214,7 @@ Layer::ClearAnimations()
Mutated();
}
static nsCSSValueList*
static nsCSSValueSharedList*
CreateCSSValueList(const InfallibleTArray<TransformFunction>& aFunctions)
{
nsAutoPtr<nsCSSValueList> result;
@ -337,7 +337,7 @@ CreateCSSValueList(const InfallibleTArray<TransformFunction>& aFunctions)
result = new nsCSSValueList();
result->mValue.SetNoneValue();
}
return result.forget();
return new nsCSSValueSharedList(result.forget());
}
void
@ -385,13 +385,11 @@ Layer::SetAnimations(const AnimationArray& aAnimations)
if (segment.endState().type() == Animatable::TArrayOfTransformFunction) {
const InfallibleTArray<TransformFunction>& startFunctions =
segment.startState().get_ArrayOfTransformFunction();
startValue->SetAndAdoptCSSValueListValue(CreateCSSValueList(startFunctions),
nsStyleAnimation::eUnit_Transform);
startValue->SetTransformValue(CreateCSSValueList(startFunctions));
const InfallibleTArray<TransformFunction>& endFunctions =
segment.endState().get_ArrayOfTransformFunction();
endValue->SetAndAdoptCSSValueListValue(CreateCSSValueList(endFunctions),
nsStyleAnimation::eUnit_Transform);
endValue->SetTransformValue(CreateCSSValueList(endFunctions));
} else {
NS_ASSERTION(segment.endState().type() == Animatable::Tfloat,
"Unknown Animatable type");

View File

@ -338,12 +338,12 @@ AddAnimationsForProperty(nsIFrame* aFrame, nsCSSProperty aProperty,
animSegment->startState() = InfallibleTArray<TransformFunction>();
animSegment->endState() = InfallibleTArray<TransformFunction>();
nsCSSValueList* list = segment->mFromValue.GetCSSValueListValue();
AddTransformFunctions(list, styleContext, presContext, bounds, scale,
nsCSSValueSharedList* list = segment->mFromValue.GetCSSValueSharedListValue();
AddTransformFunctions(list->mHead, styleContext, presContext, bounds, scale,
animSegment->startState().get_ArrayOfTransformFunction());
list = segment->mToValue.GetCSSValueListValue();
AddTransformFunctions(list, styleContext, presContext, bounds, scale,
list = segment->mToValue.GetCSSValueSharedListValue();
AddTransformFunctions(list->mHead, styleContext, presContext, bounds, scale,
animSegment->endState().get_ArrayOfTransformFunction());
} else if (aProperty == eCSSProperty_opacity) {
animSegment->startState() = segment->mFromValue.GetFloatValue();

View File

@ -283,8 +283,10 @@ GetScaleForValue(const nsStyleAnimation::Value& aValue,
return gfxSize();
}
nsCSSValueList* values = aValue.GetCSSValueListValue();
if (values->mValue.GetUnit() == eCSSUnit_None) {
nsCSSValueSharedList* list = aValue.GetCSSValueSharedListValue();
MOZ_ASSERT(list->mHead);
if (list->mHead->mValue.GetUnit() == eCSSUnit_None) {
// There is an animation, but no actual transform yet.
return gfxSize();
}
@ -292,7 +294,7 @@ GetScaleForValue(const nsStyleAnimation::Value& aValue,
nsRect frameBounds = aFrame->GetRect();
bool dontCare;
gfx3DMatrix transform = nsStyleTransformMatrix::ReadTransforms(
aValue.GetCSSValueListValue(),
list->mHead,
aFrame->StyleContext(),
aFrame->PresContext(), dontCare, frameBounds,
aFrame->PresContext()->AppUnitsPerDevPixel());

View File

@ -718,6 +718,7 @@ struct nsCSSValueList_heap : public nsCSSValueList {
// not have such a wrapper.
struct nsCSSValueSharedList {
nsCSSValueSharedList()
: mHead(nullptr)
{
MOZ_COUNT_CTOR(nsCSSValueSharedList);
}