[webkit-changes] cvs commit: WebCore/khtml/xsl xslt_processorimpl.cpp

Anders andersca at opensource.apple.com
Wed Jan 4 13:17:55 PST 2006


andersca    06/01/04 13:17:55

  Modified:    .        ChangeLog
               khtml/xsl xslt_processorimpl.cpp
  Log:
  2006-01-04  Anders Carlsson  <andersca at mac.com>
  
          Reviewed by Eric.
  
          Based on a patch by Eric.
  
          - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6180
          "text" output in fragment produced by XSLTProccessor is wrong (has xhtml garbage)
  
          * khtml/xsl/xslt_processorimpl.cpp:
          (DOM::xsltParamArrayFromParameterMap):
          (DOM::freeXsltParamArray):
          Use fastMalloc/fastFree.
  
          (DOM::createFragmentFromSource):
          If the output is "text", just create a text node and add
          it to the fragment.
  
  Revision  Changes    Path
  1.88      +18 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.87
  retrieving revision 1.88
  diff -u -r1.87 -r1.88
  --- ChangeLog	4 Jan 2006 21:05:23 -0000	1.87
  +++ ChangeLog	4 Jan 2006 21:17:54 -0000	1.88
  @@ -1,3 +1,21 @@
  +2006-01-04  Anders Carlsson  <andersca at mac.com>
  +
  +        Reviewed by Eric.
  +
  +        Based on a patch by Eric.
  +        
  +        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6180
  +        "text" output in fragment produced by XSLTProccessor is wrong (has xhtml garbage)
  +        
  +        * khtml/xsl/xslt_processorimpl.cpp:
  +        (DOM::xsltParamArrayFromParameterMap):
  +        (DOM::freeXsltParamArray):
  +        Use fastMalloc/fastFree.
  +        
  +        (DOM::createFragmentFromSource):
  +        If the output is "text", just create a text node and add
  +        it to the fragment.
  +
   2006-01-04  Geoffrey Garen  <ggaren at apple.com>
   
           Reviewed by darin.
  
  
  
  1.23      +9 -8      WebCore/khtml/xsl/xslt_processorimpl.cpp
  
  Index: xslt_processorimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xsl/xslt_processorimpl.cpp,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- xslt_processorimpl.cpp	3 Jan 2006 02:07:11 -0000	1.22
  +++ xslt_processorimpl.cpp	4 Jan 2006 21:17:55 -0000	1.23
  @@ -25,6 +25,7 @@
   #include "xslt_processorimpl.h"
   #include "xsl_stylesheetimpl.h"
   #include "xml_tokenizer.h"
  +#include "dom_textimpl.h"
   #include "htmltokenizer.h"
   #include "html_documentimpl.h"
   #include "loader.h"
  @@ -152,7 +153,7 @@
       if (parameters.isEmpty())
           return 0;
   
  -    const char **parameterArray = (const char **)malloc(((parameters.size() * 2) + 1) * sizeof(char *));
  +    const char **parameterArray = (const char **)fastMalloc(((parameters.size() * 2) + 1) * sizeof(char *));
   
       XSLTProcessorImpl::ParameterMap::iterator end = parameters.end();
       unsigned index = 0;
  @@ -172,10 +173,10 @@
           return;
       
       while (*temp) {
  -        free((void *)*(temp++));
  +        free((void *)*(temp++)); // strdup returns malloc'd blocks, so we have to use free() here
           free((void *)*(temp++));
       }
  -    free(params);
  +    fastFree(params);
   }
   
   
  @@ -226,16 +227,16 @@
       return result;
   }
   
  -static inline RefPtr<DocumentFragmentImpl> createFragmentFromSource(QString sourceString, QString sourceMIMEType, NodeImpl *sourceNode, DocumentImpl *ouputDoc)
  +static inline RefPtr<DocumentFragmentImpl> createFragmentFromSource(QString sourceString, QString sourceMIMEType, NodeImpl *sourceNode, DocumentImpl *outputDoc)
   {
  -    RefPtr<DocumentFragmentImpl> fragment = new DocumentFragmentImpl(ouputDoc);
  +    RefPtr<DocumentFragmentImpl> fragment = new DocumentFragmentImpl(outputDoc);
       
       if (sourceMIMEType == "text/html")
           parseHTMLDocumentFragment(sourceString, fragment.get());
  +    else if (sourceMIMEType == "text/plain")
  +        fragment->addChild(new TextImpl(outputDoc, sourceString));
       else {
  -        if (sourceMIMEType == "text/plain")
  -            transformTextStringToXHTMLDocumentString(sourceString);
  -        bool successfulParse = parseXMLDocumentFragment(sourceString, fragment.get(), ouputDoc->documentElement());
  +        bool successfulParse = parseXMLDocumentFragment(sourceString, fragment.get(), outputDoc->documentElement());
           if (!successfulParse)
               return 0;
       }
  
  
  



More information about the webkit-changes mailing list