Bug 1338936 - Part 7: stylo: Make sure we don't crash on unimplemented mappers; r?emilio draft
authorManish Goregaokar <manishearth@gmail.com>
Sun, 12 Feb 2017 16:02:29 -0800
changeset 482696 392a88521aad34b2f306484dfe85e4b0413d70a7
parent 482695 07b374645686c036216872adcb73a9c00d1bf735
child 545476 025a94a37c4035ae8e71dc55ec94017d539b6e8b
push id45130
push userbmo:manishearth@gmail.com
push dateMon, 13 Feb 2017 08:35:16 +0000
reviewersemilio
bugs1338936
milestone54.0a1
Bug 1338936 - Part 7: stylo: Make sure we don't crash on unimplemented mappers; r?emilio MozReview-Commit-ID: 6wg32flypt7
dom/html/nsGenericHTMLElement.cpp
dom/mathml/nsMathMLElement.cpp
--- a/dom/html/nsGenericHTMLElement.cpp
+++ b/dom/html/nsGenericHTMLElement.cpp
@@ -1517,16 +1517,22 @@ nsGenericHTMLElement::MapImageBorderAttr
 void
 nsGenericHTMLElement::MapBackgroundInto(const nsMappedAttributes* aAttributes,
                                         GenericSpecifiedValues* aData)
 {
 
   if (!aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Background)))
     return;
 
+  if (aData->IsServo()) {
+    // FIXME(bug 1330041)
+    NS_WARNING("stylo: cannot handle background");
+    return;
+  }
+
   nsPresContext* presContext = aData->PresContext();
 
   if (!aData->PropertyIsSet(eCSSProperty_background_image) &&
       presContext->UseDocumentColors()) {
     // background
     nsAttrValue* value =
       const_cast<nsAttrValue*>(aAttributes->GetAttr(nsGkAtoms::background));
     if (value) {
@@ -1540,19 +1546,16 @@ nsGenericHTMLElement::MapBackgroundInto(
         // put it in the style tree.
         if (value->Type() == nsAttrValue::eURL) {
           value->LoadImage(presContext->Document());
         }
         if (value->Type() == nsAttrValue::eImage) {
           nsCSSValueList* list = backImage->SetListValue();
           list->mValue.SetImageValue(value->GetImageValue());
         }
-      } else {
-        // FIXME(bug 1330041)
-        MOZ_ASSERT_UNREACHABLE("stylo: cannot handle background");
       }
     }
   }
 }
 
 void
 nsGenericHTMLElement::MapBGColorInto(const nsMappedAttributes* aAttributes,
                                      GenericSpecifiedValues* aData)
--- a/dom/mathml/nsMathMLElement.cpp
+++ b/dom/mathml/nsMathMLElement.cpp
@@ -485,16 +485,21 @@ nsMathMLElement::ParseNumericValue(const
   aCSSValue.SetFloatValue(floatValue, cssUnit);
   return true;
 }
 
 void
 nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
                                          GenericSpecifiedValues* aGenericData)
 {
+  if (aGenericData->IsServo()) {
+    // FIXME handle MathML properties in Stylo
+    return;
+  }
+
   nsRuleData* aData = aGenericData->AsGecko();
   if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Font)) {
     // scriptsizemultiplier
     //
     // "Specifies the multiplier to be used to adjust font size due to changes
     // in scriptlevel.
     //
     // values: number