[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:       David Faure <david () mandrakesoft ! com>
Date:       2001-12-22 17:54:40
[Download RAW message or body]

On Saturday 22 December 2001 00:19, koos.vriezen@xs4all.nl wrote:
> This patch seems to work. Probably the change from
> 'd->m_doc->updateRendering()' to
> 'DocumentImpl::updateDocumentsRendering()'
> should be done on more places where js is executed.
> 
> Please test/comment.

Dirk suggested a few changes, including using the node's changed bool
instead of m_documentChanged (since a document is a node), and making
sure to remove the document from the list upon destruction.

The attached patch seems to work for me.

-- 
David FAURE, david@mandrakesoft.com, faure@kde.org
http://www.kde.org/people/david.html (my real webpage is down)
KDE 3.0: Konquering the Desktops


["revised.patch" (text/x-diff)]

? area6070.diff
? thepatchi
? ecma/spec_dom2_core.html
? ecma/spec_dom2_html.html
? ecma/close_bug
Index: khtml_part.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/khtml_part.cpp,v
retrieving revision 1.613
diff -u -p -r1.613 khtml_part.cpp
--- khtml_part.cpp	2001/12/20 01:08:55	1.613
+++ khtml_part.cpp	2001/12/22 17:53:27
@@ -876,8 +876,7 @@ QVariant KHTMLPart::executeScript( const
   d->m_runningScripts--;
   if (!d->m_runningScripts && d->m_doc && !d->m_doc->parsing() && d->m_submitForm )
       submitFormAgain();
-  if ( d->m_doc )
-    d->m_doc->updateRendering();
+    DocumentImpl::updateDocumentsRendering();
 
   //kdDebug(6070) << "KHTMLPart::executeScript - done" << endl;
   return ret;
@@ -4309,8 +4308,7 @@ QVariant KHTMLPart::executeScript(QStrin
   if (!proxy || proxy->paused())
     return QVariant();
   QVariant ret = proxy->evaluate(filename,baseLine,script, n );
-  if ( d->m_doc )
-    d->m_doc->updateRendering();
+  DocumentImpl::updateDocumentsRendering();
   return ret;
 }
 
Index: html/html_baseimpl.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/html/html_baseimpl.cpp,v
retrieving revision 1.137
diff -u -p -r1.137 html_baseimpl.cpp
--- html/html_baseimpl.cpp	2001/12/20 01:21:51	1.137
+++ html/html_baseimpl.cpp	2001/12/22 17:53:28
@@ -389,18 +389,12 @@ void HTMLFrameSetElementImpl::parseAttri
         m_rows = attr->val()->toLengthList();
         m_totalRows = m_rows->count();
         setChanged();
-        // ### nasty - usual change handling is not enough FIXIT!
-        if (m_render)
-            m_render->layout();
         break;
     case ATTR_COLS:
         delete m_cols;
         m_cols = attr->val()->toLengthList();
         m_totalCols = m_cols->count();
         setChanged();
-        // ### nasty - usual change handling is not enough FIXIT!
-        if (m_render)
-            m_render->layout();
         break;
     case ATTR_FRAMEBORDER:
         // false or "no" or "0"..
Index: xml/dom_docimpl.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/xml/dom_docimpl.cpp,v
retrieving revision 1.131
diff -u -p -r1.131 dom_docimpl.cpp
--- xml/dom_docimpl.cpp	2001/12/22 09:38:39	1.131
+++ xml/dom_docimpl.cpp	2001/12/22 17:53:30
@@ -48,6 +48,7 @@
 #include "misc/htmlhashes.h"
 #include "misc/loader.h"
 #include <kdebug.h>
+#include <kstaticdeleter.h>
 
 #include "htmltokenizer.h"
 #include "xml_tokenizer.h"
@@ -127,6 +128,10 @@ DocumentTypeImpl *DOMImplementationImpl:
     return new DocumentTypeImpl(this,0,qualifiedName,publicId,systemId);
 }
 
+KStaticDeleter< QList<DocumentImpl> > s_changedDocumentsDeleter;
+QList<DocumentImpl> * DocumentImpl::changedDocuments = 0;
+
+
 DocumentImpl *DOMImplementationImpl::createDocument( const DOMString &namespaceURI, \
                const DOMString &qualifiedName,
                                                      const DocumentType &doctype, \
int &exceptioncode )  {
@@ -274,6 +279,8 @@ DocumentImpl::DocumentImpl(DOMImplementa
 
 DocumentImpl::~DocumentImpl()
 {
+    if (changedDocuments)
+        changedDocuments->remove(this);
     document->doc = 0;
     delete m_sheet;
     delete m_styleSelector;
@@ -802,6 +809,14 @@ void DocumentImpl::setChanged(bool b)
         changedNodes.append(this);
     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);
 }
 
@@ -876,6 +891,16 @@ void DocumentImpl::updateRendering()
     }
     kdDebug() << "UPDATERENDERING orig="<<o<<" actual="<<a<<endl;
     changedNodes.clear();
+    setChanged(false);
+}
+
+void DocumentImpl::updateDocumentsRendering()
+{
+    if (!changedDocuments)
+        return;
+    for (QListIterator<DocumentImpl> it(*changedDocuments); it.current(); )
+        if (it.current()->changed())
+            it.current()->updateRendering();
 }
 
 void DocumentImpl::attach(KHTMLView *w)
