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

List:       kde-commits
Subject:    KDE/kdelibs/khtml/html
From:       Germain Garand <germain () ebooksfrance ! org>
Date:       2010-01-23 5:30:18
Message-ID: 1264224618.224562.29600.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1078891 by ggarand:

.fix some regressions from the tokenizer work, that did not
 escape to the fast and watchful eye of Tommi Tervo. Thanks :)
.more comments, this code is a riddle.

 M  +12 -5     htmltokenizer.cpp  


--- trunk/KDE/kdelibs/khtml/html/htmltokenizer.cpp #1078890:1078891
@@ -360,7 +360,7 @@
         checkRawContentBuffer();
         unsigned char ch = src->toLatin1();
         if ( !rawContentResync && !brokenComments && !xmp && ch == '-' && 
-              rawContentSize >= 3 && rawContentSinceLastEntity >= 3 && \
!src.escaped() &&  +              rawContentSize >= 3 && ((!textarea && !title) || \
                rawContentSinceLastEntity >= 3) && !src.escaped() && 
               QString::fromRawData( rawContent+rawContentSize-3, 3 ) == "<!-" ) {
             comment = true;
             rawContent[ rawContentSize++ ] = ch;
@@ -391,9 +391,14 @@
         }
         // possible end of tagname, lets check.
         if ( !rawContentResync && !escaped && !src.escaped() && ( ch == '>' || ch == \
                '/' || ch <= ' ' ) && ch &&
-              rawContentSize >= searchStopperLen && rawContentSinceLastEntity >= \
searchStopperLen && +              rawContentSize >= searchStopperLen && ((!textarea \
                && !title) || rawContentSinceLastEntity >= searchStopperLen) &&
               QString::compare(QString::fromRawData(rawContent + rawContentSize - \
                searchStopperLen, searchStopperLen),
                   QLatin1String(searchStopper), Qt::CaseInsensitive) == 0) {
+
+            // the purpose of rawContentResync is to look for an end tag that could \
possibly be of the form: +            // </endtag   junk="more junk>\"><>"     >
+            // IOW, once the '</endtag' sequence has been found, the rest of the tag \
must still be validated, +            // so this micro-tokenizer switches to \
rawContentResync state until '>' is finally found.  rawContentResync = \
rawContentSize-searchStopperLen+1;  tquote = NoQuote;
             continue;
@@ -1054,6 +1059,7 @@
                 for(unsigned int i = 0; i < cBufferPos; i++)
                     dest[i] = cBuffer[i];
                 dest += cBufferPos;
+                rawContentSinceLastEntity += cBufferPos+1;
                 if (pre)
                     prePos += cBufferPos+1;
             }
@@ -1536,6 +1542,7 @@
                     searchStopperLen = 10;
                     textarea = true;
                     discard = NoneDiscard;
+                    rawContentSinceLastEntity = 0;
                     parseRawContent(src);
                 }
                 break;
@@ -1544,6 +1551,7 @@
                     searchStopper = titleEnd;
                     searchStopperLen = 7;
                     title = true;
+                    rawContentSinceLastEntity = 0;
                     parseRawContent(src);
                 }
                 break;
@@ -1944,9 +1952,8 @@
         rawContent[ rawContentSize + 1 ] = 0;
         int pos;
         QString food;
-        if (title || style || script) {
-            if (title)
-                currToken.reset();
+        if (title || style || script || textarea) {
+            rawContentSinceLastEntity = 0;
             food.setUnicode(rawContent, rawContentSize);
         } else if (server) {
             food = "<";


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

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