Bug 1501117 - Part 1: Serialize TimingFunction with servo. r=emilio

We could make sure we serialize TimingFunction for both computed
and specified values with servo (via CSSOM). However, Web animation
APIs could also serialize the timing function from a different code
path. We will fix it in the next patch.

Differential Revision: https://phabricator.services.mozilla.com/D10443

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Boris Chiou 2018-11-01 21:32:55 +00:00
Родитель dc29bb93e2
Коммит 91b20a5ee5
3 изменённых файлов: 1 добавлений и 73 удалений

Просмотреть файл

@ -103,6 +103,7 @@ SERIALIZED_PREDEFINED_TYPES = [
"Opacity",
"Resize",
"TextAlign",
"TimingFunction",
"TransformStyle",
"background::BackgroundSize",
"basic_shape::ClippingShape",

Просмотреть файл

@ -4576,56 +4576,6 @@ nsComputedDOMStyle::DoGetTransitionProperty()
return valueList.forget();
}
void
nsComputedDOMStyle::AppendTimingFunction(nsDOMCSSValueList *aValueList,
const nsTimingFunction& aTimingFunction)
{
RefPtr<nsROCSSPrimitiveValue> timingFunction = new nsROCSSPrimitiveValue;
nsAutoString tmp;
switch (aTimingFunction.mTiming.tag) {
case StyleComputedTimingFunction::Tag::CubicBezier:
nsStyleUtil::AppendCubicBezierTimingFunction(
aTimingFunction.mTiming.cubic_bezier.x1,
aTimingFunction.mTiming.cubic_bezier.y1,
aTimingFunction.mTiming.cubic_bezier.x2,
aTimingFunction.mTiming.cubic_bezier.y2,
tmp);
break;
case StyleComputedTimingFunction::Tag::Steps:
nsStyleUtil::AppendStepsTimingFunction(
aTimingFunction.mTiming.steps._0,
aTimingFunction.mTiming.steps._1,
tmp);
break;
case StyleComputedTimingFunction::Tag::Keyword:
nsStyleUtil::AppendCubicBezierKeywordTimingFunction(
aTimingFunction.mTiming.keyword._0,
tmp);
break;
}
timingFunction->SetString(tmp);
aValueList->AppendCSSValue(timingFunction.forget());
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetTransitionTimingFunction()
{
const nsStyleDisplay* display = StyleDisplay();
RefPtr<nsDOMCSSValueList> valueList = GetROCSSValueList(true);
MOZ_ASSERT(display->mTransitionTimingFunctionCount > 0,
"first item must be explicit");
uint32_t i = 0;
do {
AppendTimingFunction(valueList,
display->mTransitions[i].GetTimingFunction());
} while (++i < display->mTransitionTimingFunctionCount);
return valueList.forget();
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetAnimationName()
{
@ -4696,24 +4646,6 @@ nsComputedDOMStyle::DoGetAnimationDuration()
return valueList.forget();
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetAnimationTimingFunction()
{
const nsStyleDisplay* display = StyleDisplay();
RefPtr<nsDOMCSSValueList> valueList = GetROCSSValueList(true);
MOZ_ASSERT(display->mAnimationTimingFunctionCount > 0,
"first item must be explicit");
uint32_t i = 0;
do {
AppendTimingFunction(valueList,
display->mAnimations[i].GetTimingFunction());
} while (++i < display->mAnimationTimingFunctionCount);
return valueList.forget();
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetAnimationIterationCount()
{

Просмотреть файл

@ -48,7 +48,6 @@ struct nsStyleFilter;
class nsStyleGradient;
struct nsStyleImage;
class nsStyleSides;
struct nsTimingFunction;
class nsComputedDOMStyle final : public nsDOMCSSDeclaration
, public nsStubMutationObserver
@ -231,8 +230,6 @@ private:
const nsStyleSides& aCropRect,
nsString& aString);
already_AddRefed<CSSValue> GetScrollSnapPoints(const nsStyleCoord& aCoord);
void AppendTimingFunction(nsDOMCSSValueList *aValueList,
const nsTimingFunction& aTimingFunction);
bool ShouldHonorMinSizeAutoInAxis(mozilla::PhysicalAxis aAxis);
@ -402,13 +399,11 @@ private:
already_AddRefed<CSSValue> DoGetTransitionProperty();
already_AddRefed<CSSValue> DoGetTransitionDuration();
already_AddRefed<CSSValue> DoGetTransitionDelay();
already_AddRefed<CSSValue> DoGetTransitionTimingFunction();
/* CSS Animations */
already_AddRefed<CSSValue> DoGetAnimationName();
already_AddRefed<CSSValue> DoGetAnimationDuration();
already_AddRefed<CSSValue> DoGetAnimationDelay();
already_AddRefed<CSSValue> DoGetAnimationTimingFunction();
already_AddRefed<CSSValue> DoGetAnimationIterationCount();
/* CSS Flexbox properties */