Bug 762119 - Simplify ParseMappedAttrAnimValueCallback. r=dholbert
authorRobert Longson <longsonr@gmail.com>
Fri, 08 Jun 2012 08:54:39 +0100
changeset 96163 80e0fe77821359301625245adc651721545f207a
parent 96162 22a835a8a15fca8012b304b5778f35895f904b74
child 96164 fab542b4877f5a99c2baa7d3a771c800345d8077
push id841
push usertim.taubert@gmx.de
push dateSat, 09 Jun 2012 15:34:50 +0000
treeherderfx-team@2f324831c02d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs762119
milestone16.0a1
Bug 762119 - Simplify ParseMappedAttrAnimValueCallback. r=dholbert
content/svg/content/src/nsSVGElement.cpp
--- a/content/svg/content/src/nsSVGElement.cpp
+++ b/content/svg/content/src/nsSVGElement.cpp
@@ -1068,17 +1068,17 @@ public:
   MappedAttrParser(css::Loader* aLoader,
                    nsIURI* aDocURI,
                    already_AddRefed<nsIURI> aBaseURI,
                    nsIPrincipal* aNodePrincipal);
   ~MappedAttrParser();
 
   // Parses a mapped attribute value.
   void ParseMappedAttrValue(nsIAtom* aMappedAttrName,
-                            nsAString& aMappedAttrValue);
+                            const nsAString& aMappedAttrValue);
 
   // If we've parsed any values for mapped attributes, this method returns
   // a new already_AddRefed css::StyleRule that incorporates the parsed
   // values. Otherwise, this method returns null.
   already_AddRefed<css::StyleRule> CreateStyleRule();
 
 private:
   // MEMBER DATA
@@ -1116,17 +1116,17 @@ MappedAttrParser::~MappedAttrParser()
 {
   NS_ABORT_IF_FALSE(!mDecl,
                     "If mDecl was initialized, it should have been converted "
                     "into a style rule (and had its pointer cleared)");
 }
 
 void
 MappedAttrParser::ParseMappedAttrValue(nsIAtom* aMappedAttrName,
-                                       nsAString& aMappedAttrValue)
+                                       const nsAString& aMappedAttrValue)
 {
   if (!mDecl) {
     mDecl = new css::Declaration();
     mDecl->InitializeEmpty();
   }
 
   // Get the nsCSSProperty ID for our mapped attribute.
   nsCSSProperty propertyID =
@@ -1238,21 +1238,17 @@ ParseMappedAttrAnimValueCallback(void*  
   NS_ABORT_IF_FALSE(aPropertyName != SMIL_MAPPED_ATTR_STYLERULE_ATOM,
                     "animated content style rule should have been removed "
                     "from properties table already (we're rebuilding it now)");
 
   MappedAttrParser* mappedAttrParser =
     static_cast<MappedAttrParser*>(aData);
 
   nsStringBuffer* valueBuf = static_cast<nsStringBuffer*>(aPropertyValue);
-  nsAutoString value;
-  PRUint32 len = NS_strlen(static_cast<PRUnichar*>(valueBuf->Data()));
-  valueBuf->ToString(len, value);
-
-  mappedAttrParser->ParseMappedAttrValue(aPropertyName, value);
+  mappedAttrParser->ParseMappedAttrValue(aPropertyName, nsCheapString(valueBuf));
 }
 
 // Callback for freeing animated content style rule, in property table.
 static void
 ReleaseStyleRule(void*    aObject,       /* unused */
                  nsIAtom* aPropertyName,
                  void*    aPropertyValue,
                  void*    aData          /* unused */)