Bug 1367293 - Early return from ValueFromStringHelper() if the target element is not associated with any documents. r?birtles
MozReview-Commit-ID: 1mcCb5txtB4
--- a/dom/smil/nsSMILCSSValueType.cpp
+++ b/dom/smil/nsSMILCSSValueType.cpp
@@ -461,49 +461,50 @@ ValueFromStringHelper(nsCSSPropertyID aP
nsStyleContext* aStyleContext,
const nsAString& aString)
{
// FIXME (bug 1358966): Support shorthand properties
if (nsCSSProps::IsShorthand(aPropID)) {
return nullptr;
}
- // Get a suitable style context for Servo
- const ServoComputedValues* currentStyle =
- aStyleContext->StyleSource().AsServoComputedValues();
- // Bug 1349004: Remove GetParentAllowServo
- const ServoComputedValues* parentStyle =
- aStyleContext->GetParentAllowServo()
- ? aStyleContext->GetParentAllowServo()->StyleSource()
- .AsServoComputedValues()
- : nullptr;
- const ServoComputedValuesWithParent servoStyles =
- { currentStyle, parentStyle };
-
- // Parse property
nsIDocument* doc = aTargetElement->GetUncomposedDoc();
if (!doc) {
return nullptr;
}
+
+ // Parse property
// FIXME this is using the wrong base uri (bug 1343919)
RefPtr<URLExtraData> data = new URLExtraData(doc->GetDocumentURI(),
doc->GetDocumentURI(),
doc->NodePrincipal());
NS_ConvertUTF16toUTF8 value(aString);
RefPtr<RawServoDeclarationBlock> servoDeclarationBlock =
Servo_ParseProperty(aPropID,
&value,
data,
ParsingMode::AllowUnitlessLength |
ParsingMode::AllowAllNumericValues,
doc->GetCompatibilityMode()).Consume();
if (!servoDeclarationBlock) {
return nullptr;
}
+ // Get a suitable style context for Servo
+ const ServoComputedValues* currentStyle =
+ aStyleContext->StyleSource().AsServoComputedValues();
+ // Bug 1349004: Remove GetParentAllowServo
+ const ServoComputedValues* parentStyle =
+ aStyleContext->GetParentAllowServo()
+ ? aStyleContext->GetParentAllowServo()->StyleSource()
+ .AsServoComputedValues()
+ : nullptr;
+ const ServoComputedValuesWithParent servoStyles =
+ { currentStyle, parentStyle };
+
// Compute value
PropertyValuePair propValuePair;
propValuePair.mProperty = aPropID;
propValuePair.mServoDeclarationBlock = servoDeclarationBlock;
AutoTArray<Keyframe, 1> keyframes;
keyframes.AppendElement()->mPropertyValues.AppendElement(Move(propValuePair));
nsTArray<ComputedKeyframeValues> computedValues =
aPresContext->StyleSet()->AsServo()