From a9096d4a6d63cd195986186786a085c3005f947b Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Thu, 12 Dec 2013 13:09:44 +1100 Subject: [PATCH] Bug 773296 - Part 16a: Followup to move to using nsCSSValueSharedList in OMTA code. r=roc --- gfx/layers/Layers.cpp | 10 ++++------ layout/base/nsDisplayList.cpp | 8 ++++---- layout/base/nsLayoutUtils.cpp | 8 +++++--- layout/style/nsCSSValue.h | 1 + 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/gfx/layers/Layers.cpp b/gfx/layers/Layers.cpp index 6091347e7916..1aa0a3b90e17 100644 --- a/gfx/layers/Layers.cpp +++ b/gfx/layers/Layers.cpp @@ -214,7 +214,7 @@ Layer::ClearAnimations() Mutated(); } -static nsCSSValueList* +static nsCSSValueSharedList* CreateCSSValueList(const InfallibleTArray& aFunctions) { nsAutoPtr result; @@ -337,7 +337,7 @@ CreateCSSValueList(const InfallibleTArray& 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& startFunctions = segment.startState().get_ArrayOfTransformFunction(); - startValue->SetAndAdoptCSSValueListValue(CreateCSSValueList(startFunctions), - nsStyleAnimation::eUnit_Transform); + startValue->SetTransformValue(CreateCSSValueList(startFunctions)); const InfallibleTArray& 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"); diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 4f1beb619bba..b5a1495957b8 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -338,12 +338,12 @@ AddAnimationsForProperty(nsIFrame* aFrame, nsCSSProperty aProperty, animSegment->startState() = InfallibleTArray(); animSegment->endState() = InfallibleTArray(); - 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(); diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 8e97e436cc5e..208dfb981906 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -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()); diff --git a/layout/style/nsCSSValue.h b/layout/style/nsCSSValue.h index 935d804ca73f..da4a4cdda835 100644 --- a/layout/style/nsCSSValue.h +++ b/layout/style/nsCSSValue.h @@ -718,6 +718,7 @@ struct nsCSSValueList_heap : public nsCSSValueList { // not have such a wrapper. struct nsCSSValueSharedList { nsCSSValueSharedList() + : mHead(nullptr) { MOZ_COUNT_CTOR(nsCSSValueSharedList); }