Bug 1466963: Inline DeclarationBlock's methods since they just forward to Servo. r?xidorn draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Tue, 05 Jun 2018 21:30:13 +0200
changeset 804471 749d1d7017634b0ebb9ccf49cb9fc0727b79b684
parent 804470 970a8f4c4d34da0421ba473832c1dfbf40509fe8
child 804472 847d34fcc650760cf04882656f473ad13a024056
push id112373
push userbmo:emilio@crisal.io
push dateTue, 05 Jun 2018 22:12:13 +0000
reviewersxidorn
bugs1466963
milestone62.0a1
Bug 1466963: Inline DeclarationBlock's methods since they just forward to Servo. r?xidorn MozReview-Commit-ID: 1IObGPXljuM
layout/style/DeclarationBlock.cpp
layout/style/DeclarationBlock.h
--- a/layout/style/DeclarationBlock.cpp
+++ b/layout/style/DeclarationBlock.cpp
@@ -20,47 +20,9 @@ DeclarationBlock::FromCssText(const nsAS
 {
   NS_ConvertUTF16toUTF8 value(aCssText);
   RefPtr<RawServoDeclarationBlock> raw =
       Servo_ParseStyleAttribute(&value, aExtraData, aMode, aLoader).Consume();
   RefPtr<DeclarationBlock> decl = new DeclarationBlock(raw.forget());
   return decl.forget();
 }
 
-// TODO: We can make them inline.
-void
-DeclarationBlock::GetPropertyValue(const nsAString& aProperty,
-                                   nsAString& aValue) const
-{
-  NS_ConvertUTF16toUTF8 property(aProperty);
-  Servo_DeclarationBlock_GetPropertyValue(mRaw, &property, &aValue);
-}
-
-void
-DeclarationBlock::GetPropertyValueByID(nsCSSPropertyID aPropID,
-                                       nsAString& aValue) const
-{
-  Servo_DeclarationBlock_GetPropertyValueById(mRaw, aPropID, &aValue);
-}
-
-bool
-DeclarationBlock::GetPropertyIsImportant(const nsAString& aProperty) const
-{
-  NS_ConvertUTF16toUTF8 property(aProperty);
-  return Servo_DeclarationBlock_GetPropertyIsImportant(mRaw, &property);
-}
-
-bool
-DeclarationBlock::RemoveProperty(const nsAString& aProperty)
-{
-  AssertMutable();
-  NS_ConvertUTF16toUTF8 property(aProperty);
-  return Servo_DeclarationBlock_RemoveProperty(mRaw, &property);
-}
-
-bool
-DeclarationBlock::RemovePropertyByID(nsCSSPropertyID aPropID)
-{
-  AssertMutable();
-  return Servo_DeclarationBlock_RemovePropertyById(mRaw, aPropID);
-}
-
 } // namespace mozilla
--- a/layout/style/DeclarationBlock.h
+++ b/layout/style/DeclarationBlock.h
@@ -187,23 +187,47 @@ public:
   }
 
   bool GetNthProperty(uint32_t aIndex, nsAString& aReturn) const
   {
     aReturn.Truncate();
     return Servo_DeclarationBlock_GetNthProperty(mRaw, aIndex, &aReturn);
   }
 
-  void GetPropertyValue(const nsAString& aProperty, nsAString& aValue) const;
-  void GetPropertyValueByID(nsCSSPropertyID aPropID, nsAString& aValue) const;
-  bool GetPropertyIsImportant(const nsAString& aProperty) const;
+  void GetPropertyValue(const nsAString& aProperty, nsAString& aValue) const
+  {
+    NS_ConvertUTF16toUTF8 property(aProperty);
+    Servo_DeclarationBlock_GetPropertyValue(mRaw, &property, &aValue);
+  }
+
+  void GetPropertyValueByID(nsCSSPropertyID aPropID, nsAString& aValue) const
+  {
+    Servo_DeclarationBlock_GetPropertyValueById(mRaw, aPropID, &aValue);
+  }
+
+  bool GetPropertyIsImportant(const nsAString& aProperty) const
+  {
+    NS_ConvertUTF16toUTF8 property(aProperty);
+    return Servo_DeclarationBlock_GetPropertyIsImportant(mRaw, &property);
+  }
+
   // Returns whether the property was removed.
-  bool RemoveProperty(const nsAString& aProperty);
+  bool RemoveProperty(const nsAString& aProperty)
+  {
+    AssertMutable();
+    NS_ConvertUTF16toUTF8 property(aProperty);
+    return Servo_DeclarationBlock_RemoveProperty(mRaw, &property);
+  }
+
   // Returns whether the property was removed.
-  bool RemovePropertyByID(nsCSSPropertyID aProperty);
+  bool RemovePropertyByID(nsCSSPropertyID aProperty)
+  {
+    AssertMutable();
+    return Servo_DeclarationBlock_RemovePropertyById(mRaw, aProperty);
+  }
 
 private:
   ~DeclarationBlock() = default;
   union {
     // We only ever have one of these since we have an
     // nsHTMLCSSStyleSheet only for style attributes, and style
     // attributes never have an owning rule.