Bug 1317178 - Pass the property name to Servo_DeclarationBlock_SerializeOneValue. r=birtles

In order to use single_value_to_css() in
Servo_DeclarationBlock_SerializeOneValue(), we need to pass the property name
and a flag for custom properties.

MozReview-Commit-ID: 5HfI2qOmPwP

--HG--
extra : rebase_source : 968468b3c9313c4ec3007ee9883075c8fc4ab769
This commit is contained in:
Boris Chiou 2016-11-22 19:18:18 +08:00
Родитель 8565b864ed
Коммит f045a91867
2 изменённых файлов: 14 добавлений и 13 удалений

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

@ -915,26 +915,27 @@ KeyframeEffectReadOnly::GetKeyframes(JSContext*& aCx,
JS::Rooted<JSObject*> keyframeObject(aCx, &keyframeJSValue.toObject());
for (const PropertyValuePair& propertyValue : keyframe.mPropertyValues) {
const char* name = nsCSSProps::PropertyIDLName(propertyValue.mProperty);
// nsCSSValue::AppendToString does not accept shorthands properties but
// works with token stream values if we pass eCSSProperty_UNKNOWN as
// the property.
nsCSSPropertyID propertyForSerializing =
nsCSSProps::IsShorthand(propertyValue.mProperty)
? eCSSProperty_UNKNOWN
: propertyValue.mProperty;
nsAutoString stringValue;
if (propertyValue.mServoDeclarationBlock) {
// FIXME: When we support animations for custom properties on servo, we
// should pass the flag to Servo_DeclarationBlock_SerializeOneValue.
// Now, we pass false to simplify it.
nsIAtom* atom = nsCSSProps::AtomForProperty(propertyValue.mProperty);
Servo_DeclarationBlock_SerializeOneValue(
propertyValue.mServoDeclarationBlock, &stringValue);
propertyValue.mServoDeclarationBlock, atom, false, &stringValue);
} else {
// nsCSSValue::AppendToString does not accept shorthands properties but
// works with token stream values if we pass eCSSProperty_UNKNOWN as
// the property.
nsCSSPropertyID propertyForSerializing =
nsCSSProps::IsShorthand(propertyValue.mProperty)
? eCSSProperty_UNKNOWN
: propertyValue.mProperty;
propertyValue.mValue.AppendToString(
propertyForSerializing, stringValue, nsCSSValue::eNormalized);
}
const char* name = nsCSSProps::PropertyIDLName(propertyValue.mProperty);
JS::Rooted<JS::Value> value(aCx);
if (!ToJSValue(aCx, stringValue, &value) ||
!JS_DefineProperty(aCx, keyframeObject, name, value,

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

@ -108,7 +108,7 @@ SERVO_BINDING_FUNC(Servo_DeclarationBlock_GetCssText, void,
nsAString* result)
SERVO_BINDING_FUNC(Servo_DeclarationBlock_SerializeOneValue, void,
RawServoDeclarationBlockBorrowed declarations,
nsString* buffer)
const nsIAtom* property, bool is_custom, nsString* buffer)
SERVO_BINDING_FUNC(Servo_DeclarationBlock_Count, uint32_t,
RawServoDeclarationBlockBorrowed declarations)
SERVO_BINDING_FUNC(Servo_DeclarationBlock_GetNthProperty, bool,