Bug 1367293 - Early return from ValueFromStringHelper() if the target element is not associated with any documents. r=birtles
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Fri, 02 Jun 2017 09:38:00 +0900
changeset 361954 ebb95a9089b1154480fa96a0a17e1ac69086ab42
parent 361953 d820ab5d75a6093b243ec0f005bec3ba9bf7cb09
child 361955 10c6f7837bbddcf060316a5ac9c8f89dff4e56f1
push id31952
push usercbook@mozilla.com
push dateFri, 02 Jun 2017 12:17:25 +0000
treeherdermozilla-central@194c009d6295 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbirtles
bugs1367293
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1367293 - Early return from ValueFromStringHelper() if the target element is not associated with any documents. r=birtles MozReview-Commit-ID: 1mcCb5txtB4
dom/smil/nsSMILCSSValueType.cpp
--- 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()