[webkit-changes] cvs commit: WebCore/khtml/html htmltokenizer.cpp

David hyatt at opensource.apple.com
Fri Aug 26 14:37:51 PDT 2005


hyatt       05/08/26 14:37:51

  Modified:    .        Tag: Safari-2-0-branch ChangeLog
               khtml/html Tag: Safari-2-0-branch htmltokenizer.cpp
  Log:
  	Fix for 4226539, blank content on leaky-cauldron.org.  Revert
  	back to proper strict SGML comment parsing and just relax the
  	rules for comments inside <style> blocks (which weren't supposed
  	to be parsed by the HTML parser anyway... same problem as
  	<script> on news.com).
  
          Reviewed by adele
  
          * khtml/html/htmltokenizer.cpp:
          (khtml::HTMLTokenizer::parseComment):
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.10  +13 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.1.2.9
  retrieving revision 1.1.2.10
  diff -u -r1.1.2.9 -r1.1.2.10
  --- ChangeLog	26 Aug 2005 00:40:15 -0000	1.1.2.9
  +++ ChangeLog	26 Aug 2005 21:37:49 -0000	1.1.2.10
  @@ -1,3 +1,16 @@
  +2005-08-26  David Hyatt  <hyatt at apple.com>
  +
  +	Fix for 4226539, blank content on leaky-cauldron.org.  Revert
  +	back to proper strict SGML comment parsing and just relax the
  +	rules for comments inside <style> blocks (which weren't supposed
  +	to be parsed by the HTML parser anyway... same problem as
  +	<script> on news.com).
  +	
  +        Reviewed by adele
  +
  +        * khtml/html/htmltokenizer.cpp:
  +        (khtml::HTMLTokenizer::parseComment):
  +
   === Safari-416.3 ===
   
   2005-08-25  Adele Peterson  <adele at apple.com>
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.84.6.6  +15 -23    WebCore/khtml/html/htmltokenizer.cpp
  
  Index: htmltokenizer.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/htmltokenizer.cpp,v
  retrieving revision 1.84.6.5
  retrieving revision 1.84.6.6
  diff -u -r1.84.6.5 -r1.84.6.6
  --- htmltokenizer.cpp	25 Aug 2005 06:16:27 -0000	1.84.6.5
  +++ htmltokenizer.cpp	26 Aug 2005 21:37:50 -0000	1.84.6.6
  @@ -642,8 +642,8 @@
   
   void HTMLTokenizer::parseComment(TokenizerString &src)
   {
  -    // FIXME: Why does this code even run for comments inside <script>? This seems bogus.
  -    bool strict = !parser->doc()->inCompatMode() && !script;
  +    // FIXME: Why does this code even run for comments inside <script> and <style>? This seems bogus.
  +    bool strict = !parser->doc()->inCompatMode() && !script && !style;
       int delimiterCount = 0;
       bool canClose = false;
       checkScriptBuffer(src.length());
  @@ -654,7 +654,19 @@
                  QConstString((QChar*)src.current(), QMIN(16, src.length())).string().latin1());
   #endif
   
  -        if ((!strict || canClose) && *src == '>') {
  +        if (strict) {
  +            if (src->unicode() == '-') {
  +                delimiterCount++;
  +                if (delimiterCount == 2) {
  +                    delimiterCount = 0;
  +                    canClose = !canClose;
  +                }
  +            }
  +            else
  +                delimiterCount = 0;
  +        }
  +
  +        if ((!strict || canClose) && src->unicode() == '>') {
               bool handleBrokenComments = brokenComments && !(script || style);
               int endCharsCount = 1; // start off with one for the '>' character
               if (!strict) {
  @@ -688,26 +700,6 @@
                   return; // Finished parsing comment
               }
           }
  -
  -        if (strict) {
  -            if (*src == '-') {
  -                delimiterCount++;
  -                if (delimiterCount == 2) {
  -                    delimiterCount = 0;
  -                    canClose = !canClose;
  -                }
  -            } else {
  -                delimiterCount = 0;
  -                // Bad markup.  Non-space between the comment end and the markup
  -                // declaration close ('>').  Keep scanning as comment, but set
  -                // the state back to where we need to see another comment end
  -                // followed by a declaration close.
  -                // This is not exactly to spec, but is better for compatiblility.
  -                if (canClose && *src != ' ')
  -                    canClose = false;
  -            }
  -        }
  -
           ++src;
       }
   }
  
  
  



More information about the webkit-changes mailing list