Bug 1435149 - Part 1. Change some methods to static or const method in CSSEditUtils. r?masayuki draft
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Fri, 02 Feb 2018 18:34:02 +0900
changeset 750459 416f64be675b2d356885c76d0ff3187b61a8b2f1
parent 750453 0690bf69410ad52ba220d1a26e39c3a49c25cb58
child 750460 a12b6aeb6d913b98d6b1c21ff7adb07fda6a25be
push id97665
push userbmo:m_kato@ga2.so-net.ne.jp
push dateFri, 02 Feb 2018 09:57:42 +0000
reviewersmasayuki
bugs1435149
milestone60.0a1
Bug 1435149 - Part 1. Change some methods to static or const method in CSSEditUtils. r?masayuki Some methods in CSSEditUtils can change to static methods or const method. So we should change to it to avoid unnecessary HTMLEditor check. MozReview-Commit-ID: IwAbeNsgqSr
editor/libeditor/CSSEditUtils.cpp
editor/libeditor/CSSEditUtils.h
--- a/editor/libeditor/CSSEditUtils.cpp
+++ b/editor/libeditor/CSSEditUtils.cpp
@@ -311,16 +311,18 @@ CSSEditUtils::CSSEditUtils(HTMLEditor* a
 }
 
 CSSEditUtils::~CSSEditUtils()
 {
 }
 
 // Answers true if we have some CSS equivalence for the HTML style defined
 // by aProperty and/or aAttribute for the node aNode
+
+// static
 bool
 CSSEditUtils::IsCSSEditableProperty(nsINode* aNode,
                                     nsAtom* aProperty,
                                     nsAtom* aAttribute)
 {
   MOZ_ASSERT(aNode);
 
   nsINode* node = aNode;
@@ -485,32 +487,35 @@ CSSEditUtils::RemoveCSSProperty(Element&
   }
   if (NS_WARN_IF(!mHTMLEditor)) {
     return NS_ERROR_NOT_AVAILABLE;
   }
   RefPtr<HTMLEditor> htmlEditor(mHTMLEditor);
   return htmlEditor->DoTransaction(transaction);
 }
 
+// static
 nsresult
 CSSEditUtils::GetSpecifiedProperty(nsINode& aNode,
                                    nsAtom& aProperty,
                                    nsAString& aValue)
 {
   return GetCSSInlinePropertyBase(&aNode, &aProperty, aValue, eSpecified);
 }
 
+// static
 nsresult
 CSSEditUtils::GetComputedProperty(nsINode& aNode,
                                   nsAtom& aProperty,
                                   nsAString& aValue)
 {
   return GetCSSInlinePropertyBase(&aNode, &aProperty, aValue, eComputed);
 }
 
+// static
 nsresult
 CSSEditUtils::GetCSSInlinePropertyBase(nsINode* aNode,
                                        nsAtom* aProperty,
                                        nsAString& aValue,
                                        StyleType aStyleType)
 {
   MOZ_ASSERT(aNode && aProperty);
   aValue.Truncate();
@@ -541,16 +546,17 @@ CSSEditUtils::GetCSSInlinePropertyBase(n
                                CSSEnabledState::eForAllContent);
   MOZ_ASSERT(prop != eCSSProperty_UNKNOWN);
 
   decl->GetPropertyValueByID(prop, aValue);
 
   return NS_OK;
 }
 
+// static
 already_AddRefed<nsComputedDOMStyle>
 CSSEditUtils::GetComputedStyle(Element* aElement)
 {
   MOZ_ASSERT(aElement);
 
   nsIDocument* doc = aElement->GetUncomposedDoc();
   NS_ENSURE_TRUE(doc, nullptr);
 
@@ -582,24 +588,28 @@ CSSEditUtils::RemoveCSSInlineStyle(nsINo
     return NS_OK;
   }
 
   return mHTMLEditor->RemoveContainer(element);
 }
 
 // Answers true if the property can be removed by setting a "none" CSS value
 // on a node
+
+// static
 bool
 CSSEditUtils::IsCSSInvertible(nsAtom& aProperty,
                               nsAtom* aAttribute)
 {
   return nsGkAtoms::b == &aProperty;
 }
 
 // Get the default browser background color if we need it for GetCSSBackgroundColorState
