Bug 1329088 - Pass SVG length mode to Stylo. r=emilio
In the SVG element case, tell Stylo to use the SVG length mode.
MozReview-Commit-ID: 9UR1AYRh4RE
--- a/dom/svg/nsSVGElement.cpp
+++ b/dom/svg/nsSVGElement.cpp
@@ -1232,18 +1232,19 @@ MappedAttrParser::ParseMappedAttrValue(n
mParser.ParseProperty(propertyID, aMappedAttrValue, mDocURI, mBaseURI,
mElement->NodePrincipal(), mDecl->AsGecko(), &changed, false, true);
} else {
NS_ConvertUTF16toUTF8 value(aMappedAttrValue);
// FIXME (bug 1343964): Figure out a better solution for sending the base uri to servo
RefPtr<URLExtraData> data = new URLExtraData(mBaseURI, mDocURI,
mElement->NodePrincipal());
// FIXME (bug 1342559): Set SVG parsing mode for lengths
- changed = Servo_DeclarationBlock_SetPropertyById(mDecl->AsServo()->Raw(), propertyID,
- &value, false, data);
+ changed = Servo_DeclarationBlock_SetPropertyById(
+ mDecl->AsServo()->Raw(), propertyID, &value, false, data,
+ LengthParsingMode::SVG);
}
if (changed) {
// The normal reporting of use counters by the nsCSSParser won't happen
// since it doesn't have a sheet.
if (nsCSSProps::IsShorthand(propertyID)) {
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(subprop, propertyID,
CSSEnabledState::eForAllContent) {
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -204,22 +204,24 @@ SERVO_BINDING_FUNC(Servo_DeclarationBloc
nsCSSPropertyID property, nsAString* value)
SERVO_BINDING_FUNC(Servo_DeclarationBlock_GetPropertyIsImportant, bool,
RawServoDeclarationBlockBorrowed declarations,
const nsACString* property)
SERVO_BINDING_FUNC(Servo_DeclarationBlock_SetProperty, bool,
RawServoDeclarationBlockBorrowed declarations,
const nsACString* property,
const nsACString* value, bool is_important,
- RawGeckoURLExtraData* data)
+ RawGeckoURLExtraData* data,
+ mozilla::LengthParsingMode length_parsing_mode)
SERVO_BINDING_FUNC(Servo_DeclarationBlock_SetPropertyById, bool,
RawServoDeclarationBlockBorrowed declarations,
nsCSSPropertyID property,
const nsACString* value, bool is_important,
- RawGeckoURLExtraData* data)
+ RawGeckoURLExtraData* data,
+ mozilla::LengthParsingMode length_parsing_mode)
SERVO_BINDING_FUNC(Servo_DeclarationBlock_RemoveProperty, void,
RawServoDeclarationBlockBorrowed declarations,
const nsACString* property)
SERVO_BINDING_FUNC(Servo_DeclarationBlock_RemovePropertyById, void,
RawServoDeclarationBlockBorrowed declarations,
nsCSSPropertyID property)
// Compose animation value for a given property.
// |base_values| is nsRefPtrHashtable<nsUint32HashKey, RawServoAnimationValue>.
--- a/layout/style/nsDOMCSSDeclaration.cpp
+++ b/layout/style/nsDOMCSSDeclaration.cpp
@@ -347,17 +347,17 @@ nsDOMCSSDeclaration::ParsePropertyValue(
nsCSSParser cssParser(env.mCSSLoader);
cssParser.ParseProperty(aPropID, aPropValue,
env.mSheetURI, env.mBaseURI, env.mPrincipal,
decl, changed, aIsImportant);
},
[&](ServoDeclarationBlock* decl, URLExtraData* data) {
NS_ConvertUTF16toUTF8 value(aPropValue);
return Servo_DeclarationBlock_SetPropertyById(
- decl->Raw(), aPropID, &value, aIsImportant, data);
+ decl->Raw(), aPropID, &value, aIsImportant, data, LengthParsingMode::Default);
});
}
nsresult
nsDOMCSSDeclaration::ParseCustomPropertyValue(const nsAString& aPropertyName,
const nsAString& aPropValue,
bool aIsImportant)
{
@@ -369,17 +369,18 @@ nsDOMCSSDeclaration::ParseCustomProperty
cssParser.ParseVariable(propName, aPropValue, env.mSheetURI,
env.mBaseURI, env.mPrincipal, decl,
changed, aIsImportant);
},
[&](ServoDeclarationBlock* decl, URLExtraData* data) {
NS_ConvertUTF16toUTF8 property(aPropertyName);
NS_ConvertUTF16toUTF8 value(aPropValue);
return Servo_DeclarationBlock_SetProperty(
- decl->Raw(), &property, &value, aIsImportant, data);
+ decl->Raw(), &property, &value, aIsImportant, data,
+ LengthParsingMode::Default);
});
}
nsresult
nsDOMCSSDeclaration::RemovePropertyInternal(nsCSSPropertyID aPropID)
{
DeclarationBlock* olddecl = GetCSSDeclaration(eOperation_RemoveProperty);
if (!olddecl) {