Bug 546641 - Map 
 to CR in the HTML5 parser. rs=sicking.
authorHenri Sivonen <hsivonen@iki.fi>
Tue, 09 Mar 2010 15:13:48 +0200
changeset 39517 86215ba5e99e3ee022f8403940a9868d3aeaef5c
parent 39516 a0f0fde99844258a5ff7f8a06d2bf14232f87f9d
child 39518 8606d376428855abae4895e396b2f30e3ed04622
push id12240
push userhsivonen@iki.fi
push dateWed, 17 Mar 2010 08:29:32 +0000
treeherdermozilla-central@8606d3764288 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking
bugs546641
milestone1.9.3a4pre
Bug 546641 - Map &#13; to CR in the HTML5 parser. rs=sicking.
parser/html/nsHtml5Tokenizer.cpp
parser/html/nsHtml5TreeBuilder.cpp
--- a/parser/html/nsHtml5Tokenizer.cpp
+++ b/parser/html/nsHtml5Tokenizer.cpp
@@ -3389,19 +3389,16 @@ nsHtml5Tokenizer::emitOrAppendStrBuf(PRI
 void 
 nsHtml5Tokenizer::handleNcrValue(PRInt32 returnState)
 {
   if (value <= 0xFFFF) {
     if (value >= 0x80 && value <= 0x9f) {
 
       PRUnichar* val = nsHtml5NamedCharacters::WINDOWS_1252[value - 0x80];
       emitOrAppendOne(val, returnState);
-    } else if (value == 0x0D) {
-
-      emitOrAppendOne(nsHtml5Tokenizer::LF, returnState);
     } else if (value == 0x0) {
 
       emitOrAppendOne(nsHtml5Tokenizer::REPLACEMENT_CHARACTER, returnState);
     } else if ((value & 0xF800) == 0xD800) {
 
       emitOrAppendOne(nsHtml5Tokenizer::REPLACEMENT_CHARACTER, returnState);
     } else {
       PRUnichar ch = (PRUnichar) value;
--- a/parser/html/nsHtml5TreeBuilder.cpp
+++ b/parser/html/nsHtml5TreeBuilder.cpp
@@ -234,16 +234,17 @@ nsHtml5TreeBuilder::characters(const PRU
     }
     default: {
       PRInt32 end = start + length;
       for (PRInt32 i = start; i < end; i++) {
         switch(buf[i]) {
           case ' ':
           case '\t':
           case '\n':
+          case '\r':
           case '\f': {
             switch(mode) {
               case NS_HTML5TREE_BUILDER_INITIAL:
               case NS_HTML5TREE_BUILDER_BEFORE_HTML:
               case NS_HTML5TREE_BUILDER_BEFORE_HEAD: {
                 start = i + 1;
                 continue;
               }
@@ -3815,16 +3816,17 @@ nsHtml5TreeBuilder::flushCharacters()
 PRBool 
 nsHtml5TreeBuilder::charBufferContainsNonWhitespace()
 {
   for (PRInt32 i = 0; i < charBufferLen; i++) {
     switch(charBuffer[i]) {
       case ' ':
       case '\t':
       case '\n':
+      case '\r':
       case '\f': {
         continue;
       }
       default: {
         return PR_TRUE;
       }
     }
   }