+
+// static
 void
 CSSEditUtils::GetDefaultBackgroundColor(nsAString& aColor)
 {
   if (Preferences::GetBool("editor.use_custom_colors", false)) {
     nsresult rv = Preferences::GetString("editor.background_color", aColor);
     // XXX Why don't you validate the pref value?
     if (NS_FAILED(rv)) {
       NS_WARNING("failed to get editor.background_color");
@@ -617,30 +627,34 @@ CSSEditUtils::GetDefaultBackgroundColor(
   // XXX Why don't you validate the pref value?
   if (NS_FAILED(rv)) {
     NS_WARNING("failed to get browser.display.background_color");
     aColor.AssignLiteral("#ffffff");  // Default to white
   }
 }
 
 // Get the default length unit used for CSS Indent/Outdent
+
+// static
 void
 CSSEditUtils::GetDefaultLengthUnit(nsAString& aLengthUnit)
 {
   nsresult rv =
     Preferences::GetString("editor.css.default_length_unit", aLengthUnit);
   // XXX Why don't you validate the pref value?
   if (NS_FAILED(rv)) {
     aLengthUnit.AssignLiteral("px");
   }
 }
 
 // Unfortunately, CSSStyleDeclaration::GetPropertyCSSValue is not yet
 // implemented... We need then a way to determine the number part and the unit
 // from aString, aString being the result of a GetPropertyValue query...
+
+// static
 void
 CSSEditUtils::ParseLength(const nsAString& aString,
                           float* aValue,
                           nsAtom** aUnit)
 {
   if (aString.IsEmpty()) {
     *aValue = 0;
     *aUnit = NS_Atomize(aString).take();
@@ -680,16 +694,17 @@ CSSEditUtils::ParseLength(const nsAStrin
     else break;
     iter++;
     i++;
   }
   *aValue = value * sign;
   *aUnit = NS_Atomize(StringTail(aString, j-i)).take();
 }
 
+// static
 void
 CSSEditUtils::GetCSSPropertyAtom(nsCSSEditableProperty aProperty,
                                  nsAtom** aAtom)
 {
   *aAtom = nullptr;
   switch (aProperty) {
     case eCSSEditableProperty_background_color:
       *aAtom = nsGkAtoms::backgroundColor;
@@ -751,16 +766,18 @@ CSSEditUtils::GetCSSPropertyAtom(nsCSSEd
     case eCSSEditableProperty_NONE:
       // intentionally empty
       break;
   }
 }
 
 // Populate aProperty and aValueArray with the CSS declarations equivalent to the
 // value aValue according to the equivalence table aEquivTable
+
+// static
 void
 CSSEditUtils::BuildCSSDeclarations(nsTArray<nsAtom*>& aPropertyArray,
                                    nsTArray<nsString>& aValueArray,
                                    const CSSEquivTable* aEquivTable,
                                    const nsAString* aValue,
                                    bool aGetOrRemoveRequest)
 {
   // clear arrays
@@ -794,16 +811,18 @@ CSSEditUtils::BuildCSSDeclarations(nsTAr
     }
     index++;
     cssProperty = aEquivTable[index].cssProperty;
   }
 }
 
 // Populate cssPropertyArray and cssValueArray with the declarations equivalent
 // to aHTMLProperty/aAttribute/aValue for the node aNode
+
+// static
 void
 CSSEditUtils::GenerateCSSDeclarationsFromHTMLStyle(
                 Element* aElement,
                 nsAtom* aHTMLProperty,
                 nsAtom* aAttribute,
                 const nsAString* aValue,
                 nsTArray<nsAtom*>& cssPropertyArray,
                 nsTArray<nsString>& cssValueArray,
@@ -946,16 +965,18 @@ CSSEditUtils::RemoveCSSEquivalentToHTMLS
   }
   return NS_OK;
 }
 
 // returns in aValueString the list of values for the CSS equivalences to
 // the HTML style aHTMLProperty/aAttribute/aValueString for the node aNode;
 // the value of aStyleType controls the styles we retrieve : specified or
 // computed.
+
+// static
 nsresult
 CSSEditUtils::GetCSSEquivalentToHTMLInlineStyleSet(nsINode* aNode,
                                                    nsAtom* aHTMLProperty,
                                                    nsAtom* aAttribute,
                                                    nsAString& aValueString,
                                                    StyleType aStyleType)
 {
   aValueString.Truncate();
@@ -992,43 +1013,47 @@ CSSEditUtils::GetCSSEquivalentToHTMLInli
 
 // Does the node aNode (or its parent, if it's not an element node) have a CSS
 // style equivalent to the HTML style aHTMLProperty/aHTMLAttribute/valueString?
 // The value of aStyleType controls the styles we retrieve: specified or
 // computed. The return value aIsSet is true if the CSS styles are set.
 //
 // The nsIContent variant returns aIsSet instead of using an out parameter, and
 // does not modify aValue.
+
+// static
 bool
 CSSEditUtils::IsCSSEquivalentToHTMLInlineStyleSet(nsINode* aNode,
                                                   nsAtom* aProperty,
                                                   nsAtom* aAttribute,
                                                   const nsAString& aValue,
                                                   StyleType aStyleType)
 {
   // Use aValue as only an in param, not in-out
   nsAutoString value(aValue);
   return IsCSSEquivalentToHTMLInlineStyleSet(aNode, aProperty, aAttribute,
                                              value, aStyleType);
 }
 
+// static
 bool
 CSSEditUtils::IsCSSEquivalentToHTMLInlineStyleSet(nsINode* aNode,
                                                   nsAtom* aProperty,
                                                   const nsAString* aAttribute,
                                                   nsAString& aValue,
                                                   StyleType aStyleType)
 {
   MOZ_ASSERT(aNode && aProperty);
   RefPtr<nsAtom> attribute = aAttribute ? NS_Atomize(*aAttribute) : nullptr;
   return IsCSSEquivalentToHTMLInlineStyleSet(aNode,
                                              aProperty, attribute,
                                              aValue, aStyleType);
 }
 
+// static
 bool
 CSSEditUtils::IsCSSEquivalentToHTMLInlineStyleSet(
                 nsINode* aNode,
                 nsAtom* aHTMLProperty,
                 nsAtom* aHTMLAttribute,
                 nsAString& valueString,
                 StyleType aStyleType)
 {
@@ -1210,38 +1235,41 @@ CSSEditUtils::HaveCSSEquivalentStyles(
 
 void
 CSSEditUtils::SetCSSEnabled(bool aIsCSSPrefChecked)
 {
   mIsCSSPrefChecked = aIsCSSPrefChecked;
 }
 
 bool
-CSSEditUtils::IsCSSPrefChecked()
+CSSEditUtils::IsCSSPrefChecked() const
 {
   return mIsCSSPrefChecked ;
 }
 
 // ElementsSameStyle compares two elements and checks if they have the same
 // specified CSS declarations in the STYLE attribute
 // The answer is always negative if at least one of them carries an ID or a class
+
+// static
 bool
 CSSEditUtils::ElementsSameStyle(nsIDOMNode* aFirstNode,
                                 nsIDOMNode* aSecondNode)
 {
   nsCOMPtr<Element> firstElement  = do_QueryInterface(aFirstNode);
   nsCOMPtr<Element> secondElement = do_QueryInterface(aSecondNode);
 
   NS_ASSERTION((firstElement && secondElement), "Non element nodes passed to ElementsSameStyle.");
   NS_ENSURE_TRUE(firstElement, false);
   NS_ENSURE_TRUE(secondElement, false);
 
   return ElementsSameStyle(firstElement, secondElement);
 }
 
+// static
 bool
 CSSEditUtils::ElementsSameStyle(Element* aFirstElement,
                                 Element* aSecondElement)
 {
   MOZ_ASSERT(aFirstElement);
   MOZ_ASSERT(aSecondElement);
 
   if (aFirstElement->HasAttr(kNameSpaceID_None, nsGkAtoms::id) ||
@@ -1308,16 +1336,17 @@ CSSEditUtils::ElementsSameStyle(Element*
     if (!firstValue.Equals(secondValue)) {
       return false;
     }
   }
 
   return true;
 }
 
+// static
 nsresult
 CSSEditUtils::GetInlineStyles(Element* aElement,
                               nsICSSDeclaration** aCssDecl,
                               uint32_t* aLength)
 {
   NS_ENSURE_TRUE(aElement && aLength, NS_ERROR_NULL_POINTER);
   *aLength = 0;
   nsCOMPtr<nsStyledElement> inlineStyles = do_QueryInterface(aElement);
@@ -1326,16 +1355,17 @@ CSSEditUtils::GetInlineStyles(Element* a
   nsCOMPtr<nsICSSDeclaration> cssDecl = inlineStyles->Style();
   MOZ_ASSERT(cssDecl);
 
   cssDecl.forget(aCssDecl);
   *aLength = (*aCssDecl)->Length();
   return NS_OK;
 }
 
+// static
 Element*
 CSSEditUtils::GetElementContainerOrSelf(nsINode* aNode)
 {
   MOZ_ASSERT(aNode);
   if (nsINode::DOCUMENT_NODE == aNode->NodeType()) {
     return nullptr;
   }
 
--- a/editor/libeditor/CSSEditUtils.h
+++ b/editor/libeditor/CSSEditUtils.h
@@ -82,18 +82,18 @@ public:
    *
    * @param aNode          [IN] A DOM node.
    * @param aProperty      [IN] An atom containing a HTML tag name.
    * @param aAttribute     [IN] An atom containing a HTML
    *                            attribute carried by the element above.
    * @return               A boolean saying if the tag/attribute has a CSS
    *                       equiv.
    */
-  bool IsCSSEditableProperty(nsINode* aNode, nsAtom* aProperty,
-                             nsAtom* aAttribute);
+  static bool IsCSSEditableProperty(nsINode* aNode, nsAtom* aProperty,
+                                    nsAtom* aAttribute);
 
   /**
    * Adds/remove a CSS declaration to the STYLE atrribute carried by a given
    * element.
    *
    * @param aElement       [IN] A DOM element.
    * @param aProperty      [IN] An atom containing the CSS property to set.
    * @param aValue         [IN] A string containing the value of the CSS
@@ -113,20 +113,20 @@ public:
   /**
    * Gets the specified/computed style value of a CSS property for a given
    * node (or its element ancestor if it is not an element).
    *
    * @param aNode          [IN] A DOM node.
    * @param aProperty      [IN] An atom containing the CSS property to get.
    * @param aPropertyValue [OUT] The retrieved value of the property.
    */
-  nsresult GetSpecifiedProperty(nsINode& aNode, nsAtom& aProperty,
-                                nsAString& aValue);
-  nsresult GetComputedProperty(nsINode& aNode, nsAtom& aProperty,
-                               nsAString& aValue);
+  static nsresult GetSpecifiedProperty(nsINode& aNode, nsAtom& aProperty,
+                                       nsAString& aValue);
+  static nsresult GetComputedProperty(nsINode& aNode, nsAtom& aProperty,
+                                      nsAString& aValue);
 
   /**
    * Removes a CSS property from the specified declarations in STYLE attribute
    * and removes the node if it is an useless span.
    *
    * @param aNode           [IN] The specific node we want to remove a style
    *                             from.
    * @param aProperty       [IN] The CSS property atom to remove.
@@ -141,82 +141,82 @@ public:
    * on a node.
    *
    * @param aProperty     [IN] An atom containing a CSS property.
    * @param aAttribute    [IN] Pointer to an attribute name or null if this
    *                           information is irrelevant.
    * @return              A boolean saying if the property can be remove by
    *                      setting a "none" value.
    */
-  bool IsCSSInvertible(nsAtom& aProperty, nsAtom* aAttribute);
+  static bool IsCSSInvertible(nsAtom& aProperty, nsAtom* aAttribute);
 
   /**
    * Get the default browser background color if we need it for
    * GetCSSBackgroundColorState().
    *
    * @param aColor         [OUT] The default color as it is defined in prefs.
    */
-  void GetDefaultBackgroundColor(nsAString& aColor);
+  static void GetDefaultBackgroundColor(nsAString& aColor);
 
   /**
    * Get the default length unit used for CSS Indent/Outdent.
    *
    * @param aLengthUnit    [OUT] The default length unit as it is defined in
    *                             prefs.
    */
-  void GetDefaultLengthUnit(nsAString & aLengthUnit);
+  static void GetDefaultLengthUnit(nsAString & aLengthUnit);
 
   /**
    * Returns the list of values for the CSS equivalences to
    * the passed HTML style for the passed node.
    *
    * @param aNode          [IN] A DOM node.
    * @param aHTMLProperty  [IN] An atom containing an HTML property.
    * @param aAttribute     [IN] An atom of attribute name or nullptr if
    *                            irrelevant.
    * @param aValueString   [OUT] The list of CSS values.
    * @param aStyleType     [IN] eSpecified or eComputed.
    */
-  nsresult GetCSSEquivalentToHTMLInlineStyleSet(nsINode* aNode,
-                                                nsAtom* aHTMLProperty,
-                                                nsAtom* aAttribute,
-                                                nsAString& aValueString,
-                                                StyleType aStyleType);
+  static nsresult GetCSSEquivalentToHTMLInlineStyleSet(nsINode* aNode,
+                                                       nsAtom* aHTMLProperty,
+                                                       nsAtom* aAttribute,
+                                                       nsAString& aValueString,
+                                                       StyleType aStyleType);
 
   /**
    * Does the node aNode (or his parent if it is not an element node) carries
    * the CSS equivalent styles to the HTML style for this node ?
    *
    * @param aNode          [IN] A DOM node.
    * @param aHTMLProperty  [IN] An atom containing an HTML property.
    * @param aAttribute     [IN] A pointer/atom to an attribute name or nullptr
    *                            if irrelevant.
    * @param aValueString   [IN/OUT] The attribute value (in) the list of CSS
    *                                values (out).
    * @param aStyleType     [IN] eSpecified or eComputed.
    * @return               A boolean being true if the css properties are
    *                       not same as initial value.
    */
-  bool IsCSSEquivalentToHTMLInlineStyleSet(nsINode* aContent,
-                                           nsAtom* aProperty,
-                                           nsAtom* aAttribute,
-                                           nsAString& aValue,
-                                           StyleType aStyleType);
+  static bool IsCSSEquivalentToHTMLInlineStyleSet(nsINode* aContent,
+                                                  nsAtom* aProperty,
+                                                  nsAtom* aAttribute,
+                                                  nsAString& aValue,
+                                                  StyleType aStyleType);
 
-  bool IsCSSEquivalentToHTMLInlineStyleSet(nsINode* aContent,
-                                           nsAtom* aProperty,
-                                           nsAtom* aAttribute,
-                                           const nsAString& aValue,
-                                           StyleType aStyleType);
+  static bool IsCSSEquivalentToHTMLInlineStyleSet(nsINode* aContent,
+                                                  nsAtom* aProperty,
+                                                  nsAtom* aAttribute,
+                                                  const nsAString& aValue,
+                                                  StyleType aStyleType);
 
-  bool IsCSSEquivalentToHTMLInlineStyleSet(nsINode* aContent,
-                                           nsAtom* aProperty,
-                                           const nsAString* aAttribute,
-                                           nsAString& aValue,
-                                           StyleType aStyleType);
+  static bool IsCSSEquivalentToHTMLInlineStyleSet(nsINode* aContent,
+                                                  nsAtom* aProperty,
+                                                  const nsAString* aAttribute,
+                                                  nsAString& aValue,
+                                                  StyleType aStyleType);
 
   /**
    * This is a kind of IsCSSEquivalentToHTMLInlineStyleSet.
    * IsCSSEquivalentToHTMLInlineStyleSet returns whether the properties
    * aren't same as initial value.  But this method returns whether the
    * properties aren't set.
    * If node is <span style="font-weight: normal"/>,
    *  - IsCSSEquivalentToHTMLInlineStyleSet returns false.
@@ -226,20 +226,20 @@ public:
    * @param aHTMLProperty  [IN] An atom containing an HTML property.
    * @param aAttribute     [IN] An atom to an attribute name or nullptr
    *                            if irrelevant.
    * @param aStyleType     [IN] eSpecified or eComputed.
    * @return               A boolean being true if the css properties are
    *                       not set.
    */
 
-  bool HaveCSSEquivalentStyles(nsINode& aNode,
-                               nsAtom* aProperty,
-                               nsAtom* aAttribute,
-                               StyleType aStyleType);
+  static bool HaveCSSEquivalentStyles(nsINode& aNode,
+                                       nsAtom* aProperty,
+                                       nsAtom* aAttribute,
+                                       StyleType aStyleType);
 
   /**
    * Adds to the node the CSS inline styles equivalent to the HTML style
    * and return the number of CSS properties set by the call.
    *
    * @param aNode          [IN] A DOM node.
    * @param aHTMLProperty  [IN] An atom containing an HTML property.
    * @param aAttribute     [IN] An atom to an attribute name or nullptr
@@ -277,105 +277,109 @@ public:
    * Parses a "xxxx.xxxxxuuu" string where x is a digit and u an alpha char
    * we need such a parser because
    * nsIDOMCSSStyleDeclaration::GetPropertyCSSValue() is not implemented.
    *
    * @param aString        [IN] Input string to parse.
    * @param aValue         [OUT] Numeric part.
    * @param aUnit          [OUT] Unit part.
    */
-  void ParseLength(const nsAString& aString, float* aValue, nsAtom** aUnit);
+  static void ParseLength(const nsAString& aString, float* aValue,
+                          nsAtom** aUnit);
 
   /**
    * Sets the mIsCSSPrefChecked private member; used as callback from observer
    *  when the CSS pref state is changed.
    *
    * @param aIsCSSPrefChecked [IN] The new boolean state for the pref.
    */
   void SetCSSEnabled(bool aIsCSSPrefChecked);
 
   /**
    * Retrieves the mIsCSSPrefChecked private member, true if the CSS pref is
    * checked, false if it is not.
    *
    * @return                 the boolean value of the CSS pref.
    */
-  bool IsCSSPrefChecked();
+  bool IsCSSPrefChecked() const;
 
   /**
    * ElementsSameStyle compares two elements and checks if they have the same
    * specified CSS declarations in the STYLE attribute.
    * The answer is always false if at least one of them carries an ID or a
    * class.
    *
    * @param aFirstNode           [IN] A DOM node.
    * @param aSecondNode          [IN] A DOM node.
    * @return                     true if the two elements are considered to
    *                             have same styles.
    */
-  bool ElementsSameStyle(dom::Element* aFirstNode,
-                         dom::Element* aSecondNode);
-  bool ElementsSameStyle(nsIDOMNode* aFirstNode, nsIDOMNode* aSecondNode);
+  static bool ElementsSameStyle(dom::Element* aFirstNode,
+                                dom::Element* aSecondNode);
+  static bool ElementsSameStyle(nsIDOMNode* aFirstNode,
+                                nsIDOMNode* aSecondNode);
 
   /**
    * Get the specified inline styles (style attribute) for an element.
    *
    * @param aElement        [IN] The element node.
    * @param aCssDecl        [OUT] The CSS declaration corresponding to the
    *                              style attribute.
    * @param aLength         [OUT] The number of declarations in aCssDecl.
    */
-  nsresult GetInlineStyles(dom::Element* aElement,
-                           nsICSSDeclaration** aCssDecl,
-                           uint32_t* aLength);
+  static nsresult GetInlineStyles(dom::Element* aElement,
+                                  nsICSSDeclaration** aCssDecl,
+                                  uint32_t* aLength);
 
 public:
   /**
    * Returns aNode itself if it is an element node, or the first ancestors
    * being an element node if aNode is not one itself.
    *
    * @param aNode           [IN] A node
    * @param aElement        [OUT] The deepest element node containing aNode
    *                              (possibly aNode itself)
    */
-  dom::Element* GetElementContainerOrSelf(nsINode* aNode);
+  static dom::Element* GetElementContainerOrSelf(nsINode* aNode);
 
   /**
    * Gets the computed style for a given element.  Can return null.
    */
-  already_AddRefed<nsComputedDOMStyle> GetComputedStyle(dom::Element* aElement);
+  static already_AddRefed<nsComputedDOMStyle> GetComputedStyle(
+                                                dom::Element* aElement);
 
 private:
   /**
    * Retrieves the CSS property atom from an enum.
    *
    * @param aProperty          [IN] The enum value for the property.
    * @param aAtom              [OUT] The corresponding atom.
    */
-  void GetCSSPropertyAtom(nsCSSEditableProperty aProperty, nsAtom** aAtom);
+  static void GetCSSPropertyAtom(nsCSSEditableProperty aProperty,
+                                 nsAtom** aAtom);
 
   /**
    * Retrieves the CSS declarations equivalent to a HTML style value for
    * a given equivalence table.
    *
    * @param aPropertyArray     [OUT] The array of css properties.
    * @param aValueArray        [OUT] The array of values for the CSS properties
    *                                 above.
    * @param aEquivTable        [IN] The equivalence table.
    * @param aValue             [IN] The HTML style value.
    * @param aGetOrRemoveRequest [IN] A boolean value being true if the call to
    *                                 the current method is made for
    *                                 GetCSSEquivalentToHTMLInlineStyleSet() or
    *                                 RemoveCSSEquivalentToHTMLInlineStyleSet().
    */
-  void BuildCSSDeclarations(nsTArray<nsAtom*>& aPropertyArray,
-                            nsTArray<nsString>& cssValueArray,
-                            const CSSEquivTable* aEquivTable,
-                            const nsAString* aValue,
-                            bool aGetOrRemoveRequest);
+  static void BuildCSSDeclarations(nsTArray<nsAtom*>& aPropertyArray,
+                                    nsTArray<nsString>& cssValueArray,
+                                    const CSSEquivTable* aEquivTable,
+                                    const nsAString* aValue,
+                                    bool aGetOrRemoveRequest);
 
   /**
    * Retrieves the CSS declarations equivalent to the given HTML
    * property/attribute/value for a given node.
    *
    * @param aNode              [IN] The DOM node.
    * @param aHTMLProperty      [IN] An atom containing an HTML property.
    * @param aAttribute         [IN] An atom to an attribute name or nullptr
@@ -384,34 +388,36 @@ private:
    * @param aPropertyArray     [OUT] The array of CSS properties.
    * @param aValueArray        [OUT] The array of values for the CSS properties
    *                                 above.
    * @param aGetOrRemoveRequest [IN] A boolean value being true if the call to
    *                                 the current method is made for
    *                                 GetCSSEquivalentToHTMLInlineStyleSet() or
    *                                 RemoveCSSEquivalentToHTMLInlineStyleSet().
    */
-  void GenerateCSSDeclarationsFromHTMLStyle(dom::Element* aNode,
-                                            nsAtom* aHTMLProperty,
-                                            nsAtom* aAttribute,
-                                            const nsAString* aValue,
-                                            nsTArray<nsAtom*>& aPropertyArray,
-                                            nsTArray<nsString>& aValueArray,
-                                            bool aGetOrRemoveRequest);
+  static void GenerateCSSDeclarationsFromHTMLStyle(
+                dom::Element* aNode,
+                nsAtom* aHTMLProperty,
+                nsAtom* aAttribute,
+                const nsAString* aValue,
+                nsTArray<nsAtom*>& aPropertyArray,
+                nsTArray<nsString>& aValueArray,
+                bool aGetOrRemoveRequest);
 
   /**
    * Back-end for GetSpecifiedProperty and GetComputedProperty.
    *
    * @param aNode               [IN] A DOM node.
    * @param aProperty           [IN] A CSS property.
    * @param aValue              [OUT] The retrieved value for this property.
    * @param aStyleType          [IN] eSpecified or eComputed.
    */
-  nsresult GetCSSInlinePropertyBase(nsINode* aNode, nsAtom* aProperty,
-                                    nsAString& aValue, StyleType aStyleType);
+  static nsresult GetCSSInlinePropertyBase(nsINode* aNode, nsAtom* aProperty,
+                                           nsAString& aValue,
+                                           StyleType aStyleType);
 
 private:
   HTMLEditor* mHTMLEditor;
   bool mIsCSSPrefChecked;
 };
 
 #define NS_EDITOR_INDENT_INCREMENT_IN        0.4134f
 #define NS_EDITOR_INDENT_INCREMENT_CM        1.05f