#ifndef Node_h
#define Node_h
#include "EditingBoundary.h"
#include "EventTarget.h"
#include "KURLHash.h"
#include "LayoutTypes.h"
#include "RenderStyleConstants.h"
#include "ScriptWrappable.h"
#include "TreeShared.h"
#include "WebKitMutationObserver.h"
#include <wtf/Forward.h>
#include <wtf/ListHashSet.h>
#include <wtf/text/AtomicString.h>
#if USE(JSC)
namespace JSC {
class JSGlobalData;
class SlotVisitor;
}
#endif
#define DUMP_NODE_STATISTICS 0
namespace WebCore {
class Attribute;
class ClassNodeList;
class ContainerNode;
class DOMSettableTokenList;
class Document;
class DynamicSubtreeNodeList;
class Element;
class Event;
class EventContext;
class EventDispatchMediator;
class EventListener;
class FloatPoint;
class Frame;
class HTMLInputElement;
class IntRect;
class KeyboardEvent;
class NSResolver;
class NamedNodeMap;
class NameNodeList;
class NodeList;
class NodeRareData;
class NodeRenderingContext;
class PlatformKeyboardEvent;
class PlatformMouseEvent;
class PlatformWheelEvent;
class QualifiedName;
class RegisteredEventListener;
class RenderArena;
class RenderBox;
class RenderBoxModelObject;
class RenderObject;
class RenderStyle;
class TagNodeList;
class TreeScope;
#if ENABLE(MICRODATA)
class HTMLPropertiesCollection;
#endif
typedef int ExceptionCode;
const int nodeStyleChangeShift = 21;
enum StyleChangeType {
NoStyleChange = 0,
InlineStyleChange = 1 << nodeStyleChangeShift,
FullStyleChange = 2 << nodeStyleChangeShift,
SyntheticStyleChange = 3 << nodeStyleChangeShift
};
class Node : public EventTarget, public ScriptWrappable, public TreeShared<ContainerNode> {
friend class Document;
friend class TreeScope;
friend class TreeScopeAdopter;
public:
enum NodeType {
ELEMENT_NODE = 1,
ATTRIBUTE_NODE = 2,
TEXT_NODE = 3,
CDATA_SECTION_NODE = 4,
ENTITY_REFERENCE_NODE = 5,
ENTITY_NODE = 6,
PROCESSING_INSTRUCTION_NODE = 7,
COMMENT_NODE = 8,
DOCUMENT_NODE = 9,
DOCUMENT_TYPE_NODE = 10,
DOCUMENT_FRAGMENT_NODE = 11,
NOTATION_NODE = 12,
XPATH_NAMESPACE_NODE = 13,
};
enum DocumentPosition {
DOCUMENT_POSITION_EQUIVALENT = 0x00,
DOCUMENT_POSITION_DISCONNECTED = 0x01,
DOCUMENT_POSITION_PRECEDING = 0x02,
DOCUMENT_POSITION_FOLLOWING = 0x04,
DOCUMENT_POSITION_CONTAINS = 0x08,
DOCUMENT_POSITION_CONTAINED_BY = 0x10,
DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20,
};
static bool isSupported(const String& feature, const String& version);
static void startIgnoringLeaks();
static void stopIgnoringLeaks();
static void dumpStatistics();
enum StyleChange { NoChange, NoInherit, Inherit, Detach, Force };
static StyleChange diff(const RenderStyle*, const RenderStyle*, Document*);
virtual ~Node();
bool hasTagName(const QualifiedName&) const;
bool hasLocalName(const AtomicString&) const;
virtual String nodeName() const = 0;
virtual String nodeValue() const;
virtual void setNodeValue(const String&, ExceptionCode&);
virtual NodeType nodeType() const = 0;
ContainerNode* parentNode() const;
Element* parentElement() const;
Node* previousSibling() const { return m_previous; }
Node* nextSibling() const { return m_next; }
PassRefPtr<NodeList> childNodes();
Node* firstChild() const;
Node* lastChild() const;
bool hasAttributes() const;
NamedNodeMap* attributes() const;
virtual KURL baseURI() const;
void getSubresourceURLs(ListHashSet<KURL>&) const;
bool insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionCode&, bool shouldLazyAttach = false);
bool replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionCode&, bool shouldLazyAttach = false);
bool removeChild(Node* child, ExceptionCode&);
bool appendChild(PassRefPtr<Node> newChild, ExceptionCode&, bool shouldLazyAttach = false);
void remove(ExceptionCode&);
bool hasChildNodes() const { return firstChild(); }
virtual PassRefPtr<Node> cloneNode(bool deep) = 0;
const AtomicString& localName() const { return virtualLocalName(); }
const AtomicString& namespaceURI() const { return virtualNamespaceURI(); }
const AtomicString& prefix() const { return virtualPrefix(); }
virtual void setPrefix(const AtomicString&, ExceptionCode&);
void normalize();
bool isSameNode(Node* other) const { return this == other; }
bool isEqualNode(Node*) const;
bool isDefaultNamespace(const AtomicString& namespaceURI) const;
String lookupPrefix(const AtomicString& namespaceURI) const;
String lookupNamespaceURI(const String& prefix) const;
String lookupNamespacePrefix(const AtomicString& namespaceURI, const Element* originalElement) const;
String textContent(bool convertBRsToNewlines = false) const;
void setTextContent(const String&, ExceptionCode&);
Node* lastDescendant() const;
Node* firstDescendant() const;
virtual bool isActiveNode() const { return false; }
bool isElementNode() const { return getFlag(IsElementFlag); }
bool isContainerNode() const { return getFlag(IsContainerFlag); }
bool isTextNode() const { return getFlag(IsTextFlag); }
bool isHTMLElement() const { return getFlag(IsHTMLFlag); }
bool isSVGElement() const { return getFlag(IsSVGFlag); }
virtual bool isMediaControlElement() const { return false; }
virtual bool isMediaControls() const { return false; }
bool isStyledElement() const { return getFlag(IsStyledElementFlag); }
virtual bool isFrameOwnerElement() const { return false; }
virtual bool isAttributeNode() const { return false; }
virtual bool isCharacterDataNode() const { return false; }
bool isDocumentNode() const;
bool isShadowRoot() const { return getFlag(IsShadowRootFlag); }
bool inNamedFlow() const { return getFlag(InNamedFlowFlag); }
bool hasAttrList() const { return getFlag(HasAttrListFlag); }
Node* shadowAncestorNode() const;
Node* shadowTreeRootNode() const;
Node* nonBoundaryShadowTreeRootNode();
bool isInShadowTree() const;
ContainerNode* parentOrHostNode() const;
Element* parentOrHostElement() const;
Node* highestAncestor() const;
ContainerNode* parentNodeGuaranteedHostFree() const;
ContainerNode* nonShadowBoundaryParentNode() const;
Element* shadowHost() const;
void setShadowHost(Element*);
bool selfOrAncestorHasDirAutoAttribute() const { return getFlag(SelfOrAncestorHasDirAutoFlag); }
void setSelfOrAncestorHasDirAutoAttribute(bool flag) { setFlag(flag, SelfOrAncestorHasDirAutoFlag); }
Node* enclosingLinkEventParentOrSelf();
bool isBlockFlow() const;
bool isBlockFlowOrBlockTable() const;
void setPreviousSibling(Node* previous) { m_previous = previous; }
void setNextSibling(Node* next) { m_next = next; }
virtual bool canContainRangeEndPoint() const { return false; }
Node* previousNodeConsideringAtomicNodes() const;
Node* nextNodeConsideringAtomicNodes() const;
Node* nextLeafNode() const;
Node* previousLeafNode() const;
Element* enclosingBlockFlowElement() const;
Element* rootEditableElement() const;
Element* rootEditableElement(EditableType) const;
bool inSameContainingBlockFlowElement(Node*);
virtual void finishParsingChildren() { }
virtual void beginParsingChildren() { }
virtual void aboutToUnload() { }
virtual bool sheetLoaded() { return true; }
virtual void notifyLoadedSheetAndAllCriticalSubresources(bool ) { }
virtual void startLoadingDynamicSheet() { ASSERT_NOT_REACHED(); }
bool attributeStyleDirty() const { return getFlag(AttributeStyleDirtyFlag); }
bool hasName() const { return getFlag(HasNameFlag); }
bool hasID() const;
bool hasClass() const;
bool active() const { return getFlag(IsActiveFlag); }
bool inActiveChain() const { return getFlag(InActiveChainFlag); }
bool inDetach() const { return getFlag(InDetachFlag); }
bool hovered() const { return getFlag(IsHoveredFlag); }
bool focused() const { return hasRareData() ? rareDataFocused() : false; }
bool attached() const { return getFlag(IsAttachedFlag); }
void setAttached() { setFlag(IsAttachedFlag); }
bool needsStyleRecalc() const { return styleChangeType() != NoStyleChange; }
StyleChangeType styleChangeType() const { return static_cast<StyleChangeType>(m_nodeFlags & StyleChangeMask); }
bool childNeedsStyleRecalc() const { return getFlag(ChildNeedsStyleRecalcFlag); }
bool isLink() const { return getFlag(IsLinkFlag); }
void setAttributeStyleDirty() { setFlag(AttributeStyleDirtyFlag); }
void clearAttributeStyleDirty() { clearFlag(AttributeStyleDirtyFlag); }
void setHasName(bool f) { setFlag(f, HasNameFlag); }
void setChildNeedsStyleRecalc() { setFlag(ChildNeedsStyleRecalcFlag); }
void clearChildNeedsStyleRecalc() { clearFlag(ChildNeedsStyleRecalcFlag); }
void setInActiveChain() { setFlag(InActiveChainFlag); }
void clearInActiveChain() { clearFlag(InActiveChainFlag); }
void setNeedsStyleRecalc(StyleChangeType changeType = FullStyleChange);
void clearNeedsStyleRecalc() { m_nodeFlags &= ~StyleChangeMask; }
virtual void scheduleSetNeedsStyleRecalc(StyleChangeType changeType = FullStyleChange) { setNeedsStyleRecalc(changeType); }
void setIsLink(bool f) { setFlag(f, IsLinkFlag); }
void setIsLink() { setFlag(IsLinkFlag); }
void clearIsLink() { clearFlag(IsLinkFlag); }
void setInNamedFlow() { setFlag(InNamedFlowFlag); }
void clearInNamedFlow() { clearFlag(InNamedFlowFlag); }
void setHasAttrList() { setFlag(HasAttrListFlag); }
void clearHasAttrList() { clearFlag(HasAttrListFlag); }
enum ShouldSetAttached {
SetAttached,
DoNotSetAttached
};
void lazyAttach(ShouldSetAttached = SetAttached);
virtual void setFocus(bool = true);
virtual void setActive(bool f = true, bool = false) { setFlag(f, IsActiveFlag); }
virtual void setHovered(bool f = true) { setFlag(f, IsHoveredFlag); }
virtual short tabIndex() const;
virtual bool supportsFocus() const;
virtual bool isFocusable() const;
virtual bool isKeyboardFocusable(KeyboardEvent*) const;
virtual bool isMouseFocusable() const;
virtual Node* focusDelegate();
bool isContentEditable();
bool isContentRichlyEditable();
void inspect();
bool rendererIsEditable(EditableType editableType = ContentIsEditable) const
{
switch (editableType) {
case ContentIsEditable:
return rendererIsEditable(Editable);
case HasEditableAXRole:
return isEditableToAccessibility(Editable);
}
ASSERT_NOT_REACHED();
return false;
}
bool rendererIsRichlyEditable(EditableType editableType = ContentIsEditable) const
{
switch (editableType) {
case ContentIsEditable:
return rendererIsEditable(RichlyEditable);
case HasEditableAXRole:
return isEditableToAccessibility(RichlyEditable);
}
ASSERT_NOT_REACHED();
return false;
}
virtual bool shouldUseInputMethod();
virtual LayoutRect getRect() const;
IntRect getPixelSnappedRect() const { return pixelSnappedIntRect(getRect()); }
LayoutRect renderRect(bool* isReplaced);
IntRect pixelSnappedRenderRect(bool* isReplaced) { return pixelSnappedIntRect(renderRect(isReplaced)); }
bool hasNonEmptyBoundingBox() const;
unsigned nodeIndex() const;
Document* ownerDocument() const;
Document* document() const
{
ASSERT(this);
ASSERT(m_document || (nodeType() == DOCUMENT_TYPE_NODE && !inDocument()));
return m_document;
}
TreeScope* treeScope() const;
bool inDocument() const
{
ASSERT(m_document || !getFlag(InDocumentFlag));
return getFlag(InDocumentFlag);
}
bool isReadOnlyNode() const { return nodeType() == ENTITY_REFERENCE_NODE; }
virtual bool childTypeAllowed(NodeType) const { return false; }
unsigned childNodeCount() const;
Node* childNode(unsigned index) const;
Node* traverseNextNode() const;
Node* traverseNextNode(const Node* stayWithin) const;
Node* traverseNextSibling() const;
Node* traverseNextSibling(const Node* stayWithin) const;
Node* traversePreviousNode(const Node* stayWithin = 0) const;
Node* traversePreviousSibling(const Node* stayWithin = 0) const;
Node* traverseNextNodePostOrder() const;
Node* traversePreviousNodePostOrder(const Node* stayWithin = 0) const;
Node* traversePreviousSiblingPostOrder(const Node* stayWithin = 0) const;
void checkSetPrefix(const AtomicString& prefix, ExceptionCode&);
bool isDescendantOrShadowDescendantOf(const Node* otherNode);
bool isDescendantOf(const Node*) const;
bool contains(const Node*) const;
bool containsIncludingShadowDOM(Node*);
void checkAddChild(Node* newChild, ExceptionCode&);
void checkReplaceChild(Node* newChild, Node* oldChild, ExceptionCode&);
virtual bool canReplaceChild(Node* newChild, Node* oldChild);
virtual bool offsetInCharacters() const;
virtual int maxCharacterOffset() const;
virtual bool canStartSelection() const;
FloatPoint convertToPage(const FloatPoint&) const;
FloatPoint convertFromPage(const FloatPoint&) const;
RenderObject* renderer() const { return m_renderer; }
void setRenderer(RenderObject* renderer) { m_renderer = renderer; }
RenderBox* renderBox() const;
RenderBoxModelObject* renderBoxModelObject() const;
virtual void attach();
virtual void detach();
void reattach();
void reattachIfAttached();
virtual void willRemove();
void createRendererIfNeeded();
virtual bool rendererIsNeeded(const NodeRenderingContext&);
virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const { return true; }
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
ContainerNode* parentNodeForRenderingAndStyle();
RenderStyle* renderStyle() const;
virtual void setRenderStyle(PassRefPtr<RenderStyle>);
RenderStyle* computedStyle(PseudoId pseudoElementSpecifier = NOPSEUDO) { return virtualComputedStyle(pseudoElementSpecifier); }
enum InsertionNotificationRequest {
InsertionDone,
InsertionShouldCallDidNotifyDescendantInseretions
};
virtual InsertionNotificationRequest insertedInto(Node* insertionPoint);
virtual void didNotifyDescendantInseretions(Node*) { }
virtual void removedFrom(Node* insertionPoint);
#ifndef NDEBUG
virtual void formatForDebugger(char* buffer, unsigned length) const;
void showNode(const char* prefix = "") const;
void showTreeForThis() const;
void showTreeAndMark(const Node* markedNode1, const char* markedLabel1, const Node* markedNode2 = 0, const char* markedLabel2 = 0) const;
void showTreeForThisAcrossFrame() const;
#endif
void registerDynamicSubtreeNodeList(DynamicSubtreeNodeList*);
void unregisterDynamicSubtreeNodeList(DynamicSubtreeNodeList*);
void invalidateNodeListsCacheAfterAttributeChanged(const QualifiedName&);
void invalidateNodeListsCacheAfterChildrenChanged();
void removeCachedClassNodeList(ClassNodeList*, const String&);
void removeCachedNameNodeList(NameNodeList*, const String&);
void removeCachedTagNodeList(TagNodeList*, const AtomicString&);
void removeCachedTagNodeList(TagNodeList*, const QualifiedName&);
void removeCachedLabelsNodeList(DynamicSubtreeNodeList*);
void removeCachedChildNodeList();
PassRefPtr<NodeList> getElementsByTagName(const AtomicString&);
PassRefPtr<NodeList> getElementsByTagNameNS(const AtomicString& namespaceURI, const AtomicString& localName);
PassRefPtr<NodeList> getElementsByName(const String& elementName);
PassRefPtr<NodeList> getElementsByClassName(const String& classNames);
virtual bool willRespondToMouseMoveEvents();
virtual bool willRespondToMouseWheelEvents();
virtual bool willRespondToMouseClickEvents();
PassRefPtr<Element> querySelector(const String& selectors, ExceptionCode&);
PassRefPtr<NodeList> querySelectorAll(const String& selectors, ExceptionCode&);
unsigned short compareDocumentPosition(Node*);
virtual Node* toNode();
virtual HTMLInputElement* toInputElement();
virtual const AtomicString& interfaceName() const;
virtual ScriptExecutionContext* scriptExecutionContext() const;
virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture);
virtual bool removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture);
virtual void* preDispatchEventHandler(Event*) { return 0; }
virtual void postDispatchEventHandler(Event*, void* ) { }
using EventTarget::dispatchEvent;
bool dispatchEvent(PassRefPtr<Event>);
void dispatchScopedEvent(PassRefPtr<Event>);
void dispatchScopedEventDispatchMediator(PassRefPtr<EventDispatchMediator>);
virtual void handleLocalEvents(Event*);
void dispatchRegionLayoutUpdateEvent();
void dispatchSubtreeModifiedEvent();
void dispatchDOMActivateEvent(int detail, PassRefPtr<Event> underlyingEvent);
void dispatchFocusInEvent(const AtomicString& eventType, PassRefPtr<Node> oldFocusedNode);
void dispatchFocusOutEvent(const AtomicString& eventType, PassRefPtr<Node> newFocusedNode);
bool dispatchKeyEvent(const PlatformKeyboardEvent&);
bool dispatchWheelEvent(const PlatformWheelEvent&);
bool dispatchMouseEvent(const PlatformMouseEvent&, const AtomicString& eventType, int clickCount = 0, Node* relatedTarget = 0);
void dispatchSimulatedClick(PassRefPtr<Event> underlyingEvent, bool sendMouseEvents = false, bool showPressedLook = true);
bool dispatchBeforeLoadEvent(const String& sourceURL);
virtual void dispatchFocusEvent(PassRefPtr<Node> oldFocusedNode);
virtual void dispatchBlurEvent(PassRefPtr<Node> newFocusedNode);
virtual void dispatchChangeEvent();
virtual void dispatchInputEvent();
virtual void defaultEventHandler(Event*);
virtual bool disabled() const;
using TreeShared<ContainerNode>::ref;
using TreeShared<ContainerNode>::deref;
virtual EventTargetData* eventTargetData();
virtual EventTargetData* ensureEventTargetData();
#if ENABLE(MICRODATA)
DOMSettableTokenList* itemProp();
DOMSettableTokenList* itemRef();
DOMSettableTokenList* itemType();
HTMLPropertiesCollection* properties();
#endif
#if ENABLE(MUTATION_OBSERVERS)
void getRegisteredMutationObserversOfType(HashMap<WebKitMutationObserver*, MutationRecordDeliveryOptions>&, WebKitMutationObserver::MutationType, const QualifiedName* attributeName);
MutationObserverRegistration* registerMutationObserver(PassRefPtr<WebKitMutationObserver>);
void unregisterMutationObserver(MutationObserverRegistration*);
void registerTransientMutationObserver(MutationObserverRegistration*);
void unregisterTransientMutationObserver(MutationObserverRegistration*);
void notifyMutationObserversNodeWillDetach();
#endif // ENABLE(MUTATION_OBSERVERS)
#if ENABLE(STYLE_SCOPED)
void registerScopedHTMLStyleChild();
void unregisterScopedHTMLStyleChild();
#endif
bool hasScopedHTMLStyleChild() const;
size_t numberOfScopedHTMLStyleChildren() const;
private:
enum NodeFlags {
IsTextFlag = 1,
IsContainerFlag = 1 << 1,
IsElementFlag = 1 << 2,
IsStyledElementFlag = 1 << 3,
IsHTMLFlag = 1 << 4,
IsSVGFlag = 1 << 5,
IsAttachedFlag = 1 << 6,
ChildNeedsStyleRecalcFlag = 1 << 7,
InDocumentFlag = 1 << 8,
IsLinkFlag = 1 << 9,
IsActiveFlag = 1 << 10,
IsHoveredFlag = 1 << 11,
InActiveChainFlag = 1 << 12,
InDetachFlag = 1 << 13,
HasRareDataFlag = 1 << 14,
IsShadowRootFlag = 1 << 15,
IsParsingChildrenFinishedFlag = 1 << 16, IsStyleAttributeValidFlag = 1 << 17, #if ENABLE(SVG)
AreSVGAttributesValidFlag = 1 << 18, IsSynchronizingSVGAttributesFlag = 1 << 19, HasSVGRareDataFlag = 1 << 20, #endif
StyleChangeMask = 1 << nodeStyleChangeShift | 1 << (nodeStyleChangeShift + 1),
SelfOrAncestorHasDirAutoFlag = 1 << 23,
HasCustomWillOrDidRecalcStyleFlag = 1 << 24,
HasCustomStyleForRendererFlag = 1 << 25,
HasNameFlag = 1 << 26,
AttributeStyleDirtyFlag = 1 << 27,
#if ENABLE(SVG)
DefaultNodeFlags = IsParsingChildrenFinishedFlag | IsStyleAttributeValidFlag | AreSVGAttributesValidFlag,
#else
DefaultNodeFlags = IsParsingChildrenFinishedFlag | IsStyleAttributeValidFlag,
#endif
InNamedFlowFlag = 1 << 29,
HasAttrListFlag = 1 << 30
};
bool getFlag(NodeFlags mask) const { return m_nodeFlags & mask; }
void setFlag(bool f, NodeFlags mask) const { m_nodeFlags = (m_nodeFlags & ~mask) | (-(int32_t)f & mask); }
void setFlag(NodeFlags mask) const { m_nodeFlags |= mask; }
void clearFlag(NodeFlags mask) const { m_nodeFlags &= ~mask; }
protected:
enum ConstructionType {
CreateOther = DefaultNodeFlags,
CreateText = DefaultNodeFlags | IsTextFlag,
CreateContainer = DefaultNodeFlags | IsContainerFlag,
CreateElement = CreateContainer | IsElementFlag,
CreateShadowRoot = CreateContainer | IsShadowRootFlag,
CreateStyledElement = CreateElement | IsStyledElementFlag,
CreateHTMLElement = CreateStyledElement | IsHTMLFlag,
CreateSVGElement = CreateStyledElement | IsSVGFlag,
CreateDocument = CreateContainer | InDocumentFlag
};
Node(Document*, ConstructionType);
virtual void didMoveToNewDocument(Document* oldDocument);
virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const { }
void setTabIndexExplicitly(short);
void clearTabIndexExplicitly();
bool hasRareData() const { return getFlag(HasRareDataFlag); }
NodeRareData* rareData() const;
NodeRareData* ensureRareData();
void clearRareData();
bool hasCustomWillOrDidRecalcStyle() const { return getFlag(HasCustomWillOrDidRecalcStyleFlag); }
void setHasCustomWillOrDidRecalcStyle() { setFlag(true, HasCustomWillOrDidRecalcStyleFlag); }
bool hasCustomStyleForRenderer() const { return getFlag(HasCustomStyleForRendererFlag); }
void setHasCustomStyleForRenderer() { setFlag(true, HasCustomStyleForRendererFlag); }
void clearHasCustomStyleForRenderer() { clearFlag(HasCustomStyleForRendererFlag); }
private:
NodeRareData* setTreeScope(TreeScope*);
void setDocument(Document*);
enum EditableLevel { Editable, RichlyEditable };
bool rendererIsEditable(EditableLevel) const;
bool isEditableToAccessibility(EditableLevel) const;
void setStyleChange(StyleChangeType);
void markAncestorsWithChildNeedsStyleRecalc();
virtual void refEventTarget();
virtual void derefEventTarget();
virtual OwnPtr<NodeRareData> createRareData();
bool rareDataFocused() const;
virtual RenderStyle* nonRendererRenderStyle() const;
virtual const AtomicString& virtualPrefix() const;
virtual const AtomicString& virtualLocalName() const;
virtual const AtomicString& virtualNamespaceURI() const;
virtual RenderStyle* virtualComputedStyle(PseudoId = NOPSEUDO);
Element* ancestorElement() const;
Node* traverseNextAncestorSibling() const;
Node* traverseNextAncestorSibling(const Node* stayWithin) const;
using TreeShared<ContainerNode>::parent;
void trackForDebugging();
#if ENABLE(MUTATION_OBSERVERS)
Vector<OwnPtr<MutationObserverRegistration> >* mutationObserverRegistry();
HashSet<MutationObserverRegistration*>* transientMutationObserverRegistry();
void collectMatchingObserversForMutation(HashMap<WebKitMutationObserver*, MutationRecordDeliveryOptions>&, Node* fromNode, WebKitMutationObserver::MutationType, const QualifiedName* attributeName);
#endif
mutable uint32_t m_nodeFlags;
Document* m_document;
Node* m_previous;
Node* m_next;
RenderObject* m_renderer;
protected:
bool isParsingChildrenFinished() const { return getFlag(IsParsingChildrenFinishedFlag); }
void setIsParsingChildrenFinished() { setFlag(IsParsingChildrenFinishedFlag); }
void clearIsParsingChildrenFinished() { clearFlag(IsParsingChildrenFinishedFlag); }
bool isStyleAttributeValid() const { return getFlag(IsStyleAttributeValidFlag); }
void setIsStyleAttributeValid(bool f) { setFlag(f, IsStyleAttributeValidFlag); }
void setIsStyleAttributeValid() const { setFlag(IsStyleAttributeValidFlag); }
void clearIsStyleAttributeValid() { clearFlag(IsStyleAttributeValidFlag); }
#if ENABLE(SVG)
bool areSVGAttributesValid() const { return getFlag(AreSVGAttributesValidFlag); }
void setAreSVGAttributesValid() const { setFlag(AreSVGAttributesValidFlag); }
void clearAreSVGAttributesValid() { clearFlag(AreSVGAttributesValidFlag); }
bool isSynchronizingSVGAttributes() const { return getFlag(IsSynchronizingSVGAttributesFlag); }
void setIsSynchronizingSVGAttributes() const { setFlag(IsSynchronizingSVGAttributesFlag); }
void clearIsSynchronizingSVGAttributes() const { clearFlag(IsSynchronizingSVGAttributesFlag); }
bool hasRareSVGData() const { return getFlag(HasSVGRareDataFlag); }
void setHasRareSVGData() { setFlag(HasSVGRareDataFlag); }
void clearHasRareSVGData() { clearFlag(HasSVGRareDataFlag); }
#endif
#if ENABLE(MICRODATA)
void setItemProp(const String&);
void setItemRef(const String&);
void setItemType(const String&);
#endif
};
inline void addSubresourceURL(ListHashSet<KURL>& urls, const KURL& url)
{
if (!url.isNull())
urls.add(url);
}
inline ContainerNode* Node::parentNode() const
{
return getFlag(IsShadowRootFlag) ? 0 : parent();
}
inline ContainerNode* Node::parentOrHostNode() const
{
return parent();
}
inline ContainerNode* Node::parentNodeGuaranteedHostFree() const
{
ASSERT(!getFlag(IsShadowRootFlag));
return parentOrHostNode();
}
inline void Node::reattach()
{
if (attached())
detach();
attach();
}
inline void Node::reattachIfAttached()
{
if (attached())
reattach();
}
}
#ifndef NDEBUG
void showTree(const WebCore::Node*);
#endif
#endif