[webkit-changes] cvs commit: LayoutTests/fast/dom gc-6-expected.txt gc-6.html gc-7-expected.txt gc-7.html gc-1.html gc-2.html gc-3.html gc-5.html

Maciej mjs at opensource.apple.com
Tue Nov 8 00:11:22 PST 2005


mjs         05/11/08 00:11:21

  Modified:    .        ChangeLog
               khtml/editing SelectionController.cpp visible_position.cpp
                        visible_text.cpp
               khtml/html html_baseimpl.cpp html_baseimpl.h
                        html_blockimpl.cpp html_blockimpl.h
                        html_canvasimpl.cpp html_canvasimpl.h
                        html_documentimpl.cpp html_elementimpl.cpp
                        html_elementimpl.h html_formimpl.cpp
                        html_formimpl.h html_headimpl.cpp html_headimpl.h
                        html_imageimpl.cpp html_imageimpl.h
                        html_inlineimpl.cpp html_inlineimpl.h
                        html_listimpl.h html_miscimpl.cpp html_miscimpl.h
                        html_objectimpl.cpp html_objectimpl.h
                        html_tableimpl.cpp html_tableimpl.h htmlfactory.cpp
                        htmlparser.cpp htmlparser.h htmltokenizer.cpp
                        htmltokenizer.h
               khtml/misc loader.h shared.h
               khtml/xbl xbl_tokenizer.cpp xbl_tokenizer.h
               khtml/xml dom2_rangeimpl.cpp dom2_rangeimpl.h
                        dom_docimpl.cpp dom_docimpl.h dom_elementimpl.cpp
                        dom_elementimpl.h dom_nodeimpl.cpp dom_nodeimpl.h
                        dom_textimpl.cpp dom_textimpl.h dom_xmlimpl.cpp
                        dom_xmlimpl.h xml_tokenizer.cpp xml_tokenizer.h
               khtml/xsl xslt_processorimpl.cpp
               .        ChangeLog
               fast/dom gc-1.html gc-2.html gc-3.html gc-5.html
  Added:       khtml/xml DocPtr.h
               fast/dom gc-6-expected.txt gc-6.html gc-7-expected.txt
                        gc-7.html
  Log:
  LayoutTests:
  
          Reviewed by Eric, Geoff and Darin.
  
  	- added test cases for <rdar://problem/4118258> XML DOM trees freed prematurely unless reference held to document node (causes crash)
  
  	Also updated the GC tests to try a little harder to trigger GC,
  	the old way might not work as well with the reworking of SimpleNumber.
  
          * fast/dom/gc-1.html:
          * fast/dom/gc-2.html:
          * fast/dom/gc-3.html:
          * fast/dom/gc-5.html:
          * fast/dom/gc-6-expected.txt: Added.
          * fast/dom/gc-6.html: Added.
          * fast/dom/gc-7-expected.txt: Added.
          * fast/dom/gc-7.html: Added.
  
  WebCore:
  
          Reviewed by Eric, Geoff and Darin.
  
  	- fixed <rdar://problem/4118258> XML DOM trees freed prematurely unless reference held to document node (causes crash)
  
  	I changed the design for how DOM nodes maintain their reference to
  	the document. Instead of using DocumentPtr, an indirect reference
  	which would go null in a clean way when the document is destroyed,
  	they now have a different strategy.
  
  	Nodes that belong to the document now hold a special kind of
  	reference on the document - a "self only reference". When a
  	document has no regular references but still has self-only
  	references, it won't be destroyed, but it will drop all its
  	children. This allows detached nodees to still have a valid
  	document reference, but they won't keep the rest of the DOM alive
  	or cause circular references.
  
          * khtml/editing/SelectionController.cpp:
          (khtml::SelectionController::toRange):
          * khtml/editing/visible_position.cpp:
          (khtml::makeRange):
          * khtml/editing/visible_text.cpp:
          (khtml::TextIterator::range):
          (khtml::SimplifiedBackwardsTextIterator::range):
          * khtml/html/html_baseimpl.cpp:
          (HTMLBodyElementImpl::HTMLBodyElementImpl):
          (HTMLFrameElementImpl::HTMLFrameElementImpl):
          (HTMLFrameSetElementImpl::HTMLFrameSetElementImpl):
          (HTMLHeadElementImpl::HTMLHeadElementImpl):
          (HTMLHtmlElementImpl::HTMLHtmlElementImpl):
          (HTMLIFrameElementImpl::HTMLIFrameElementImpl):
          * khtml/html/html_baseimpl.h:
          * khtml/html/html_blockimpl.cpp:
          (HTMLBlockquoteElementImpl::HTMLBlockquoteElementImpl):
          (HTMLDivElementImpl::HTMLDivElementImpl):
          (HTMLHRElementImpl::HTMLHRElementImpl):
          (HTMLHeadingElementImpl::HTMLHeadingElementImpl):
          (HTMLParagraphElementImpl::HTMLParagraphElementImpl):
          (HTMLPreElementImpl::HTMLPreElementImpl):
          (HTMLMarqueeElementImpl::HTMLMarqueeElementImpl):
          * khtml/html/html_blockimpl.h:
          * khtml/html/html_canvasimpl.cpp:
          (HTMLCanvasElementImpl::HTMLCanvasElementImpl):
          * khtml/html/html_canvasimpl.h:
          * khtml/html/html_documentimpl.cpp:
          (DOM::HTMLDocumentImpl::createTokenizer):
          (DOM::HTMLDocumentImpl::determineParseMode):
          * khtml/html/html_elementimpl.cpp:
          (HTMLElementImpl::HTMLElementImpl):
          (HTMLElementImpl::createContextualFragment):
          (HTMLElementImpl::setInnerText):
          (HTMLElementImpl::setOuterText):
          * khtml/html/html_elementimpl.h:
          * khtml/html/html_formimpl.cpp:
          (DOM::HTMLFormElementImpl::HTMLFormElementImpl):
          (DOM::HTMLGenericFormElementImpl::HTMLGenericFormElementImpl):
          (DOM::HTMLButtonElementImpl::HTMLButtonElementImpl):
          (DOM::HTMLFieldSetElementImpl::HTMLFieldSetElementImpl):
          (DOM::HTMLInputElementImpl::HTMLInputElementImpl):
          (DOM::HTMLLabelElementImpl::HTMLLabelElementImpl):
          (DOM::HTMLLegendElementImpl::HTMLLegendElementImpl):
          (DOM::HTMLSelectElementImpl::HTMLSelectElementImpl):
          (DOM::HTMLKeygenElementImpl::HTMLKeygenElementImpl):
          (DOM::HTMLOptGroupElementImpl::HTMLOptGroupElementImpl):
          (DOM::HTMLOptionElementImpl::HTMLOptionElementImpl):
          (DOM::HTMLOptionElementImpl::setText):
          (DOM::HTMLTextAreaElementImpl::HTMLTextAreaElementImpl):
          (DOM::HTMLIsIndexElementImpl::HTMLIsIndexElementImpl):
          * khtml/html/html_formimpl.h:
          * khtml/html/html_headimpl.cpp:
          (HTMLBaseElementImpl::HTMLBaseElementImpl):
          (HTMLLinkElementImpl::HTMLLinkElementImpl):
          (HTMLMetaElementImpl::HTMLMetaElementImpl):
          (HTMLScriptElementImpl::HTMLScriptElementImpl):
          (HTMLStyleElementImpl::HTMLStyleElementImpl):
          (HTMLTitleElementImpl::HTMLTitleElementImpl):
          * khtml/html/html_headimpl.h:
          * khtml/html/html_imageimpl.cpp:
          (HTMLImageElementImpl::HTMLImageElementImpl):
          (HTMLMapElementImpl::HTMLMapElementImpl):
          (HTMLAreaElementImpl::HTMLAreaElementImpl):
          * khtml/html/html_imageimpl.h:
          * khtml/html/html_inlineimpl.cpp:
          (DOM::HTMLAnchorElementImpl::HTMLAnchorElementImpl):
          (DOM::HTMLBRElementImpl::HTMLBRElementImpl):
          (DOM::HTMLFontElementImpl::HTMLFontElementImpl):
          (DOM::HTMLModElementImpl::HTMLModElementImpl):
          (DOM::HTMLQuoteElementImpl::HTMLQuoteElementImpl):
          * khtml/html/html_inlineimpl.h:
          * khtml/html/html_listimpl.h:
          (DOM::HTMLUListElementImpl::HTMLUListElementImpl):
          (DOM::HTMLDirectoryElementImpl::HTMLDirectoryElementImpl):
          (DOM::HTMLMenuElementImpl::HTMLMenuElementImpl):
          (DOM::HTMLOListElementImpl::HTMLOListElementImpl):
          (DOM::HTMLLIElementImpl::HTMLLIElementImpl):
          (DOM::HTMLDListElementImpl::HTMLDListElementImpl):
          * khtml/html/html_miscimpl.cpp:
          (DOM::HTMLBaseFontElementImpl::HTMLBaseFontElementImpl):
          * khtml/html/html_miscimpl.h:
          * khtml/html/html_objectimpl.cpp:
          (DOM::HTMLAppletElementImpl::HTMLAppletElementImpl):
          (DOM::HTMLEmbedElementImpl::HTMLEmbedElementImpl):
          (DOM::HTMLObjectElementImpl::HTMLObjectElementImpl):
          (DOM::HTMLParamElementImpl::HTMLParamElementImpl):
          * khtml/html/html_objectimpl.h:
          * khtml/html/html_tableimpl.cpp:
          (DOM::HTMLTableElementImpl::HTMLTableElementImpl):
          (DOM::HTMLTableElementImpl::createTHead):
          (DOM::HTMLTableElementImpl::createTFoot):
          (DOM::HTMLTableElementImpl::createCaption):
          (DOM::HTMLTableElementImpl::insertRow):
          (DOM::HTMLTableSectionElementImpl::HTMLTableSectionElementImpl):
          (DOM::HTMLTableSectionElementImpl::insertRow):
          (DOM::HTMLTableRowElementImpl::insertCell):
          (DOM::HTMLTableCellElementImpl::HTMLTableCellElementImpl):
          (DOM::HTMLTableColElementImpl::HTMLTableColElementImpl):
          * khtml/html/html_tableimpl.h:
          (DOM::HTMLTablePartElementImpl::HTMLTablePartElementImpl):
          (DOM::HTMLTableRowElementImpl::HTMLTableRowElementImpl):
          (DOM::HTMLTableCaptionElementImpl::HTMLTableCaptionElementImpl):
          * khtml/html/htmlfactory.cpp:
          (DOM::htmlConstructor):
          (DOM::headConstructor):
          (DOM::bodyConstructor):
          (DOM::baseConstructor):
          (DOM::linkConstructor):
          (DOM::metaConstructor):
          (DOM::styleConstructor):
          (DOM::titleConstructor):
          (DOM::frameConstructor):
          (DOM::framesetConstructor):
          (DOM::iframeConstructor):
          (DOM::formConstructor):
          (DOM::buttonConstructor):
          (DOM::inputConstructor):
          (DOM::isindexConstructor):
          (DOM::fieldsetConstructor):
          (DOM::labelConstructor):
          (DOM::legendConstructor):
          (DOM::optgroupConstructor):
          (DOM::optionConstructor):
          (DOM::selectConstructor):
          (DOM::textareaConstructor):
          (DOM::dlConstructor):
          (DOM::ulConstructor):
          (DOM::olConstructor):
          (DOM::dirConstructor):
          (DOM::menuConstructor):
          (DOM::liConstructor):
          (DOM::blockquoteConstructor):
          (DOM::divConstructor):
          (DOM::headingConstructor):
          (DOM::hrConstructor):
          (DOM::paragraphConstructor):
          (DOM::preConstructor):
          (DOM::basefontConstructor):
          (DOM::fontConstructor):
          (DOM::modConstructor):
          (DOM::anchorConstructor):
          (DOM::imageConstructor):
          (DOM::mapConstructor):
          (DOM::areaConstructor):
          (DOM::canvasConstructor):
          (DOM::appletConstructor):
          (DOM::embedConstructor):
          (DOM::objectConstructor):
          (DOM::paramConstructor):
          (DOM::scriptConstructor):
          (DOM::tableConstructor):
          (DOM::tableCaptionConstructor):
          (DOM::tableColConstructor):
          (DOM::tableRowConstructor):
          (DOM::tableCellConstructor):
          (DOM::tableSectionConstructor):
          (DOM::brConstructor):
          (DOM::quoteConstructor):
          (DOM::marqueeConstructor):
          (DOM::HTMLElementFactory::createHTMLElement):
          * khtml/html/htmlparser.cpp:
          (HTMLParser::HTMLParser):
          (HTMLParser::~HTMLParser):
          * khtml/html/htmlparser.h:
          (HTMLParser::doc):
          * khtml/html/htmltokenizer.cpp:
          (khtml::HTMLTokenizer::HTMLTokenizer):
          (khtml::HTMLTokenizer::parseTag):
          (khtml::parseHTMLDocumentFragment):
          * khtml/html/htmltokenizer.h:
          * khtml/misc/loader.h:
          * khtml/misc/shared.h:
          (khtml::TreeShared::~TreeShared):
          (khtml::TreeShared::destroy):
          (khtml::TreeShared::deref):
          * khtml/xbl/xbl_tokenizer.cpp:
          (XBL::XBLTokenHandler::XBLTokenHandler):
          * khtml/xbl/xbl_tokenizer.h:
          (XBL::):
          * khtml/xml/dom2_rangeimpl.cpp:
          (DOM::RangeImpl::RangeImpl):
          (DOM::RangeImpl::setStart):
          (DOM::RangeImpl::setEnd):
          (DOM::RangeImpl::processContents):
          (DOM::RangeImpl::cloneRange):
          (DOM::RangeImpl::setStartAfter):
          (DOM::RangeImpl::setEndBefore):
          (DOM::RangeImpl::setEndAfter):
          (DOM::RangeImpl::setStartBefore):
          (DOM::rangeOfContents):
          * khtml/xml/dom2_rangeimpl.h:
          * khtml/xml/dom_docimpl.cpp:
          (DOMImplementationImpl::createDocumentType):
          (DOMImplementationImpl::createDocument):
          (DocumentImpl::DocumentImpl):
          (DocumentImpl::destroy):
          (DocumentImpl::~DocumentImpl):
          (DocumentImpl::createDocumentFragment):
          (DocumentImpl::createTextNode):
          (DocumentImpl::createComment):
          (DocumentImpl::createCDATASection):
          (DocumentImpl::createProcessingInstruction):
          (DocumentImpl::createEntityReference):
          (DocumentImpl::createEditingTextNode):
          (DocumentImpl::createElementNS):
          (DocumentImpl::setTitle):
          (DocumentImpl::removeTitle):
          (DocumentImpl::createRange):
          (DocumentImpl::createTokenizer):
          (DocumentImpl::implicitClose):
          (DocumentImpl::setHoverNode):
          (DocumentImpl::setActiveNode):
          (DocumentImpl::setFocusNode):
          (DocumentImpl::createAttributeNS):
          (DocumentFragmentImpl::DocumentFragmentImpl):
          (DocumentFragmentImpl::cloneNode):
          (DocumentTypeImpl::DocumentTypeImpl):
          * khtml/xml/dom_docimpl.h:
          (DOM::DocumentImpl::selfOnlyRef):
          (DOM::DocumentImpl::selfOnlyDeref):
          (DOM::DocumentImpl::focusNode):
          (DOM::DocumentImpl::hoverNode):
          (DOM::DocumentImpl::activeNode):
          * khtml/xml/dom_elementimpl.cpp:
          (AttributeImpl::allocateImpl):
          (AttrImpl::AttrImpl):
          (AttrImpl::cloneNode):
          (ElementImpl::ElementImpl):
          (StyledElementImpl::StyledElementImpl):
          * khtml/xml/dom_elementimpl.h:
          * khtml/xml/dom_nodeimpl.cpp:
          (DOM::NodeImpl::NodeImpl):
          (DOM::NodeImpl::setDocument):
          (DOM::NodeImpl::~NodeImpl):
          (DOM::NodeImpl::dispatchEvent):
          (DOM::NodeImpl::dispatchWindowEvent):
          (DOM::NodeImpl::dispatchMouseEvent):
          (DOM::NodeImpl::checkAddChild):
          (DOM::ContainerNodeImpl::ContainerNodeImpl):
          (DOM::ContainerNodeImpl::removeAllChildren):
          (DOM::ContainerNodeImpl::~ContainerNodeImpl):
          * khtml/xml/dom_nodeimpl.h:
          (DOM::NodeImpl::inDocument):
          (DOM::NodeImpl::getDocument):
          * khtml/xml/dom_textimpl.cpp:
          (CharacterDataImpl::CharacterDataImpl):
          (CommentImpl::CommentImpl):
          (TextImpl::TextImpl):
          (TextImpl::createNew):
          (CDATASectionImpl::CDATASectionImpl):
          (CDATASectionImpl::createNew):
          (EditingTextImpl::EditingTextImpl):
          * khtml/xml/dom_textimpl.h:
          * khtml/xml/dom_xmlimpl.cpp:
          (DOM::EntityImpl::EntityImpl):
          (DOM::EntityReferenceImpl::EntityReferenceImpl):
          (DOM::EntityReferenceImpl::cloneNode):
          (DOM::NotationImpl::NotationImpl):
          (DOM::ProcessingInstructionImpl::ProcessingInstructionImpl):
          (DOM::ProcessingInstructionImpl::cloneNode):
          * khtml/xml/dom_xmlimpl.h:
          * khtml/xml/xml_tokenizer.cpp:
          (khtml::XMLTokenizer::XMLTokenizer):
          (khtml::XMLTokenizer::startElementNs):
          (khtml::XMLTokenizer::enterText):
          (khtml::XMLTokenizer::processingInstruction):
          (khtml::XMLTokenizer::cdataBlock):
          (khtml::XMLTokenizer::comment):
          (khtml::XMLTokenizer::internalSubset):
          (khtml::XMLTokenizer::finish):
          (khtml::XMLTokenizer::insertErrorMessageBlock):
          (khtml::XMLTokenizer::executeScripts):
          (khtml::newXMLTokenizer):
          * khtml/xml/xml_tokenizer.h:
          * khtml/xsl/xslt_processorimpl.cpp:
          (DOM::createFragmentFromSource):
  
  Revision  Changes    Path
  1.346     +297 -0    WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.345
  retrieving revision 1.346
  diff -u -r1.345 -r1.346
  --- ChangeLog	8 Nov 2005 00:49:06 -0000	1.345
  +++ ChangeLog	8 Nov 2005 08:10:50 -0000	1.346
  @@ -1,3 +1,300 @@
  +2005-11-07  Maciej Stachowiak  <mjs at apple.com>
  +
  +        Reviewed by Eric, Geoff and Darin.
  +
  +	- fixed <rdar://problem/4118258> XML DOM trees freed prematurely unless reference held to document node (causes crash)
  +
  +	I changed the design for how DOM nodes maintain their reference to
  +	the document. Instead of using DocumentPtr, an indirect reference
  +	which would go null in a clean way when the document is destroyed,
  +	they now have a different strategy.
  +
  +	Nodes that belong to the document now hold a special kind of
  +	reference on the document - a "self only reference". When a
  +	document has no regular references but still has self-only
  +	references, it won't be destroyed, but it will drop all its
  +	children. This allows detached nodees to still have a valid
  +	document reference, but they won't keep the rest of the DOM alive
  +	or cause circular references.
  +
  +        * khtml/editing/SelectionController.cpp:
  +        (khtml::SelectionController::toRange):
  +        * khtml/editing/visible_position.cpp:
  +        (khtml::makeRange):
  +        * khtml/editing/visible_text.cpp:
  +        (khtml::TextIterator::range):
  +        (khtml::SimplifiedBackwardsTextIterator::range):
  +        * khtml/html/html_baseimpl.cpp:
  +        (HTMLBodyElementImpl::HTMLBodyElementImpl):
  +        (HTMLFrameElementImpl::HTMLFrameElementImpl):
  +        (HTMLFrameSetElementImpl::HTMLFrameSetElementImpl):
  +        (HTMLHeadElementImpl::HTMLHeadElementImpl):
  +        (HTMLHtmlElementImpl::HTMLHtmlElementImpl):
  +        (HTMLIFrameElementImpl::HTMLIFrameElementImpl):
  +        * khtml/html/html_baseimpl.h:
  +        * khtml/html/html_blockimpl.cpp:
  +        (HTMLBlockquoteElementImpl::HTMLBlockquoteElementImpl):
  +        (HTMLDivElementImpl::HTMLDivElementImpl):
  +        (HTMLHRElementImpl::HTMLHRElementImpl):
  +        (HTMLHeadingElementImpl::HTMLHeadingElementImpl):
  +        (HTMLParagraphElementImpl::HTMLParagraphElementImpl):
  +        (HTMLPreElementImpl::HTMLPreElementImpl):
  +        (HTMLMarqueeElementImpl::HTMLMarqueeElementImpl):
  +        * khtml/html/html_blockimpl.h:
  +        * khtml/html/html_canvasimpl.cpp:
  +        (HTMLCanvasElementImpl::HTMLCanvasElementImpl):
  +        * khtml/html/html_canvasimpl.h:
  +        * khtml/html/html_documentimpl.cpp:
  +        (DOM::HTMLDocumentImpl::createTokenizer):
  +        (DOM::HTMLDocumentImpl::determineParseMode):
  +        * khtml/html/html_elementimpl.cpp:
  +        (HTMLElementImpl::HTMLElementImpl):
  +        (HTMLElementImpl::createContextualFragment):
  +        (HTMLElementImpl::setInnerText):
  +        (HTMLElementImpl::setOuterText):
  +        * khtml/html/html_elementimpl.h:
  +        * khtml/html/html_formimpl.cpp:
  +        (DOM::HTMLFormElementImpl::HTMLFormElementImpl):
  +        (DOM::HTMLGenericFormElementImpl::HTMLGenericFormElementImpl):
  +        (DOM::HTMLButtonElementImpl::HTMLButtonElementImpl):
  +        (DOM::HTMLFieldSetElementImpl::HTMLFieldSetElementImpl):
  +        (DOM::HTMLInputElementImpl::HTMLInputElementImpl):
  +        (DOM::HTMLLabelElementImpl::HTMLLabelElementImpl):
  +        (DOM::HTMLLegendElementImpl::HTMLLegendElementImpl):
  +        (DOM::HTMLSelectElementImpl::HTMLSelectElementImpl):
  +        (DOM::HTMLKeygenElementImpl::HTMLKeygenElementImpl):
  +        (DOM::HTMLOptGroupElementImpl::HTMLOptGroupElementImpl):
  +        (DOM::HTMLOptionElementImpl::HTMLOptionElementImpl):
  +        (DOM::HTMLOptionElementImpl::setText):
  +        (DOM::HTMLTextAreaElementImpl::HTMLTextAreaElementImpl):
  +        (DOM::HTMLIsIndexElementImpl::HTMLIsIndexElementImpl):
  +        * khtml/html/html_formimpl.h:
  +        * khtml/html/html_headimpl.cpp:
  +        (HTMLBaseElementImpl::HTMLBaseElementImpl):
  +        (HTMLLinkElementImpl::HTMLLinkElementImpl):
  +        (HTMLMetaElementImpl::HTMLMetaElementImpl):
  +        (HTMLScriptElementImpl::HTMLScriptElementImpl):
  +        (HTMLStyleElementImpl::HTMLStyleElementImpl):
  +        (HTMLTitleElementImpl::HTMLTitleElementImpl):
  +        * khtml/html/html_headimpl.h:
  +        * khtml/html/html_imageimpl.cpp:
  +        (HTMLImageElementImpl::HTMLImageElementImpl):
  +        (HTMLMapElementImpl::HTMLMapElementImpl):
  +        (HTMLAreaElementImpl::HTMLAreaElementImpl):
  +        * khtml/html/html_imageimpl.h:
  +        * khtml/html/html_inlineimpl.cpp:
  +        (DOM::HTMLAnchorElementImpl::HTMLAnchorElementImpl):
  +        (DOM::HTMLBRElementImpl::HTMLBRElementImpl):
  +        (DOM::HTMLFontElementImpl::HTMLFontElementImpl):
  +        (DOM::HTMLModElementImpl::HTMLModElementImpl):
  +        (DOM::HTMLQuoteElementImpl::HTMLQuoteElementImpl):
  +        * khtml/html/html_inlineimpl.h:
  +        * khtml/html/html_listimpl.h:
  +        (DOM::HTMLUListElementImpl::HTMLUListElementImpl):
  +        (DOM::HTMLDirectoryElementImpl::HTMLDirectoryElementImpl):
  +        (DOM::HTMLMenuElementImpl::HTMLMenuElementImpl):
  +        (DOM::HTMLOListElementImpl::HTMLOListElementImpl):
  +        (DOM::HTMLLIElementImpl::HTMLLIElementImpl):
  +        (DOM::HTMLDListElementImpl::HTMLDListElementImpl):
  +        * khtml/html/html_miscimpl.cpp:
  +        (DOM::HTMLBaseFontElementImpl::HTMLBaseFontElementImpl):
  +        * khtml/html/html_miscimpl.h:
  +        * khtml/html/html_objectimpl.cpp:
  +        (DOM::HTMLAppletElementImpl::HTMLAppletElementImpl):
  +        (DOM::HTMLEmbedElementImpl::HTMLEmbedElementImpl):
  +        (DOM::HTMLObjectElementImpl::HTMLObjectElementImpl):
  +        (DOM::HTMLParamElementImpl::HTMLParamElementImpl):
  +        * khtml/html/html_objectimpl.h:
  +        * khtml/html/html_tableimpl.cpp:
  +        (DOM::HTMLTableElementImpl::HTMLTableElementImpl):
  +        (DOM::HTMLTableElementImpl::createTHead):
  +        (DOM::HTMLTableElementImpl::createTFoot):
  +        (DOM::HTMLTableElementImpl::createCaption):
  +        (DOM::HTMLTableElementImpl::insertRow):
  +        (DOM::HTMLTableSectionElementImpl::HTMLTableSectionElementImpl):
  +        (DOM::HTMLTableSectionElementImpl::insertRow):
  +        (DOM::HTMLTableRowElementImpl::insertCell):
  +        (DOM::HTMLTableCellElementImpl::HTMLTableCellElementImpl):
  +        (DOM::HTMLTableColElementImpl::HTMLTableColElementImpl):
  +        * khtml/html/html_tableimpl.h:
  +        (DOM::HTMLTablePartElementImpl::HTMLTablePartElementImpl):
  +        (DOM::HTMLTableRowElementImpl::HTMLTableRowElementImpl):
  +        (DOM::HTMLTableCaptionElementImpl::HTMLTableCaptionElementImpl):
  +        * khtml/html/htmlfactory.cpp:
  +        (DOM::htmlConstructor):
  +        (DOM::headConstructor):
  +        (DOM::bodyConstructor):
  +        (DOM::baseConstructor):
  +        (DOM::linkConstructor):
  +        (DOM::metaConstructor):
  +        (DOM::styleConstructor):
  +        (DOM::titleConstructor):
  +        (DOM::frameConstructor):
  +        (DOM::framesetConstructor):
  +        (DOM::iframeConstructor):
  +        (DOM::formConstructor):
  +        (DOM::buttonConstructor):
  +        (DOM::inputConstructor):
  +        (DOM::isindexConstructor):
  +        (DOM::fieldsetConstructor):
  +        (DOM::labelConstructor):
  +        (DOM::legendConstructor):
  +        (DOM::optgroupConstructor):
  +        (DOM::optionConstructor):
  +        (DOM::selectConstructor):
  +        (DOM::textareaConstructor):
  +        (DOM::dlConstructor):
  +        (DOM::ulConstructor):
  +        (DOM::olConstructor):
  +        (DOM::dirConstructor):
  +        (DOM::menuConstructor):
  +        (DOM::liConstructor):
  +        (DOM::blockquoteConstructor):
  +        (DOM::divConstructor):
  +        (DOM::headingConstructor):
  +        (DOM::hrConstructor):
  +        (DOM::paragraphConstructor):
  +        (DOM::preConstructor):
  +        (DOM::basefontConstructor):
  +        (DOM::fontConstructor):
  +        (DOM::modConstructor):
  +        (DOM::anchorConstructor):
  +        (DOM::imageConstructor):
  +        (DOM::mapConstructor):
  +        (DOM::areaConstructor):
  +        (DOM::canvasConstructor):
  +        (DOM::appletConstructor):
  +        (DOM::embedConstructor):
  +        (DOM::objectConstructor):
  +        (DOM::paramConstructor):
  +        (DOM::scriptConstructor):
  +        (DOM::tableConstructor):
  +        (DOM::tableCaptionConstructor):
  +        (DOM::tableColConstructor):
  +        (DOM::tableRowConstructor):
  +        (DOM::tableCellConstructor):
  +        (DOM::tableSectionConstructor):
  +        (DOM::brConstructor):
  +        (DOM::quoteConstructor):
  +        (DOM::marqueeConstructor):
  +        (DOM::HTMLElementFactory::createHTMLElement):
  +        * khtml/html/htmlparser.cpp:
  +        (HTMLParser::HTMLParser):
  +        (HTMLParser::~HTMLParser):
  +        * khtml/html/htmlparser.h:
  +        (HTMLParser::doc):
  +        * khtml/html/htmltokenizer.cpp:
  +        (khtml::HTMLTokenizer::HTMLTokenizer):
  +        (khtml::HTMLTokenizer::parseTag):
  +        (khtml::parseHTMLDocumentFragment):
  +        * khtml/html/htmltokenizer.h:
  +        * khtml/misc/loader.h:
  +        * khtml/misc/shared.h:
  +        (khtml::TreeShared::~TreeShared):
  +        (khtml::TreeShared::destroy):
  +        (khtml::TreeShared::deref):
  +        * khtml/xbl/xbl_tokenizer.cpp:
  +        (XBL::XBLTokenHandler::XBLTokenHandler):
  +        * khtml/xbl/xbl_tokenizer.h:
  +        (XBL::):
  +        * khtml/xml/dom2_rangeimpl.cpp:
  +        (DOM::RangeImpl::RangeImpl):
  +        (DOM::RangeImpl::setStart):
  +        (DOM::RangeImpl::setEnd):
  +        (DOM::RangeImpl::processContents):
  +        (DOM::RangeImpl::cloneRange):
  +        (DOM::RangeImpl::setStartAfter):
  +        (DOM::RangeImpl::setEndBefore):
  +        (DOM::RangeImpl::setEndAfter):
  +        (DOM::RangeImpl::setStartBefore):
  +        (DOM::rangeOfContents):
  +        * khtml/xml/dom2_rangeimpl.h:
  +        * khtml/xml/dom_docimpl.cpp:
  +        (DOMImplementationImpl::createDocumentType):
  +        (DOMImplementationImpl::createDocument):
  +        (DocumentImpl::DocumentImpl):
  +        (DocumentImpl::destroy):
  +        (DocumentImpl::~DocumentImpl):
  +        (DocumentImpl::createDocumentFragment):
  +        (DocumentImpl::createTextNode):
  +        (DocumentImpl::createComment):
  +        (DocumentImpl::createCDATASection):
  +        (DocumentImpl::createProcessingInstruction):
  +        (DocumentImpl::createEntityReference):
  +        (DocumentImpl::createEditingTextNode):
  +        (DocumentImpl::createElementNS):
  +        (DocumentImpl::setTitle):
  +        (DocumentImpl::removeTitle):
  +        (DocumentImpl::createRange):
  +        (DocumentImpl::createTokenizer):
  +        (DocumentImpl::implicitClose):
  +        (DocumentImpl::setHoverNode):
  +        (DocumentImpl::setActiveNode):
  +        (DocumentImpl::setFocusNode):
  +        (DocumentImpl::createAttributeNS):
  +        (DocumentFragmentImpl::DocumentFragmentImpl):
  +        (DocumentFragmentImpl::cloneNode):
  +        (DocumentTypeImpl::DocumentTypeImpl):
  +        * khtml/xml/dom_docimpl.h:
  +        (DOM::DocumentImpl::selfOnlyRef):
  +        (DOM::DocumentImpl::selfOnlyDeref):
  +        (DOM::DocumentImpl::focusNode):
  +        (DOM::DocumentImpl::hoverNode):
  +        (DOM::DocumentImpl::activeNode):
  +        * khtml/xml/dom_elementimpl.cpp:
  +        (AttributeImpl::allocateImpl):
  +        (AttrImpl::AttrImpl):
  +        (AttrImpl::cloneNode):
  +        (ElementImpl::ElementImpl):
  +        (StyledElementImpl::StyledElementImpl):
  +        * khtml/xml/dom_elementimpl.h:
  +        * khtml/xml/dom_nodeimpl.cpp:
  +        (DOM::NodeImpl::NodeImpl):
  +        (DOM::NodeImpl::setDocument):
  +        (DOM::NodeImpl::~NodeImpl):
  +        (DOM::NodeImpl::dispatchEvent):
  +        (DOM::NodeImpl::dispatchWindowEvent):
  +        (DOM::NodeImpl::dispatchMouseEvent):
  +        (DOM::NodeImpl::checkAddChild):
  +        (DOM::ContainerNodeImpl::ContainerNodeImpl):
  +        (DOM::ContainerNodeImpl::removeAllChildren):
  +        (DOM::ContainerNodeImpl::~ContainerNodeImpl):
  +        * khtml/xml/dom_nodeimpl.h:
  +        (DOM::NodeImpl::inDocument):
  +        (DOM::NodeImpl::getDocument):
  +        * khtml/xml/dom_textimpl.cpp:
  +        (CharacterDataImpl::CharacterDataImpl):
  +        (CommentImpl::CommentImpl):
  +        (TextImpl::TextImpl):
  +        (TextImpl::createNew):
  +        (CDATASectionImpl::CDATASectionImpl):
  +        (CDATASectionImpl::createNew):
  +        (EditingTextImpl::EditingTextImpl):
  +        * khtml/xml/dom_textimpl.h:
  +        * khtml/xml/dom_xmlimpl.cpp:
  +        (DOM::EntityImpl::EntityImpl):
  +        (DOM::EntityReferenceImpl::EntityReferenceImpl):
  +        (DOM::EntityReferenceImpl::cloneNode):
  +        (DOM::NotationImpl::NotationImpl):
  +        (DOM::ProcessingInstructionImpl::ProcessingInstructionImpl):
  +        (DOM::ProcessingInstructionImpl::cloneNode):
  +        * khtml/xml/dom_xmlimpl.h:
  +        * khtml/xml/xml_tokenizer.cpp:
  +        (khtml::XMLTokenizer::XMLTokenizer):
  +        (khtml::XMLTokenizer::startElementNs):
  +        (khtml::XMLTokenizer::enterText):
  +        (khtml::XMLTokenizer::processingInstruction):
  +        (khtml::XMLTokenizer::cdataBlock):
  +        (khtml::XMLTokenizer::comment):
  +        (khtml::XMLTokenizer::internalSubset):
  +        (khtml::XMLTokenizer::finish):
  +        (khtml::XMLTokenizer::insertErrorMessageBlock):
  +        (khtml::XMLTokenizer::executeScripts):
  +        (khtml::newXMLTokenizer):
  +        * khtml/xml/xml_tokenizer.h:
  +        * khtml/xsl/xslt_processorimpl.cpp:
  +        (DOM::createFragmentFromSource):
  +
   2005-11-07  David Harrison  <harrison at apple.com>
   
           Reviewed by Justin and Hyatt.
  
  
  
  1.101     +1 -1      WebCore/khtml/editing/SelectionController.cpp
  
  Index: SelectionController.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/editing/SelectionController.cpp,v
  retrieving revision 1.100
  retrieving revision 1.101
  diff -u -r1.100 -r1.101
  --- SelectionController.cpp	1 Nov 2005 22:29:19 -0000	1.100
  +++ SelectionController.cpp	8 Nov 2005 08:10:55 -0000	1.101
  @@ -651,7 +651,7 @@
       }
   
       int exceptionCode = 0;
  -    SharedPtr<RangeImpl> result(new RangeImpl(s.node()->docPtr()));
  +    SharedPtr<RangeImpl> result(new RangeImpl(s.node()->getDocument()));
       result->setStart(s.node(), s.offset(), exceptionCode);
       if (exceptionCode) {
           ERROR("Exception setting Range start from SelectionController: %d", exceptionCode);
  
  
  
  1.62      +1 -1      WebCore/khtml/editing/visible_position.cpp
  
  Index: visible_position.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/editing/visible_position.cpp,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- visible_position.cpp	7 Nov 2005 19:59:22 -0000	1.61
  +++ visible_position.cpp	8 Nov 2005 08:10:55 -0000	1.62
  @@ -425,7 +425,7 @@
   {
       Position s = start.position();
       Position e = end.position();
  -    return SharedPtr<RangeImpl>(new RangeImpl(s.node()->docPtr(), s.node(), s.offset(), e.node(), e.offset()));
  +    return SharedPtr<RangeImpl>(new RangeImpl(s.node()->getDocument(), s.node(), s.offset(), e.node(), e.offset()));
   }
   
   VisiblePosition startVisiblePosition(const RangeImpl *r, EAffinity affinity)
  
  
  
  1.41      +4 -4      WebCore/khtml/editing/visible_text.cpp
  
  Index: visible_text.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/editing/visible_text.cpp,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- visible_text.cpp	4 Nov 2005 05:58:11 -0000	1.40
  +++ visible_text.cpp	8 Nov 2005 08:10:56 -0000	1.41
  @@ -464,13 +464,13 @@
               m_positionEndOffset += index;
               m_positionOffsetBaseNode = 0;
           }
  -        return SharedPtr<RangeImpl>(new RangeImpl(m_positionNode->docPtr(),
  +        return SharedPtr<RangeImpl>(new RangeImpl(m_positionNode->getDocument(),
               m_positionNode, m_positionStartOffset, m_positionNode, m_positionEndOffset));
       }
   
       // otherwise, return the end of the overall range we were given
       if (m_endContainer)
  -        return SharedPtr<RangeImpl>(new RangeImpl(m_endContainer->docPtr(), 
  +        return SharedPtr<RangeImpl>(new RangeImpl(m_endContainer->getDocument(), 
               m_endContainer, m_endOffset, m_endContainer, m_endOffset));
           
       return SharedPtr<RangeImpl>();
  @@ -710,9 +710,9 @@
   SharedPtr<RangeImpl> SimplifiedBackwardsTextIterator::range() const
   {
       if (m_positionNode) {
  -        return SharedPtr<RangeImpl>(new RangeImpl(m_positionNode->docPtr(), m_positionNode, m_positionStartOffset, m_positionNode, m_positionEndOffset));
  +        return SharedPtr<RangeImpl>(new RangeImpl(m_positionNode->getDocument(), m_positionNode, m_positionStartOffset, m_positionNode, m_positionEndOffset));
       } else {
  -        return SharedPtr<RangeImpl>(new RangeImpl(m_startNode->docPtr(), m_startNode, m_startOffset, m_startNode, m_startOffset));
  +        return SharedPtr<RangeImpl>(new RangeImpl(m_startNode->getDocument(), m_startNode, m_startOffset, m_startNode, m_startOffset));
       }
   }
   
  
  
  
  1.83      +7 -7      WebCore/khtml/html/html_baseimpl.cpp
  
  Index: html_baseimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_baseimpl.cpp,v
  retrieving revision 1.82
  retrieving revision 1.83
  diff -u -r1.82 -r1.83
  --- html_baseimpl.cpp	27 Oct 2005 23:15:01 -0000	1.82
  +++ html_baseimpl.cpp	8 Nov 2005 08:10:57 -0000	1.83
  @@ -51,7 +51,7 @@
   using namespace khtml;
   using namespace HTMLNames;
   
  -HTMLBodyElementImpl::HTMLBodyElementImpl(DocumentPtr *doc)
  +HTMLBodyElementImpl::HTMLBodyElementImpl(DocumentImpl *doc)
       : HTMLElementImpl(bodyTag, doc), m_linkDecl(0)
   {
   }
  @@ -263,13 +263,13 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLFrameElementImpl::HTMLFrameElementImpl(DocumentPtr *doc)
  +HTMLFrameElementImpl::HTMLFrameElementImpl(DocumentImpl *doc)
       : HTMLElementImpl(frameTag, doc)
   {
       init();
   }
   
  -HTMLFrameElementImpl::HTMLFrameElementImpl(const QualifiedName& tagName, DocumentPtr *doc)
  +HTMLFrameElementImpl::HTMLFrameElementImpl(const QualifiedName& tagName, DocumentImpl *doc)
       : HTMLElementImpl(tagName, doc)
   {
       init();
  @@ -645,7 +645,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLFrameSetElementImpl::HTMLFrameSetElementImpl(DocumentPtr *doc)
  +HTMLFrameSetElementImpl::HTMLFrameSetElementImpl(DocumentImpl *doc)
       : HTMLElementImpl(framesetTag, doc)
   {
       // default value for rows and cols...
  @@ -785,7 +785,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLHeadElementImpl::HTMLHeadElementImpl(DocumentPtr *doc)
  +HTMLHeadElementImpl::HTMLHeadElementImpl(DocumentImpl *doc)
       : HTMLElementImpl(headTag, doc)
   {
   }
  @@ -814,7 +814,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLHtmlElementImpl::HTMLHtmlElementImpl(DocumentPtr *doc)
  +HTMLHtmlElementImpl::HTMLHtmlElementImpl(DocumentImpl *doc)
       : HTMLElementImpl(htmlTag, doc)
   {
   }
  @@ -843,7 +843,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLIFrameElementImpl::HTMLIFrameElementImpl(DocumentPtr *doc) : HTMLFrameElementImpl(iframeTag, doc)
  +HTMLIFrameElementImpl::HTMLIFrameElementImpl(DocumentImpl *doc) : HTMLFrameElementImpl(iframeTag, doc)
   {
       m_frameBorder = false;
       m_marginWidth = -1;
  
  
  
  1.32      +7 -7      WebCore/khtml/html/html_baseimpl.h
  
  Index: html_baseimpl.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_baseimpl.h,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- html_baseimpl.h	27 Oct 2005 23:15:01 -0000	1.31
  +++ html_baseimpl.h	8 Nov 2005 08:10:57 -0000	1.32
  @@ -51,7 +51,7 @@
   class HTMLBodyElementImpl : public HTMLElementImpl
   {
   public:
  -    HTMLBodyElementImpl(DocumentPtr *doc);
  +    HTMLBodyElementImpl(DocumentImpl *doc);
       ~HTMLBodyElementImpl();
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
  @@ -91,8 +91,8 @@
       friend class khtml::RenderPartObject;
   
   public:
  -    HTMLFrameElementImpl(DocumentPtr *doc);
  -    HTMLFrameElementImpl(const QualifiedName& tagName, DocumentPtr* doc);
  +    HTMLFrameElementImpl(DocumentImpl *doc);
  +    HTMLFrameElementImpl(const QualifiedName& tagName, DocumentImpl* doc);
       ~HTMLFrameElementImpl();
   
       void init();
  @@ -172,7 +172,7 @@
   {
       friend class khtml::RenderFrameSet;
   public:
  -    HTMLFrameSetElementImpl(DocumentPtr *doc);
  +    HTMLFrameSetElementImpl(DocumentImpl *doc);
       ~HTMLFrameSetElementImpl();
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
  @@ -220,7 +220,7 @@
   class HTMLHeadElementImpl : public HTMLElementImpl
   {
   public:
  -    HTMLHeadElementImpl(DocumentPtr *doc);
  +    HTMLHeadElementImpl(DocumentImpl *doc);
       ~HTMLHeadElementImpl();
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
  @@ -236,7 +236,7 @@
   class HTMLHtmlElementImpl : public HTMLElementImpl
   {
   public:
  -    HTMLHtmlElementImpl(DocumentPtr *doc);
  +    HTMLHtmlElementImpl(DocumentImpl *doc);
       ~HTMLHtmlElementImpl();
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
  @@ -253,7 +253,7 @@
   class HTMLIFrameElementImpl : public HTMLFrameElementImpl
   {
   public:
  -    HTMLIFrameElementImpl(DocumentPtr *doc);
  +    HTMLIFrameElementImpl(DocumentImpl *doc);
       ~HTMLIFrameElementImpl();
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
  
  
  
  1.28      +7 -7      WebCore/khtml/html/html_blockimpl.cpp
  
  Index: html_blockimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_blockimpl.cpp,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- html_blockimpl.cpp	2 Nov 2005 08:52:44 -0000	1.27
  +++ html_blockimpl.cpp	8 Nov 2005 08:10:57 -0000	1.28
  @@ -37,7 +37,7 @@
   using namespace DOM;
   using namespace HTMLNames;
   
  -HTMLBlockquoteElementImpl::HTMLBlockquoteElementImpl(DocumentPtr *doc)
  +HTMLBlockquoteElementImpl::HTMLBlockquoteElementImpl(DocumentImpl *doc)
       : HTMLElementImpl(blockquoteTag, doc)
   {
   }
  @@ -58,7 +58,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLDivElementImpl::HTMLDivElementImpl(DocumentPtr *doc)
  +HTMLDivElementImpl::HTMLDivElementImpl(DocumentImpl *doc)
       : HTMLElementImpl(divTag, doc)
   {
   }
  @@ -104,7 +104,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLHRElementImpl::HTMLHRElementImpl(DocumentPtr *doc)
  +HTMLHRElementImpl::HTMLHRElementImpl(DocumentImpl *doc)
       : HTMLElementImpl(hrTag, doc)
   {
   }
  @@ -215,7 +215,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLHeadingElementImpl::HTMLHeadingElementImpl(const QualifiedName& tagName, DocumentPtr *doc)
  +HTMLHeadingElementImpl::HTMLHeadingElementImpl(const QualifiedName& tagName, DocumentImpl *doc)
       : HTMLElementImpl(tagName, doc)
   {
   }
  @@ -242,7 +242,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLParagraphElementImpl::HTMLParagraphElementImpl(DocumentPtr *doc)
  +HTMLParagraphElementImpl::HTMLParagraphElementImpl(DocumentImpl *doc)
       : HTMLElementImpl(pTag, doc)
   {
   }
  @@ -289,7 +289,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLPreElementImpl::HTMLPreElementImpl(const QualifiedName& tagName, DocumentPtr *doc)
  +HTMLPreElementImpl::HTMLPreElementImpl(const QualifiedName& tagName, DocumentImpl *doc)
       : HTMLElementImpl(tagName, doc)
   {
   }
  @@ -342,7 +342,7 @@
    // WinIE uses 60ms as the minimum delay by default.
   const int defaultMinimumDelay = 60;
   
  -HTMLMarqueeElementImpl::HTMLMarqueeElementImpl(DocumentPtr *doc)
  +HTMLMarqueeElementImpl::HTMLMarqueeElementImpl(DocumentImpl *doc)
   : HTMLElementImpl(marqueeTag, doc),
     m_minimumDelay(defaultMinimumDelay)
   {
  
  
  
  1.14      +7 -7      WebCore/khtml/html/html_blockimpl.h
  
  Index: html_blockimpl.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_blockimpl.h,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- html_blockimpl.h	2 Nov 2005 08:52:44 -0000	1.13
  +++ html_blockimpl.h	8 Nov 2005 08:10:57 -0000	1.14
  @@ -36,7 +36,7 @@
   class HTMLBlockquoteElementImpl : public HTMLElementImpl
   {
   public:
  -    HTMLBlockquoteElementImpl(DocumentPtr *doc);
  +    HTMLBlockquoteElementImpl(DocumentImpl *doc);
       ~HTMLBlockquoteElementImpl();
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
  @@ -53,7 +53,7 @@
   class HTMLDivElementImpl : public HTMLElementImpl
   {
   public:
  -    HTMLDivElementImpl(DocumentPtr *doc);
  +    HTMLDivElementImpl(DocumentImpl *doc);
       ~HTMLDivElementImpl();
       
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
  @@ -71,7 +71,7 @@
   class HTMLHRElementImpl : public HTMLElementImpl
   {
   public:
  -    HTMLHRElementImpl(DocumentPtr *doc);
  +    HTMLHRElementImpl(DocumentImpl *doc);
       ~HTMLHRElementImpl();
       
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
  @@ -98,7 +98,7 @@
   class HTMLHeadingElementImpl : public HTMLElementImpl
   {
   public:
  -    HTMLHeadingElementImpl(const QualifiedName& tagName, DocumentPtr *doc);
  +    HTMLHeadingElementImpl(const QualifiedName& tagName, DocumentImpl *doc);
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
       virtual int tagPriority() const { return 5; }
  @@ -113,7 +113,7 @@
   class HTMLParagraphElementImpl : public HTMLElementImpl
   {
   public:
  -    HTMLParagraphElementImpl(DocumentPtr *doc);
  +    HTMLParagraphElementImpl(DocumentImpl *doc);
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
       virtual int tagPriority() const { return 3; }
  @@ -131,7 +131,7 @@
   class HTMLPreElementImpl : public HTMLElementImpl
   {
   public:
  -    HTMLPreElementImpl(const QualifiedName& tagName, DocumentPtr *doc);
  +    HTMLPreElementImpl(const QualifiedName& tagName, DocumentImpl *doc);
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
       virtual int tagPriority() const { return 5; }
  @@ -151,7 +151,7 @@
   class HTMLMarqueeElementImpl : public HTMLElementImpl
   {
   public:
  -    HTMLMarqueeElementImpl(DocumentPtr *doc);
  +    HTMLMarqueeElementImpl(DocumentImpl *doc);
       
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
       virtual int tagPriority() const { return 3; }
  
  
  
  1.9       +1 -1      WebCore/khtml/html/html_canvasimpl.cpp
  
  Index: html_canvasimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_canvasimpl.cpp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- html_canvasimpl.cpp	3 Oct 2005 21:12:28 -0000	1.8
  +++ html_canvasimpl.cpp	8 Nov 2005 08:10:58 -0000	1.9
  @@ -55,7 +55,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLCanvasElementImpl::HTMLCanvasElementImpl(DocumentPtr *doc)
  +HTMLCanvasElementImpl::HTMLCanvasElementImpl(DocumentImpl *doc)
       : HTMLImageElementImpl(canvasTag, doc)
   {
   }
  
  
  
  1.5       +1 -1      WebCore/khtml/html/html_canvasimpl.h
  
  Index: html_canvasimpl.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_canvasimpl.h,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- html_canvasimpl.h	18 Jul 2005 21:44:20 -0000	1.4
  +++ html_canvasimpl.h	8 Nov 2005 08:10:58 -0000	1.5
  @@ -42,7 +42,7 @@
       : public HTMLImageElementImpl
   {
   public:
  -    HTMLCanvasElementImpl(DocumentPtr *doc);
  +    HTMLCanvasElementImpl(DocumentImpl *doc);
       ~HTMLCanvasElementImpl();
   
       virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
  
  
  
  1.74      +2 -2      WebCore/khtml/html/html_documentimpl.cpp
  
  Index: html_documentimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_documentimpl.cpp,v
  retrieving revision 1.73
  retrieving revision 1.74
  diff -u -r1.73 -r1.74
  --- html_documentimpl.cpp	26 Oct 2005 06:10:09 -0000	1.73
  +++ html_documentimpl.cpp	8 Nov 2005 08:10:58 -0000	1.74
  @@ -238,7 +238,7 @@
   
   Tokenizer *HTMLDocumentImpl::createTokenizer()
   {
  -    return new HTMLTokenizer(docPtr(),m_view);
  +    return new HTMLTokenizer(this, m_view);
   }
   
   // --------------------------------------------------------------------------
  @@ -496,7 +496,7 @@
       int resultFlags = 0;
       if (parseDocTypeDeclaration(str, &resultFlags, publicID, systemID)) {
           if (resultFlags & PARSEMODE_HAVE_DOCTYPE)
  -            setDocType(new DocumentTypeImpl(docPtr(), "HTML", publicID, systemID));
  +            setDocType(new DocumentTypeImpl(this, "HTML", publicID, systemID));
           if (!(resultFlags & PARSEMODE_HAVE_DOCTYPE)) {
               // No doctype found at all.  Default to quirks mode and Html4.
               pMode = Compat;
  
  
  
  1.110     +4 -4      WebCore/khtml/html/html_elementimpl.cpp
  
  Index: html_elementimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_elementimpl.cpp,v
  retrieving revision 1.109
  retrieving revision 1.110
  diff -u -r1.109 -r1.110
  --- html_elementimpl.cpp	27 Oct 2005 06:03:29 -0000	1.109
  +++ html_elementimpl.cpp	8 Nov 2005 08:10:58 -0000	1.110
  @@ -62,7 +62,7 @@
   
   // ------------------------------------------------------------------
   
  -HTMLElementImpl::HTMLElementImpl(const QualifiedName& tagName, DocumentPtr *doc)
  +HTMLElementImpl::HTMLElementImpl(const QualifiedName& tagName, DocumentImpl *doc)
       : StyledElementImpl(tagName, doc)
   {
   }
  @@ -283,7 +283,7 @@
           hasLocalName(headTag) || hasLocalName(styleTag) || hasLocalName(titleTag))
           return 0;
   
  -    DocumentFragmentImpl *fragment = new DocumentFragmentImpl(docPtr());
  +    DocumentFragmentImpl *fragment = new DocumentFragmentImpl(getDocument());
       fragment->ref();
       
       if (getDocument()->isHTMLDocument())
  @@ -390,7 +390,7 @@
       }
   
       removeChildren();
  -    appendChild(new TextImpl(docPtr(), text), exception);
  +    appendChild(new TextImpl(getDocument(), text), exception);
   }
   
   void HTMLElementImpl::setOuterText(const DOMString &text, int &exception)
  @@ -416,7 +416,7 @@
           return;
       }
   
  -    TextImpl *t = new TextImpl(docPtr(), text);
  +    TextImpl *t = new TextImpl(getDocument(), text);
       ref();
       parent->replaceChild(t, this, exception);
       deref();
  
  
  
  1.39      +1 -1      WebCore/khtml/html/html_elementimpl.h
  
  Index: html_elementimpl.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_elementimpl.h,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- html_elementimpl.h	4 Aug 2005 22:45:54 -0000	1.38
  +++ html_elementimpl.h	8 Nov 2005 08:10:58 -0000	1.39
  @@ -38,7 +38,7 @@
   class HTMLElementImpl : public StyledElementImpl
   {
   public:
  -    HTMLElementImpl(const QualifiedName& tagName, DocumentPtr *doc);
  +    HTMLElementImpl(const QualifiedName& tagName, DocumentImpl *doc);
       virtual ~HTMLElementImpl();
   
       virtual bool isHTMLElement() const { return true; }
  
  
  
  1.202     +16 -16    WebCore/khtml/html/html_formimpl.cpp
  
  Index: html_formimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_formimpl.cpp,v
  retrieving revision 1.201
  retrieving revision 1.202
  diff -u -r1.201 -r1.202
  --- html_formimpl.cpp	7 Nov 2005 22:30:20 -0000	1.201
  +++ html_formimpl.cpp	8 Nov 2005 08:10:58 -0000	1.202
  @@ -108,7 +108,7 @@
       QValueList<FormDataListItem> m_list;
   };
   
  -HTMLFormElementImpl::HTMLFormElementImpl(DocumentPtr *doc)
  +HTMLFormElementImpl::HTMLFormElementImpl(DocumentImpl *doc)
       : HTMLElementImpl(formTag, doc)
   {
       collectionInfo = 0;
  @@ -859,7 +859,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLGenericFormElementImpl::HTMLGenericFormElementImpl(const QualifiedName& tagName, DocumentPtr *doc, HTMLFormElementImpl *f)
  +HTMLGenericFormElementImpl::HTMLGenericFormElementImpl(const QualifiedName& tagName, DocumentImpl *doc, HTMLFormElementImpl *f)
       : HTMLElementImpl(tagName, doc)
   {
       m_disabled = m_readOnly = false;
  @@ -1189,7 +1189,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLButtonElementImpl::HTMLButtonElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
  +HTMLButtonElementImpl::HTMLButtonElementImpl(DocumentImpl *doc, HTMLFormElementImpl *f)
       : HTMLGenericFormElementImpl(buttonTag, doc, f)
   {
       m_type = SUBMIT;
  @@ -1319,7 +1319,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLFieldSetElementImpl::HTMLFieldSetElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
  +HTMLFieldSetElementImpl::HTMLFieldSetElementImpl(DocumentImpl *doc, HTMLFormElementImpl *f)
      : HTMLGenericFormElementImpl(fieldsetTag, doc, f)
   {
   }
  @@ -1350,13 +1350,13 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLInputElementImpl::HTMLInputElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
  +HTMLInputElementImpl::HTMLInputElementImpl(DocumentImpl *doc, HTMLFormElementImpl *f)
       : HTMLGenericFormElementImpl(inputTag, doc, f)
   {
       init();
   }
   
  -HTMLInputElementImpl::HTMLInputElementImpl(const QualifiedName& tagName, DocumentPtr *doc, HTMLFormElementImpl *f)
  +HTMLInputElementImpl::HTMLInputElementImpl(const QualifiedName& tagName, DocumentImpl *doc, HTMLFormElementImpl *f)
       : HTMLGenericFormElementImpl(tagName, doc, f)
   {
       init();
  @@ -2619,7 +2619,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLLabelElementImpl::HTMLLabelElementImpl(DocumentPtr *doc)
  +HTMLLabelElementImpl::HTMLLabelElementImpl(DocumentImpl *doc)
       : HTMLElementImpl(labelTag, doc)
   {
   }
  @@ -2710,7 +2710,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLLegendElementImpl::HTMLLegendElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
  +HTMLLegendElementImpl::HTMLLegendElementImpl(DocumentImpl *doc, HTMLFormElementImpl *f)
   : HTMLGenericFormElementImpl(legendTag, doc, f)
   {
   }
  @@ -2791,13 +2791,13 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLSelectElementImpl::HTMLSelectElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
  +HTMLSelectElementImpl::HTMLSelectElementImpl(DocumentImpl *doc, HTMLFormElementImpl *f)
       : HTMLGenericFormElementImpl(selectTag, doc, f), m_options(0)
   {
       init();
   }
   
  -HTMLSelectElementImpl::HTMLSelectElementImpl(const QualifiedName& tagName, DocumentPtr *doc, HTMLFormElementImpl *f)
  +HTMLSelectElementImpl::HTMLSelectElementImpl(const QualifiedName& tagName, DocumentImpl *doc, HTMLFormElementImpl *f)
       : HTMLGenericFormElementImpl(tagName, doc, f), m_options(0)
   {
       init();
  @@ -3281,7 +3281,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLKeygenElementImpl::HTMLKeygenElementImpl(DocumentPtr* doc, HTMLFormElementImpl* f)
  +HTMLKeygenElementImpl::HTMLKeygenElementImpl(DocumentImpl* doc, HTMLFormElementImpl* f)
       : HTMLSelectElementImpl(keygenTag, doc, f)
   {
       QStringList keys = KSSLKeyGen::supportedKeySizes();
  @@ -3340,7 +3340,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLOptGroupElementImpl::HTMLOptGroupElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
  +HTMLOptGroupElementImpl::HTMLOptGroupElementImpl(DocumentImpl *doc, HTMLFormElementImpl *f)
       : HTMLGenericFormElementImpl(optgroupTag, doc, f)
   {
   }
  @@ -3425,7 +3425,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLOptionElementImpl::HTMLOptionElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
  +HTMLOptionElementImpl::HTMLOptionElementImpl(DocumentImpl *doc, HTMLFormElementImpl *f)
       : HTMLGenericFormElementImpl(optionTag, doc, f)
   {
       m_selected = false;
  @@ -3476,7 +3476,7 @@
       }
   
       removeChildren();
  -    appendChild(new TextImpl(docPtr(), text), exception);
  +    appendChild(new TextImpl(getDocument(), text), exception);
   }
   
   int HTMLOptionElementImpl::index() const
  @@ -3574,7 +3574,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLTextAreaElementImpl::HTMLTextAreaElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
  +HTMLTextAreaElementImpl::HTMLTextAreaElementImpl(DocumentImpl *doc, HTMLFormElementImpl *f)
       : HTMLGenericFormElementImpl(textareaTag, doc, f), m_valueIsValid(false), m_valueMatchesRenderer(false)
   {
       // DTD requires rows & cols be specified, but we will provide reasonable defaults
  @@ -3835,7 +3835,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLIsIndexElementImpl::HTMLIsIndexElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
  +HTMLIsIndexElementImpl::HTMLIsIndexElementImpl(DocumentImpl *doc, HTMLFormElementImpl *f)
       : HTMLInputElementImpl(isindexTag, doc, f)
   {
       m_type = TEXT;
  
  
  
  1.94      +15 -15    WebCore/khtml/html/html_formimpl.h
  
  Index: html_formimpl.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_formimpl.h,v
  retrieving revision 1.93
  retrieving revision 1.94
  diff -u -r1.93 -r1.94
  --- html_formimpl.h	7 Nov 2005 22:30:21 -0000	1.93
  +++ html_formimpl.h	8 Nov 2005 08:10:59 -0000	1.94
  @@ -65,7 +65,7 @@
   class HTMLFormElementImpl : public HTMLElementImpl
   {
   public:
  -    HTMLFormElementImpl(DocumentPtr *doc);
  +    HTMLFormElementImpl(DocumentImpl *doc);
       virtual ~HTMLFormElementImpl();
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
  @@ -166,7 +166,7 @@
       friend class khtml::RenderFormElement;
   
   public:
  -    HTMLGenericFormElementImpl(const QualifiedName& tagName, DocumentPtr *doc, HTMLFormElementImpl *f = 0);
  +    HTMLGenericFormElementImpl(const QualifiedName& tagName, DocumentImpl *doc, HTMLFormElementImpl *f = 0);
       virtual ~HTMLGenericFormElementImpl();
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
  @@ -241,7 +241,7 @@
   class HTMLButtonElementImpl : public HTMLGenericFormElementImpl
   {
   public:
  -    HTMLButtonElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);
  +    HTMLButtonElementImpl(DocumentImpl *doc, HTMLFormElementImpl *f = 0);
       virtual ~HTMLButtonElementImpl();
   
       enum typeEnum {
  @@ -286,7 +286,7 @@
   class HTMLFieldSetElementImpl : public HTMLGenericFormElementImpl
   {
   public:
  -    HTMLFieldSetElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);
  +    HTMLFieldSetElementImpl(DocumentImpl *doc, HTMLFormElementImpl *f = 0);
       virtual ~HTMLFieldSetElementImpl();
       
       virtual int tagPriority() const { return 3; }
  @@ -331,8 +331,8 @@
   #endif
       };
   
  -    HTMLInputElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);
  -    HTMLInputElementImpl(const QualifiedName& tagName, DocumentPtr *doc, HTMLFormElementImpl *f = 0);
  +    HTMLInputElementImpl(DocumentImpl *doc, HTMLFormElementImpl *f = 0);
  +    HTMLInputElementImpl(const QualifiedName& tagName, DocumentImpl *doc, HTMLFormElementImpl *f = 0);
       virtual ~HTMLInputElementImpl();
       void init();
   
  @@ -480,7 +480,7 @@
   class HTMLLabelElementImpl : public HTMLElementImpl
   {
   public:
  -    HTMLLabelElementImpl(DocumentPtr *doc);
  +    HTMLLabelElementImpl(DocumentImpl *doc);
       virtual ~HTMLLabelElementImpl();
   
       virtual int tagPriority() const { return 5; }
  @@ -515,7 +515,7 @@
   class HTMLLegendElementImpl : public HTMLGenericFormElementImpl
   {
   public:
  -    HTMLLegendElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);
  +    HTMLLegendElementImpl(DocumentImpl *doc, HTMLFormElementImpl *f = 0);
       virtual ~HTMLLegendElementImpl();
   
       virtual bool isFocusable() const;
  @@ -547,8 +547,8 @@
       friend class khtml::RenderSelect;
   
   public:
  -    HTMLSelectElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);
  -    HTMLSelectElementImpl(const QualifiedName& tagName, DocumentPtr *doc, HTMLFormElementImpl *f = 0);
  +    HTMLSelectElementImpl(DocumentImpl *doc, HTMLFormElementImpl *f = 0);
  +    HTMLSelectElementImpl(const QualifiedName& tagName, DocumentImpl *doc, HTMLFormElementImpl *f = 0);
       ~HTMLSelectElementImpl();
       void init();
   
  @@ -639,7 +639,7 @@
   class HTMLKeygenElementImpl : public HTMLSelectElementImpl
   {
   public:
  -    HTMLKeygenElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);
  +    HTMLKeygenElementImpl(DocumentImpl *doc, HTMLFormElementImpl *f = 0);
   
       virtual int tagPriority() const { return 0; }
   
  @@ -660,7 +660,7 @@
   class HTMLOptGroupElementImpl : public HTMLGenericFormElementImpl
   {
   public:
  -    HTMLOptGroupElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);
  +    HTMLOptGroupElementImpl(DocumentImpl *doc, HTMLFormElementImpl *f = 0);
       virtual ~HTMLOptGroupElementImpl();
   
       virtual bool checkDTD(const NodeImpl* newChild) { return newChild->hasTagName(HTMLNames::optionTag) || newChild->hasTagName(HTMLNames::hrTag); }
  @@ -690,7 +690,7 @@
       friend class DOM::HTMLSelectElementImpl;
   
   public:
  -    HTMLOptionElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);
  +    HTMLOptionElementImpl(DocumentImpl *doc, HTMLFormElementImpl *f = 0);
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
       virtual int tagPriority() const { return 2; }
  @@ -742,7 +742,7 @@
           ta_Physical
       };
   
  -    HTMLTextAreaElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);
  +    HTMLTextAreaElementImpl(DocumentImpl *doc, HTMLFormElementImpl *f = 0);
       ~HTMLTextAreaElementImpl();
   
       virtual bool checkDTD(const NodeImpl* newChild) { return newChild->isTextNode(); }
  @@ -814,7 +814,7 @@
   class HTMLIsIndexElementImpl : public HTMLInputElementImpl
   {
   public:
  -    HTMLIsIndexElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);
  +    HTMLIsIndexElementImpl(DocumentImpl *doc, HTMLFormElementImpl *f = 0);
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
       virtual int tagPriority() const { return 0; }
  
  
  
  1.58      +6 -6      WebCore/khtml/html/html_headimpl.cpp
  
  Index: html_headimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_headimpl.cpp,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- html_headimpl.cpp	3 Oct 2005 21:12:29 -0000	1.57
  +++ html_headimpl.cpp	8 Nov 2005 08:10:59 -0000	1.58
  @@ -46,7 +46,7 @@
   using namespace HTMLNames;
   using namespace khtml;
   
  -HTMLBaseElementImpl::HTMLBaseElementImpl(DocumentPtr *doc)
  +HTMLBaseElementImpl::HTMLBaseElementImpl(DocumentImpl *doc)
       : HTMLElementImpl(baseTag, doc)
   {
   }
  @@ -109,7 +109,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLLinkElementImpl::HTMLLinkElementImpl(DocumentPtr *doc)
  +HTMLLinkElementImpl::HTMLLinkElementImpl(DocumentImpl *doc)
       : HTMLElementImpl(linkTag, doc)
   {
       m_sheet = 0;
  @@ -401,7 +401,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLMetaElementImpl::HTMLMetaElementImpl(DocumentPtr *doc) : HTMLElementImpl(metaTag, doc)
  +HTMLMetaElementImpl::HTMLMetaElementImpl(DocumentImpl *doc) : HTMLElementImpl(metaTag, doc)
   {
   }
   
  @@ -479,7 +479,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLScriptElementImpl::HTMLScriptElementImpl(DocumentPtr *doc)
  +HTMLScriptElementImpl::HTMLScriptElementImpl(DocumentImpl *doc)
       : HTMLElementImpl(scriptTag, doc), m_cachedScript(0), m_createdByParser(false), m_evaluated(false)
   {
   }
  @@ -660,7 +660,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLStyleElementImpl::HTMLStyleElementImpl(DocumentPtr *doc) : HTMLElementImpl(styleTag, doc)
  +HTMLStyleElementImpl::HTMLStyleElementImpl(DocumentImpl *doc) : HTMLElementImpl(styleTag, doc)
   {
       m_sheet = 0;
       m_loading = false;
  @@ -776,7 +776,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLTitleElementImpl::HTMLTitleElementImpl(DocumentPtr *doc)
  +HTMLTitleElementImpl::HTMLTitleElementImpl(DocumentImpl *doc)
       : HTMLElementImpl(titleTag, doc), m_title("")
   {
   }
  
  
  
  1.22      +6 -6      WebCore/khtml/html/html_headimpl.h
  
  Index: html_headimpl.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_headimpl.h,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- html_headimpl.h	9 Jul 2005 20:19:10 -0000	1.21
  +++ html_headimpl.h	8 Nov 2005 08:10:59 -0000	1.22
  @@ -46,7 +46,7 @@
   class HTMLBaseElementImpl : public HTMLElementImpl
   {
   public:
  -    HTMLBaseElementImpl(DocumentPtr *doc);
  +    HTMLBaseElementImpl(DocumentImpl *doc);
       ~HTMLBaseElementImpl();
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
  @@ -76,7 +76,7 @@
   class HTMLLinkElementImpl : public khtml::CachedObjectClient, public HTMLElementImpl
   {
   public:
  -    HTMLLinkElementImpl(DocumentPtr *doc);
  +    HTMLLinkElementImpl(DocumentImpl *doc);
       ~HTMLLinkElementImpl();
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
  @@ -154,7 +154,7 @@
   class HTMLMetaElementImpl : public HTMLElementImpl
   {
   public:
  -    HTMLMetaElementImpl(DocumentPtr *doc);
  +    HTMLMetaElementImpl(DocumentImpl *doc);
       ~HTMLMetaElementImpl();
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
  @@ -187,7 +187,7 @@
   class HTMLScriptElementImpl : public HTMLElementImpl, public khtml::CachedObjectClient
   {
   public:
  -    HTMLScriptElementImpl(DocumentPtr *doc);
  +    HTMLScriptElementImpl(DocumentImpl *doc);
       ~HTMLScriptElementImpl();
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
  @@ -238,7 +238,7 @@
   class HTMLStyleElementImpl : public HTMLElementImpl
   {
   public:
  -    HTMLStyleElementImpl(DocumentPtr *doc);
  +    HTMLStyleElementImpl(DocumentImpl *doc);
       ~HTMLStyleElementImpl();
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
  @@ -277,7 +277,7 @@
   class HTMLTitleElementImpl : public HTMLElementImpl
   {
   public:
  -    HTMLTitleElementImpl(DocumentPtr *doc);
  +    HTMLTitleElementImpl(DocumentImpl *doc);
       ~HTMLTitleElementImpl();
   
       virtual bool checkDTD(const NodeImpl* newChild) { return newChild->isTextNode(); }
  
  
  
  1.54      +4 -4      WebCore/khtml/html/html_imageimpl.cpp
  
  Index: html_imageimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_imageimpl.cpp,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- html_imageimpl.cpp	6 Oct 2005 04:13:12 -0000	1.53
  +++ html_imageimpl.cpp	8 Nov 2005 08:10:59 -0000	1.54
  @@ -139,14 +139,14 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLImageElementImpl::HTMLImageElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
  +HTMLImageElementImpl::HTMLImageElementImpl(DocumentImpl *doc, HTMLFormElementImpl *f)
       : HTMLElementImpl(imgTag, doc), m_imageLoader(this), ismap(false), m_form(f)
   {
       if (m_form)
           m_form->registerImgElement(this);
   }
   
  -HTMLImageElementImpl::HTMLImageElementImpl(const QualifiedName& tagName, DocumentPtr *doc)
  +HTMLImageElementImpl::HTMLImageElementImpl(const QualifiedName& tagName, DocumentImpl *doc)
       : HTMLElementImpl(tagName, doc), m_imageLoader(this), ismap(false), m_form(0)
   {
   }
  @@ -493,7 +493,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLMapElementImpl::HTMLMapElementImpl(DocumentPtr *doc)
  +HTMLMapElementImpl::HTMLMapElementImpl(DocumentImpl *doc)
       : HTMLElementImpl(mapTag, doc)
   {
   }
  @@ -582,7 +582,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLAreaElementImpl::HTMLAreaElementImpl(DocumentPtr *doc)
  +HTMLAreaElementImpl::HTMLAreaElementImpl(DocumentImpl *doc)
       : HTMLAnchorElementImpl(areaTag, doc)
   {
       m_coords=0;
  
  
  
  1.27      +4 -4      WebCore/khtml/html/html_imageimpl.h
  
  Index: html_imageimpl.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_imageimpl.h,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- html_imageimpl.h	27 Sep 2005 22:37:17 -0000	1.26
  +++ html_imageimpl.h	8 Nov 2005 08:10:59 -0000	1.27
  @@ -74,8 +74,8 @@
   {
       friend class HTMLFormElementImpl;
   public:
  -    HTMLImageElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);
  -    HTMLImageElementImpl(const QualifiedName& tagName, DocumentPtr* doc);
  +    HTMLImageElementImpl(DocumentImpl *doc, HTMLFormElementImpl *f = 0);
  +    HTMLImageElementImpl(const QualifiedName& tagName, DocumentImpl* doc);
       ~HTMLImageElementImpl();
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
  @@ -160,7 +160,7 @@
   
       enum Shape { Default, Poly, Rect, Circle, Unknown };
   
  -    HTMLAreaElementImpl(DocumentPtr *doc);
  +    HTMLAreaElementImpl(DocumentImpl *doc);
       ~HTMLAreaElementImpl();
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
  @@ -214,7 +214,7 @@
   class HTMLMapElementImpl : public HTMLElementImpl
   {
   public:
  -    HTMLMapElementImpl(DocumentPtr *doc);
  +    HTMLMapElementImpl(DocumentImpl *doc);
       ~HTMLMapElementImpl();
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
  
  
  
  1.53      +6 -6      WebCore/khtml/html/html_inlineimpl.cpp
  
  Index: html_inlineimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_inlineimpl.cpp,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- html_inlineimpl.cpp	3 Oct 2005 21:12:29 -0000	1.52
  +++ html_inlineimpl.cpp	8 Nov 2005 08:10:59 -0000	1.53
  @@ -48,13 +48,13 @@
   using namespace EventNames;
   using namespace HTMLNames;
   
  -HTMLAnchorElementImpl::HTMLAnchorElementImpl(DocumentPtr *doc)
  +HTMLAnchorElementImpl::HTMLAnchorElementImpl(DocumentImpl *doc)
       : HTMLElementImpl(aTag, doc)
   {
       m_hasTarget = false;
   }
   
  -HTMLAnchorElementImpl::HTMLAnchorElementImpl(const QualifiedName& tagName, DocumentPtr *doc)
  +HTMLAnchorElementImpl::HTMLAnchorElementImpl(const QualifiedName& tagName, DocumentImpl *doc)
       : HTMLElementImpl(tagName, doc)
   {
       m_hasTarget = false;
  @@ -382,7 +382,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLBRElementImpl::HTMLBRElementImpl(DocumentPtr *doc) : HTMLElementImpl(brTag, doc)
  +HTMLBRElementImpl::HTMLBRElementImpl(DocumentImpl *doc) : HTMLElementImpl(brTag, doc)
   {
   }
   
  @@ -433,7 +433,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLFontElementImpl::HTMLFontElementImpl(DocumentPtr *doc)
  +HTMLFontElementImpl::HTMLFontElementImpl(DocumentImpl *doc)
       : HTMLElementImpl(fontTag, doc)
   {
   }
  @@ -562,7 +562,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLModElementImpl::HTMLModElementImpl(const QualifiedName& tagName, DocumentPtr *doc)
  +HTMLModElementImpl::HTMLModElementImpl(const QualifiedName& tagName, DocumentImpl *doc)
       : HTMLElementImpl(tagName, doc)
   {
   }
  @@ -589,7 +589,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLQuoteElementImpl::HTMLQuoteElementImpl(DocumentPtr *doc)
  +HTMLQuoteElementImpl::HTMLQuoteElementImpl(DocumentImpl *doc)
       : HTMLElementImpl(qTag, doc)
   {
   }
  
  
  
  1.23      +6 -6      WebCore/khtml/html/html_inlineimpl.h
  
  Index: html_inlineimpl.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_inlineimpl.h,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- html_inlineimpl.h	16 Sep 2005 22:42:11 -0000	1.22
  +++ html_inlineimpl.h	8 Nov 2005 08:11:00 -0000	1.23
  @@ -33,8 +33,8 @@
   class HTMLAnchorElementImpl : public HTMLElementImpl
   {
   public:
  -    HTMLAnchorElementImpl(DocumentPtr *doc);
  -    HTMLAnchorElementImpl(const QualifiedName& tagName, DocumentPtr* doc);
  +    HTMLAnchorElementImpl(DocumentImpl *doc);
  +    HTMLAnchorElementImpl(const QualifiedName& tagName, DocumentImpl* doc);
       ~HTMLAnchorElementImpl();
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
  @@ -98,7 +98,7 @@
   class HTMLBRElementImpl : public HTMLElementImpl
   {
   public:
  -    HTMLBRElementImpl(DocumentPtr *doc);
  +    HTMLBRElementImpl(DocumentImpl *doc);
       ~HTMLBRElementImpl();
       
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
  @@ -118,7 +118,7 @@
   class HTMLFontElementImpl : public HTMLElementImpl
   {
   public:
  -    HTMLFontElementImpl(DocumentPtr *doc);
  +    HTMLFontElementImpl(DocumentImpl *doc);
       ~HTMLFontElementImpl();
       
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
  @@ -142,7 +142,7 @@
   class HTMLModElementImpl : public HTMLElementImpl
   {
   public:
  -    HTMLModElementImpl(const QualifiedName& tagName, DocumentPtr *doc);
  +    HTMLModElementImpl(const QualifiedName& tagName, DocumentImpl *doc);
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
       virtual int tagPriority() const { return 1; }
  @@ -159,7 +159,7 @@
   class HTMLQuoteElementImpl : public HTMLElementImpl
   {
   public:
  -    HTMLQuoteElementImpl(DocumentPtr *doc);
  +    HTMLQuoteElementImpl(DocumentImpl *doc);
       
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
       virtual int tagPriority() const { return 1; }
  
  
  
  1.14      +6 -6      WebCore/khtml/html/html_listimpl.h
  
  Index: html_listimpl.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_listimpl.h,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- html_listimpl.h	16 Sep 2005 22:42:12 -0000	1.13
  +++ html_listimpl.h	8 Nov 2005 08:11:00 -0000	1.14
  @@ -36,7 +36,7 @@
   class HTMLUListElementImpl : public HTMLElementImpl
   {
   public:
  -    HTMLUListElementImpl(DocumentPtr *doc) : HTMLElementImpl(HTMLNames::ulTag, doc) {}
  +    HTMLUListElementImpl(DocumentImpl *doc) : HTMLElementImpl(HTMLNames::ulTag, doc) {}
       virtual ~HTMLUListElementImpl() {}
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
  @@ -59,7 +59,7 @@
   class HTMLDirectoryElementImpl : public HTMLElementImpl
   {
   public:
  -    HTMLDirectoryElementImpl(DocumentPtr *doc) : HTMLElementImpl(HTMLNames::dirTag, doc) {}
  +    HTMLDirectoryElementImpl(DocumentImpl *doc) : HTMLElementImpl(HTMLNames::dirTag, doc) {}
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
       virtual int tagPriority() const { return 5; }
  @@ -73,7 +73,7 @@
   class HTMLMenuElementImpl : public HTMLElementImpl
   {
   public:
  -    HTMLMenuElementImpl(DocumentPtr *doc) : HTMLElementImpl(HTMLNames::menuTag, doc) {}
  +    HTMLMenuElementImpl(DocumentImpl *doc) : HTMLElementImpl(HTMLNames::menuTag, doc) {}
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
       virtual int tagPriority() const { return 5; }
  @@ -87,7 +87,7 @@
   class HTMLOListElementImpl : public HTMLElementImpl
   {
   public:
  -    HTMLOListElementImpl(DocumentPtr *doc)
  +    HTMLOListElementImpl(DocumentImpl *doc)
           : HTMLElementImpl(HTMLNames::olTag, doc) { _start = 1; }
       
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
  @@ -114,7 +114,7 @@
   class HTMLLIElementImpl : public HTMLElementImpl
   {
   public:
  -    HTMLLIElementImpl(DocumentPtr *doc)
  +    HTMLLIElementImpl(DocumentImpl *doc)
           : HTMLElementImpl(HTMLNames::liTag, doc) { isValued = false; }
       virtual ~HTMLLIElementImpl() {}
   
  @@ -142,7 +142,7 @@
   class HTMLDListElementImpl : public HTMLElementImpl
   {
   public:
  -    HTMLDListElementImpl(DocumentPtr *doc) : HTMLElementImpl(HTMLNames::dlTag, doc) {}
  +    HTMLDListElementImpl(DocumentImpl *doc) : HTMLElementImpl(HTMLNames::dlTag, doc) {}
       virtual ~HTMLDListElementImpl() {}
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
  
  
  
  1.39      +1 -1      WebCore/khtml/html/html_miscimpl.cpp
  
  Index: html_miscimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_miscimpl.cpp,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- html_miscimpl.cpp	24 Oct 2005 21:42:15 -0000	1.38
  +++ html_miscimpl.cpp	8 Nov 2005 08:11:00 -0000	1.39
  @@ -37,7 +37,7 @@
   
   using namespace HTMLNames;
   
  -HTMLBaseFontElementImpl::HTMLBaseFontElementImpl(DocumentPtr *doc)
  +HTMLBaseFontElementImpl::HTMLBaseFontElementImpl(DocumentImpl *doc)
       : HTMLElementImpl(basefontTag, doc)
   {
   }
  
  
  
  1.23      +1 -1      WebCore/khtml/html/html_miscimpl.h
  
  Index: html_miscimpl.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_miscimpl.h,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- html_miscimpl.h	16 Sep 2005 22:42:12 -0000	1.22
  +++ html_miscimpl.h	8 Nov 2005 08:11:00 -0000	1.23
  @@ -37,7 +37,7 @@
   class HTMLBaseFontElementImpl : public HTMLElementImpl
   {
   public:
  -    HTMLBaseFontElementImpl(DocumentPtr *doc);
  +    HTMLBaseFontElementImpl(DocumentImpl *doc);
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
       virtual int tagPriority() const { return 0; }
  
  
  
  1.88      +4 -4      WebCore/khtml/html/html_objectimpl.cpp
  
  Index: html_objectimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_objectimpl.cpp,v
  retrieving revision 1.87
  retrieving revision 1.88
  diff -u -r1.87 -r1.88
  --- html_objectimpl.cpp	1 Nov 2005 18:36:28 -0000	1.87
  +++ html_objectimpl.cpp	8 Nov 2005 08:11:00 -0000	1.88
  @@ -63,7 +63,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLAppletElementImpl::HTMLAppletElementImpl(DocumentPtr *doc)
  +HTMLAppletElementImpl::HTMLAppletElementImpl(DocumentImpl *doc)
     : HTMLElementImpl(appletTag, doc)
   {
       appletInstance = 0;
  @@ -389,7 +389,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLEmbedElementImpl::HTMLEmbedElementImpl(DocumentPtr *doc)
  +HTMLEmbedElementImpl::HTMLEmbedElementImpl(DocumentImpl *doc)
       : HTMLElementImpl(embedTag, doc), embedInstance(0)
   {}
   
  @@ -553,7 +553,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLObjectElementImpl::HTMLObjectElementImpl(DocumentPtr *doc) 
  +HTMLObjectElementImpl::HTMLObjectElementImpl(DocumentImpl *doc) 
   #if APPLE_CHANGES
   : HTMLElementImpl(objectTag, doc), m_imageLoader(0), objectInstance(0)
   #else
  @@ -1082,7 +1082,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLParamElementImpl::HTMLParamElementImpl(DocumentPtr *doc)
  +HTMLParamElementImpl::HTMLParamElementImpl(DocumentImpl *doc)
       : HTMLElementImpl(paramTag, doc)
   {
   }
  
  
  
  1.39      +4 -4      WebCore/khtml/html/html_objectimpl.h
  
  Index: html_objectimpl.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_objectimpl.h,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- html_objectimpl.h	1 Nov 2005 18:36:28 -0000	1.38
  +++ html_objectimpl.h	8 Nov 2005 08:11:01 -0000	1.39
  @@ -41,7 +41,7 @@
   class HTMLAppletElementImpl : public HTMLElementImpl
   {
   public:
  -    HTMLAppletElementImpl(DocumentPtr *doc);
  +    HTMLAppletElementImpl(DocumentImpl *doc);
       ~HTMLAppletElementImpl();
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
  @@ -117,7 +117,7 @@
   class HTMLEmbedElementImpl : public HTMLElementImpl
   {
   public:
  -    HTMLEmbedElementImpl(DocumentPtr *doc);
  +    HTMLEmbedElementImpl(DocumentImpl *doc);
       ~HTMLEmbedElementImpl();
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
  @@ -155,7 +155,7 @@
   class HTMLObjectElementImpl : public HTMLElementImpl
   {
   public:
  -    HTMLObjectElementImpl(DocumentPtr *doc);
  +    HTMLObjectElementImpl(DocumentImpl *doc);
       ~HTMLObjectElementImpl();
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
  @@ -269,7 +269,7 @@
   {
       friend class HTMLAppletElementImpl;
   public:
  -    HTMLParamElementImpl(DocumentPtr *doc);
  +    HTMLParamElementImpl(DocumentImpl *doc);
       ~HTMLParamElementImpl();
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
  
  
  
  1.67      +10 -10    WebCore/khtml/html/html_tableimpl.cpp
  
  Index: html_tableimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_tableimpl.cpp,v
  retrieving revision 1.66
  retrieving revision 1.67
  diff -u -r1.66 -r1.67
  --- html_tableimpl.cpp	3 Oct 2005 21:12:30 -0000	1.66
  +++ html_tableimpl.cpp	8 Nov 2005 08:11:01 -0000	1.67
  @@ -52,7 +52,7 @@
   
   using namespace HTMLNames;
   
  -HTMLTableElementImpl::HTMLTableElementImpl(DocumentPtr *doc)
  +HTMLTableElementImpl::HTMLTableElementImpl(DocumentImpl *doc)
     : HTMLElementImpl(tableTag, doc)
   {
       tCaption = 0;
  @@ -157,7 +157,7 @@
       if(!head)
       {
           int exceptioncode = 0;
  -        head = new HTMLTableSectionElementImpl(theadTag, docPtr(), true /* implicit */);
  +        head = new HTMLTableSectionElementImpl(theadTag, getDocument(), true /* implicit */);
           if(foot)
               insertBefore( head, foot, exceptioncode );
           else if(firstBody)
  @@ -184,7 +184,7 @@
       if(!foot)
       {
           int exceptioncode = 0;
  -        foot = new HTMLTableSectionElementImpl(tfootTag, docPtr(), true /*implicit */);
  +        foot = new HTMLTableSectionElementImpl(tfootTag, getDocument(), true /*implicit */);
           if(firstBody)
               insertBefore( foot, firstBody, exceptioncode );
           else
  @@ -209,7 +209,7 @@
       if(!tCaption)
       {
           int exceptioncode = 0;
  -        tCaption = new HTMLTableCaptionElementImpl(docPtr());
  +        tCaption = new HTMLTableCaptionElementImpl(getDocument());
           insertBefore( tCaption, firstChild(), exceptioncode );
       }
       return tCaption;
  @@ -233,7 +233,7 @@
       // (note: this is different from "if the table has no sections", since we can have
       // <TABLE><TR>)
       if(!firstBody && !head && !foot)
  -        setTBody( new HTMLTableSectionElementImpl(tbodyTag, docPtr(), true /* implicit */) );
  +        setTBody( new HTMLTableSectionElementImpl(tbodyTag, getDocument(), true /* implicit */) );
   
       //kdDebug(6030) << k_funcinfo << index << endl;
       // IE treats index=-1 as default value meaning 'append after last'
  @@ -780,7 +780,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLTableSectionElementImpl::HTMLTableSectionElementImpl(const QualifiedName& tagName, DocumentPtr *doc, bool implicit)
  +HTMLTableSectionElementImpl::HTMLTableSectionElementImpl(const QualifiedName& tagName, DocumentImpl *doc, bool implicit)
       : HTMLTablePartElementImpl(tagName, doc)
   {
       m_implicit = implicit;
  @@ -821,7 +821,7 @@
       }
       else
       {
  -        r = new HTMLTableRowElementImpl(docPtr());
  +        r = new HTMLTableRowElementImpl(getDocument());
           if ( numRows == index || index == -1 )
               appendChild(r, exceptioncode);
           else {
  @@ -992,7 +992,7 @@
           exceptioncode = DOMException::INDEX_SIZE_ERR; // per the DOM
       else
       {
  -        c = new HTMLTableCellElementImpl(tdTag, docPtr());
  +        c = new HTMLTableCellElementImpl(tdTag, getDocument());
           if(numCells == index || index == -1)
               appendChild(c, exceptioncode);
           else {
  @@ -1083,7 +1083,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLTableCellElementImpl::HTMLTableCellElementImpl(const QualifiedName& tagName, DocumentPtr *doc)
  +HTMLTableCellElementImpl::HTMLTableCellElementImpl(const QualifiedName& tagName, DocumentImpl *doc)
     : HTMLTablePartElementImpl(tagName, doc)
   {
       _col = -1;
  @@ -1307,7 +1307,7 @@
   
   // -------------------------------------------------------------------------
   
  -HTMLTableColElementImpl::HTMLTableColElementImpl(const QualifiedName& tagName, DocumentPtr *doc)
  +HTMLTableColElementImpl::HTMLTableColElementImpl(const QualifiedName& tagName, DocumentImpl *doc)
       : HTMLTablePartElementImpl(tagName, doc)
   {
       _span = (tagName.matches(colgroupTag) ? 0 : 1);
  
  
  
  1.29      +7 -7      WebCore/khtml/html/html_tableimpl.h
  
  Index: html_tableimpl.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_tableimpl.h,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- html_tableimpl.h	27 Sep 2005 22:37:17 -0000	1.28
  +++ html_tableimpl.h	8 Nov 2005 08:11:01 -0000	1.29
  @@ -59,7 +59,7 @@
           Box    = 0x0f
       };
   
  -    HTMLTableElementImpl(DocumentPtr *doc);
  +    HTMLTableElementImpl(DocumentImpl *doc);
       ~HTMLTableElementImpl();
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
  @@ -150,7 +150,7 @@
   
   {
   public:
  -    HTMLTablePartElementImpl(const QualifiedName& tagName, DocumentPtr *doc)
  +    HTMLTablePartElementImpl(const QualifiedName& tagName, DocumentImpl *doc)
           : HTMLElementImpl(tagName, doc)
           { }
   
  @@ -163,7 +163,7 @@
   class HTMLTableSectionElementImpl : public HTMLTablePartElementImpl
   {
   public:
  -    HTMLTableSectionElementImpl(const QualifiedName& tagName, DocumentPtr *doc, bool implicit);
  +    HTMLTableSectionElementImpl(const QualifiedName& tagName, DocumentImpl *doc, bool implicit);
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
       virtual int tagPriority() const { return 8; }
  @@ -196,7 +196,7 @@
   class HTMLTableRowElementImpl : public HTMLTablePartElementImpl
   {
   public:
  -    HTMLTableRowElementImpl(DocumentPtr *doc)
  +    HTMLTableRowElementImpl(DocumentImpl *doc)
           : HTMLTablePartElementImpl(HTMLNames::trTag, doc) {}
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
  @@ -242,7 +242,7 @@
   class HTMLTableCellElementImpl : public HTMLTablePartElementImpl
   {
   public:
  -    HTMLTableCellElementImpl(const QualifiedName& tagName, DocumentPtr *doc);
  +    HTMLTableCellElementImpl(const QualifiedName& tagName, DocumentImpl *doc);
       ~HTMLTableCellElementImpl();
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
  @@ -322,7 +322,7 @@
   class HTMLTableColElementImpl : public HTMLTablePartElementImpl
   {
   public:
  -    HTMLTableColElementImpl(const QualifiedName& tagName, DocumentPtr *doc);
  +    HTMLTableColElementImpl(const QualifiedName& tagName, DocumentImpl *doc);
   
       virtual HTMLTagStatus endTagRequirement() const { return hasLocalName(HTMLNames::colTag) ? TagStatusForbidden : TagStatusOptional; }
       virtual int tagPriority() const { return hasLocalName(HTMLNames::colTag) ? 0 : 1; }
  @@ -362,7 +362,7 @@
   class HTMLTableCaptionElementImpl : public HTMLTablePartElementImpl
   {
   public:
  -    HTMLTableCaptionElementImpl(DocumentPtr *doc)
  +    HTMLTableCaptionElementImpl(DocumentImpl *doc)
           : HTMLTablePartElementImpl(HTMLNames::captionTag, doc) {}
   
       virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
  
  
  
  1.10      +58 -58    WebCore/khtml/html/htmlfactory.cpp
  
  Index: htmlfactory.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/htmlfactory.cpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- htmlfactory.cpp	1 Nov 2005 18:36:28 -0000	1.9
  +++ htmlfactory.cpp	8 Nov 2005 08:11:01 -0000	1.10
  @@ -43,290 +43,290 @@
   
   using namespace HTMLNames;
   
  -typedef HTMLElementImpl* (*ConstructorFunc)(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser);
  +typedef HTMLElementImpl* (*ConstructorFunc)(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser);
   typedef HashMap<DOMStringImpl *, void*, PointerHash<DOMStringImpl *> > FunctionMap;
   static FunctionMap* gFunctionMap;
   
  -HTMLElementImpl* htmlConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* htmlConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLHtmlElementImpl(docPtr);
   }
   
  -HTMLElementImpl* headConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* headConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLHeadElementImpl(docPtr);
   }
   
  -HTMLElementImpl* bodyConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* bodyConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLBodyElementImpl(docPtr);
   }
   
  -HTMLElementImpl* baseConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* baseConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLBaseElementImpl(docPtr);
   }
   
  -HTMLElementImpl* linkConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* linkConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLLinkElementImpl(docPtr);
   }
   
  -HTMLElementImpl* metaConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* metaConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLMetaElementImpl(docPtr);
   }
   
  -HTMLElementImpl* styleConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* styleConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLStyleElementImpl(docPtr);
   }
   
  -HTMLElementImpl* titleConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* titleConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLTitleElementImpl(docPtr);
   }
   
  -HTMLElementImpl* frameConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* frameConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLFrameElementImpl(docPtr);
   }
   
  -HTMLElementImpl* framesetConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* framesetConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLFrameSetElementImpl(docPtr);
   }
   
  -HTMLElementImpl* iframeConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* iframeConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLIFrameElementImpl(docPtr);
   }
   
  -HTMLElementImpl* formConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* formConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLFormElementImpl(docPtr);
   }
   
  -HTMLElementImpl* buttonConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* buttonConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLButtonElementImpl(docPtr, form);
   }
   
  -HTMLElementImpl* inputConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* inputConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLInputElementImpl(docPtr, form);
   }
   
  -HTMLElementImpl* isindexConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* isindexConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLIsIndexElementImpl(docPtr, form);
   }
   
  -HTMLElementImpl* fieldsetConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* fieldsetConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLFieldSetElementImpl(docPtr, form);
   }
   
  -HTMLElementImpl* labelConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* labelConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLLabelElementImpl(docPtr);
   }
   
  -HTMLElementImpl* legendConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* legendConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLLegendElementImpl(docPtr, form);
   }
   
  -HTMLElementImpl* optgroupConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* optgroupConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLOptGroupElementImpl(docPtr, form);
   }
   
  -HTMLElementImpl* optionConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* optionConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLOptionElementImpl(docPtr, form);
   }
   
  -HTMLElementImpl* selectConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* selectConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLSelectElementImpl(docPtr, form);
   }
   
  -HTMLElementImpl* textareaConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* textareaConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLTextAreaElementImpl(docPtr, form);
   }
   
  -HTMLElementImpl* dlConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* dlConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLDListElementImpl(docPtr);
   }
   
  -HTMLElementImpl* ulConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* ulConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLUListElementImpl(docPtr);
   }
   
  -HTMLElementImpl* olConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* olConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLOListElementImpl(docPtr);
   }
   
  -HTMLElementImpl* dirConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* dirConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLDirectoryElementImpl(docPtr);
   }
   
  -HTMLElementImpl* menuConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* menuConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLMenuElementImpl(docPtr);
   }
   
  -HTMLElementImpl* liConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* liConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLLIElementImpl(docPtr);
   }
   
  -HTMLElementImpl* blockquoteConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* blockquoteConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLBlockquoteElementImpl(docPtr);
   }
   
  -HTMLElementImpl* divConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* divConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLDivElementImpl(docPtr);
   }
   
  -HTMLElementImpl* headingConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* headingConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLHeadingElementImpl(QualifiedName(nullAtom, tagName, xhtmlNamespaceURI), docPtr);
   }
   
  -HTMLElementImpl* hrConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* hrConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLHRElementImpl(docPtr);
   }
   
  -HTMLElementImpl* paragraphConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* paragraphConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLParagraphElementImpl(docPtr);
   }
   
  -HTMLElementImpl* preConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* preConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLPreElementImpl(QualifiedName(nullAtom, tagName, xhtmlNamespaceURI), docPtr);
   }
   
  -HTMLElementImpl* basefontConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* basefontConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLBaseFontElementImpl(docPtr);
   }
   
  -HTMLElementImpl* fontConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* fontConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLFontElementImpl(docPtr);
   }
   
  -HTMLElementImpl* modConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* modConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLModElementImpl(QualifiedName(nullAtom, tagName, xhtmlNamespaceURI), docPtr);
   }
   
  -HTMLElementImpl* anchorConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* anchorConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLAnchorElementImpl(docPtr);
   }
   
  -HTMLElementImpl* imageConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* imageConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLImageElementImpl(docPtr, form);
   }
   
  -HTMLElementImpl* mapConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* mapConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLMapElementImpl(docPtr);
   }
   
  -HTMLElementImpl* areaConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* areaConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLAreaElementImpl(docPtr);
   }
   
  -HTMLElementImpl* canvasConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* canvasConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLCanvasElementImpl(docPtr);
   }
   
  -HTMLElementImpl* appletConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* appletConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLAppletElementImpl(docPtr);
   }
   
  -HTMLElementImpl* embedConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* embedConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLEmbedElementImpl(docPtr);
   }
   
  -HTMLElementImpl* objectConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* objectConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       HTMLObjectElementImpl * object = new HTMLObjectElementImpl(docPtr);
       object->setComplete(!createdByParser);
       return object;
   }
   
  -HTMLElementImpl* paramConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* paramConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLParamElementImpl(docPtr);
   }
   
  -HTMLElementImpl* scriptConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* scriptConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       HTMLScriptElementImpl* script = new HTMLScriptElementImpl(docPtr);
       script->setCreatedByParser(createdByParser);
       return script;
   }
   
  -HTMLElementImpl* tableConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* tableConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLTableElementImpl(docPtr);
   }
   
  -HTMLElementImpl* tableCaptionConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* tableCaptionConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLTableCaptionElementImpl(docPtr);
   }
   
  -HTMLElementImpl* tableColConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* tableColConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLTableColElementImpl(QualifiedName(nullAtom, tagName, xhtmlNamespaceURI), docPtr);
   }
   
  -HTMLElementImpl* tableRowConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* tableRowConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLTableRowElementImpl(docPtr);
   }
   
  -HTMLElementImpl* tableCellConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* tableCellConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLTableCellElementImpl(QualifiedName(nullAtom, tagName, xhtmlNamespaceURI), docPtr);
   }
   
  -HTMLElementImpl* tableSectionConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* tableSectionConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLTableSectionElementImpl(QualifiedName(nullAtom, tagName, xhtmlNamespaceURI), docPtr, false);
   }
   
  -HTMLElementImpl* brConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* brConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLBRElementImpl(docPtr);
   }
   
  -HTMLElementImpl* quoteConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* quoteConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLQuoteElementImpl(docPtr);
   }
   
  -HTMLElementImpl* marqueeConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
  +HTMLElementImpl* marqueeConstructor(const AtomicString& tagName, DocumentImpl* docPtr, HTMLFormElementImpl* form, bool createdByParser)
   {
       return new HTMLMarqueeElementImpl(docPtr);
   }
  @@ -336,7 +336,7 @@
       if (!doc)
           return 0; // Don't allow elements to ever be made without having a doc.
   
  -    DocumentPtr* docPtr = doc->docPtr();
  +    DocumentImpl* docPtr = doc;
       if (!gFunctionMap) {
           // Create the table.
           gFunctionMap = new FunctionMap;
  
  
  
  1.121     +2 -6      WebCore/khtml/html/htmlparser.cpp
  
  Index: htmlparser.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/htmlparser.cpp,v
  retrieving revision 1.120
  retrieving revision 1.121
  diff -u -r1.120 -r1.121
  --- htmlparser.cpp	16 Oct 2005 03:36:06 -0000	1.120
  +++ htmlparser.cpp	8 Nov 2005 08:11:02 -0000	1.121
  @@ -117,24 +117,22 @@
    *    element or ignore the tag.
    *
    */
  -HTMLParser::HTMLParser(KHTMLView *_parent, DocumentPtr *doc, bool includesComments) 
  +HTMLParser::HTMLParser(KHTMLView *_parent, DocumentImpl *doc, bool includesComments) 
       : current(0), currentIsReferenced(false), includesCommentsInDOM(includesComments)
   {
       HTMLWidget    = _parent;
       document      = doc;
  -    document->ref();
   
       blockStack = 0;
   
       reset();
   }
   
  -HTMLParser::HTMLParser(DOM::DocumentFragmentImpl *i, DocumentPtr *doc, bool includesComments)
  +HTMLParser::HTMLParser(DOM::DocumentFragmentImpl *i, DocumentImpl *doc, bool includesComments)
       : current(0), currentIsReferenced(false), includesCommentsInDOM(includesComments)
   {
       HTMLWidget = 0;
       document = doc;
  -    document->ref();
   
       blockStack = 0;
   
  @@ -149,8 +147,6 @@
   
       setCurrent(0);
   
  -    document->deref();
  -
       if (isindex)
           isindex->deref();
   }
  
  
  
  1.30      +4 -6      WebCore/khtml/html/htmlparser.h
  
  Index: htmlparser.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/htmlparser.h,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- htmlparser.h	10 Sep 2005 21:03:44 -0000	1.29
  +++ htmlparser.h	8 Nov 2005 08:11:02 -0000	1.30
  @@ -36,7 +36,6 @@
   
   namespace DOM {
       class HTMLDocumentImpl;
  -    class DocumentPtr;
       class HTMLElementImpl;
       class NodeImpl;
       class HTMLFormElementImpl;
  @@ -56,8 +55,8 @@
   class HTMLParser
   {
   public:
  -    HTMLParser(KHTMLView *w, DOM::DocumentPtr *i, bool includesComments=false);
  -    HTMLParser(DOM::DocumentFragmentImpl *frag, DOM::DocumentPtr *doc, bool includesComments=false);
  +    HTMLParser(KHTMLView *w, DOM::DocumentImpl *i, bool includesComments=false);
  +    HTMLParser(DOM::DocumentFragmentImpl *frag, DOM::DocumentImpl *doc, bool includesComments=false);
       virtual ~HTMLParser();
   
       /**
  @@ -79,15 +78,14 @@
       bool noSpaces() const { return !inBody; }
       bool selectMode() const { return inSelect; }
   
  -    DOM::HTMLDocumentImpl *doc() const { return static_cast<DOM::HTMLDocumentImpl *>(document->document()); }
  -    DOM::DocumentPtr *docPtr() const { return document; }
  +    DOM::HTMLDocumentImpl *doc() const { return static_cast<DOM::HTMLDocumentImpl *>(document); }
   
   protected:
       void setCurrent(DOM::NodeImpl* newCurrent);
       void setSkipMode(const DOM::QualifiedName& qName) { discard_until = qName.localName(); }
   
       KHTMLView *HTMLWidget;
  -    DOM::DocumentPtr *document;
  +    DOM::DocumentImpl *document;
   
       /*
        * generate a node from the token
  
  
  
  1.125     +7 -7      WebCore/khtml/html/htmltokenizer.cpp
  
  Index: htmltokenizer.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/htmltokenizer.cpp,v
  retrieving revision 1.124
  retrieving revision 1.125
  diff -u -r1.124 -r1.125
  --- htmltokenizer.cpp	27 Oct 2005 06:03:31 -0000	1.124
  +++ htmltokenizer.cpp	8 Nov 2005 08:11:02 -0000	1.125
  @@ -157,7 +157,7 @@
   
   // ----------------------------------------------------------------------------
   
  -HTMLTokenizer::HTMLTokenizer(DOM::DocumentPtr *_doc, KHTMLView *_view, bool includesComments)
  +HTMLTokenizer::HTMLTokenizer(DOM::DocumentImpl *_doc, KHTMLView *_view, bool includesComments)
       : inWrite(false)
   {
       view = _view;
  @@ -174,7 +174,7 @@
       begin();
   }
   
  -HTMLTokenizer::HTMLTokenizer(DOM::DocumentPtr *_doc, DOM::DocumentFragmentImpl *i, bool includesComments)
  +HTMLTokenizer::HTMLTokenizer(DOM::DocumentImpl *_doc, DOM::DocumentFragmentImpl *i, bool includesComments)
       : inWrite(false)
   {
       view = 0;
  @@ -1053,7 +1053,7 @@
                           ++src;
                       }
                       else {
  -                        currToken.addAttribute(parser->docPtr()->document(), attrName, emptyAtom);
  +                        currToken.addAttribute(parser->doc(), attrName, emptyAtom);
                           dest = buffer;
                           state.setTagState(SearchAttribute);
                       }
  @@ -1105,7 +1105,7 @@
                           dest--; // remove trailing newlines
                       AtomicString v(buffer+1, dest-buffer-1);
                       attrName = v; // Just make the name/value match. (FIXME: Is this some WinIE quirk?)
  -                    currToken.addAttribute(parser->docPtr()->document(), attrName, v);
  +                    currToken.addAttribute(parser->doc(), attrName, v);
                       state.setTagState(SearchAttribute);
                       dest = buffer;
                       tquote = NoQuote;
  @@ -1129,7 +1129,7 @@
                           AtomicString v(buffer+1, dest-buffer-1);
                           if (attrName.isEmpty())
                               attrName = v; // Make the name match the value. (FIXME: Is this a WinIE quirk?)
  -                        currToken.addAttribute(parser->docPtr()->document(), attrName, v);
  +                        currToken.addAttribute(parser->doc(), attrName, v);
   
                           dest = buffer;
                           state.setTagState(SearchAttribute);
  @@ -1165,7 +1165,7 @@
                       if ( curchar <= ' ' || curchar == '>' )
                       {
                           AtomicString v(buffer+1, dest-buffer-1);
  -                        currToken.addAttribute(parser->docPtr()->document(), attrName, v);
  +                        currToken.addAttribute(parser->doc(), attrName, v);
                           dest = buffer;
                           state.setTagState(SearchAttribute);
                           break;
  @@ -1838,7 +1838,7 @@
   
   void parseHTMLDocumentFragment(const DOM::DOMString &source, DOM::DocumentFragmentImpl *fragment)
   {
  -    HTMLTokenizer tok(fragment->docPtr(), fragment);
  +    HTMLTokenizer tok(fragment->getDocument(), fragment);
       tok.setForceSynchronous(true);
       tok.write(source.qstring(), true);
       tok.finish();
  
  
  
  1.46      +2 -3      WebCore/khtml/html/htmltokenizer.h
  
  Index: htmltokenizer.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/htmltokenizer.h,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- htmltokenizer.h	27 Oct 2005 06:03:31 -0000	1.45
  +++ htmltokenizer.h	8 Nov 2005 08:11:03 -0000	1.46
  @@ -49,7 +49,6 @@
   class KHTMLView;
   
   namespace DOM {
  -    class DocumentPtr;
       class DocumentFragmentImpl;
   }
   
  @@ -115,8 +114,8 @@
   class HTMLTokenizer : public Tokenizer, public CachedObjectClient
   {
   public:
  -    HTMLTokenizer(DOM::DocumentPtr *, KHTMLView * = 0, bool includesComments=false);
  -    HTMLTokenizer(DOM::DocumentPtr *, DOM::DocumentFragmentImpl *frag, bool includesComments=false);
  +    HTMLTokenizer(DOM::DocumentImpl *, KHTMLView * = 0, bool includesComments=false);
  +    HTMLTokenizer(DOM::DocumentImpl *, DOM::DocumentFragmentImpl *frag, bool includesComments=false);
       virtual ~HTMLTokenizer();
   
       virtual bool write(const TokenizerString &str, bool appendData);
  
  
  
  1.46      +2 -1      WebCore/khtml/misc/loader.h
  
  Index: loader.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/misc/loader.h,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- loader.h	24 Oct 2005 18:58:51 -0000	1.45
  +++ loader.h	8 Nov 2005 08:11:09 -0000	1.46
  @@ -52,6 +52,7 @@
   
   #include <khtml_settings.h>
   #include <dom/dom_string.h>
  +#include "DocPtr.h"
   
   class QMovie;
   class KHTMLPart;
  @@ -517,7 +518,7 @@
           bool m_bautoloadImages : 1;
           KHTMLSettings::KAnimationAdvice m_showAnimations : 2;
           KHTMLPart* m_part;
  -        DOM::DocumentImpl* m_doc;
  +        DOM::DocumentImpl *m_doc;
           bool m_loadInProgress;
       };
   
  
  
  
  1.9       +4 -4      WebCore/khtml/misc/shared.h
  
  Index: shared.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/misc/shared.h,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- shared.h	27 Sep 2005 22:37:19 -0000	1.8
  +++ shared.h	8 Nov 2005 08:11:10 -0000	1.9
  @@ -35,14 +35,14 @@
   public:
       TreeShared() { _ref = 0; m_parent = 0; /*counter++;*/ }
       TreeShared( type *parent ) { _ref=0; m_parent = parent; /*counter++;*/ }
  -    ~TreeShared() { /*counter--;*/ }
  +    virtual ~TreeShared() { /*counter--;*/ }
   
  +    virtual void removedLastRef() { delete static_cast<type *>(this); }
       void ref() { _ref++;  }
       void deref() { 
   	if(_ref) _ref--; 
  -	if(!_ref && !m_parent) {
  -	    delete static_cast<type *>(this); 
  -	}
  +	if(!_ref && !m_parent)
  +	    removedLastRef();
       }
       bool hasOneRef() { //kdDebug(300) << "ref=" << _ref << endl;
       	return _ref==1; }
  
  
  
  1.5       +1 -2      WebCore/khtml/xbl/xbl_tokenizer.cpp
  
  Index: xbl_tokenizer.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xbl/xbl_tokenizer.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- xbl_tokenizer.cpp	3 Oct 2005 21:12:49 -0000	1.4
  +++ xbl_tokenizer.cpp	8 Nov 2005 08:11:10 -0000	1.5
  @@ -10,7 +10,6 @@
   #include "xbl_protohandler.h"
   #include "xbl_protoimplementation.h"
   
  -using DOM::DocumentPtr;
   using DOM::ElementImpl;
   using DOM::Node;
   
  @@ -18,7 +17,7 @@
   
   const char xblNS[] = "http://www.mozilla.org/xbl";
       
  -XBLTokenHandler::XBLTokenHandler(DocumentPtr* doc)
  +XBLTokenHandler::XBLTokenHandler(DocumentImpl* doc)
   :   XMLHandler(doc, 0),
       m_state(eXBL_InDocument),
       m_secondaryState(eXBL_None),
  
  
  
  1.3       +1 -1      WebCore/khtml/xbl/xbl_tokenizer.h
  
  Index: xbl_tokenizer.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xbl/xbl_tokenizer.h,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- xbl_tokenizer.h	7 Feb 2004 01:19:44 -0000	1.2
  +++ xbl_tokenizer.h	8 Nov 2005 08:11:10 -0000	1.3
  @@ -41,7 +41,7 @@
   } XBLSecondaryState;
   
   public:
  -    XBLTokenHandler(DOM::DocumentPtr *_doc);
  +    XBLTokenHandler(DOM::DocumentImpl *_doc);
       ~XBLTokenHandler();
       
       XBLDocumentImpl* xblDocument() const;
  
  
  
  1.46      +13 -13    WebCore/khtml/xml/dom2_rangeimpl.cpp
  
  Index: dom2_rangeimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom2_rangeimpl.cpp,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- dom2_rangeimpl.cpp	3 Oct 2005 21:12:51 -0000	1.45
  +++ dom2_rangeimpl.cpp	8 Nov 2005 08:11:11 -0000	1.46
  @@ -47,20 +47,20 @@
   
   namespace DOM {
   
  -RangeImpl::RangeImpl(DocumentPtr *_ownerDocument)
  +RangeImpl::RangeImpl(DocumentImpl *_ownerDocument)
   {
       m_ownerDocument = _ownerDocument;
       m_ownerDocument->ref();
  -    m_startContainer = _ownerDocument->document();
  +    m_startContainer = _ownerDocument;
       m_startContainer->ref();
  -    m_endContainer = _ownerDocument->document();
  +    m_endContainer = _ownerDocument;
       m_endContainer->ref();
       m_startOffset = 0;
       m_endOffset = 0;
       m_detached = false;
   }
   
  -RangeImpl::RangeImpl(DocumentPtr *_ownerDocument,
  +RangeImpl::RangeImpl(DocumentImpl *_ownerDocument,
                 NodeImpl *_startContainer, int _startOffset,
                 NodeImpl *_endContainer, int _endOffset)
   {
  @@ -176,7 +176,7 @@
           return;
       }
   
  -    if (refNode->getDocument() != m_ownerDocument->document()) {
  +    if (refNode->getDocument() != m_ownerDocument) {
           exceptioncode = DOMException::WRONG_DOCUMENT_ERR;
           return;
       }
  @@ -214,7 +214,7 @@
           return;
       }
   
  -    if (refNode->getDocument() != m_ownerDocument->document()) {
  +    if (refNode->getDocument() != m_ownerDocument) {
           exceptioncode = DOMException::WRONG_DOCUMENT_ERR;
           return;
       }
  @@ -448,7 +448,7 @@
   
       DocumentFragmentImpl *fragment = 0;
       if (action == EXTRACT_CONTENTS || action == CLONE_CONTENTS)
  -        fragment = new DocumentFragmentImpl(m_ownerDocument);
  +        fragment = new DocumentFragmentImpl(m_ownerDocument.get());
   
       // Simple case: the start and end containers are the same. We just grab
       // everything >= start offset and < end offset
  @@ -981,7 +981,7 @@
           return 0;
       }
   
  -    return new RangeImpl(m_ownerDocument,m_startContainer,m_startOffset,m_endContainer,m_endOffset);
  +    return new RangeImpl(m_ownerDocument.get(), m_startContainer, m_startOffset, m_endContainer, m_endOffset);
   }
   
   void RangeImpl::setStartAfter( NodeImpl *refNode, int &exceptioncode )
  @@ -996,7 +996,7 @@
           return;
       }
   
  -    if (refNode->getDocument() != m_ownerDocument->document()) {
  +    if (refNode->getDocument() != m_ownerDocument) {
           exceptioncode = DOMException::WRONG_DOCUMENT_ERR;
           return;
       }
  @@ -1020,7 +1020,7 @@
           return;
       }
   
  -    if (refNode->getDocument() != m_ownerDocument->document()) {
  +    if (refNode->getDocument() != m_ownerDocument) {
           exceptioncode = DOMException::WRONG_DOCUMENT_ERR;
           return;
       }
  @@ -1044,7 +1044,7 @@
           return;
       }
   
  -    if (refNode->getDocument() != m_ownerDocument->document()) {
  +    if (refNode->getDocument() != m_ownerDocument) {
           exceptioncode = DOMException::WRONG_DOCUMENT_ERR;
           return;
       }
  @@ -1230,7 +1230,7 @@
           return;
       }
   
  -    if (refNode->getDocument() != m_ownerDocument->document()) {
  +    if (refNode->getDocument() != m_ownerDocument) {
           exceptioncode = DOMException::WRONG_DOCUMENT_ERR;
           return;
       }
  @@ -1411,7 +1411,7 @@
   
   SharedPtr<RangeImpl> rangeOfContents(NodeImpl *node)
   {
  -    RangeImpl *range = new RangeImpl(node->docPtr());
  +    RangeImpl *range = new RangeImpl(node->getDocument());
       int exception = 0;
       range->selectNodeContents(node, exception);
       return SharedPtr<RangeImpl>(range);
  
  
  
  1.30      +5 -4      WebCore/khtml/xml/dom2_rangeimpl.h
  
  Index: dom2_rangeimpl.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom2_rangeimpl.h,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- dom2_rangeimpl.h	3 Oct 2005 21:12:51 -0000	1.29
  +++ dom2_rangeimpl.h	8 Nov 2005 08:11:11 -0000	1.30
  @@ -29,11 +29,11 @@
   
   #include "dom/dom2_range.h"
   #include "misc/shared.h"
  +#include "DocPtr.h"
   
   namespace DOM {
   
   class DocumentFragmentImpl;
  -class DocumentPtr;
   class DOMString;
   class NodeImpl;
   class Position;
  @@ -42,8 +42,8 @@
   {
       friend class DocumentImpl;
   public:
  -    RangeImpl(DocumentPtr *_ownerDocument);
  -    RangeImpl(DocumentPtr *_ownerDocument,
  +    RangeImpl(DocumentImpl *_ownerDocument);
  +    RangeImpl(DocumentImpl *_ownerDocument,
                 NodeImpl *_startContainer, int _startOffset,
                 NodeImpl *_endContainer, int _endOffset);
   
  @@ -106,7 +106,8 @@
   #endif
   
   protected:
  -    DocumentPtr *m_ownerDocument;
  +    // FIXME - this could be a full-on SharedPtr in principle...
  +    DocPtr<DocumentImpl> m_ownerDocument;
       NodeImpl *m_startContainer;
       unsigned m_startOffset;
       NodeImpl *m_endContainer;
  
  
  
  1.267     +62 -75    WebCore/khtml/xml/dom_docimpl.cpp
  
  Index: dom_docimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_docimpl.cpp,v
  retrieving revision 1.266
  retrieving revision 1.267
  diff -u -r1.266 -r1.267
  --- dom_docimpl.cpp	1 Nov 2005 07:16:08 -0000	1.266
  +++ dom_docimpl.cpp	8 Nov 2005 08:11:11 -0000	1.267
  @@ -244,7 +244,7 @@
           return 0;
       }
   
  -    return new DocumentTypeImpl(this,DocumentPtr::nullDocumentPtr(),qualifiedName,publicId,systemId);
  +    return new DocumentTypeImpl(this, 0, qualifiedName, publicId, systemId);
   }
   
   DOMImplementationImpl* DOMImplementationImpl::getInterface(const DOMString& /*feature*/) const
  @@ -305,7 +305,7 @@
   
       // now get the interesting parts of the doctype
       if (doctype)
  -        doc->setDocType(new DocumentTypeImpl(doc->docPtr(), *doctype));
  +        doc->setDocType(new DocumentTypeImpl(doc, *doctype));
   
       return doc;
   }
  @@ -362,11 +362,10 @@
   
   // KHTMLView might be 0
   DocumentImpl::DocumentImpl(DOMImplementationImpl *_implementation, KHTMLView *v)
  -    : ContainerNodeImpl( new DocumentPtr() )
  +    : ContainerNodeImpl(0)
         , m_domtree_version(0)
         , m_title("")
         , m_titleSetExplicitly(false)
  -      , m_titleElement(0)
         , m_imageLoadEventTimer(0)
   #ifndef KHTML_NO_XBL
         , m_bindingManager(new XBLBindingManager(this))
  @@ -385,9 +384,10 @@
       , m_designMode(inherit)
       , m_hasDashboardRegions(false)
       , m_dashboardRegionsDirty(false)
  +    , m_selfOnlyRefCount(0)
   #endif
   {
  -    document->doc = this;
  +    document.resetSkippingRef(this);
   
       m_paintDevice = 0;
       m_paintDeviceMetrics = 0;
  @@ -426,9 +426,6 @@
       m_attrNames = 0;
       m_attrNameAlloc = 0;
       m_attrNameCount = 0;
  -    m_focusNode = 0;
  -    m_hoverNode = 0;
  -    m_activeNode = 0;
       m_defaultView = new AbstractViewImpl(this);
       m_defaultView->ref();
       m_listenerTypes = 0;
  @@ -466,6 +463,29 @@
       m_docID = docID++;
   }
   
  +void DocumentImpl::removedLastRef()
  +{
  +    if (m_selfOnlyRefCount) {
  +        // if removing a child removes the last self-only ref, we don't
  +        // want the document to be destructed until after
  +        // removeAllChildren returns, so we guard ourselves with an
  +        // extra self-only ref
  +
  +        DocPtr<DocumentImpl> guard(this);
  +
  +        // we must make sure not to be retaining any of our children through
  +        // these extra pointers or we will create a reference cycle
  +        m_docType = 0;
  +        m_focusNode = 0;
  +        m_hoverNode = 0;
  +        m_activeNode = 0;
  +        m_titleElement = 0;
  +
  +        removeAllChildren();
  +    } else
  +        delete this;
  +}
  +
   DocumentImpl::~DocumentImpl()
   {
       assert(!m_render);
  @@ -479,7 +499,7 @@
       if (changedDocuments && m_docChanged)
           changedDocuments->remove(this);
       delete m_tokenizer;
  -    document->doc = 0;
  +    document.resetSkippingRef(0);
       delete m_sheet;
       delete m_styleSelector;
       delete m_docLoader;
  @@ -501,16 +521,6 @@
       m_defaultView->deref();
       m_styleSheets->deref();
   
  -    if (m_focusNode)
  -        m_focusNode->deref();
  -    if (m_hoverNode)
  -        m_hoverNode->deref();
  -    if (m_activeNode)
  -        m_activeNode->deref();
  -
  -    if (m_titleElement)
  -        m_titleElement->deref();
  -
       if (m_renderArena){
           delete m_renderArena;
           m_renderArena = 0;
  @@ -582,17 +592,17 @@
   
   DocumentFragmentImpl *DocumentImpl::createDocumentFragment(  )
   {
  -    return new DocumentFragmentImpl( docPtr() );
  +    return new DocumentFragmentImpl(getDocument());
   }
   
  -TextImpl *DocumentImpl::createTextNode( const DOMString &data )
  +TextImpl *DocumentImpl::createTextNode(const DOMString &data)
   {
  -    return new TextImpl( docPtr(), data);
  +    return new TextImpl(this, data);
   }
   
  -CommentImpl *DocumentImpl::createComment ( const DOMString &data )
  +CommentImpl *DocumentImpl::createComment (const DOMString &data)
   {
  -    return new CommentImpl( docPtr(), data );
  +    return new CommentImpl(this, data);
   }
   
   CDATASectionImpl *DocumentImpl::createCDATASection(const DOMString &data, int &exception)
  @@ -601,7 +611,7 @@
           exception = DOMException::NOT_SUPPORTED_ERR;
           return NULL;
       }
  -    return new CDATASectionImpl(docPtr(), data);
  +    return new CDATASectionImpl(this, data);
   }
   
   ProcessingInstructionImpl *DocumentImpl::createProcessingInstruction(const DOMString &target, const DOMString &data, int &exception)
  @@ -614,7 +624,7 @@
           exception = DOMException::NOT_SUPPORTED_ERR;
           return NULL;
       }
  -    return new ProcessingInstructionImpl(docPtr(),target,data);
  +    return new ProcessingInstructionImpl(this, target, data);
   }
   
   EntityReferenceImpl *DocumentImpl::createEntityReference(const DOMString &name, int &exception)
  @@ -627,12 +637,12 @@
           exception = DOMException::NOT_SUPPORTED_ERR;
           return NULL;
       }
  -    return new EntityReferenceImpl(docPtr(), name.impl());
  +    return new EntityReferenceImpl(this, name.impl());
   }
   
   EditingTextImpl *DocumentImpl::createEditingTextNode(const DOMString &text)
   {
  -    return new EditingTextImpl(docPtr(), text);
  +    return new EditingTextImpl(this, text);
   }
   
   CSSStyleDeclarationImpl *DocumentImpl::createCSSStyleDeclaration()
  @@ -727,7 +737,7 @@
       }
       
       if (!e)
  -        e = new ElementImpl(QualifiedName(AtomicString(prefix), AtomicString(localName), AtomicString(_namespaceURI)), document);
  +        e = new ElementImpl(QualifiedName(AtomicString(prefix), AtomicString(localName), AtomicString(_namespaceURI)), getDocument());
       
       return e;
   }
  @@ -872,17 +882,12 @@
       if (!titleElement) {
           // Title set by JavaScript -- overrides any title elements.
           m_titleSetExplicitly = true;
  -        if (m_titleElement) {
  -            m_titleElement->deref();
  -            m_titleElement = 0;
  -        }
  +        m_titleElement = 0;
       } else if (titleElement != m_titleElement) {
  -        if (m_titleElement) {
  +        if (m_titleElement)
               // Only allow the first title element to change the title -- others have no effect.
               return;
  -        }
           m_titleElement = titleElement;
  -        titleElement->ref();
       }
   
       if (m_title == title)
  @@ -900,8 +905,6 @@
       // FIXME: Ideally we might want this to search for the first remaining title element, and use it.
       m_titleElement = 0;
   
  -    titleElement->deref();
  -
       if (!m_title.isEmpty()) {
           m_title = "";
           updateTitle();
  @@ -945,7 +948,7 @@
   
   RangeImpl *DocumentImpl::createRange()
   {
  -    return new RangeImpl( docPtr() );
  +    return new RangeImpl(this);
   }
   
   NodeIteratorImpl *DocumentImpl::createNodeIterator(NodeImpl *root, unsigned whatToShow, 
  @@ -1302,7 +1305,7 @@
   
   Tokenizer *DocumentImpl::createTokenizer()
   {
  -    return newXMLTokenizer(docPtr(), m_view);
  +    return newXMLTokenizer(this, m_view);
   }
   
   void DocumentImpl::setPaintDevice( QPaintDevice *dev )
  @@ -1402,7 +1405,7 @@
       if (!body && isHTMLDocument()) {
           NodeImpl *de = documentElement();
           if (de) {
  -            body = new HTMLBodyElementImpl(docPtr());
  +            body = new HTMLBodyElementImpl(this);
               int exceptionCode = 0;
               de->appendChild(body, exceptionCode);
               if (exceptionCode != 0)
  @@ -2171,24 +2174,14 @@
   
   void DocumentImpl::setHoverNode(NodeImpl* newHoverNode)
   {
  -    if (m_hoverNode != newHoverNode) {
  -        if (m_hoverNode)
  -            m_hoverNode->deref();
  +    if (m_hoverNode != newHoverNode)
           m_hoverNode = newHoverNode;
  -        if (m_hoverNode)
  -            m_hoverNode->ref();
  -    }    
   }
   
   void DocumentImpl::setActiveNode(NodeImpl* newActiveNode)
   {
  -    if (m_activeNode != newActiveNode) {
  -        if (m_activeNode)
  -            m_activeNode->deref();
  +    if (m_activeNode != newActiveNode)
           m_activeNode = newActiveNode;
  -        if (m_activeNode)
  -            m_activeNode->ref();
  -    }    
   }
   
   #if APPLE_CHANGES
  @@ -2250,12 +2243,12 @@
           return true;
   
   #if APPLE_CHANGES
  -    if (m_focusNode && m_focusNode->isContentEditable() && !relinquishesEditingFocus(m_focusNode))
  +    if (m_focusNode && m_focusNode->isContentEditable() && !relinquishesEditingFocus(m_focusNode.get()))
           return false;
   #endif     
          
       bool focusChangeBlocked = false;
  -    NodeImpl *oldFocusNode = m_focusNode;
  +    SharedPtr<NodeImpl> oldFocusNode = m_focusNode;
       m_focusNode = 0;
   
       // Remove focus from the existing focus node (if any)
  @@ -2265,24 +2258,19 @@
   
           oldFocusNode->setFocus(false);
           oldFocusNode->dispatchHTMLEvent(blurEvent, false, false);
  -        if (m_focusNode != 0) {
  +        if (m_focusNode) {
               // handler shifted focus
               focusChangeBlocked = true;
               newFocusNode = 0;
           }
           oldFocusNode->dispatchUIEvent(DOMFocusOutEvent);
  -        if (m_focusNode != 0) {
  +        if (m_focusNode) {
               // handler shifted focus
               focusChangeBlocked = true;
               newFocusNode = 0;
           }
  -        if ((oldFocusNode == this) && oldFocusNode->hasOneRef()) {
  -            oldFocusNode->deref(); // deletes this
  +        if ((oldFocusNode.get() == this) && oldFocusNode->hasOneRef())
               return true;
  -        }
  -        else {
  -            oldFocusNode->deref();
  -        }
       }
   
       // Clear the selection when changing the focus node to null or to a node that is not 
  @@ -2303,7 +2291,6 @@
   #endif
           // Set focus on the new node
           m_focusNode = newFocusNode;
  -        m_focusNode->ref();
           m_focusNode->dispatchHTMLEvent(focusEvent, false, false);
           if (m_focusNode != newFocusNode) {
               // handler shifted focus
  @@ -2320,14 +2307,14 @@
           // eww, I suck. set the qt focus correctly
           // ### find a better place in the code for this
           if (view()) {
  -            QWidget *focusWidget = widgetForNode(m_focusNode);
  +            QWidget *focusWidget = widgetForNode(m_focusNode.get());
               if (focusWidget) {
                   // Make sure a widget has the right size before giving it focus.
                   // Otherwise, we are testing edge cases of the QWidget code.
                   // Specifically, in WebCore this does not work well for text fields.
                   updateLayout();
                   // Re-get the widget in case updating the layout changed things.
  -                focusWidget = widgetForNode(m_focusNode);
  +                focusWidget = widgetForNode(m_focusNode.get());
               }
               if (focusWidget)
                   focusWidget->setFocus();
  @@ -3205,9 +3192,9 @@
       
       // FIXME: Assume this is a mapped attribute, since createAttribute isn't namespace-aware.  There's no harm to XML
       // documents if we're wrong.
  -    return new AttrImpl(0, docPtr(), new MappedAttributeImpl(QualifiedName(prefix.impl(), 
  -                                                                           localName.impl(),
  -                                                                           namespaceURI.impl()), DOMString("").impl()), false);
  +    return new AttrImpl(0, this, new MappedAttributeImpl(QualifiedName(prefix.impl(), 
  +                                                                       localName.impl(),
  +                                                                       namespaceURI.impl()), DOMString("").impl()), false);
   }
   
   SharedPtr<HTMLCollectionImpl> DocumentImpl::images()
  @@ -3267,7 +3254,7 @@
   
   // ----------------------------------------------------------------------------
   
  -DocumentFragmentImpl::DocumentFragmentImpl(DocumentPtr *doc) : ContainerNodeImpl(doc)
  +DocumentFragmentImpl::DocumentFragmentImpl(DocumentImpl *doc) : ContainerNodeImpl(doc)
   {
   }
   
  @@ -3309,9 +3296,9 @@
   }
   
   
  -NodeImpl *DocumentFragmentImpl::cloneNode ( bool deep )
  +NodeImpl *DocumentFragmentImpl::cloneNode (bool deep)
   {
  -    DocumentFragmentImpl *clone = new DocumentFragmentImpl( docPtr() );
  +    DocumentFragmentImpl *clone = new DocumentFragmentImpl(getDocument());
       if (deep)
           cloneChildNodes(clone);
       return clone;
  @@ -3320,17 +3307,17 @@
   
   // ----------------------------------------------------------------------------
   
  -DocumentTypeImpl::DocumentTypeImpl(DOMImplementationImpl *i, DocumentPtr *doc, const DOMString &n, const DOMString &p, const DOMString &s)
  +DocumentTypeImpl::DocumentTypeImpl(DOMImplementationImpl *i, DocumentImpl *doc, const DOMString &n, const DOMString &p, const DOMString &s)
       : NodeImpl(doc), m_implementation(i), m_name(n), m_publicId(p), m_systemId(s)
   {
   }
   
  -DocumentTypeImpl::DocumentTypeImpl(DocumentPtr *doc, const DOMString &n, const DOMString &p, const DOMString &s)
  +DocumentTypeImpl::DocumentTypeImpl(DocumentImpl *doc, const DOMString &n, const DOMString &p, const DOMString &s)
       : NodeImpl(doc), m_name(n), m_publicId(p), m_systemId(s)
   {
   }
   
  -DocumentTypeImpl::DocumentTypeImpl(DocumentPtr *doc, const DocumentTypeImpl &t)
  +DocumentTypeImpl::DocumentTypeImpl(DocumentImpl *doc, const DocumentTypeImpl &t)
       : NodeImpl(doc), m_implementation(t.m_implementation)
       , m_name(t.m_name), m_publicId(t.m_publicId), m_systemId(t.m_systemId), m_subset(t.m_subset)
   {
  
  
  
  1.135     +27 -11    WebCore/khtml/xml/dom_docimpl.h
  
  Index: dom_docimpl.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_docimpl.h,v
  retrieving revision 1.134
  retrieving revision 1.135
  diff -u -r1.134 -r1.135
  --- dom_docimpl.h	27 Oct 2005 23:15:03 -0000	1.134
  +++ dom_docimpl.h	8 Nov 2005 08:11:12 -0000	1.135
  @@ -172,6 +172,21 @@
       DocumentImpl(DOMImplementationImpl *_implementation, KHTMLView *v);
       ~DocumentImpl();
   
  +    virtual void removedLastRef();
  +
  +    // Nodes belonging to this document hold "self-only" references -
  +    // these are enough to keep the document from being destroyed, but
  +    // not enough to keep it from removing its children. This allows a
  +    // node that outlives its document to still have a valid document
  +    // pointer without introducing reference cycles
  +
  +    void selfOnlyRef() { ++m_selfOnlyRefCount; }
  +    void selfOnlyDeref() {
  +        --m_selfOnlyRefCount;
  +        if (!m_selfOnlyRefCount && !refCount())
  +            delete this;
  +    }
  +
       // DOM methods & attributes for Document
   
       virtual DocumentTypeImpl *doctype() const; // returns 0 for HTML documents
  @@ -405,13 +420,13 @@
   
       QStringList availableStyleSheets() const;
   
  -    NodeImpl *focusNode() const { return m_focusNode; }
  +    NodeImpl *focusNode() const { return m_focusNode.get(); }
       bool setFocusNode(NodeImpl *newFocusNode);
   
  -    NodeImpl *hoverNode() const { return m_hoverNode; }
  +    NodeImpl *hoverNode() const { return m_hoverNode.get(); }
       void setHoverNode(NodeImpl *newHoverNode);
       
  -    NodeImpl *activeNode() const { return m_activeNode; }
  +    NodeImpl *activeNode() const { return m_activeNode.get(); }
       void setActiveNode(NodeImpl *newActiveNode);
   
       // Updates for :target (CSS3 selector).
  @@ -630,9 +645,9 @@
   
       QColor m_textColor;
   
  -    NodeImpl *m_focusNode;
  -    NodeImpl *m_hoverNode;
  -    NodeImpl *m_activeNode;
  +    SharedPtr<NodeImpl> m_focusNode;
  +    SharedPtr<NodeImpl> m_hoverNode;
  +    SharedPtr<NodeImpl> m_activeNode;
   
       unsigned int m_domtree_version;
       
  @@ -678,7 +693,7 @@
       
       DOMString m_title;
       bool m_titleSetExplicitly;
  -    NodeImpl *m_titleElement;
  +    SharedPtr<NodeImpl> m_titleElement;
       
       RenderArena* m_renderArena;
   
  @@ -781,13 +796,14 @@
       QValueList<khtml::DashboardRegionValue> m_dashboardRegions;
       bool m_hasDashboardRegions;
       bool m_dashboardRegionsDirty;
  +    int m_selfOnlyRefCount;
   #endif
   };
   
   class DocumentFragmentImpl : public ContainerNodeImpl
   {
   public:
  -    DocumentFragmentImpl(DocumentPtr *doc);
  +    DocumentFragmentImpl(DocumentImpl *doc);
   
       // DOM methods overridden from  parent classes
       virtual DOMString nodeName() const;
  @@ -803,9 +819,9 @@
   class DocumentTypeImpl : public NodeImpl
   {
   public:
  -    DocumentTypeImpl(DOMImplementationImpl *, DocumentPtr *, const DOMString &name, const DOMString &publicId, const DOMString &systemId);
  -    DocumentTypeImpl(DocumentPtr *, const DOMString &name, const DOMString &publicId, const DOMString &systemId);
  -    DocumentTypeImpl(DocumentPtr *, const DocumentTypeImpl &);
  +    DocumentTypeImpl(DOMImplementationImpl *, DocumentImpl *, const DOMString &name, const DOMString &publicId, const DOMString &systemId);
  +    DocumentTypeImpl(DocumentImpl *, const DOMString &name, const DOMString &publicId, const DOMString &systemId);
  +    DocumentTypeImpl(DocumentImpl *, const DocumentTypeImpl &);
   
       // DOM methods & attributes for DocumentType
       NamedNodeMapImpl *entities() const { return m_entities.get(); }
  
  
  
  1.90      +5 -5      WebCore/khtml/xml/dom_elementimpl.cpp
  
  Index: dom_elementimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_elementimpl.cpp,v
  retrieving revision 1.89
  retrieving revision 1.90
  diff -u -r1.89 -r1.90
  --- dom_elementimpl.cpp	3 Nov 2005 19:12:05 -0000	1.89
  +++ dom_elementimpl.cpp	8 Nov 2005 08:11:12 -0000	1.90
  @@ -58,10 +58,10 @@
   }
   
   void AttributeImpl::allocateImpl(ElementImpl* e) {
  -    m_impl = new AttrImpl(e, e->docPtr(), this, true);
  +    m_impl = new AttrImpl(e, e->getDocument(), this, true);
   }
   
  -AttrImpl::AttrImpl(ElementImpl* element, DocumentPtr* docPtr, AttributeImpl* a, bool createTextChild)
  +AttrImpl::AttrImpl(ElementImpl* element, DocumentImpl* docPtr, AttributeImpl* a, bool createTextChild)
       : ContainerNodeImpl(docPtr),
         m_element(element),
         m_attribute(a),
  @@ -164,7 +164,7 @@
   
   NodeImpl *AttrImpl::cloneNode ( bool /*deep*/)
   {
  -    AttrImpl *clone = new AttrImpl(0, docPtr(), m_attribute->clone(), false);
  +    AttrImpl *clone = new AttrImpl(0, getDocument(), m_attribute->clone(), false);
       
       cloneChildNodes(clone);
       return clone;
  @@ -256,7 +256,7 @@
   static ElementImplCounter elementImplCounter;
   #endif NDEBUG
   
  -ElementImpl::ElementImpl(const QualifiedName& qName, DocumentPtr *doc)
  +ElementImpl::ElementImpl(const QualifiedName& qName, DocumentImpl *doc)
       : ContainerNodeImpl(doc), m_tagName(qName)
   {
   #ifndef NDEBUG
  @@ -1272,7 +1272,7 @@
       }
   }
   
  -StyledElementImpl::StyledElementImpl(const QualifiedName& name, DocumentPtr *doc)
  +StyledElementImpl::StyledElementImpl(const QualifiedName& name, DocumentImpl *doc)
       : ElementImpl(name, doc)
   {
       m_inlineStyleDecl = 0;
  
  
  
  1.59      +3 -3      WebCore/khtml/xml/dom_elementimpl.h
  
  Index: dom_elementimpl.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_elementimpl.h,v
  retrieving revision 1.58
  retrieving revision 1.59
  diff -u -r1.58 -r1.59
  --- dom_elementimpl.h	2 Nov 2005 08:52:49 -0000	1.58
  +++ dom_elementimpl.h	8 Nov 2005 08:11:12 -0000	1.59
  @@ -113,7 +113,7 @@
       friend class NamedAttrMapImpl;
   
   public:
  -    AttrImpl(ElementImpl* element, DocumentPtr* docPtr, AttributeImpl* a, bool createTextChild);
  +    AttrImpl(ElementImpl* element, DocumentImpl* doc, AttributeImpl* a, bool createTextChild);
       ~AttrImpl();
   
   private:
  @@ -165,7 +165,7 @@
       friend class NodeImpl;
       friend class khtml::CSSStyleSelector;
   public:
  -    ElementImpl(const QualifiedName& tagName, DocumentPtr *doc);
  +    ElementImpl(const QualifiedName& tagName, DocumentImpl *doc);
       ~ElementImpl();
   
       // Used to quickly determine whether or not an element has a given CSS class.
  @@ -422,7 +422,7 @@
   class StyledElementImpl : public ElementImpl
   {
   public:
  -    StyledElementImpl(const QualifiedName& tagName, DocumentPtr *doc);
  +    StyledElementImpl(const QualifiedName& tagName, DocumentImpl *doc);
       virtual ~StyledElementImpl();
   
       virtual bool isStyledElement() const { return true; }
  
  
  
  1.208     +30 -46    WebCore/khtml/xml/dom_nodeimpl.cpp
  
  Index: dom_nodeimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_nodeimpl.cpp,v
  retrieving revision 1.207
  retrieving revision 1.208
  diff -u -r1.207 -r1.208
  --- dom_nodeimpl.cpp	1 Nov 2005 16:59:49 -0000	1.207
  +++ dom_nodeimpl.cpp	8 Nov 2005 08:11:12 -0000	1.208
  @@ -103,7 +103,7 @@
   static NodeImplCounter nodeImplCounter;
   #endif NDEBUG
   
  -NodeImpl::NodeImpl(DocumentPtr *doc)
  +NodeImpl::NodeImpl(DocumentImpl *doc)
       : document(doc),
         m_previous(0),
         m_next(0),
  @@ -129,21 +129,13 @@
   #ifndef NDEBUG
       ++NodeImplCounter::count;
   #endif
  -    if (document)
  -        document->ref();
   }
   
  -void NodeImpl::setDocument(DocumentPtr *doc)
  +void NodeImpl::setDocument(DocumentImpl *doc)
   {
       if (inDocument())
   	return;
       
  -    if (doc)
  -	doc->ref();
  -    
  -    if (document)
  -	document->deref();
  -
       document = doc;
   }
   
  @@ -158,8 +150,6 @@
           getDocument()->unregisterDisconnectedNodeWithEventListeners(this);
       delete m_regdListeners;
       delete m_nodeLists;
  -    if (document)
  -        document->deref();
       if (m_previous)
           m_previous->setNextSibling(0);
       if (m_next)
  @@ -525,9 +515,9 @@
       KHTMLPart *part = nil;
       KHTMLView *view = nil;
       
  -    if (document && document->document()) {
  -        part = document->document()->part();
  -        view = document->document()->view();
  +    if (DocumentImpl *doc = getDocument()) {
  +        part = doc->part();
  +        view = doc->view();
           // Since event handling code could cause this object to be deleted, grab a reference to the view now
           if (view)
               view->ref();
  @@ -642,14 +632,6 @@
       return !defaultPrevented; // ### what if defaultPrevented was called before dispatchEvent?
   }
   
  -DocumentPtr *DocumentPtr::nullDocumentPtr()
  -{
  -    static DocumentPtr doc;
  -    
  -    doc.ref();
  -    return &doc;
  -}
  -
   bool NodeImpl::dispatchHTMLEvent(const AtomicString &eventType, bool canBubbleArg, bool cancelableArg)
   {
       assert(!getDocument()->eventDispatchForbidden());
  @@ -661,40 +643,35 @@
   {
       assert(!getDocument()->eventDispatchForbidden());
       int exceptioncode = 0;
  -    EventImpl *evt = new EventImpl(eventType, canBubbleArg, cancelableArg);
  -    evt->ref();
  -    DocumentPtr *doc = document;
  -    doc->ref();
  -    evt->setTarget(doc->document());
  -    bool r = dispatchGenericEvent( evt, exceptioncode );
  -    if (!evt->defaultPrevented() && doc->document())
  -	doc->document()->defaultEventHandler(evt);
  -    
  -    if (eventType == loadEvent && !evt->propagationStopped() && doc->document()) {
  +    SharedPtr<EventImpl> evt = new EventImpl(eventType, canBubbleArg, cancelableArg);
  +    SharedPtr<DocumentImpl> doc = getDocument();
  +    evt->setTarget(doc.get());
  +    bool r = dispatchGenericEvent(evt.get(), exceptioncode);
  +    if (!evt->defaultPrevented() && doc)
  + 	doc->defaultEventHandler(evt.get());
  +
  +    if (eventType == loadEvent && !evt->propagationStopped() && doc) {
           // For onload events, send them to the enclosing frame only.
           // This is a DOM extension and is independent of bubbling/capturing rules of
           // the DOM.  You send the event only to the enclosing frame.  It does not
           // bubble through the parent document.
  -        ElementImpl* elt = doc->document()->ownerElement();
  +        ElementImpl* elt = doc->ownerElement();
           if (elt && (elt->getDocument()->domain().isNull() ||
  -                    elt->getDocument()->domain() == doc->document()->domain())) {
  +                    elt->getDocument()->domain() == doc->domain())) {
               // We also do a security check, since we don't want to allow the enclosing
               // iframe to see loads of child documents in other domains.
               evt->setCurrentTarget(elt);
   
               // Capturing first.
  -            elt->handleLocalEvents(evt,true);
  +            elt->handleLocalEvents(evt.get(), true);
   
               // Bubbling second.
               if (!evt->propagationStopped())
  -                elt->handleLocalEvents(evt,false);
  +                elt->handleLocalEvents(evt.get(), false);
               r = !evt->defaultPrevented();
           }
       }
   
  -    doc->deref();
  -    evt->deref();
  -
       return r;
   }
   
  @@ -727,7 +704,7 @@
   
       int clientX = 0;
       int clientY = 0;
  -    if (KHTMLView *view = document->document()->view())
  +    if (KHTMLView *view = getDocument()->view())
           view->viewportToContents(_mouse->x(), _mouse->y(), clientX, clientY);
       int screenX = _mouse->globalX();
       int screenY = _mouse->globalY();
  @@ -1176,7 +1153,7 @@
       if (shouldAdoptChild) {
           for (NodeImpl* node = newChild; node; node = node->traverseNextNode(newChild)) {
               KJS::ScriptInterpreter::updateDOMNodeDocument(node, node->getDocument(), getDocument());
  -            node->setDocument(getDocument()->docPtr());
  +            node->setDocument(getDocument());
           }
       }
   }
  @@ -1862,14 +1839,13 @@
   
   //-------------------------------------------------------------------------
   
  -ContainerNodeImpl::ContainerNodeImpl(DocumentPtr *doc)
  +ContainerNodeImpl::ContainerNodeImpl(DocumentImpl *doc)
       : NodeImpl(doc)
   {
       _first = _last = 0;
   }
   
  -
  -ContainerNodeImpl::~ContainerNodeImpl()
  +void ContainerNodeImpl::removeAllChildren()
   {
       //kdDebug( 6020 ) << "ContainerNodeImpl destructor" << endl;
   
  @@ -1901,7 +1877,8 @@
               else
                   head = n;
               tail = n;
  -        }
  +        } else if (n->inDocument())
  +            n->removedFromDocument();
       }
       
       // Only for the top level call, do the actual deleting.
  @@ -1918,9 +1895,16 @@
           }
           
           alreadyInsideDestructor = false;
  +        _first = 0;
  +        _last = 0;
       }
   }
   
  +ContainerNodeImpl::~ContainerNodeImpl()
  +{
  +    removeAllChildren();
  +}
  +
   
   NodeImpl *ContainerNodeImpl::firstChild() const
   {
  
  
  
  1.113     +8 -22     WebCore/khtml/xml/dom_nodeimpl.h
  
  Index: dom_nodeimpl.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_nodeimpl.h,v
  retrieving revision 1.112
  retrieving revision 1.113
  diff -u -r1.112 -r1.113
  --- dom_nodeimpl.h	1 Nov 2005 16:59:50 -0000	1.112
  +++ dom_nodeimpl.h	8 Nov 2005 08:11:13 -0000	1.113
  @@ -30,6 +30,7 @@
   #include "misc/helper.h"
   #include "misc/shared.h"
   #include "dom_atomicstring.h"
  +#include "DocPtr.h"
   
   class QPainter;
   template <class type> class QPtrList;
  @@ -60,26 +61,12 @@
   class QualifiedName;
   class RegisteredEventListener;
   
  -class DocumentPtr : public khtml::Shared<DocumentPtr>
  -{
  -public:
  -    DocumentImpl *document() const { return doc; }
  -    static DocumentPtr *nullDocumentPtr();
  -    
  -private:
  -    DocumentPtr() { doc = 0; }
  -    friend class DocumentImpl;
  -    friend class DOMImplementationImpl;
  -
  -    DocumentImpl *doc;
  -};
  -
   // this class implements nodes, which can have a parent but no children:
   class NodeImpl : public khtml::TreeShared<NodeImpl>
   {
       friend class DocumentImpl;
   public:
  -    NodeImpl(DocumentPtr *doc);
  +    NodeImpl(DocumentImpl *doc);
       virtual ~NodeImpl();
   
       // DOM methods & attributes for Node
  @@ -227,7 +214,7 @@
       bool hasChangedChild() const { return m_hasChangedChild; }
       bool isLink() const { return m_isLink; }
       // inDocument should also make sure a document exists in case the document has been destroyed before the node is removed from the document.
  -    bool inDocument() const { return document->document() && m_inDocument; }
  +    bool inDocument() const { return document.get() && m_inDocument; }
       bool styleElement() const { return m_styleElement; }
       bool implicitNode() const { return m_implicit; }
       void setHasID(bool b=true) { m_hasId = b; }
  @@ -265,9 +252,9 @@
       unsigned nodeIndex() const;
       // Returns the document that this node is associated with. This is guaranteed to always be non-null, as opposed to
       // DOM's ownerDocument() which is null for Document nodes (and sometimes DocumentType nodes).
  -    DocumentImpl* getDocument() const { return document->document(); }
  +    DocumentImpl* getDocument() const { return document.get(); }
   
  -    void setDocument(DocumentPtr *doc);
  +    void setDocument(DocumentImpl *doc);
   
       void addEventListener(const AtomicString &eventType, EventListener *listener, bool useCapture);
       void removeEventListener(const AtomicString &eventType, EventListener *listener, bool useCapture);
  @@ -339,8 +326,6 @@
       /* Like traversePreviousNode, but visits nodes before their children. */
       NodeImpl *traversePreviousNodePostOrder(const NodeImpl *stayWithin = 0) const;
   
  -    DocumentPtr *docPtr() const { return document; }
  -
       NodeImpl *previousEditable() const;
       NodeImpl *nextEditable() const;
       //bool isEditable() const;
  @@ -479,7 +464,7 @@
       SharedPtr<NodeListImpl> getElementsByTagNameNS(const DOMString &namespaceURI, const DOMString &localName);
   
   private: // members
  -    DocumentPtr *document;
  +    DocPtr<DocumentImpl> document;
       NodeImpl *m_previous;
       NodeImpl *m_next;
   protected:
  @@ -513,7 +498,7 @@
   class ContainerNodeImpl : public NodeImpl
   {
   public:
  -    ContainerNodeImpl(DocumentPtr *doc);
  +    ContainerNodeImpl(DocumentImpl *doc);
       virtual ~ContainerNodeImpl();
   
       // DOM methods overridden from  parent classes
  @@ -528,6 +513,7 @@
       // Other methods (not part of DOM)
       void willRemove();
       int willRemoveChild(NodeImpl *child);
  +    void removeAllChildren();
       void removeChildren();
       void cloneChildNodes(NodeImpl *clone);
   
  
  
  
  1.36      +12 -12    WebCore/khtml/xml/dom_textimpl.cpp
  
  Index: dom_textimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_textimpl.cpp,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- dom_textimpl.cpp	2 Nov 2005 08:52:50 -0000	1.35
  +++ dom_textimpl.cpp	8 Nov 2005 08:11:13 -0000	1.36
  @@ -37,13 +37,13 @@
   using namespace DOM::EventNames;
   using namespace khtml;
   
  -CharacterDataImpl::CharacterDataImpl(DocumentPtr *doc)
  +CharacterDataImpl::CharacterDataImpl(DocumentImpl *doc)
       : NodeImpl(doc)
   {
       str = 0;
   }
   
  -CharacterDataImpl::CharacterDataImpl(DocumentPtr *doc, const DOMString &_text)
  +CharacterDataImpl::CharacterDataImpl(DocumentImpl *doc, const DOMString &_text)
       : NodeImpl(doc)
   {
       str = _text.impl() ? _text.impl() : new DOMStringImpl((QChar*)0, 0);
  @@ -291,12 +291,12 @@
   
   // ---------------------------------------------------------------------------
   
  -CommentImpl::CommentImpl(DocumentPtr *doc, const DOMString &_text)
  +CommentImpl::CommentImpl(DocumentImpl *doc, const DOMString &_text)
       : CharacterDataImpl(doc, _text)
   {
   }
   
  -CommentImpl::CommentImpl(DocumentPtr *doc)
  +CommentImpl::CommentImpl(DocumentImpl *doc)
       : CharacterDataImpl(doc)
   {
   }
  @@ -341,12 +341,12 @@
   
   // ### allow having children in text nodes for entities, comments etc.
   
  -TextImpl::TextImpl(DocumentPtr *doc, const DOMString &_text)
  +TextImpl::TextImpl(DocumentImpl *doc, const DOMString &_text)
       : CharacterDataImpl(doc, _text)
   {
   }
   
  -TextImpl::TextImpl(DocumentPtr *doc)
  +TextImpl::TextImpl(DocumentImpl *doc)
       : CharacterDataImpl(doc)
   {
   }
  @@ -489,7 +489,7 @@
   
   TextImpl *TextImpl::createNew(DOMStringImpl *_str)
   {
  -    return new TextImpl(docPtr(),_str);
  +    return new TextImpl(getDocument(), _str);
   }
   
   DOMString TextImpl::toString() const
  @@ -523,11 +523,11 @@
   
   // ---------------------------------------------------------------------------
   
  -CDATASectionImpl::CDATASectionImpl(DocumentPtr *impl, const DOMString &_text) : TextImpl(impl,_text)
  +CDATASectionImpl::CDATASectionImpl(DocumentImpl *impl, const DOMString &_text) : TextImpl(impl,_text)
   {
   }
   
  -CDATASectionImpl::CDATASectionImpl(DocumentPtr *impl) : TextImpl(impl)
  +CDATASectionImpl::CDATASectionImpl(DocumentImpl *impl) : TextImpl(impl)
   {
   }
   
  @@ -559,7 +559,7 @@
   
   TextImpl *CDATASectionImpl::createNew(DOMStringImpl *_str)
   {
  -    return new CDATASectionImpl(docPtr(),_str);
  +    return new CDATASectionImpl(getDocument(), _str);
   }
   
   DOMString CDATASectionImpl::toString() const
  @@ -570,12 +570,12 @@
   
   // ---------------------------------------------------------------------------
   
  -EditingTextImpl::EditingTextImpl(DocumentPtr *impl, const DOMString &text)
  +EditingTextImpl::EditingTextImpl(DocumentImpl *impl, const DOMString &text)
       : TextImpl(impl, text)
   {
   }
   
  -EditingTextImpl::EditingTextImpl(DocumentPtr *impl)
  +EditingTextImpl::EditingTextImpl(DocumentImpl *impl)
       : TextImpl(impl)
   {
   }
  
  
  
  1.21      +10 -10    WebCore/khtml/xml/dom_textimpl.h
  
  Index: dom_textimpl.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_textimpl.h,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- dom_textimpl.h	16 Sep 2005 22:42:20 -0000	1.20
  +++ dom_textimpl.h	8 Nov 2005 08:11:13 -0000	1.21
  @@ -38,8 +38,8 @@
   class CharacterDataImpl : public NodeImpl
   {
   public:
  -    CharacterDataImpl(DocumentPtr *doc, const DOMString &_text);
  -    CharacterDataImpl(DocumentPtr *doc);
  +    CharacterDataImpl(DocumentImpl *doc, const DOMString &_text);
  +    CharacterDataImpl(DocumentImpl *doc);
       virtual ~CharacterDataImpl();
   
       // DOM methods & attributes for CharacterData
  @@ -90,8 +90,8 @@
   class CommentImpl : public CharacterDataImpl
   {
   public:
  -    CommentImpl(DocumentPtr *doc, const DOMString &_text);
  -    CommentImpl(DocumentPtr *doc);
  +    CommentImpl(DocumentImpl *doc, const DOMString &_text);
  +    CommentImpl(DocumentImpl *doc);
       virtual ~CommentImpl();
   
       // DOM methods overridden from  parent classes
  @@ -112,8 +112,8 @@
   class TextImpl : public CharacterDataImpl
   {
   public:
  -    TextImpl(DocumentPtr *impl, const DOMString &_text);
  -    TextImpl(DocumentPtr *impl);
  +    TextImpl(DocumentImpl *impl, const DOMString &_text);
  +    TextImpl(DocumentImpl *impl);
       virtual ~TextImpl();
   
       // DOM methods & attributes for CharacterData
  @@ -151,8 +151,8 @@
   {
   // ### should these have id==ID_TEXT
   public:
  -    CDATASectionImpl(DocumentPtr *impl, const DOMString &_text);
  -    CDATASectionImpl(DocumentPtr *impl);
  +    CDATASectionImpl(DocumentImpl *impl, const DOMString &_text);
  +    CDATASectionImpl(DocumentImpl *impl);
       virtual ~CDATASectionImpl();
   
       // DOM methods overridden from  parent classes
  @@ -175,8 +175,8 @@
   class EditingTextImpl : public TextImpl
   {
   public:
  -    EditingTextImpl(DocumentPtr *impl, const DOMString &text);
  -    EditingTextImpl(DocumentPtr *impl);
  +    EditingTextImpl(DocumentImpl *impl, const DOMString &text);
  +    EditingTextImpl(DocumentImpl *impl);
       virtual ~EditingTextImpl();
   
       virtual bool rendererIsNeeded(khtml::RenderStyle *);
  
  
  
  1.18      +11 -11    WebCore/khtml/xml/dom_xmlimpl.cpp
  
  Index: dom_xmlimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_xmlimpl.cpp,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- dom_xmlimpl.cpp	27 Oct 2005 06:03:32 -0000	1.17
  +++ dom_xmlimpl.cpp	8 Nov 2005 08:11:13 -0000	1.18
  @@ -36,7 +36,7 @@
   
   namespace DOM {
   
  -EntityImpl::EntityImpl(DocumentPtr *doc) : ContainerNodeImpl(doc)
  +EntityImpl::EntityImpl(DocumentImpl *doc) : ContainerNodeImpl(doc)
   {
       m_publicId = 0;
       m_systemId = 0;
  @@ -44,7 +44,7 @@
       m_name = 0;
   }
   
  -EntityImpl::EntityImpl(DocumentPtr *doc, DOMString _name) : ContainerNodeImpl(doc)
  +EntityImpl::EntityImpl(DocumentImpl *doc, DOMString _name) : ContainerNodeImpl(doc)
   {
       m_publicId = 0;
       m_systemId = 0;
  @@ -54,7 +54,7 @@
           m_name->ref();
   }
   
  -EntityImpl::EntityImpl(DocumentPtr *doc, DOMString _publicId, DOMString _systemId, DOMString _notationName) : ContainerNodeImpl(doc)
  +EntityImpl::EntityImpl(DocumentImpl *doc, DOMString _publicId, DOMString _systemId, DOMString _notationName) : ContainerNodeImpl(doc)
   {
       m_publicId = _publicId.impl();
       if (m_publicId)
  @@ -164,12 +164,12 @@
   
   // -------------------------------------------------------------------------
   
  -EntityReferenceImpl::EntityReferenceImpl(DocumentPtr *doc) : ContainerNodeImpl(doc)
  +EntityReferenceImpl::EntityReferenceImpl(DocumentImpl *doc) : ContainerNodeImpl(doc)
   {
       m_entityName = 0;
   }
   
  -EntityReferenceImpl::EntityReferenceImpl(DocumentPtr *doc, DOMStringImpl *_entityName) : ContainerNodeImpl(doc)
  +EntityReferenceImpl::EntityReferenceImpl(DocumentImpl *doc, DOMStringImpl *_entityName) : ContainerNodeImpl(doc)
   {
       m_entityName = _entityName;
       if (m_entityName)
  @@ -194,7 +194,7 @@
   
   NodeImpl *EntityReferenceImpl::cloneNode ( bool deep )
   {
  -    EntityReferenceImpl *clone = new EntityReferenceImpl(docPtr(),m_entityName);
  +    EntityReferenceImpl *clone = new EntityReferenceImpl(getDocument(), m_entityName);
       // ### make sure children are readonly
       // ### since we are a reference, should we clone children anyway (even if not deep?)
       if (deep)
  @@ -230,14 +230,14 @@
   
   // -------------------------------------------------------------------------
   
  -NotationImpl::NotationImpl(DocumentPtr *doc) : ContainerNodeImpl(doc)
  +NotationImpl::NotationImpl(DocumentImpl *doc) : ContainerNodeImpl(doc)
   {
       m_publicId = 0;
       m_systemId = 0;
       m_name = 0;
   }
   
  -NotationImpl::NotationImpl(DocumentPtr *doc, DOMString _name, DOMString _publicId, DOMString _systemId) : ContainerNodeImpl(doc)
  +NotationImpl::NotationImpl(DocumentImpl *doc, DOMString _name, DOMString _publicId, DOMString _systemId) : ContainerNodeImpl(doc)
   {
       m_name = _name.impl();
       if (m_name)
  @@ -298,7 +298,7 @@
   // ### need a way of updating these properly whenever child nodes of the processing instruction
   // change or are added/removed
   
  -ProcessingInstructionImpl::ProcessingInstructionImpl(DocumentPtr *doc) : ContainerNodeImpl(doc)
  +ProcessingInstructionImpl::ProcessingInstructionImpl(DocumentImpl *doc) : ContainerNodeImpl(doc)
   {
       m_target = 0;
       m_data = 0;
  @@ -310,7 +310,7 @@
   #endif
   }
   
  -ProcessingInstructionImpl::ProcessingInstructionImpl(DocumentPtr *doc, DOMString _target, DOMString _data) : ContainerNodeImpl(doc)
  +ProcessingInstructionImpl::ProcessingInstructionImpl(DocumentImpl *doc, DOMString _target, DOMString _data) : ContainerNodeImpl(doc)
   {
       m_target = _target.impl();
       if (m_target)
  @@ -384,7 +384,7 @@
   NodeImpl *ProcessingInstructionImpl::cloneNode ( bool /*deep*/)
   {
       // ### copy m_localHref
  -    return new ProcessingInstructionImpl(docPtr(),m_target,m_data);
  +    return new ProcessingInstructionImpl(getDocument(), m_target, m_data);
   }
   
   DOMString ProcessingInstructionImpl::localHref() const
  
  
  
  1.15      +9 -9      WebCore/khtml/xml/dom_xmlimpl.h
  
  Index: dom_xmlimpl.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_xmlimpl.h,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- dom_xmlimpl.h	27 Oct 2005 06:03:33 -0000	1.14
  +++ dom_xmlimpl.h	8 Nov 2005 08:11:14 -0000	1.15
  @@ -42,9 +42,9 @@
   class EntityImpl : public ContainerNodeImpl
   {
   public:
  -    EntityImpl(DocumentPtr *doc);
  -    EntityImpl(DocumentPtr *doc, DOMString _name);
  -    EntityImpl(DocumentPtr *doc, DOMString _publicId, DOMString _systemId, DOMString _notationName);
  +    EntityImpl(DocumentImpl *doc);
  +    EntityImpl(DocumentImpl *doc, DOMString _name);
  +    EntityImpl(DocumentImpl *doc, DOMString _publicId, DOMString _systemId, DOMString _notationName);
       virtual ~EntityImpl();
   
       // DOM methods & attributes for Entity
  @@ -76,8 +76,8 @@
   class EntityReferenceImpl : public ContainerNodeImpl
   {
   public:
  -    EntityReferenceImpl(DocumentPtr *doc);
  -    EntityReferenceImpl(DocumentPtr *doc, DOMStringImpl *_entityName);
  +    EntityReferenceImpl(DocumentImpl *doc);
  +    EntityReferenceImpl(DocumentImpl *doc, DOMStringImpl *_entityName);
       virtual ~EntityReferenceImpl();
   
       // DOM methods overridden from  parent classes
  @@ -98,8 +98,8 @@
   class NotationImpl : public ContainerNodeImpl
   {
   public:
  -    NotationImpl(DocumentPtr *doc);
  -    NotationImpl(DocumentPtr *doc, DOMString _name, DOMString _publicId, DOMString _systemId);
  +    NotationImpl(DocumentImpl *doc);
  +    NotationImpl(DocumentImpl *doc, DOMString _name, DOMString _publicId, DOMString _systemId);
       virtual ~NotationImpl();
   
       // DOM methods & attributes for Notation
  @@ -127,8 +127,8 @@
   class ProcessingInstructionImpl : public ContainerNodeImpl, private khtml::CachedObjectClient
   {
   public:
  -    ProcessingInstructionImpl(DocumentPtr *doc);
  -    ProcessingInstructionImpl(DocumentPtr *doc, DOMString _target, DOMString _data);
  +    ProcessingInstructionImpl(DocumentImpl *doc);
  +    ProcessingInstructionImpl(DocumentImpl *doc, DOMString _target, DOMString _data);
       virtual ~ProcessingInstructionImpl();
   
       // DOM methods & attributes for Notation
  
  
  
  1.51      +20 -21    WebCore/khtml/xml/xml_tokenizer.cpp
  
  Index: xml_tokenizer.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/xml_tokenizer.cpp,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- xml_tokenizer.cpp	1 Nov 2005 07:16:08 -0000	1.50
  +++ xml_tokenizer.cpp	8 Nov 2005 08:11:14 -0000	1.51
  @@ -68,7 +68,7 @@
   class XMLTokenizer : public Tokenizer, public CachedObjectClient
   {
   public:
  -    XMLTokenizer(DocumentPtr *, KHTMLView * = 0);
  +    XMLTokenizer(DocumentImpl *, KHTMLView * = 0);
       XMLTokenizer(DocumentFragmentImpl *, ElementImpl *);
       ~XMLTokenizer();
   
  @@ -112,7 +112,7 @@
       bool enterText();
       void exitText();
   
  -    DocumentPtr *m_doc;
  +    DocumentImpl *m_doc;
       KHTMLView *m_view;
   
       QString m_xmlCode;
  @@ -190,9 +190,9 @@
   
   // --------------------------------
   
  -XMLTokenizer::XMLTokenizer(DocumentPtr *_doc, KHTMLView *_view)
  +XMLTokenizer::XMLTokenizer(DocumentImpl *_doc, KHTMLView *_view)
       : m_doc(_doc), m_view(_view),
  -      m_context(NULL), m_currentNode(m_doc->document()),
  +      m_context(NULL), m_currentNode(m_doc),
         m_sawError(false), m_errorCount(0),
         m_lastErrorLine(0), m_scriptsIt(0), m_cachedScript(0), m_parsingFragment(false)
   {
  @@ -201,7 +201,7 @@
   }
   
   XMLTokenizer::XMLTokenizer(DocumentFragmentImpl *fragment, ElementImpl *parentElement)
  -    : m_doc(fragment->docPtr()), m_view(0),
  +    : m_doc(fragment->getDocument()), m_view(0),
         m_context(0), m_currentNode(fragment),
         m_sawError(false), m_errorCount(0),
         m_lastErrorLine(0), m_scriptsIt(0), m_cachedScript(0), m_parsingFragment(true)
  @@ -329,7 +329,7 @@
       }
   
       int exceptioncode = 0;
  -    ElementImpl *newElement = m_doc->document()->createElementNS(uri, qName, exceptioncode);
  +    ElementImpl *newElement = m_doc->createElementNS(uri, qName, exceptioncode);
       if (!newElement)
           return;
       
  @@ -399,7 +399,7 @@
   
   bool XMLTokenizer::enterText()
   {
  -    NodeImpl *newNode = m_doc->document()->createTextNode("");
  +    NodeImpl *newNode = m_doc->createTextNode("");
       if (m_currentNode->addChild(newNode)) {
           m_currentNode = newNode;
           return true;
  @@ -478,7 +478,7 @@
       
       // ### handle exceptions
       int exception = 0;
  -    ProcessingInstructionImpl *pi = m_doc->document()->createProcessingInstruction(
  +    ProcessingInstructionImpl *pi = m_doc->createProcessingInstruction(
           toQString(target),
           toQString(data),
           exception);
  @@ -487,11 +487,11 @@
   
       m_currentNode->addChild(pi);
       // don't load stylesheets for standalone documents
  -    if (m_doc->document()->part()) {
  +    if (m_doc->part()) {
   	m_sawXSLTransform = !pi->checkStyleSheet();
   #ifdef KHTML_XSLT
           // Pretend we didn't see this PI if we're the result of a transform.
  -        if (m_sawXSLTransform && !m_doc->document()->transformSourceDocument())
  +        if (m_sawXSLTransform && !m_doc->transformSourceDocument())
   #else
           if (m_sawXSLTransform)
   #endif
  @@ -509,7 +509,7 @@
           exitText();
   
       int ignoreException = 0;
  -    NodeImpl *newNode = m_doc->document()->createCDATASection("", ignoreException);
  +    NodeImpl *newNode = m_doc->createCDATASection("", ignoreException);
       if (m_currentNode->addChild(newNode)) {
           if (m_view && !newNode->attached())
               newNode->attach();
  @@ -534,7 +534,7 @@
       if (m_currentNode->nodeType() == Node::TEXT_NODE)
           exitText();
       // ### handle exceptions
  -    m_currentNode->addChild(m_doc->document()->createComment(toQString(s)));
  +    m_currentNode->addChild(m_doc->createComment(toQString(s)));
   }
   
   void XMLTokenizer::internalSubset(const xmlChar *name, const xmlChar *externalID, const xmlChar *systemID)
  @@ -542,12 +542,11 @@
       if (m_parserStopped)
           return;
   
  -    DocumentPtr *docPtr = m_doc;
  -    DocumentImpl *doc = docPtr->document();
  +    DocumentImpl *doc = m_doc;
       if (!doc)
           return;
   
  -    doc->setDocType(new DocumentTypeImpl(docPtr, toQString(name), toQString(externalID), toQString(systemID)));
  +    doc->setDocType(new DocumentTypeImpl(doc, toQString(name), toQString(externalID), toQString(systemID)));
   }
   
   inline XMLTokenizer *getTokenizer(void *closure)
  @@ -666,7 +665,7 @@
       } else {
           // Parsing was successful. Now locate all html <script> tags in the document and execute them
           // one by one.
  -        addScripts(m_doc->document());
  +        addScripts(m_doc);
           m_scriptsIt = new QPtrListIterator<HTMLScriptElementImpl>(m_scripts);
           executeScripts();
       }
  @@ -682,7 +681,7 @@
   
       // Create elements for display
       int exceptioncode = 0;
  -    DocumentImpl *doc = m_doc->document();
  +    DocumentImpl *doc = m_doc;
       NodeImpl* root = doc->documentElement();
       if (!root) {
           root = doc->createElementNS(xhtmlNamespaceURI, "html", exceptioncode);
  @@ -744,9 +743,9 @@
           QString charset = m_scriptsIt->current()->getAttribute(charsetAttr).qstring();
   
   	// don't load external scripts for standalone documents (for now)
  -        if (scriptSrc != "" && m_doc->document()->part()) {
  +        if (scriptSrc != "" && m_doc->part()) {
               // we have a src attribute
  -            m_cachedScript = m_doc->document()->docLoader()->requestScript(scriptSrc, charset);
  +            m_cachedScript = m_doc->docLoader()->requestScript(scriptSrc, charset);
               ++(*m_scriptsIt);
               m_cachedScript->ref(this); // will call executeScripts() again if already cached
               return;
  @@ -773,7 +772,7 @@
   
       // All scripts have finished executing, so calculate the style for the document and close
       // the last element
  -    m_doc->document()->updateStyleSelector();
  +    m_doc->updateStyleSelector();
   }
   
   void XMLTokenizer::notifyFinished(CachedObject *finishedObj)
  @@ -818,7 +817,7 @@
   }
   #endif
   
  -Tokenizer *newXMLTokenizer(DocumentPtr *d, KHTMLView *v)
  +Tokenizer *newXMLTokenizer(DocumentImpl *d, KHTMLView *v)
   {
       return new XMLTokenizer(d, v);
   }
  
  
  
  1.22      +1 -2      WebCore/khtml/xml/xml_tokenizer.h
  
  Index: xml_tokenizer.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/xml_tokenizer.h,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- xml_tokenizer.h	27 Oct 2005 22:34:50 -0000	1.21
  +++ xml_tokenizer.h	8 Nov 2005 08:11:14 -0000	1.22
  @@ -35,7 +35,6 @@
   class KHTMLView;
   
   namespace DOM {
  -    class DocumentPtr;
       class DocumentImpl;
       class DocumentFragmentImpl;
       class ElementImpl;
  @@ -83,7 +82,7 @@
   #endif
   };
   
  -Tokenizer *newXMLTokenizer(DOM::DocumentPtr *, KHTMLView * = 0);
  +Tokenizer *newXMLTokenizer(DOM::DocumentImpl *, KHTMLView * = 0);
   #ifdef KHTML_XSLT
   void *xmlDocPtrForString(const QString &source, const QString &url = QString());
   #endif
  
  
  
  1.1                  WebCore/khtml/xml/DocPtr.h
  
  Index: DocPtr.h
  ===================================================================
  // -*- mode: c++; c-basic-offset: 4 -*-
  /*
   * This file is part of the DOM implementation for KDE.
   * Copyright (C) 2005 Apple Computer, Inc.
   *
   * This library is free software; you can redistribute it and/or
   * modify it under the terms of the GNU Library General Public
   * License as published by the Free Software Foundation; either
   * version 2 of the License, or (at your option) any later version.
   *
   * This library is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   * Library General Public License for more details.
   *
   * You should have received a copy of the GNU Library General Public License
   * along with this library; see the file COPYING.LIB.  If not, write to
   * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   * Boston, MA 02111-1307, USA.
   *
   */
  #ifndef DOM_DocPtr_h
  #define DOM_DocPtr_h
  
  namespace DOM {
  
  template <class T> class DocPtr
  {
   public:
      DocPtr() : m_ptr(NULL) {}
      DocPtr(T *ptr) : m_ptr(ptr) { if (ptr) ptr->selfOnlyRef(); }
      DocPtr(const DocPtr &o) : m_ptr(o.m_ptr) { if (T *ptr = m_ptr) ptr->selfOnlyRefRef(); }
      ~DocPtr() { if (T *ptr = m_ptr) ptr->selfOnlyDeref(); }
      
      template <class U> DocPtr(const DocPtr<U> &o) : m_ptr(o.get()) { if (T *ptr = m_ptr) ptr->selfOnlyRef(); }
      
      // FIXME: Deprecate in favor of operators below, then remove?
      bool isNull() const { return m_ptr == NULL; }
      bool notNull() const { return m_ptr != NULL; }
      
      // FIXME: Deprecate in favor of operator=, then remove?
      void reset() { if (T *ptr = m_ptr) ptr->selfOnlyDeref(); m_ptr = NULL; }
      void reset(T *o) { if (o) o->selfOnlyRef(); if (T *ptr = m_ptr) ptr->selfOnlyDeref(); m_ptr = o; }
  
      void resetSkippingRef(T *o) { m_ptr = o; }
      
      T *get() const { return m_ptr; }
      
      T &operator*() const { return *m_ptr; }
      T *operator->() const { return m_ptr; }
      
      bool operator!() const { return m_ptr == NULL; }
      operator bool() const { return m_ptr != NULL; }
      
      DocPtr &operator=(const DocPtr &);
      DocPtr &operator=(T *);
      
   private:
      T *m_ptr;
      
      operator int() const; // deliberately not implemented; helps prevent operator bool from converting to int accidentally
  };
  
  template <class T> DocPtr<T> &DocPtr<T>::operator=(const DocPtr<T> &o) 
  {
      T *optr = o.m_ptr;
      if (optr)
          optr->selfOnlyRef();
      if (T *ptr = m_ptr)
          ptr->selfOnlyDeref();
      m_ptr = optr;
          return *this;
  }
  
  template <class T> inline DocPtr<T> &DocPtr<T>::operator=(T *optr)
  {
      if (optr)
          optr->selfOnlyRef();
      if (T *ptr = m_ptr)
          ptr->selfOnlyDeref();
      m_ptr = optr;
      return *this;
  }
  
  template <class T> inline bool operator==(const DocPtr<T> &a, const DocPtr<T> &b) 
  { 
      return a.get() == b.get(); 
  }
  
  template <class T> inline bool operator==(const DocPtr<T> &a, const T *b) 
  { 
      return a.get() == b; 
  }
  
  template <class T> inline bool operator==(const T *a, const DocPtr<T> &b) 
  {
      return a == b.get(); 
  }
  
  template <class T> inline bool operator!=(const DocPtr<T> &a, const DocPtr<T> &b) 
  { 
      return a.get() != b.get(); 
  }
  
  template <class T> inline bool operator!=(const DocPtr<T> &a, const T *b)
  {
      return a.get() != b; 
  }
  
  template <class T> inline bool operator!=(const T *a, const DocPtr<T> &b) 
  { 
      return a != b.get(); 
  }
  
  } // namespace DOM
  
  #endif DOM_DocPtr_h
  
  
  
  1.15      +1 -1      WebCore/khtml/xsl/xslt_processorimpl.cpp
  
  Index: xslt_processorimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xsl/xslt_processorimpl.cpp,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- xslt_processorimpl.cpp	27 Oct 2005 22:34:52 -0000	1.14
  +++ xslt_processorimpl.cpp	8 Nov 2005 08:11:18 -0000	1.15
  @@ -221,7 +221,7 @@
   
   static inline SharedPtr<DocumentFragmentImpl> createFragmentFromSource(QString sourceString, QString sourceMIMEType, NodeImpl *sourceNode, DocumentImpl *ouputDoc)
   {
  -    SharedPtr<DocumentFragmentImpl> fragment = new DocumentFragmentImpl(ouputDoc->docPtr());
  +    SharedPtr<DocumentFragmentImpl> fragment = new DocumentFragmentImpl(ouputDoc);
       
       if (sourceMIMEType == "text/html")
           parseHTMLDocumentFragment(sourceString, fragment.get());
  
  
  
  1.78      +18 -0     LayoutTests/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/LayoutTests/ChangeLog,v
  retrieving revision 1.77
  retrieving revision 1.78
  diff -u -r1.77 -r1.78
  --- ChangeLog	8 Nov 2005 00:49:35 -0000	1.77
  +++ ChangeLog	8 Nov 2005 08:11:19 -0000	1.78
  @@ -1,3 +1,21 @@
  +2005-11-07  Maciej Stachowiak  <mjs at apple.com>
  +
  +        Reviewed by Eric, Geoff and Darin.
  +
  +	- added test cases for <rdar://problem/4118258> XML DOM trees freed prematurely unless reference held to document node (causes crash)
  +
  +	Also updated the GC tests to try a little harder to trigger GC,
  +	the old way might not work as well with the reworking of SimpleNumber.
  +	
  +        * fast/dom/gc-1.html:
  +        * fast/dom/gc-2.html:
  +        * fast/dom/gc-3.html:
  +        * fast/dom/gc-5.html:
  +        * fast/dom/gc-6-expected.txt: Added.
  +        * fast/dom/gc-6.html: Added.
  +        * fast/dom/gc-7-expected.txt: Added.
  +        * fast/dom/gc-7.html: Added.
  +
   2005-11-07  David Harrison  <harrison at apple.com>
   
           Layout test for http://bugzilla.opendarwin.org/show_bug.cgi?id=3739
  
  
  
  1.2       +4 -2      LayoutTests/fast/dom/gc-1.html
  
  Index: gc-1.html
  ===================================================================
  RCS file: /cvs/root/LayoutTests/fast/dom/gc-1.html,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- gc-1.html	31 May 2005 01:20:46 -0000	1.1
  +++ gc-1.html	8 Nov 2005 08:11:19 -0000	1.2
  @@ -6,8 +6,10 @@
   
       // create lots of objects to force a garbage collection
       var i = 0;
  -    while (i < 1000) {
  -        i = i+1;
  +    var s;
  +    while (i < 5000) {
  +        i = i+1.11;
  +	s = s + " ";
       }
   
       var output= document.getElementById("output");
  
  
  
  1.2       +5 -3      LayoutTests/fast/dom/gc-2.html
  
  Index: gc-2.html
  ===================================================================
  RCS file: /cvs/root/LayoutTests/fast/dom/gc-2.html,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- gc-2.html	31 May 2005 01:20:46 -0000	1.1
  +++ gc-2.html	8 Nov 2005 08:11:19 -0000	1.2
  @@ -11,9 +11,11 @@
       document.getElementById("div").innerHTML = "<span>replacement content</span>";
   
       // create lots of objects to force a garbage collection
  -    var i = "";
  -    while (i < 1000) {
  -        i = i + "a";
  +    var i = 0;
  +    var s;
  +    while (i < 5000) {
  +        i = i+1.11;
  +	s = s + " ";
       }
   
       var output= document.getElementById("output");
  
  
  
  1.3       +4 -2      LayoutTests/fast/dom/gc-3.html
  
  Index: gc-3.html
  ===================================================================
  RCS file: /cvs/root/LayoutTests/fast/dom/gc-3.html,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- gc-3.html	18 Oct 2005 00:16:47 -0000	1.2
  +++ gc-3.html	8 Nov 2005 08:11:19 -0000	1.3
  @@ -9,8 +9,10 @@
   
       // create lots of objects to force a garbage collection
       var i = 0;
  -    while (i < 1000) {
  -        i = i+1;
  +    var s;
  +    while (i < 5000) {
  +        i = i+1.11;
  +	s = s + " ";
       }
   
       var output= document.getElementById("output");
  
  
  
  1.2       +4 -2      LayoutTests/fast/dom/gc-5.html
  
  Index: gc-5.html
  ===================================================================
  RCS file: /cvs/root/LayoutTests/fast/dom/gc-5.html,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- gc-5.html	14 Jul 2005 04:48:45 -0000	1.1
  +++ gc-5.html	8 Nov 2005 08:11:19 -0000	1.2
  @@ -10,8 +10,10 @@
   
       // create lots of objects to force a garbage collection
       var i = 0;
  -    while (i < 1000) {
  -        i = i+1;
  +    var s;
  +    while (i < 5000) {
  +        i = i+1.11;
  +	s = s + " ";
       }
   
       var output= document.getElementById("output");
  
  
  
  1.1                  LayoutTests/fast/dom/gc-6-expected.txt
  
  Index: gc-6-expected.txt
  ===================================================================
  This test verifies that DOM documents are protected against garbage collection but without necessarily keeping all their children alive, so long as any node in the document is reachable.
  
  The output should be the following pieces of text on lines by themselves: "B", "[object SPAN]", "null", "[object HTMLDocument]".
  
  
  
  
  
  1.1                  LayoutTests/fast/dom/gc-6.html
  
  Index: gc-6.html
  ===================================================================
  <head>
  <script>
  
  function doit()
  {
      var frame = document.getElementById("frame");
      var spanB = frame.contentDocument.getElementById("span-B");
      spanB.customProperty = "B";
      frame.src="about:blank";
  
      // create lots of objects to force a garbage collection
      var i = 0;
      var s;
      while (i < 5000) {
          i = i+1.11;
  	s = s + " ";
      }
  
      var output= document.getElementById("output");
  
      output.innerHTML += spanB.customProperty + "<BR>";
      output.innerHTML += spanB + "<BR>";
      output.innerHTML += spanB.parentNode + "<BR>";
      output.innerHTML += spanB.ownerDocument + "<BR>";
  }
  
  if (window.layoutTestController) {
      layoutTestController.dumpAsText();
  }
  
  </script>
  </head>
  
  <body onload="doit()">
  <div style="border: 1px solid red">
  <p>
  This test verifies that DOM documents are protected against garbage
  collection but without necessarily keeping all their children alive,
  so long as any node in the document is reachable.
  </p>
  <p>
  The output should be the following pieces of text on lines by
  themselves: "B", "[object SPAN]", "null", "[object HTMLDocument]".
  </p>
  </div>
  
  <div id="output">
  </div>
  
  <iframe id="frame" src='data:text/html,<div id="div"><span id="span-A"><span id="span-B"><span id="span-C">original span</span></span></span></div>'>
  </body>
  
  
  
  1.1                  LayoutTests/fast/dom/gc-7-expected.txt
  
  Index: gc-7-expected.txt
  ===================================================================
  This test verifies that bjects are protected against garbage collection as long as the document is alive (for contrast with test 6).
  
  The output should be the following pieces of text on lines by themselves: "B", "[object SPAN]", "[object SPAN]", "[object HTMLDocument]".
  
  
  
  
  
  1.1                  LayoutTests/fast/dom/gc-7.html
  
  Index: gc-7.html
  ===================================================================
  <head>
  <script>
  
  function doit()
  {
      var frame = document.getElementById("frame");
      frameDoc = frame.contentDocument;
      var spanB = frame.contentDocument.getElementById("span-B");
      spanB.customProperty = "B";
      frame.src="about:blank";
  
      // create lots of objects to force a garbage collection
      var i = 0;
      var s;
      while (i < 5000) {
          i = i+1.11;
  	s = s + " ";
      }
  
      var output= document.getElementById("output");
  
      output.innerHTML += spanB.customProperty + "<BR>";
      output.innerHTML += spanB + "<BR>";
      output.innerHTML += spanB.parentNode + "<BR>";
      output.innerHTML += spanB.ownerDocument + "<BR>";
  }
  
  if (window.layoutTestController) {
      layoutTestController.dumpAsText();
  }
  
  </script>
  </head>
  
  <body onload="doit()">
  <div style="border: 1px solid red">
  <p>
  This test verifies that bjects are protected against garbage
  collection as long as the document is alive (for contrast with test
  6).
  </p>
  <p>
  The output should be the following pieces of text on lines by
  themselves: "B", "[object SPAN]", "[object SPAN]", "[object HTMLDocument]".
  </p>
  </div>
  
  <div id="output">
  </div>
  
  <iframe id="frame" src='data:text/html,<div id="div"><span id="span-A"><span id="span-B"><span id="span-C">original span</span></span></span></div>'>
  </body>
  
  
  



More information about the webkit-changes mailing list