2 * This file is part of the DOM implementation for KDE.
4 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
5 * (C) 1999 Antti Koivisto (koivisto@kde.org)
6 * (C) 2001 Dirk Mueller (mueller@kde.org)
7 * Copyright (C) 2004 Apple Computer, Inc.
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Library General Public License for more details.
19 * You should have received a copy of the GNU Library General Public License
20 * along with this library; see the file COPYING.LIB. If not, write to
21 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 * Boston, MA 02111-1307, USA.
25 #ifndef _DOM_DocumentImpl_h_
26 #define _DOM_DocumentImpl_h_
28 #include "xml/dom_elementimpl.h"
29 #include "xml/dom2_traversalimpl.h"
30 #include "misc/shared.h"
32 #include <qstringlist.h>
38 #include <qdatetime.h>
43 #include "KWQSignal.h"
48 class QPaintDeviceMetrics;
54 class KWQAccObjectCache;
58 class CSSStyleSelector;
64 struct DashboardRegionValue;
70 class XBLBindingManager;
75 class AbstractViewImpl;
77 class CDATASectionImpl;
78 class CSSStyleSheetImpl;
79 class CSSMappedAttributeDeclarationImpl;
81 class DocumentFragmentImpl;
84 class DocumentTypeImpl;
86 class DOMImplementation;
88 class EditingTextImpl;
90 class EntityReferenceImpl;
93 class GenericRONamedNodeMapImpl;
94 class HTMLDocumentImpl;
95 class HTMLElementImpl;
96 class HTMLImageLoader;
97 class HTMLMapElementImpl;
100 class NodeFilterImpl;
101 class NodeIteratorImpl;
103 class ProcessingInstructionImpl;
106 class RegisteredEventListener;
107 class StyleSheetImpl;
108 class StyleSheetListImpl;
110 class TreeWalkerImpl;
112 class XSLStyleSheetImpl;
115 // A range of a node within a document that is "marked", such as being misspelled
116 struct DocumentMarker
120 // Not doing grammar yet, but this is a placeholder for it
124 enum MarkerType type;
125 ulong startOffset, endOffset;
127 bool operator == (const DocumentMarker &o) const {
128 return type == o.type && startOffset == o.startOffset && endOffset == o.endOffset;
130 bool operator != (const DocumentMarker &o) const {
131 return !(*this == o);
135 class DOMImplementationImpl : public khtml::Shared<DOMImplementationImpl>
138 DOMImplementationImpl();
139 ~DOMImplementationImpl();
141 // DOM methods & attributes for DOMImplementation
142 bool hasFeature ( const DOMString &feature, const DOMString &version );
143 DocumentTypeImpl *createDocumentType( const DOMString &qualifiedName, const DOMString &publicId,
144 const DOMString &systemId, int &exceptioncode );
145 DocumentImpl *createDocument( const DOMString &namespaceURI, const DOMString &qualifiedName,
146 const DocumentType &doctype, int &exceptioncode );
148 DOMImplementationImpl* getInterface(const DOMString& feature) const;
150 // From the DOMImplementationCSS interface
151 CSSStyleSheetImpl *createCSSStyleSheet(DOMStringImpl *title, DOMStringImpl *media, int &exceptioncode);
153 // From the HTMLDOMImplementation interface
154 HTMLDocumentImpl* createHTMLDocument( const DOMString& title);
156 // Other methods (not part of DOM)
157 DocumentImpl *createDocument( KHTMLView *v = 0 );
158 HTMLDocumentImpl *createHTMLDocument( KHTMLView *v = 0 );
160 // Returns the static instance of this class - only one instance of this class should
161 // ever be present, and is used as a factory method for creating DocumentImpl objects
162 static DOMImplementationImpl *instance();
165 static DOMImplementation createInstance (DOMImplementationImpl *impl);
169 static DOMImplementationImpl *m_instance;
176 class DocumentImpl : public QObject, public NodeBaseImpl
180 DocumentImpl(DOMImplementationImpl *_implementation, KHTMLView *v);
183 // DOM methods & attributes for Document
185 DocumentTypeImpl *doctype() const;
187 DOMImplementationImpl *implementation() const;
188 virtual ElementImpl *documentElement() const;
189 virtual ElementImpl *createElement ( const DOMString &tagName, int &exceptioncode );
190 DocumentFragmentImpl *createDocumentFragment ();
191 TextImpl *createTextNode ( const DOMString &data );
192 CommentImpl *createComment ( const DOMString &data );
193 CDATASectionImpl *createCDATASection ( const DOMString &data );
194 ProcessingInstructionImpl *createProcessingInstruction ( const DOMString &target, const DOMString &data );
195 Attr createAttribute(NodeImpl::Id id);
196 EntityReferenceImpl *createEntityReference ( const DOMString &name );
197 NodeImpl *importNode( NodeImpl *importedNode, bool deep, int &exceptioncode );
198 virtual ElementImpl *createElementNS ( const DOMString &_namespaceURI, const DOMString &_qualifiedName, int &exceptioncode );
199 ElementImpl *getElementById ( const DOMString &elementId ) const;
201 // Actually part of HTMLDocument, but used for giving XML documents a window title as well
202 DOMString title() const { return m_title; }
203 void setTitle(DOMString _title);
205 // DOM methods overridden from parent classes
207 virtual DOMString nodeName() const;
208 virtual unsigned short nodeType() const;
210 // Other methods (not part of DOM)
211 virtual bool isDocumentNode() const { return true; }
212 virtual bool isHTMLDocument() const { return false; }
214 ElementImpl *createHTMLElement(const DOMString &tagName, int &exceptioncode);
215 ElementImpl *createHTMLElement(unsigned short tagID);
217 khtml::CSSStyleSelector *styleSelector() { return m_styleSelector; }
219 ElementImpl *DocumentImpl::getElementByAccessKey( const DOMString &key );
222 * Updates the pending sheet count and then calls updateStyleSelector.
224 void stylesheetLoaded();
227 * This method returns true if all top-level stylesheets have loaded (including
228 * any @imports that they may be loading).
230 bool haveStylesheetsLoaded() { return m_pendingStylesheets <= 0 || m_ignorePendingStylesheets; }
233 * Increments the number of pending sheets. The <link> elements
234 * invoke this to add themselves to the loading list.
236 void addPendingSheet() { m_pendingStylesheets++; }
239 * Called when one or more stylesheets in the document may have been added, removed or changed.
241 * Creates a new style selector and assign it to this document. This is done by iterating through all nodes in
242 * document (or those before <BODY> in a HTML document), searching for stylesheets. Stylesheets can be contained in
243 * <LINK>, <STYLE> or <BODY> elements, as well as processing instructions (XML documents only). A list is
244 * constructed from these which is used to create the a new style selector which collates all of the stylesheets
245 * found and is used to calculate the derived styles for all rendering objects.
247 void updateStyleSelector();
249 void recalcStyleSelector();
251 bool usesDescendantRules() { return m_usesDescendantRules; }
252 void setUsesDescendantRules(bool b) { m_usesDescendantRules = b; }
253 bool usesSiblingRules() { return m_usesSiblingRules; }
254 void setUsesSiblingRules(bool b) { m_usesSiblingRules = b; }\
258 // Query all registered elements for their state
259 QStringList docState();
260 void registerMaintainsState(NodeImpl* e) { m_maintainsState.append(e); }
261 void deregisterMaintainsState(NodeImpl* e) { m_maintainsState.removeRef(e); }
263 // Set the state the document should restore to
264 void setRestoreState( const QStringList &s) { m_state = s; }
265 QStringList &restoreState( ) { return m_state; }
267 KHTMLView *view() const { return m_view; }
268 KHTMLPart *part() const;
270 RangeImpl *createRange();
272 NodeIteratorImpl *createNodeIterator(NodeImpl *root, unsigned long whatToShow,
273 NodeFilterImpl *filter, bool expandEntityReferences, int &exceptioncode);
275 TreeWalkerImpl *createTreeWalker(NodeImpl *root, unsigned long whatToShow,
276 NodeFilterImpl *filter, bool expandEntityReferences, int &exceptioncode);
278 // Special support for editing
279 CSSStyleDeclarationImpl *createCSSStyleDeclaration();
280 EditingTextImpl *createEditingTextNode(const DOMString &text);
282 virtual void recalcStyle( StyleChange = NoChange );
283 static QPtrList<DocumentImpl> * changedDocuments;
284 virtual void updateRendering();
286 void updateLayoutIgnorePendingStylesheets();
287 static void updateDocumentsRendering();
288 khtml::DocLoader *docLoader() { return m_docLoader; }
290 virtual void attach();
291 virtual void detach();
293 RenderArena* renderArena() { return m_renderArena; }
296 KWQAccObjectCache* getAccObjectCache();
299 // to get visually ordered hebrew and arabic pages right
300 void setVisuallyOrdered();
302 void updateSelection();
307 void implicitClose();
308 void write ( const DOMString &text );
309 void write ( const QString &text );
310 void writeln ( const DOMString &text );
311 void finishParsing ( );
314 QString URL() const { return m_url; }
315 void setURL(const QString& url);
317 QString baseURL() const { return m_baseURL.isEmpty() ? m_url : m_baseURL; }
318 void setBaseURL(const QString& baseURL) { m_baseURL = baseURL; }
320 QString baseTarget() const { return m_baseTarget; }
321 void setBaseTarget(const QString& baseTarget) { m_baseTarget = baseTarget; }
324 QString completeURL(const QString &);
326 QString completeURL(const QString& url) { return KURL(baseURL(),url).url(); };
329 // from cachedObjectClient
330 virtual void setStyleSheet(const DOMString &url, const DOMString &sheetStr);
331 void setUserStyleSheet(const QString& sheet);
332 QString userStyleSheet() const { return m_usersheet; }
333 void setPrintStyleSheet(const QString& sheet) { m_printSheet = sheet; }
334 QString printStyleSheet() const { return m_printSheet; }
336 CSSStyleSheetImpl* elementSheet();
337 virtual khtml::Tokenizer *createTokenizer();
338 khtml::Tokenizer *tokenizer() { return m_tokenizer; }
340 QPaintDeviceMetrics *paintDeviceMetrics() { return m_paintDeviceMetrics; }
341 QPaintDevice *paintDevice() const { return m_paintDevice; }
342 void setPaintDevice( QPaintDevice *dev );
356 virtual void determineParseMode( const QString &str );
357 void setParseMode( ParseMode m ) { pMode = m; }
358 ParseMode parseMode() const { return pMode; }
360 bool inCompatMode() { return pMode == Compat; }
361 bool inAlmostStrictMode() { return pMode == AlmostStrict; }
362 bool inStrictMode() { return pMode == Strict; }
364 void setHTMLMode( HTMLMode m ) { hMode = m; }
365 HTMLMode htmlMode() const { return hMode; }
367 void setParsing(bool b);
368 bool parsing() const { return m_bParsing; }
369 int minimumLayoutDelay();
370 bool shouldScheduleLayout();
371 int elapsedTime() const;
373 void setTextColor( QColor color ) { m_textColor = color; }
374 QColor textColor() const { return m_textColor; }
376 const QColor& linkColor() const { return m_linkColor; }
377 const QColor& visitedLinkColor() const { return m_visitedLinkColor; }
378 const QColor& activeLinkColor() const { return m_activeLinkColor; }
379 void setLinkColor(const QColor& c) { m_linkColor = c; }
380 void setVisitedLinkColor(const QColor& c) { m_visitedLinkColor = c; }
381 void setActiveLinkColor(const QColor& c) { m_activeLinkColor = c; }
382 void resetLinkColor();
383 void resetVisitedLinkColor();
384 void resetActiveLinkColor();
387 NodeImpl *findElement( Id id );
389 bool prepareMouseEvent( bool readonly, int x, int y, MouseEvent *ev );
391 virtual bool childAllowed( NodeImpl *newChild );
392 virtual bool childTypeAllowed( unsigned short nodeType );
393 virtual NodeImpl *cloneNode ( bool deep );
395 // ### think about implementing ref'counting for the id's
396 // in order to be able to reassign those that are no longer in use
397 // (could make problems when it is still kept somewhere around, i.e. styleselector)
398 NodeImpl::Id tagId(DOMStringImpl* _namespaceURI, DOMStringImpl *_name, bool readonly);
399 DOMString tagName(NodeImpl::Id _id) const;
401 NodeImpl::Id attrId(DOMStringImpl* _namespaceURI, DOMStringImpl *_name, bool readonly);
402 DOMString attrName(NodeImpl::Id _id) const;
404 // the namespace uri is mapped to the same id for both
405 // tagnames as well as attributes.
406 DOMStringImpl* namespaceURI(NodeImpl::Id _id) const;
408 StyleSheetListImpl* styleSheets();
410 /* Newly proposed CSS3 mechanism for selecting alternate
411 stylesheets using the DOM. May be subject to change as
414 DOMString preferredStylesheetSet();
415 DOMString selectedStylesheetSet();
416 void setSelectedStylesheetSet(const DOMString& aString);
418 QStringList availableStyleSheets() const;
420 NodeImpl *focusNode() const { return m_focusNode; }
421 bool setFocusNode(NodeImpl *newFocusNode);
423 NodeImpl *hoverNode() const { return m_hoverNode; }
424 void setHoverNode(NodeImpl *newHoverNode);
426 // Updates for :target (CSS3 selector).
427 void setCSSTarget(NodeImpl* n);
428 NodeImpl* getCSSTarget();
430 void setDocumentChanged(bool);
432 void attachNodeIterator(NodeIteratorImpl *ni);
433 void detachNodeIterator(NodeIteratorImpl *ni);
434 void notifyBeforeNodeRemoval(NodeImpl *n);
435 AbstractViewImpl *defaultView() const;
436 EventImpl *createEvent(const DOMString &eventType, int &exceptioncode);
438 // keep track of what types of event listeners are registered, so we don't
439 // dispatch events unnecessarily
441 DOMSUBTREEMODIFIED_LISTENER = 0x01,
442 DOMNODEINSERTED_LISTENER = 0x02,
443 DOMNODEREMOVED_LISTENER = 0x04,
444 DOMNODEREMOVEDFROMDOCUMENT_LISTENER = 0x08,
445 DOMNODEINSERTEDINTODOCUMENT_LISTENER = 0x10,
446 DOMATTRMODIFIED_LISTENER = 0x20,
447 DOMCHARACTERDATAMODIFIED_LISTENER = 0x40
450 bool hasListenerType(ListenerType listenerType) const { return (m_listenerTypes & listenerType); }
451 void addListenerType(ListenerType listenerType) { m_listenerTypes = m_listenerTypes | listenerType; }
453 CSSStyleDeclarationImpl *getOverrideStyle(ElementImpl *elt, DOMStringImpl *pseudoElt);
455 typedef QMap<QString, ProcessingInstructionImpl*> LocalStyleRefs;
456 LocalStyleRefs* localStyleRefs() { return &m_localStyleRefs; }
458 virtual void defaultEventHandler(EventImpl *evt);
459 void setHTMLWindowEventListener(int id, EventListener *listener);
460 EventListener *getHTMLWindowEventListener(int id);
461 void removeHTMLWindowEventListener(int id);
463 void addWindowEventListener(int id, EventListener *listener, const bool useCapture);
464 void removeWindowEventListener(int id, EventListener *listener, bool useCapture);
465 bool hasWindowEventListener(int id);
467 EventListener *createHTMLEventListener(QString code, NodeImpl *node);
470 * Searches through the document, starting from fromNode, for the next selectable element that comes after fromNode.
471 * The order followed is as specified in section 17.11.1 of the HTML4 spec, which is elements with tab indexes
472 * first (from lowest to highest), and then elements without tab indexes (in document order).
474 * @param fromNode The node from which to start searching. The node after this will be focused. May be null.
476 * @return The focus node that comes after fromNode
478 * See http://www.w3.org/TR/html4/interact/forms.html#h-17.11.1
480 NodeImpl *nextFocusNode(NodeImpl *fromNode);
483 * Searches through the document, starting from fromNode, for the previous selectable element (that comes _before_)
484 * fromNode. The order followed is as specified in section 17.11.1 of the HTML4 spec, which is elements with tab
485 * indexes first (from lowest to highest), and then elements without tab indexes (in document order).
487 * @param fromNode The node from which to start searching. The node before this will be focused. May be null.
489 * @return The focus node that comes before fromNode
491 * See http://www.w3.org/TR/html4/interact/forms.html#h-17.11.1
493 NodeImpl *previousFocusNode(NodeImpl *fromNode);
495 int nodeAbsIndex(NodeImpl *node);
496 NodeImpl *nodeWithAbsIndex(int absIndex);
499 * Handles a HTTP header equivalent set by a meta tag using <meta http-equiv="..." content="...">. This is called
500 * when a meta tag is encountered during document parsing, and also when a script dynamically changes or adds a meta
501 * tag. This enables scripts to use meta tags to perform refreshes and set expiry dates in addition to them being
502 * specified in a HTML file.
504 * @param equiv The http header name (value of the meta tag's "equiv" attribute)
505 * @param content The header value (value of the meta tag's "content" attribute)
507 void processHttpEquiv(const DOMString &equiv, const DOMString &content);
509 void dispatchImageLoadEventSoon(HTMLImageLoader*);
510 void dispatchImageLoadEventsNow();
511 void removeImage(HTMLImageLoader*);
512 virtual void timerEvent(QTimerEvent *);
514 // Returns the owning element in the parent document.
515 // Returns 0 if this is the top level document.
516 ElementImpl *ownerElement();
518 DOMString domain() const;
519 void setDomain( const DOMString &newDomain, bool force = false ); // not part of the DOM
521 DOMString policyBaseURL() const { return m_policyBaseURL; }
522 void setPolicyBaseURL(const DOMString &s) { m_policyBaseURL = s; }
524 // The following implements the rule from HTML 4 for what valid names are.
525 // To get this right for all the XML cases, we probably have to improve this or move it
526 // and make it sensitive to the type of document.
527 static bool isValidName(const DOMString &);
529 void addElementById(const DOMString &elementId, ElementImpl *element);
530 void removeElementById(const DOMString &elementId, ElementImpl *element);
532 void addImageMap(HTMLMapElementImpl *);
533 void removeImageMap(HTMLMapElementImpl *);
534 HTMLMapElementImpl *getImageMap(const DOMString &URL) const;
536 HTMLElementImpl* body();
538 DOMString toString() const;
540 bool execCommand(const DOMString &command, bool userInterface, const DOMString &value);
541 bool queryCommandEnabled(const DOMString &command);
542 bool queryCommandIndeterm(const DOMString &command);
543 bool queryCommandState(const DOMString &command);
544 bool queryCommandSupported(const DOMString &command);
545 DOMString queryCommandValue(const DOMString &command);
547 void addMarker(Range range, DocumentMarker::MarkerType type);
548 void removeMarker(Range range, DocumentMarker::MarkerType type);
549 void addMarker(NodeImpl *node, DocumentMarker marker);
550 void removeMarker(NodeImpl *node, DocumentMarker marker);
551 void removeAllMarkers(NodeImpl *node, ulong startOffset, long length);
552 void removeAllMarkers(NodeImpl *node);
553 void removeAllMarkers();
554 void shiftMarkers(NodeImpl *node, ulong startOffset, long delta);
555 QValueList<DocumentMarker> markersForNode(NodeImpl *node);
566 void setDesignMode(InheritedBool value);
567 InheritedBool getDesignMode() const;
568 bool inDesignMode() const;
569 DocumentImpl *parentDocument() const;
570 DocumentImpl *topDocument() const;
573 void applyXSLTransform(ProcessingInstructionImpl* pi);
574 void setTransformSource(void* doc) { m_transformSource = doc; }
575 const void* transformSource() { return m_transformSource; }
576 DocumentImpl* transformSourceDocument() { return m_transformSourceDocument; }
577 void setTransformSourceDocument(DocumentImpl* doc);
582 XBL::XBLBindingManager* bindingManager() const { return m_bindingManager; }
585 void incDOMTreeVersion() { ++m_domtree_version; }
586 unsigned int domTreeVersion() const { return m_domtree_version; }
589 void finishedParsing();
592 khtml::CSSStyleSelector *m_styleSelector;
596 khtml::DocLoader *m_docLoader;
597 khtml::Tokenizer *m_tokenizer;
600 QString m_baseTarget;
602 DocumentTypeImpl *m_doctype;
603 DOMImplementationImpl *m_implementation;
605 StyleSheetImpl *m_sheet;
607 QString m_printSheet;
608 QStringList m_availableSheets;
610 // Track the number of currently loading top-level stylesheets. Sheets
611 // loaded using the @import directive are not included in this count.
612 // We use this count of pending sheets to detect when we can begin attaching
614 int m_pendingStylesheets;
616 // But sometimes you need to ignore pending stylesheet count to
617 // force an immediate layout when requested by JS.
618 bool m_ignorePendingStylesheets;
620 CSSStyleSheetImpl *m_elemSheet;
622 QPaintDevice *m_paintDevice;
623 QPaintDeviceMetrics *m_paintDeviceMetrics;
629 NodeImpl *m_focusNode;
630 NodeImpl *m_hoverNode;
632 unsigned int m_domtree_version;
634 // ### replace me with something more efficient
635 // in lookup and insertion.
636 DOMStringImpl **m_elementNames;
637 unsigned short m_elementNameAlloc;
638 unsigned short m_elementNameCount;
640 DOMStringImpl **m_attrNames;
641 unsigned short m_attrNameAlloc;
642 unsigned short m_attrNameCount;
644 DOMStringImpl** m_namespaceURIs;
645 unsigned short m_namespaceURIAlloc;
646 unsigned short m_namespaceURICount;
648 QPtrList<NodeIteratorImpl> m_nodeIterators;
649 AbstractViewImpl *m_defaultView;
651 unsigned short m_listenerTypes;
652 StyleSheetListImpl* m_styleSheets;
653 LocalStyleRefs m_localStyleRefs; // references to inlined style elements
654 QPtrList<RegisteredEventListener> m_windowEventListeners;
655 QPtrList<NodeImpl> m_maintainsState;
658 QColor m_visitedLinkColor;
659 QColor m_activeLinkColor;
661 DOMString m_preferredStylesheetSet;
664 bool visuallyOrdered;
666 bool m_bAllDataReceived;
668 bool m_styleSelectorDirty;
669 bool m_inStyleRecalc;
670 bool m_usesDescendantRules;
671 bool m_usesSiblingRules;
675 RenderArena* m_renderArena;
677 QPtrDict< QValueList<DocumentMarker> > m_markers;
680 KWQAccObjectCache* m_accCache;
683 QPtrList<HTMLImageLoader> m_imageLoadEventDispatchSoonList;
684 QPtrList<HTMLImageLoader> m_imageLoadEventDispatchingList;
685 int m_imageLoadEventTimer;
687 NodeImpl* m_cssTarget;
689 bool m_processingLoadEvent;
691 bool m_overMinimumLayoutThreshold;
694 void* m_transformSource;
695 DocumentImpl* m_transformSourceDocument;
699 XBL::XBLBindingManager* m_bindingManager; // The access point through which documents and elements communicate with XBL.
702 QMap<QString, HTMLMapElementImpl *> m_imageMapsByName;
704 DOMString m_policyBaseURL;
706 QPtrDict<NodeImpl> m_disconnectedNodesWithEventListeners;
710 KWQSignal m_finishedParsing;
712 static Document createInstance (DocumentImpl *impl);
715 void setInPageCache(bool flag);
716 void restoreRenderer(khtml::RenderObject* render);
718 void passwordFieldAdded();
719 void passwordFieldRemoved();
720 bool hasPasswordField() const;
722 void secureFormAdded();
723 void secureFormRemoved();
724 bool hasSecureForm() const;
726 void setShouldCreateRenderers(bool f);
727 bool shouldCreateRenderers();
729 void setDecoder(khtml::Decoder *);
730 khtml::Decoder *decoder() const { return m_decoder; }
732 void setDashboardRegionsDirty(bool f) { m_dashboardRegionsDirty = f; }
733 bool dashboardRegionsDirty() const { return m_dashboardRegionsDirty; }
734 bool hasDashboardRegions () const { return m_hasDashboardRegions; }
735 void setHasDashboardRegions (bool f) { m_hasDashboardRegions = f; }
736 const QValueList<khtml::DashboardRegionValue> & dashboardRegions() const;
737 void setDashboardRegions (const QValueList<khtml::DashboardRegionValue>& regions);
739 void removeAllEventListenersFromAllNodes();
741 void registerDisconnectedNodeWithEventListeners(NodeImpl *node);
742 void unregisterDisconnectedNodeWithEventListeners(NodeImpl *node);
745 void removeAllDisconnectedNodeEventListeners();
747 JSEditor *jsEditor();
749 JSEditor *m_jsEditor;
750 bool relinquishesEditingFocus(NodeImpl *node);
751 bool acceptsEditingFocus(NodeImpl *node);
753 mutable DOMString m_domain;
755 khtml::RenderObject *m_savedRenderer;
756 int m_passwordFields;
759 khtml::Decoder *m_decoder;
761 QDict<ElementImpl> m_elementsById;
763 QDict<ElementImpl> m_elementsByAccessKey;
764 bool m_accessKeyDictValid;
766 bool m_createRenderers;
768 InheritedBool m_designMode;
770 QValueList<khtml::DashboardRegionValue> m_dashboardRegions;
771 bool m_hasDashboardRegions;
772 bool m_dashboardRegionsDirty;
776 class DocumentFragmentImpl : public NodeBaseImpl
779 DocumentFragmentImpl(DocumentPtr *doc);
781 // DOM methods overridden from parent classes
782 virtual DOMString nodeName() const;
783 virtual unsigned short nodeType() const;
784 virtual NodeImpl *cloneNode ( bool deep );
786 // Other methods (not part of DOM)
787 virtual bool childTypeAllowed( unsigned short type );
789 virtual DOMString toString() const;
793 class DocumentTypeImpl : public NodeImpl
796 DocumentTypeImpl(DOMImplementationImpl *_implementation, DocumentPtr *doc,
797 const DOMString &qualifiedName, const DOMString &publicId,
798 const DOMString &systemId);
801 // DOM methods & attributes for DocumentType
802 NamedNodeMapImpl *entities() const { return m_entities; }
803 NamedNodeMapImpl *notations() const { return m_notations; }
805 DOMString name() const { return m_qualifiedName; }
806 DOMString publicId() const { return m_publicId; }
807 DOMString systemId() const { return m_systemId; }
808 DOMString internalSubset() const { return m_subset; }
810 // DOM methods overridden from parent classes
811 virtual DOMString nodeName() const;
812 virtual unsigned short nodeType() const;
813 virtual bool childTypeAllowed( unsigned short type );
814 virtual NodeImpl *cloneNode ( bool deep );
816 // Other methods (not part of DOM)
817 void setName(const DOMString& n) { m_qualifiedName = n; }
818 void setPublicId(const DOMString& publicId) { m_publicId = publicId; }
819 void setSystemId(const DOMString& systemId) { m_systemId = systemId; }
820 DOMImplementationImpl *implementation() const { return m_implementation; }
821 void copyFrom(const DocumentTypeImpl&);
823 virtual DOMString toString() const;
826 static DocumentType createInstance (DocumentTypeImpl *impl);
830 DOMImplementationImpl *m_implementation;
831 NamedNodeMapImpl* m_entities;
832 NamedNodeMapImpl* m_notations;
834 DOMString m_qualifiedName;
835 DOMString m_publicId;
836 DOMString m_systemId;