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

List:       kde-commits
Subject:    branches/KDE/4.0/kdelibs/khtml/xml
From:       Harri Porten <porten () kde ! org>
Date:       2008-04-05 15:01:39
Message-ID: 1207407699.027938.23363.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 793889 by porten:

Moved bad call out of constructor to all callers I could find.
No functional change, i.e. no badness removed but will allow for
easier incremental fixing of what's mentioned in Dirk's comment.


 M  +20 -10    dom_docimpl.cpp  


--- branches/KDE/4.0/kdelibs/khtml/xml/dom_docimpl.cpp #793888:793889
@@ -176,6 +176,11 @@
 
     // ### this is completely broken.. without a view it will not work (Dirk)
     DocumentImpl *doc = new DocumentImpl(this, 0);
+    // ### this should be created during parsing a <!DOCTYPE>
+    doc->setDocType(new DocumentTypeImpl(this, doc,
+                                         DOMString() /* qualifiedName */,
+                                         DOMString() /* publicId */,
+                                         DOMString() /* systemId */));
 
     // now get the interesting parts of the doctype
     // ### create new one if not there (currently always there)
@@ -209,12 +214,24 @@
 
 DocumentImpl *DOMImplementationImpl::createDocument( KHTMLView *v )
 {
-    return new DocumentImpl(this, v);
+    DocumentImpl* doc = new DocumentImpl(this, v);
+    // ### this should be created during parsing a <!DOCTYPE>
+    doc->setDocType(new DocumentTypeImpl(doc->implementation(), doc,
+                                         DOMString() /* qualifiedName */,
+                                         DOMString() /* publicId */,
+                                         DOMString() /* systemId */));
+    return doc;
 }
 
 HTMLDocumentImpl *DOMImplementationImpl::createHTMLDocument( KHTMLView *v )
 {
-    return new HTMLDocumentImpl(this, v);
+    HTMLDocumentImpl* doc = new HTMLDocumentImpl(this, v);
+    // ### this should be created during parsing a <!DOCTYPE>
+    doc->setDocType(new DocumentTypeImpl(doc->implementation(), doc,
+                                         DOMString() /* qualifiedName */,
+                                         DOMString() /* publicId */,
+                                         DOMString() /* systemId */));
+    return doc;
 }
 
 HTMLDocumentImpl* DOMImplementationImpl::createHTMLDocument( const DOMString& title )
@@ -341,14 +358,7 @@
     m_docChanged = false;
     m_elemSheet = 0;
     m_tokenizer = 0;
-
-    // ### this should be created during parsing a <!DOCTYPE>
-    // not during construction. Not sure who added that and why (Dirk)
-    setDocType( new DocumentTypeImpl(_implementation, getDocument(),
-                                     DOMString() /* qualifiedName */,
-                                     DOMString() /* publicId */,
-                                     DOMString() /* systemId */) );
-
+    m_doctype = 0;
     m_implementation = _implementation;
     m_implementation->ref();
     pMode = Strict;
[prev in list] [next in list] [prev in thread] [next in thread] 

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