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_NodeImpl_h_
26 #define _DOM_NodeImpl_h_
28 #include "dom/dom_string.h"
29 #include "dom/dom_node.h"
30 #include "misc/main_thread_malloc.h"
31 #include "misc/helper.h"
32 #include "misc/shared.h"
33 #include "dom_atomicstring.h"
36 template <class type> class QPtrList;
37 template <class type> class QPtrDict;
54 using khtml::SharedPtr;
61 class NamedAttrMapImpl;
62 class RegisteredEventListener;
64 // The namespace used for XHTML elements
65 #define XHTML_NAMESPACE "http://www.w3.org/1999/xhtml"
67 const Q_UINT16 noNamespace = 0;
68 const Q_UINT16 anyNamespace = 1;
69 const Q_UINT16 xhtmlNamespace = 2;
70 const Q_UINT16 anyLocalName = 0;
72 const Q_UINT32 namespaceMask = 0xFFFF0000U;
73 const Q_UINT32 localNameMask = 0x0000FFFFU;
75 inline Q_UINT16 namespacePart(Q_UINT32 i) { return i >> 16; }
76 inline Q_UINT16 localNamePart(Q_UINT32 i) { return i; }
77 inline Q_UINT32 makeId(Q_UINT16 n, Q_UINT16 l) { return (n << 16) | l; }
79 // Can't use makeId here because it results in an "initroutine".
80 const Q_UINT32 anyQName = anyNamespace << 16 | anyLocalName;
82 class DocumentPtr : public khtml::Shared<DocumentPtr>
85 DocumentImpl *document() const { return doc; }
87 DocumentPtr() { doc = 0; }
88 friend class DocumentImpl;
89 friend class DOMImplementationImpl;
94 // this class implements nodes, which can have a parent but no children:
95 class NodeImpl : public khtml::TreeShared<NodeImpl>
97 friend class DocumentImpl;
99 NodeImpl(DocumentPtr *doc);
102 MAIN_THREAD_ALLOCATED;
104 // DOM methods & attributes for Node
105 virtual DOMString nodeName() const = 0;
106 virtual DOMString nodeValue() const;
107 virtual void setNodeValue( const DOMString &_nodeValue, int &exceptioncode );
108 virtual unsigned short nodeType() const = 0;
109 NodeImpl *parentNode() const { return m_parent; }
110 NodeImpl *previousSibling() const { return m_previous; }
111 NodeImpl *nextSibling() const { return m_next; }
112 virtual NodeListImpl *childNodes();
113 virtual NodeImpl *firstChild() const;
114 virtual NodeImpl *lastChild() const;
115 virtual bool hasAttributes() const;
116 virtual NamedAttrMapImpl *attributes() const;
117 virtual DocumentImpl *ownerDocument() const;
118 virtual NodeImpl *insertBefore ( NodeImpl *newChild, NodeImpl *refChild, int &exceptioncode );
119 virtual NodeImpl *replaceChild ( NodeImpl *newChild, NodeImpl *oldChild, int &exceptioncode );
120 virtual NodeImpl *removeChild ( NodeImpl *oldChild, int &exceptioncode );
121 virtual NodeImpl *appendChild ( NodeImpl *newChild, int &exceptioncode );
122 virtual void remove(int &exceptioncode);
123 virtual bool hasChildNodes ( ) const;
124 virtual NodeImpl *cloneNode ( bool deep ) = 0;
125 virtual DOMString localName() const;
126 virtual DOMString namespaceURI() const;
127 virtual DOMString prefix() const;
128 virtual void setPrefix(const DOMString &_prefix, int &exceptioncode );
130 static bool isSupported(const DOMString &feature, const DOMString &version);
132 NodeImpl *lastDescendent() const;
134 // Other methods (not part of DOM)
135 virtual bool isElementNode() const { return false; }
136 virtual bool isHTMLElement() const { return false; }
137 virtual bool isStyledElement() const { return false; }
138 virtual bool isAttributeNode() const { return false; }
139 virtual bool isTextNode() const { return false; }
140 virtual bool isDocumentNode() const { return false; }
141 virtual bool isXMLElementNode() const { return false; }
142 bool isBlockFlow() const;
143 bool isBlockFlowOrTable() const;
145 // Used by <form> elements to indicate a malformed state of some kind, typically
146 // used to keep from applying the bottom margin of the form.
147 virtual bool isMalformed() { return false; }
148 virtual void setMalformed(bool malformed) {};
150 virtual bool containsOnlyWhitespace() const { return false; }
152 // helper functions not being part of the DOM
153 // Attention: they assume that the caller did the consistency checking!
154 void setPreviousSibling(NodeImpl *previous) { m_previous = previous; }
155 void setNextSibling(NodeImpl *next) { m_next = next; }
157 virtual void setFirstChild(NodeImpl *child);
158 virtual void setLastChild(NodeImpl *child);
160 bool isAtomicNode() const;
161 NodeImpl *previousNodeConsideringAtomicNodes() const;
162 NodeImpl *nextNodeConsideringAtomicNodes() const;
164 /** (Not part of the official DOM)
165 * Returns the next leaf node.
167 * Using this function delivers leaf nodes as if the whole DOM tree
168 * were a linear chain of its leaf nodes.
169 * @return next leaf node or 0 if there are no more.
171 NodeImpl *nextLeafNode() const;
173 /** (Not part of the official DOM)
174 * Returns the previous leaf node.
176 * Using this function delivers leaf nodes as if the whole DOM tree
177 * were a linear chain of its leaf nodes.
178 * @return previous leaf node or 0 if there are no more.
180 NodeImpl *previousLeafNode() const;
182 bool isEditableBlock() const;
183 ElementImpl *enclosingBlockFlowElement() const;
184 ElementImpl *enclosingBlockFlowOrTableElement() const;
185 ElementImpl *enclosingInlineElement() const;
186 ElementImpl *rootEditableElement() const;
188 bool inSameRootEditableElement(NodeImpl *);
189 bool inSameContainingBlockFlowElement(NodeImpl *);
191 // used by the parser. Doesn't do as many error checkings as
192 // appendChild(), and returns the node into which will be parsed next.
193 virtual NodeImpl *addChild(NodeImpl *newChild);
195 // called by the parser when this element's close tag is reached,
196 // signalling that all child tags have been parsed and added.
197 // This is only needed for <applet> and <object> elements, which can't lay themselves out
198 // until they know all of their nested <param>s. [3603191, 4040848]
199 virtual void closeRenderer() { }
202 // id() is used to easily and exactly identify a node. It
203 // is optimized for quick comparison and low memory consumption.
204 // its value depends on the owner document of the node and is
205 // categorized in the following way:
206 // 1..ID_LAST_TAG: the node inherits HTMLElementImpl and is
207 // part of the HTML namespace.
208 // The HTML namespace is either the global
209 // one (no namespace) or the XHTML namespace
210 // depending on the owner document's doctype
211 // ID_LAST_TAG+1..0xffff: non-HTML elements in the global namespace
212 // others non-HTML elements in a namespace.
213 // the upper 16 bit identify the namespace
214 // the lower 16 bit identify the local part of the
215 // qualified element name.
216 virtual Id id() const { return 0; };
218 Id identifier() const;
220 enum MouseEventType {
230 MouseEvent( int _button, MouseEventType _type,
231 const DOMString &_url = DOMString(), const DOMString& _target = DOMString(),
232 NodeImpl *_innerNode = 0)
234 button = _button; type = _type;
235 url = _url; target = _target;
236 innerNode.reset(_innerNode);
241 DOMString url; // url under mouse or empty
243 SharedPtr<NodeImpl> innerNode;
246 // for LINK and STYLE
247 virtual void sheetLoaded() {}
249 bool hasID() const { return m_hasId; }
250 bool hasClass() const { return m_hasClass; }
251 bool hasStyle() const { return m_hasStyle; }
252 bool active() const { return m_active; }
253 bool focused() const { return m_focused; }
254 bool attached() const { return m_attached; }
255 bool changed() const { return m_changed; }
256 bool hasChangedChild() const { return m_hasChangedChild; }
257 bool isLink() const { return m_isLink; }
258 // inDocument should also make sure a document exists in case the document has been destroyed before the node is removed from the document.
259 bool inDocument() const { return document->document() && m_inDocument; }
260 bool styleElement() const { return m_styleElement; }
261 bool implicitNode() const { return m_implicit; }
262 void setHasID(bool b=true) { m_hasId = b; }
263 void setHasClass(bool b=true) { m_hasClass = b; }
264 void setHasStyle(bool b=true) { m_hasStyle = b; }
265 void setHasChangedChild( bool b = true ) { m_hasChangedChild = b; }
266 void setInDocument(bool b=true) { m_inDocument = b; }
267 virtual void setFocus(bool b=true) { m_focused = b; }
268 virtual void setActive(bool b=true) { m_active = b; }
269 void setChanged(bool b=true);
271 unsigned short tabIndex() const { return m_tabIndex; }
272 void setTabIndex(unsigned short _tabIndex) { m_tabIndex = _tabIndex; }
275 * whether this node can receive the keyboard focus.
277 virtual bool isFocusable() const;
278 virtual bool isKeyboardFocusable() const;
279 virtual bool isMouseFocusable() const;
281 virtual bool isInline() const;
283 virtual bool isContentEditable() const;
284 virtual QRect getRect() const;
286 enum StyleChange { NoChange, NoInherit, Inherit, Detach, Force };
287 virtual void recalcStyle( StyleChange = NoChange ) {}
288 StyleChange diff( khtml::RenderStyle *s1, khtml::RenderStyle *s2 ) const;
290 unsigned long nodeIndex() const;
291 // Returns the document that this node is associated with. This is guaranteed to always be non-null, as opposed to
292 // DOM's ownerDocument() which is null for Document nodes (and sometimes DocumentType nodes).
293 DocumentImpl* getDocument() const { return document->document(); }
295 void setDocument(DocumentPtr *doc);
297 void addEventListener(const DOMString &, EventListener *listener, bool useCapture);
298 void removeEventListener(const DOMString &, EventListener *listener, bool useCapture);
300 void addEventListener(int id, EventListener *listener, bool useCapture);
301 void removeEventListener(int id, EventListener *listener, bool useCapture);
302 void removeHTMLEventListener(int id);
303 void setHTMLEventListener(int id, EventListener *listener);
304 EventListener *getHTMLEventListener(int id);
305 void removeAllEventListeners();
307 bool dispatchEvent(EventImpl *evt, int &exceptioncode, bool tempEvent = false);
308 bool dispatchGenericEvent( EventImpl *evt, int &exceptioncode);
309 bool dispatchHTMLEvent(int _id, bool canBubbleArg, bool cancelableArg);
310 bool dispatchWindowEvent(int _id, bool canBubbleArg, bool cancelableArg);
311 bool dispatchMouseEvent(QMouseEvent *e, int overrideId = 0, int overrideDetail = 0);
312 bool dispatchUIEvent(int _id, int detail = 0);
313 bool dispatchSubtreeModifiedEvent(bool childrenChanged = true);
314 bool dispatchKeyEvent(QKeyEvent *key);
315 void dispatchWheelEvent(QWheelEvent *);
317 void handleLocalEvents(EventImpl *evt, bool useCapture);
320 * Perform the default action for an event e.g. submitting a form
322 virtual void defaultEventHandler(EventImpl *evt);
325 * Used for disabled form elements; if true, prevents mouse events from being dispatched
326 * to event listeners, and prevents DOMActivate events from being sent at all.
328 virtual bool disabled() const;
330 virtual bool isReadOnly();
331 virtual bool childTypeAllowed( unsigned short /*type*/ ) { return false; }
332 virtual unsigned long childNodeCount() const;
333 virtual NodeImpl *childNode(unsigned long index);
336 * Does a pre-order traversal of the tree to find the node next node after this one. This uses the same order that
337 * the tags appear in the source file.
339 * @param stayWithin If not null, the traversal will stop once the specified node is reached. This can be used to
340 * restrict traversal to a particular sub-tree.
342 * @return The next node, in document order
344 * see @ref traversePreviousNode()
346 NodeImpl *traverseNextNode(const NodeImpl *stayWithin = 0) const;
348 /* Like traverseNextNode, but skips children and starts with the next sibling. */
349 NodeImpl *traverseNextSibling(const NodeImpl *stayWithin = 0) const;
352 * Does a reverse pre-order traversal to find the node that comes before the current one in document order
354 * see @ref traverseNextNode()
356 NodeImpl *traversePreviousNode() const;
358 /* Like traversePreviousNode, but visits nodes before their children. */
359 NodeImpl *traversePreviousNodePostOrder(const NodeImpl *stayWithin = 0) const;
361 DocumentPtr *docPtr() const { return document; }
363 NodeImpl *previousEditable() const;
364 NodeImpl *nextEditable() const;
365 //bool isEditable() const;
367 khtml::RenderObject *renderer() const { return m_render; }
368 khtml::RenderObject *nextRenderer();
369 khtml::RenderObject *previousRenderer();
370 void setRenderer(khtml::RenderObject* renderer) { m_render = renderer; }
372 void checkSetPrefix(const DOMString &_prefix, int &exceptioncode);
373 void checkAddChild(NodeImpl *newChild, int &exceptioncode);
374 bool isAncestor(const NodeImpl *) const;
375 virtual bool childAllowed( NodeImpl *newChild );
377 virtual long maxOffset() const;
378 long maxDeepOffset() const;
379 virtual long caretMinOffset() const;
380 virtual long caretMaxOffset() const;
381 virtual unsigned long caretMaxRenderedOffset() const;
383 virtual long previousOffset (long current) const;
384 virtual long nextOffset (long current) const;
387 virtual void dump(QTextStream *stream, QString ind = "") const;
390 // -----------------------------------------------------------------------------
391 // Integration with rendering tree
394 * Attaches this node to the rendering tree. This calculates the style to be applied to the node and creates an
395 * appropriate RenderObject which will be inserted into the tree (except when the style has display: none). This
396 * makes the node visible in the KHTMLView.
398 virtual void attach();
401 * Detaches the node from the rendering tree, making it invisible in the rendered view. This method will remove
402 * the node's rendering object from the rendering tree and delete it.
404 virtual void detach();
406 void createRendererIfNeeded();
407 virtual khtml::RenderStyle *styleForRenderer(khtml::RenderObject *parent);
408 virtual bool rendererIsNeeded(khtml::RenderStyle *);
409 virtual khtml::RenderObject *createRenderer(RenderArena *, khtml::RenderStyle *);
411 // -----------------------------------------------------------------------------
412 // Methods for maintaining the state of the element between history navigation
415 * Indicates whether or not this type of node maintains it's state. If so, the state of the node will be stored when
416 * the user goes to a different page using the state() method, and restored using the restoreState() method if the
417 * user returns (e.g. using the back button). This is used to ensure that user-changeable elements such as form
418 * controls maintain their contents when the user returns to a previous page in the history.
420 virtual bool maintainsState();
423 * Returns the state of this node represented as a string. This string will be passed to restoreState() if the user
424 * returns to the page.
426 * @return State information about the node represented as a string
428 virtual QString state();
431 * Sets the state of the element based on strings previously returned by state(). This is used to initialize form
432 * controls with their old values when the user returns to the page in their history. The receiver
433 * should remove the string from the list that it uses for its restore.
435 * @param states The strings previously returned by nodes' state methods.
437 virtual void restoreState(QStringList &stateList);
439 // -----------------------------------------------------------------------------
440 // Notification of document stucture changes
443 * Notifies the node that it has been inserted into the document. This is called during document parsing, and also
444 * when a node is added through the DOM methods insertBefore(), appendChild() or replaceChild(). Note that this only
445 * happens when the node becomes part of the document tree, i.e. only when the document is actually an ancestor of
446 * the node. The call happens _after_ the node has been added to the tree.
448 * This is similar to the DOMNodeInsertedIntoDocument DOM event, but does not require the overhead of event
451 virtual void insertedIntoDocument();
454 * Notifies the node that it is no longer part of the document tree, i.e. when the document is no longer an ancestor
457 * This is similar to the DOMNodeRemovedFromDocument DOM event, but does not require the overhead of event
458 * dispatching, and is called _after_ the node is removed from the tree.
460 virtual void removedFromDocument();
463 * Notifies the node that it's list of children have changed (either by adding or removing child nodes), or a child
464 * node that is of the type CDATA_SECTION_NODE, TEXT_NODE or COMMENT_NODE has changed its value.
466 virtual void childrenChanged();
468 virtual DOMString toString() const = 0;
471 virtual void formatForDebugger(char *buffer, unsigned length) const;
473 void displayNode(const char *prefix="");
477 void registerNodeList(NodeListImpl *list);
478 void unregisterNodeList(NodeListImpl *list);
479 void notifyNodeListsSubtreeModified();
480 void notifyLocalNodeListsSubtreeModified();
482 SharedPtr<NodeListImpl> getElementsByTagName(const DOMString &name) { return getElementsByTagNameNS(DOMString(), name); }
483 SharedPtr<NodeListImpl> getElementsByTagNameNS(const DOMString &namespaceURI, const DOMString &localName);
486 DocumentPtr *document;
487 NodeImpl *m_previous;
490 khtml::RenderObject *m_render;
491 QPtrList<RegisteredEventListener> *m_regdListeners;
492 QPtrDict<NodeListImpl> *m_nodeLists;
494 unsigned short m_tabIndex : 15;
495 bool m_hasTabIndex : 1;
502 bool m_hasChangedChild : 1;
503 bool m_inDocument : 1;
506 bool m_specified : 1; // used in AttrImpl. Accessor functions there
509 bool m_styleElement : 1; // contains stylesheet text
510 bool m_implicit : 1; // implicitely generated by the parser
515 class ContainerNodeImpl : public NodeImpl
518 ContainerNodeImpl(DocumentPtr *doc);
519 virtual ~ContainerNodeImpl();
521 // DOM methods overridden from parent classes
522 virtual NodeImpl *firstChild() const;
523 virtual NodeImpl *lastChild() const;
524 virtual NodeImpl *insertBefore ( NodeImpl *newChild, NodeImpl *refChild, int &exceptioncode );
525 virtual NodeImpl *replaceChild ( NodeImpl *newChild, NodeImpl *oldChild, int &exceptioncode );
526 virtual NodeImpl *removeChild ( NodeImpl *oldChild, int &exceptioncode );
527 virtual NodeImpl *appendChild ( NodeImpl *newChild, int &exceptioncode );
528 virtual bool hasChildNodes ( ) const;
530 // Other methods (not part of DOM)
531 void removeChildren();
532 void cloneChildNodes(NodeImpl *clone);
534 virtual void setFirstChild(NodeImpl *child);
535 virtual void setLastChild(NodeImpl *child);
536 virtual NodeImpl *addChild(NodeImpl *newChild);
537 virtual void attach();
538 virtual void detach();
540 virtual QRect getRect() const;
541 bool getUpperLeftCorner(int &xPos, int &yPos) const;
542 bool getLowerRightCorner(int &xPos, int &yPos) const;
544 virtual void setFocus(bool=true);
545 virtual void setActive(bool=true);
546 virtual unsigned long childNodeCount() const;
547 virtual NodeImpl *childNode(unsigned long index);
549 virtual void insertedIntoDocument();
550 virtual void removedFromDocument();
556 // helper functions for inserting children:
558 // ### this should vanish. do it in dom/ !
559 // check for same source document:
560 bool checkSameDocument( NodeImpl *newchild, int &exceptioncode );
561 // check for being child:
562 bool checkIsChild( NodeImpl *oldchild, int &exceptioncode );
565 // find out if a node is allowed to be our child
566 void dispatchChildInsertedEvents( NodeImpl *child, int &exceptioncode );
567 void dispatchChildRemovalEvents( NodeImpl *child, int &exceptioncode );
570 // --------------------------------------------------------------------------
574 class NodeListImpl : public khtml::Shared<NodeListImpl>
577 NodeListImpl( NodeImpl *_rootNode );
578 virtual ~NodeListImpl();
580 MAIN_THREAD_ALLOCATED;
582 // DOM methods & attributes for NodeList
583 virtual unsigned long length() const = 0;
584 virtual NodeImpl *item ( unsigned long index ) const = 0;
585 virtual NodeImpl *itemById ( const DOMString & elementId ) const;
587 // Other methods (not part of DOM)
589 void rootNodeSubtreeModified();
592 // helper functions for searching all ElementImpls in a tree
593 unsigned long recursiveLength(NodeImpl *start = 0) const;
594 NodeImpl *recursiveItem ( unsigned long offset, NodeImpl *start = 0 ) const;
595 virtual bool nodeMatches( NodeImpl *testNode ) const = 0;
598 mutable int cachedLength;
599 mutable NodeImpl *lastItem;
600 mutable unsigned long lastItemOffset;
601 mutable bool isLengthCacheValid : 1;
602 mutable bool isItemCacheValid : 1;
605 class ChildNodeListImpl : public NodeListImpl
608 ChildNodeListImpl( NodeImpl *n);
610 // DOM methods overridden from parent classes
612 virtual unsigned long length() const;
613 virtual NodeImpl *item ( unsigned long index ) const;
616 virtual bool nodeMatches( NodeImpl *testNode ) const;
621 * NodeList which lists all Nodes in a document with a given tag name
623 class TagNodeListImpl : public NodeListImpl
626 TagNodeListImpl( NodeImpl *n, NodeImpl::Id tagId, NodeImpl::Id tagIdMask );
628 // DOM methods overridden from parent classes
630 virtual unsigned long length() const;
631 virtual NodeImpl *item ( unsigned long index ) const;
633 // Other methods (not part of DOM)
636 virtual bool nodeMatches( NodeImpl *testNode ) const;
639 NodeImpl::Id m_idMask;
644 * NodeList which lists all Nodes in a Element with a given "name=" tag
646 class NameNodeListImpl : public NodeListImpl
649 NameNodeListImpl( NodeImpl *doc, const DOMString &t );
651 // DOM methods overridden from parent classes
653 virtual unsigned long length() const;
654 virtual NodeImpl *item ( unsigned long index ) const;
656 // Other methods (not part of DOM)
659 virtual bool nodeMatches( NodeImpl *testNode ) const;
665 // Generic NamedNodeMap interface
666 // Other classes implement this for more specific situations e.g. attributes
668 class NamedNodeMapImpl : public khtml::Shared<NamedNodeMapImpl>
671 NamedNodeMapImpl() { }
672 virtual ~NamedNodeMapImpl();
674 MAIN_THREAD_ALLOCATED;
676 NodeImpl *getNamedItem(const DOMString &name) const { return getNamedItemNS(DOMString(), name); }
677 SharedPtr<NodeImpl> removeNamedItem(const DOMString &name, int &exception) { return removeNamedItemNS(DOMString(), name, exception); }
679 NodeImpl *getNamedItemNS(const DOMString &namespaceURI, const DOMString &localName) const;
680 SharedPtr<NodeImpl> setNamedItemNS(NodeImpl *arg, int &exception) { return setNamedItem(arg, exception); }
681 SharedPtr<NodeImpl> removeNamedItemNS(const DOMString &namespaceURI, const DOMString &localName, int &exception);
683 // DOM methods & attributes for NamedNodeMap
684 virtual NodeImpl *getNamedItem ( NodeImpl::Id id ) const = 0;
685 virtual SharedPtr<NodeImpl> removeNamedItem ( NodeImpl::Id id, int &exceptioncode ) = 0;
686 virtual SharedPtr<NodeImpl> setNamedItem ( NodeImpl* arg, int &exceptioncode ) = 0;
688 virtual NodeImpl *item ( unsigned long index ) const = 0;
689 virtual unsigned long length( ) const = 0;
691 // Other methods (not part of DOM)
692 virtual NodeImpl::Id mapId(const DOMString& namespaceURI, const DOMString& localName, bool readonly) = 0;
693 virtual bool isReadOnly() { return false; }
699 // Generic read-only NamedNodeMap implementation
700 // You can add items using the internal function addItem()
701 class GenericRONamedNodeMapImpl : public NamedNodeMapImpl
704 GenericRONamedNodeMapImpl(DocumentPtr* doc);
705 virtual ~GenericRONamedNodeMapImpl();
707 // DOM methods & attributes for NamedNodeMap
709 virtual NodeImpl *getNamedItem ( const DOMString &name, int &exceptioncode ) const;
710 virtual Node setNamedItem ( const Node &arg, int &exceptioncode );
711 virtual Node removeNamedItem ( const DOMString &name, int &exceptioncode );
712 virtual NodeImpl *item ( unsigned long index ) const;
713 virtual unsigned long length( ) const;
714 virtual NodeImpl *getNamedItemNS( const DOMString &namespaceURI, const DOMString &localName,
715 int &exceptioncode ) const;
716 virtual NodeImpl *setNamedItemNS( NodeImpl *arg, int &exceptioncode );
717 virtual NodeImpl *removeNamedItemNS( const DOMString &namespaceURI, const DOMString &localName,
718 int &exceptioncode );
720 // Other methods (not part of DOM)
722 virtual bool isReadOnly() { return true; }
724 void addNode(NodeImpl *n);
728 QPtrList<NodeImpl> *m_contents;