[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-02-28 9:28:35
Message-ID: 1267349315.823445.11213.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1097036 by ggarand:

fix my previous commit and rearrange some bits.

Meanwhile, I need to do more tests and analysis, so disable the lock
until I have been able to do that.

 M  +13 -7     htmltokenizer.cpp  
 M  +2 -1      htmltokenizer.h  


--- trunk/KDE/kdelibs/khtml/html/htmltokenizer.cpp #1097035:1097036
@@ -2107,7 +2107,7 @@
     assert(!cachedScript.isEmpty());
     // Make external scripts wait for external stylesheets.
     // FIXME: This needs to be done for inline scripts too.
-    m_hasScriptsWaitingForStylesheets = !parser->doc()->haveStylesheetsLoaded();
+    m_hasScriptsWaitingForStylesheets = false; // !parser->doc()->haveStylesheetsLoaded();
     if (m_hasScriptsWaitingForStylesheets) {
         kDebug( 6036 ) << "Delaying script execution until stylesheets have loaded.";
         return;
@@ -2116,9 +2116,9 @@
                                      "Continuing processing of delayed external scripts");
 
     bool done = false;
-    QTime t = QTime::currentTime();
+    m_scriptTime.start();
     while (!done && cachedScript.head()->isLoaded()) {
-        if (!continueProcessingScripts(t.elapsed()))
+        if (!continueProcessingScripts())
             break;
 
         CachedScript* cs = cachedScript.dequeue();
@@ -2136,10 +2136,16 @@
 	scriptExecution( scriptSource.string(), cachedScriptUrl );
 
         done = cachedScript.isEmpty();
-
+        if (done) {
+            assert(!m_hasScriptsWaitingForStylesheets);
+        } else if (m_hasScriptsWaitingForStylesheets) {
+            // flag has changed during the script execution,
+            // so we need to wait for stylesheets again.
+             done = true;
+        }
         // 'script' is true when we are called synchronously from
         // scriptHandler(). In that case scriptHandler() will take care
-        // of 'scriptOutput'.
+        // of the pending queue.
         if ( !script ) {
             while (pendingQueue.count() > 1) {
                TokenizerString t = pendingQueue.pop();
@@ -2154,11 +2160,11 @@
     }
 }
 
-bool HTMLTokenizer::continueProcessingScripts(int t)
+bool HTMLTokenizer::continueProcessingScripts()
 {
     if (m_externalScriptsTimerId)
         return false;
-    if (t > m_tokenizerYieldDelay && m_documentTokenizer) {
+    if (m_scriptTime.elapsed() > m_tokenizerYieldDelay && m_documentTokenizer) {
         if ( (m_externalScriptsTimerId = startTimer(0)) )
             return false;
     }
--- trunk/KDE/kdelibs/khtml/html/htmltokenizer.h #1097035:1097036
@@ -221,7 +221,7 @@
     // from CachedObjectClient
     void notifyFinished(khtml::CachedObject *finishedObj);
 
-    bool continueProcessingScripts(int);
+    bool continueProcessingScripts();
 protected:
     // Internal buffers
     ///////////////////
@@ -411,6 +411,7 @@
     int m_tokenizerYieldDelay;
     int m_yieldTimer;
     QTime m_time;
+    QTime m_scriptTime;
 
     // Set true if this tokenizer is used for documents and not fragments
     bool m_documentTokenizer; 
[prev in list] [next in list] [prev in thread] [next in thread] 

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