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

List:       kfm-devel
Subject:    Re: patch + examples, change frameset.rows from js
From:       <koos.vriezen () xs4all ! nl>
Date:       2001-12-23 16:52:10
[Download RAW message or body]

Hi,

Sorry for that last patch. Somehow a document could be marked changed,
without having any changedNodes.
The attached patch fixes it.

Regards,

Koos Vriezen



["khtml.diff" (TEXT/PLAIN)]

--- ./xml/dom_docimpl.h.orig	Sun Dec 23 16:13:57 2001
+++ ./xml/dom_docimpl.h	Sun Dec 23 16:18:07 2001
@@ -272,6 +272,9 @@
 
     virtual DocumentImpl *getDocument()
         { return this; }
+    virtual bool isDocumentChanged() 
+	{ return m_docChanged; }
+    virtual void setDocumentChanged(bool);
     void attachNodeIterator(NodeIteratorImpl *ni);
     void detachNodeIterator(NodeIteratorImpl *ni);
     void notifyBeforeNodeRemoval(NodeImpl *n);
@@ -358,6 +361,7 @@
     bool m_loadingSheet;
     bool visuallyOrdered;
     bool m_bParsing;
+    bool m_docChanged;
 };
 
 class DocumentFragmentImpl : public NodeBaseImpl
--- ./xml/dom_docimpl.cpp.orig	Sun Dec 23 16:13:40 2001
+++ ./xml/dom_docimpl.cpp	Sun Dec 23 17:45:31 2001
@@ -252,6 +252,7 @@
     visuallyOrdered = false;
     m_loadingSheet = false;
     m_bParsing = false;
+    m_docChanged = false;
     m_sheet = 0;
     m_elemSheet = 0;
     m_tokenizer = 0;
@@ -279,7 +280,7 @@
 
 DocumentImpl::~DocumentImpl()
 {
-    if (changedDocuments)
+    if (changedDocuments && m_docChanged)
         changedDocuments->remove(this);
     document->doc = 0;
     delete m_sheet;
@@ -780,6 +781,18 @@
     return new TreeWalkerImpl;
 }
 
+void DocumentImpl::setDocumentChanged(bool b) 
+{
+    if (!changedDocuments)
+        changedDocuments = s_changedDocumentsDeleter.setObject( new QList<DocumentImpl>() );
+
+    if (b && !m_docChanged)
+        changedDocuments->append(this);
+    else if (!b && m_docChanged)
+        changedDocuments->remove(this);
+    m_docChanged = b;
+}
+
 void DocumentImpl::applyChanges(bool,bool force)
 {
     if ( !m_render && attached() ) return;
@@ -810,13 +823,6 @@
     else
         changedNodes.remove(this);
 
-    if (!changedDocuments)
-        changedDocuments = s_changedDocumentsDeleter.setObject( new QList<DocumentImpl>() );
-
-    if (b && !changed())
-        changedDocuments->append(this);
-    else if (!b && changed())
-        changedDocuments->remove(this);
     NodeBaseImpl::setChanged(b);
 }
 
@@ -869,7 +875,9 @@
 void DocumentImpl::updateRendering()
 {
     int o=changedNodes.count();
-    if (!o) return;
+    setDocumentChanged(false);
+    if (!o) 
+	return;
     kdDebug() << "UPDATERENDERING: "<<o<<endl;
 
     int a=0;
@@ -899,7 +907,7 @@
     if (!changedDocuments)
         return;
     for (QListIterator<DocumentImpl> it(*changedDocuments); it.current(); )
-        if (it.current()->changed())
+        if (it.current()->isDocumentChanged())
             it.current()->updateRendering();
 }
 
--- ./xml/dom_nodeimpl.cpp.orig	Sun Dec 23 16:14:08 2001
+++ ./xml/dom_nodeimpl.cpp	Sun Dec 23 16:27:55 2001
@@ -392,8 +392,7 @@
     if (b && !changed() && ownerDocument())
     {
         ownerDocument()->changedNodes.append(this);
-        if ( this != ownerDocument() )
-            ownerDocument()->setChanged(b);
+	ownerDocument()->setDocumentChanged(b);
     }
     else if (!b && changed() && ownerDocument())
         ownerDocument()->changedNodes.remove(this);


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

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