Index: xml/dom_docimpl.h
===================================================================
RCS file: /home/kde/kdelibs/khtml/xml/dom_docimpl.h,v
retrieving revision 1.72
diff -u -p -r1.72 dom_docimpl.h
--- xml/dom_docimpl.h	2001/12/09 12:35:24	1.72
+++ xml/dom_docimpl.h	2001/12/22 17:53:30
@@ -179,9 +179,11 @@ public:
                             bool entityReferenceExpansion);
 
     QList<NodeImpl> changedNodes;
+    static QList<DocumentImpl> * changedDocuments;
     virtual void setChanged(bool b=true);
     virtual void recalcStyle();
     virtual void updateRendering();
+    static void updateDocumentsRendering();
     khtml::DocLoader *docLoader() { return m_docLoader; }
 
     void attach(KHTMLView *w=0);
@@ -270,7 +272,6 @@ public:
 
     virtual DocumentImpl *getDocument()
         { return this; }
-
     void attachNodeIterator(NodeIteratorImpl *ni);
     void detachNodeIterator(NodeIteratorImpl *ni);
     void notifyBeforeNodeRemoval(NodeImpl *n);
Index: xml/dom_nodeimpl.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/xml/dom_nodeimpl.cpp,v
retrieving revision 1.155
diff -u -p -r1.155 dom_nodeimpl.cpp
--- xml/dom_nodeimpl.cpp	2001/12/22 09:38:39	1.155
+++ xml/dom_nodeimpl.cpp	2001/12/22 17:53:31
@@ -389,9 +389,12 @@ void NodeImpl::setChanged(bool b)
 {
     if (b && !attached()) // changed compared to what?
         return;
-
     if (b && !changed() && ownerDocument())
+    {
         ownerDocument()->changedNodes.append(this);
+        if ( this != ownerDocument() )
+            ownerDocument()->setChanged(b);
+    }
     else if (!b && changed() && ownerDocument())
         ownerDocument()->changedNodes.remove(this);
     m_changed = b;
@@ -1537,10 +1540,11 @@ NodeImpl *NodeBaseImpl::addChild(NodeImp
 void NodeBaseImpl::applyChanges(bool top, bool force)
 {
 
-    setChanged(false);
 
-    if (!attached())
+    if (!attached()) {
+           setChanged(false);
 	    return;
+    }
 
     int ow = (m_style?m_style->outlineWidth():0);
 



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

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