[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/khtml/xml
From:       Harri Porten <porten () kde ! org>
Date:       2010-02-14 19:15:17
Message-ID: 1266174917.024067.32290.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1090155 by porten:

Escape non-breaking space for Text node serialization.


 M  +6 -0      dom_stringimpl.cpp  


--- trunk/KDE/kdelibs/khtml/xml/dom_stringimpl.cpp #1090154:1090155
@@ -523,6 +523,7 @@
 static const unsigned short amp[] = {'&', 'a', 'm', 'p', ';'};
 static const unsigned short lt[] =  {'&', 'l', 't', ';'};
 static const unsigned short gt[] =  {'&', 'g', 't', ';'};
+static const unsigned short nbsp[] =  {'&', 'n', 'b', 's', 'p', ';'};
 
 DOMStringImpl *DOMStringImpl::escapeHTML()
 {
@@ -532,6 +533,8 @@
             outL += 5; //&amp;
         else if (s[i] == '<' || s[i] == '>')
             outL += 4; //&gt;/&lt;
+        else if (s[i] == QChar::Nbsp)
+            outL += 6; //&nbsp;
         else
             ++outL;
     }
@@ -554,6 +557,9 @@
         } else if (s[i] == '>') {
             memcpy(&toRet->s[outP], gt, sizeof(gt));
             outP += 4;
+        } else if (s[i] == QChar::Nbsp) {
+            memcpy(&toRet->s[outP], nbsp, sizeof(nbsp));
+            outP += 6;
         } else {
             toRet->s[outP] = s[i];
             ++outP;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic