Commit 80c76ce7 authored by darin@apple.com's avatar darin@apple.com

2008-09-28 Darin Adler <darin@apple.com>

        Reviewed by Sam Weinig (except for a few comment and header tweaks).

        - https://bugs.webkit.org/show_bug.cgi?id=21158
          reduce use of virtual functions in Node for speed

        Speeds up Dromaeo a bit less than 1%.

        * bindings/js/JSNamedNodesCollection.cpp: Include Element.h instead of
        Node.h now that some inlines are in there.

        * dom/Attr.h: Override both the virtual and non-virtual name functions.

        * dom/ChildNodeList.cpp:
        (WebCore::ChildNodeList::nodeMatches): Updated to take an Element.
        * dom/ChildNodeList.h: Ditto.
        * dom/ClassNodeList.cpp:
        (WebCore::ClassNodeList::nodeMatches): Ditto.
        * dom/ClassNodeList.h: Ditto.

        * dom/Document.h: Put the Node::isDocumentNode() function's inline
        definition here where it can see the Document class definition.

        * dom/DynamicNodeList.cpp:
        (WebCore::DynamicNodeList::length): Changed to pass an Element.
        (WebCore::DynamicNodeList::itemForwardsFromCurrent): Ditto.
        (WebCore::DynamicNodeList::itemBackwardsFromCurrent): Ditto.
        (WebCore::DynamicNodeList::itemWithName): Ditto.
        * dom/DynamicNodeList.h: Ditto.

        * dom/Element.cpp: Removed virtualHasTagName.
        * dom/Element.h: Made localName, prefix, namespaceURI, and
        styleForRenderer non-virtual. Added virtualPrefix, virtualLocalName,
        virtualNamespaceURI, and removed virtualHasTagName. Put the
        Node::hasTagName, Node::hasAttributes, and Node::attributes
        functions' inline definitions here where they can see the Element
        class definition.

        * dom/NameNodeList.cpp:
        (WebCore::NameNodeList::nodeMatches): Updated to take an Element.
        * dom/NameNodeList.h: Ditto.

        * dom/Node.cpp:
        (WebCore::Node::virtualPrefix): Renamed from prefix.
        (WebCore::Node::virtualLocalName): Renamed from localName.
        (WebCore::Node::virtualNamespaceURI): Renamed from namespaceURI.
        (WebCore::Node::styleForRenderer): Handle the Element case here.

        * dom/Node.h: Removed definition of hasTagName that calls virtual,
        since we now have a non-virtual version. Made hasAttributes,
        attributes, remove, localName, namespaceURI, prefix, isDocumentNode,
        and styleForRenderer non-virtual. Added virtualPrefix,
        virtualLocalName, and virtualNamespaceURI. Removed isMalformed
        and setMalformed, which are used only on HTMLFormElement objects.

        * dom/TagNodeList.cpp:
        (WebCore::TagNodeList::nodeMatches): Updated to take an Element.
        * dom/TagNodeList.h: Ditto.

        * html/HTMLAnchorElement.cpp: Added a comment.
        * html/HTMLFormControlElement.cpp: Ditto.

        * html/HTMLAnchorElement.h: Removed unused, unimplemented setTabIndex
        function. Marked tabIndex function virtual explicitly for clarity.

        * html/HTMLAreaElement.h: Removed unused, unimplemented setTabIndex
        function. Marked isFocusable function virtual explicitly for clarity.

        * html/HTMLElement.h: Marked tabIndex function virtual explicitly for
        clarity.
        * html/HTMLFormControlElement.h: Ditto.

        * html/HTMLFormElement.h: Made isMalformed non-virtual.

        * html/HTMLParser.cpp:
        (WebCore::HTMLParser::handleError): Use the already-cast-to-HTMLElement
        pointer to call localName since that one does not need to call a virtual
        function.

        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::layoutBlock): Cast to HTMLFormElement before
        calling isMalformed. We already did a tag name check so we know it's
        an HTMLFormELement.

        * xml/XPathUtil.cpp:
        (WebCore::XPath::isValidContextNode): Rewrote to not make so many calls
        to nodeType(), since it's a virtual function.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37037 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 54c1969e
2008-09-28 Darin Adler <darin@apple.com>
Reviewed by Sam Weinig (except for a few comment and header tweaks).
- https://bugs.webkit.org/show_bug.cgi?id=21158
reduce use of virtual functions in Node for speed
Speeds up Dromaeo a bit less than 1%.
* bindings/js/JSNamedNodesCollection.cpp: Include Element.h instead of
Node.h now that some inlines are in there.
* dom/Attr.h: Override both the virtual and non-virtual name functions.
* dom/ChildNodeList.cpp:
(WebCore::ChildNodeList::nodeMatches): Updated to take an Element.
* dom/ChildNodeList.h: Ditto.
* dom/ClassNodeList.cpp:
(WebCore::ClassNodeList::nodeMatches): Ditto.
* dom/ClassNodeList.h: Ditto.
* dom/Document.h: Put the Node::isDocumentNode() function's inline
definition here where it can see the Document class definition.
* dom/DynamicNodeList.cpp:
(WebCore::DynamicNodeList::length): Changed to pass an Element.
(WebCore::DynamicNodeList::itemForwardsFromCurrent): Ditto.
(WebCore::DynamicNodeList::itemBackwardsFromCurrent): Ditto.
(WebCore::DynamicNodeList::itemWithName): Ditto.
* dom/DynamicNodeList.h: Ditto.
* dom/Element.cpp: Removed virtualHasTagName.
* dom/Element.h: Made localName, prefix, namespaceURI, and
styleForRenderer non-virtual. Added virtualPrefix, virtualLocalName,
virtualNamespaceURI, and removed virtualHasTagName. Put the
Node::hasTagName, Node::hasAttributes, and Node::attributes
functions' inline definitions here where they can see the Element
class definition.
* dom/NameNodeList.cpp:
(WebCore::NameNodeList::nodeMatches): Updated to take an Element.
* dom/NameNodeList.h: Ditto.
* dom/Node.cpp:
(WebCore::Node::virtualPrefix): Renamed from prefix.
(WebCore::Node::virtualLocalName): Renamed from localName.
(WebCore::Node::virtualNamespaceURI): Renamed from namespaceURI.
(WebCore::Node::styleForRenderer): Handle the Element case here.
* dom/Node.h: Removed definition of hasTagName that calls virtual,
since we now have a non-virtual version. Made hasAttributes,
attributes, remove, localName, namespaceURI, prefix, isDocumentNode,
and styleForRenderer non-virtual. Added virtualPrefix,
virtualLocalName, and virtualNamespaceURI. Removed isMalformed
and setMalformed, which are used only on HTMLFormElement objects.
* dom/TagNodeList.cpp:
(WebCore::TagNodeList::nodeMatches): Updated to take an Element.
* dom/TagNodeList.h: Ditto.
* html/HTMLAnchorElement.cpp: Added a comment.
* html/HTMLFormControlElement.cpp: Ditto.
* html/HTMLAnchorElement.h: Removed unused, unimplemented setTabIndex
function. Marked tabIndex function virtual explicitly for clarity.
* html/HTMLAreaElement.h: Removed unused, unimplemented setTabIndex
function. Marked isFocusable function virtual explicitly for clarity.
* html/HTMLElement.h: Marked tabIndex function virtual explicitly for
clarity.
* html/HTMLFormControlElement.h: Ditto.
* html/HTMLFormElement.h: Made isMalformed non-virtual.
* html/HTMLParser.cpp:
(WebCore::HTMLParser::handleError): Use the already-cast-to-HTMLElement
pointer to call localName since that one does not need to call a virtual
function.
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::layoutBlock): Cast to HTMLFormElement before
calling isMalformed. We already did a tag name check so we know it's
an HTMLFormELement.
* xml/XPathUtil.cpp:
(WebCore::XPath::isValidContextNode): Rewrote to not make so many calls
to nodeType(), since it's a virtual function.
2008-09-28 David Hyatt <hyatt@apple.com>
Make frameRectsChanged() cross-platform on ScrollView.
......
......@@ -27,9 +27,9 @@
#include "JSNamedNodesCollection.h"
#include "AtomicString.h"
#include "Element.h"
#include "JSNode.h"
#include "NamedAttrMap.h"
#include "Node.h"
namespace WebCore {
......
......@@ -57,9 +57,9 @@ public:
// DOM methods overridden from parent classes
virtual String nodeName() const;
virtual NodeType nodeType() const;
virtual const AtomicString& localName() const;
virtual const AtomicString& namespaceURI() const;
virtual const AtomicString& prefix() const;
const AtomicString& localName() const;
const AtomicString& namespaceURI() const;
const AtomicString& prefix() const;
virtual void setPrefix(const AtomicString&, ExceptionCode&);
virtual String nodeValue() const;
......@@ -81,6 +81,10 @@ public:
void setSpecified(bool specified) { m_specified = specified; }
private:
virtual const AtomicString& virtualPrefix() const { return prefix(); }
virtual const AtomicString& virtualLocalName() const { return localName(); }
virtual const AtomicString& virtualNamespaceURI() const { return namespaceURI(); }
Element* m_element;
RefPtr<Attribute> m_attribute;
unsigned m_ignoreChildrenChanged : 31;
......
......@@ -2,7 +2,7 @@
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2001 Dirk Mueller (mueller@kde.org)
* Copyright (C) 2004, 2007 Apple Inc. All rights reserved.
* Copyright (C) 2004, 2007, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -23,7 +23,7 @@
#include "config.h"
#include "ChildNodeList.h"
#include "ContainerNode.h"
#include "Element.h"
namespace WebCore {
......@@ -98,8 +98,11 @@ Node* ChildNodeList::item(unsigned index) const
return 0;
}
bool ChildNodeList::nodeMatches(Node* testNode) const
bool ChildNodeList::nodeMatches(Element* testNode) const
{
// Note: Due to the overrides of the length and item functions above,
// this function will be called only by DynamicNodeList::itemWithName,
// for an element that was located with getElementById.
return testNode->parentNode() == m_rootNode;
}
......
......@@ -42,7 +42,7 @@ namespace WebCore {
protected:
ChildNodeList(PassRefPtr<Node> rootNode, Caches*);
virtual bool nodeMatches(Node*) const;
virtual bool nodeMatches(Element*) const;
};
} // namespace WebCore
......
......@@ -41,7 +41,7 @@ ClassNodeList::ClassNodeList(PassRefPtr<Node> rootNode, const String& classNames
{
}
bool ClassNodeList::nodeMatches(Node* testNode) const
bool ClassNodeList::nodeMatches(Element* testNode) const
{
if (!testNode->hasClass())
return false;
......
......@@ -45,7 +45,7 @@ namespace WebCore {
private:
ClassNodeList(PassRefPtr<Node> rootNode, const String& classNames, Caches*);
virtual bool nodeMatches(Node*) const;
virtual bool nodeMatches(Element*) const;
ClassNames m_classNames;
};
......
......@@ -283,7 +283,6 @@ public:
virtual NodeType nodeType() const;
// Other methods (not part of DOM)
virtual bool isDocumentNode() const { return true; }
virtual bool isHTMLDocument() const { return false; }
virtual bool isImageDocument() const { return false; }
#if ENABLE(SVG)
......@@ -1075,6 +1074,11 @@ inline bool Document::hasElementWithId(AtomicStringImpl* id) const
ASSERT(id);
return m_elementsById.contains(id) || m_duplicateIds.contains(id);
}
inline bool Node::isDocumentNode() const
{
return this == m_document.get();
}
} // namespace WebCore
......
/**
/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2001 Dirk Mueller (mueller@kde.org)
* Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
* Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -59,35 +59,29 @@ unsigned DynamicNodeList::length() const
if (m_caches->isLengthCacheValid)
return m_caches->cachedLength;
unsigned len = 0;
unsigned length = 0;
for (Node* n = m_rootNode->firstChild(); n; n = n->traverseNextNode(m_rootNode.get())) {
if (n->isElementNode()) {
if (nodeMatches(n))
len++;
}
}
for (Node* n = m_rootNode->firstChild(); n; n = n->traverseNextNode(m_rootNode.get()))
length += n->isElementNode() && nodeMatches(static_cast<Element*>(n));
m_caches->cachedLength = len;
m_caches->cachedLength = length;
m_caches->isLengthCacheValid = true;
return len;
return length;
}
Node* DynamicNodeList::itemForwardsFromCurrent(Node* start, unsigned offset, int remainingOffset) const
{
ASSERT(remainingOffset >= 0);
for (Node* n = start; n; n = n->traverseNextNode(m_rootNode.get())) {
if (n->isElementNode()) {
if (nodeMatches(n)) {
if (!remainingOffset) {
m_caches->lastItem = n;
m_caches->lastItemOffset = offset;
m_caches->isItemCacheValid = true;
return n;
}
remainingOffset--;
if (n->isElementNode() && nodeMatches(static_cast<Element*>(n))) {
if (!remainingOffset) {
m_caches->lastItem = n;
m_caches->lastItemOffset = offset;
m_caches->isItemCacheValid = true;
return n;
}
--remainingOffset;
}
}
......@@ -98,16 +92,14 @@ Node* DynamicNodeList::itemBackwardsFromCurrent(Node* start, unsigned offset, in
{
ASSERT(remainingOffset < 0);
for (Node* n = start; n; n = n->traversePreviousNode(m_rootNode.get())) {
if (n->isElementNode()) {
if (nodeMatches(n)) {
if (!remainingOffset) {
m_caches->lastItem = n;
m_caches->lastItemOffset = offset;
m_caches->isItemCacheValid = true;
return n;
}
remainingOffset++;
if (n->isElementNode() && nodeMatches(static_cast<Element*>(n))) {
if (!remainingOffset) {
m_caches->lastItem = n;
m_caches->lastItemOffset = offset;
m_caches->isItemCacheValid = true;
return n;
}
++remainingOffset;
}
}
......@@ -135,21 +127,18 @@ Node* DynamicNodeList::item(unsigned offset) const
Node* DynamicNodeList::itemWithName(const AtomicString& elementId) const
{
if (m_rootNode->isDocumentNode() || m_rootNode->inDocument()) {
Node* node = m_rootNode->document()->getElementById(elementId);
if (!node || !nodeMatches(node))
return 0;
for (Node* p = node->parentNode(); p; p = p->parentNode()) {
if (p == m_rootNode)
return node;
Element* node = m_rootNode->document()->getElementById(elementId);
if (node && nodeMatches(node)) {
for (Node* p = node->parentNode(); p; p = p->parentNode()) {
if (p == m_rootNode)
return node;
}
}
return 0;
}
unsigned l = length();
for (unsigned i = 0; i < l; i++) {
unsigned length = this->length();
for (unsigned i = 0; i < length; i++) {
Node* node = item(i);
if (node->isElementNode() && static_cast<Element*>(node)->getIDAttribute() == elementId)
return node;
......
......@@ -32,6 +32,7 @@
namespace WebCore {
class AtomicString;
class Element;
class Node;
class DynamicNodeList : public NodeList {
......@@ -64,7 +65,7 @@ namespace WebCore {
DynamicNodeList(PassRefPtr<Node> rootNode);
DynamicNodeList(PassRefPtr<Node> rootNode, Caches*);
virtual bool nodeMatches(Node*) const = 0;
virtual bool nodeMatches(Element*) const = 0;
RefPtr<Node> m_rootNode;
mutable Caches* m_caches;
......
......@@ -1199,11 +1199,6 @@ void Element::cancelFocusAppearanceUpdate()
document()->cancelFocusAppearanceUpdate();
}
bool Element::virtualHasTagName(const QualifiedName& name) const
{
return hasTagName(name);
}
void Element::normalizeAttributes()
{
// Normalize attributes.
......
......@@ -101,10 +101,10 @@ public:
bool hasLocalName(const AtomicString& other) const { return m_tagName.localName() == other; }
bool hasLocalName(const QualifiedName& other) const { return m_tagName.localName() == other.localName(); }
virtual const AtomicString& localName() const { return m_tagName.localName(); }
virtual const AtomicString& prefix() const { return m_tagName.prefix(); }
virtual void setPrefix(const AtomicString &_prefix, ExceptionCode&);
virtual const AtomicString& namespaceURI() const { return m_tagName.namespaceURI(); }
const AtomicString& localName() const { return m_tagName.localName(); }
const AtomicString& prefix() const { return m_tagName.prefix(); }
virtual void setPrefix(const AtomicString&, ExceptionCode&);
const AtomicString& namespaceURI() const { return m_tagName.namespaceURI(); }
virtual KURL baseURI() const;
......@@ -140,7 +140,7 @@ public:
virtual void attach();
virtual void detach();
virtual RenderStyle* styleForRenderer(RenderObject* parent);
RenderStyle* styleForRenderer(RenderObject* parent);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
virtual void recalcStyle(StyleChange = NoChange);
......@@ -208,9 +208,10 @@ private:
void updateFocusAppearanceSoonAfterAttach();
void cancelFocusAppearanceUpdate();
virtual bool virtualHasTagName(const QualifiedName&) const;
private:
virtual const AtomicString& virtualPrefix() const { return prefix(); }
virtual const AtomicString& virtualLocalName() const { return localName(); }
virtual const AtomicString& virtualNamespaceURI() const { return namespaceURI(); }
QualifiedName m_tagName;
virtual NodeRareData* createRareData();
......@@ -234,6 +235,21 @@ protected:
private:
bool m_parsingChildrenFinished : 1;
};
inline bool Node::hasTagName(const QualifiedName& name) const
{
return isElementNode() && static_cast<const Element*>(this)->hasTagName(name);
}
inline bool Node::hasAttributes() const
{
return isElementNode() && static_cast<const Element*>(this)->hasAttributes();
}
inline NamedAttrMap* Node::attributes() const
{
return isElementNode() ? static_cast<const Element*>(this)->attributes() : 0;
}
} //namespace
......
......@@ -37,10 +37,9 @@ NameNodeList::NameNodeList(PassRefPtr<Node> rootNode, const String& name, Dynami
{
}
bool NameNodeList::nodeMatches(Node* testNode) const
bool NameNodeList::nodeMatches(Element* testNode) const
{
ASSERT(testNode->isElementNode());
return static_cast<Element*>(testNode)->getAttribute(nameAttr) == m_nodeName;
return testNode->getAttribute(nameAttr) == m_nodeName;
}
} // namespace WebCore
......@@ -42,7 +42,7 @@ namespace WebCore {
private:
NameNodeList(PassRefPtr<Node> rootNode, const String& name, Caches*);
virtual bool nodeMatches(Node*) const;
virtual bool nodeMatches(Element*) const;
AtomicString m_nodeName;
};
......
......@@ -271,11 +271,6 @@ PassRefPtr<NodeList> Node::childNodes()
return ChildNodeList::create(this, &data->nodeLists()->m_childNodeListCaches);
}
bool Node::virtualHasTagName(const QualifiedName&) const
{
return false;
}
Node *Node::lastDescendant() const
{
Node *n = const_cast<Node *>(this);
......@@ -369,7 +364,7 @@ void Node::normalize()
}
}
const AtomicString& Node::prefix() const
const AtomicString& Node::virtualPrefix() const
{
// For nodes other than elements and attributes, the prefix is always null
return nullAtom;
......@@ -383,12 +378,12 @@ void Node::setPrefix(const AtomicString& /*prefix*/, ExceptionCode& ec)
ec = NAMESPACE_ERR;
}
const AtomicString& Node::localName() const
const AtomicString& Node::virtualLocalName() const
{
return nullAtom;
}
const AtomicString& Node::namespaceURI() const
const AtomicString& Node::virtualNamespaceURI() const
{
return nullAtom;
}
......@@ -1049,9 +1044,11 @@ void Node::createRendererIfNeeded()
}
}
RenderStyle *Node::styleForRenderer(RenderObject *parent)
RenderStyle* Node::styleForRenderer(RenderObject* parent)
{
RenderStyle *style = parent->style();
if (isElementNode())
return document()->styleSelector()->styleForElement(static_cast<Element*>(this));
RenderStyle* style = parent->style();
style->ref();
return style;
}
......@@ -1458,16 +1455,6 @@ Document *Node::ownerDocument() const
return doc == this ? 0 : doc;
}
bool Node::hasAttributes() const
{
return false;
}
NamedAttrMap* Node::attributes() const
{
return 0;
}
KURL Node::baseURI() const
{
return parentNode() ? parentNode()->baseURI() : KURL();
......
......@@ -103,7 +103,7 @@ public:
// DOM methods & attributes for Node
bool hasTagName(const QualifiedName& name) const { return virtualHasTagName(name); }
bool hasTagName(const QualifiedName&) const;
virtual String nodeName() const = 0;
virtual String nodeValue() const;
virtual void setNodeValue(const String&, ExceptionCode&);
......@@ -115,8 +115,8 @@ public:
virtual PassRefPtr<NodeList> childNodes();
Node* firstChild() const { return isContainerNode() ? containerFirstChild() : 0; }
Node* lastChild() const { return isContainerNode() ? containerLastChild() : 0; }
virtual bool hasAttributes() const;
virtual NamedAttrMap* attributes() const;
bool hasAttributes() const;
NamedAttrMap* attributes() const;
virtual KURL baseURI() const;
......@@ -130,12 +130,12 @@ public:
virtual bool removeChild(Node* child, ExceptionCode&);
virtual bool appendChild(PassRefPtr<Node> newChild, ExceptionCode&, bool shouldLazyAttach = false);
virtual void remove(ExceptionCode&);
void remove(ExceptionCode&);
bool hasChildNodes() const { return firstChild(); }
virtual PassRefPtr<Node> cloneNode(bool deep) = 0;
virtual const AtomicString& localName() const;
virtual const AtomicString& namespaceURI() const;
virtual const AtomicString& prefix() const;
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();
......@@ -159,9 +159,10 @@ public:
virtual bool isHTMLElement() const { return false; }
#if ENABLE(SVG)
virtual
virtual bool isSVGElement() const { return false; }
#else
static bool isSVGElement() { return false; }
#endif
bool isSVGElement() const { return false; }
virtual bool isStyledElement() const { return false; }
virtual bool isFrameOwnerElement() const { return false; }
......@@ -169,7 +170,7 @@ public:
virtual bool isTextNode() const { return false; }
virtual bool isCommentNode() const { return false; }
virtual bool isCharacterDataNode() const { return false; }
virtual bool isDocumentNode() const { return false; }
bool isDocumentNode() const;
virtual bool isEventTargetNode() const { return false; }
virtual bool isShadowNode() const { return false; }
virtual Node* shadowParentNode() { return 0; }
......@@ -183,11 +184,6 @@ public:
bool isBlockFlow() const;
bool isBlockFlowOrBlockTable() const;
// Used by <form> elements to indicate a malformed state of some kind, typically
// used to keep from applying the bottom margin of the form.
virtual bool isMalformed() { return false; }
virtual void setMalformed(bool malformed) { }
// These low-level calls give the caller responsibility for maintaining the integrity of the tree.
void setPreviousSibling(Node* previous) { m_previous = previous; }
void setNextSibling(Node* next) { m_next = next; }
......@@ -272,7 +268,7 @@ public:
virtual bool canLazyAttach();
virtual void setFocus(bool b = true);
virtual void setActive(bool b = true, bool pause=false) { m_active = b; }
virtual void setActive(bool b = true, bool /*pause*/ = false) { m_active = b; }
virtual void setHovered(bool b = true) { m_hovered = b; }
virtual short tabIndex() const;
......@@ -309,9 +305,9 @@ public:
// of a DocumentType node that is not used with any Document yet. A Document node returns itself.
Document* document() const
{
ASSERT(this);
ASSERT(m_document || nodeType() == DOCUMENT_TYPE_NODE && !inDocument());
return m_document.get();
ASSERT(this);
ASSERT(m_document || nodeType() == DOCUMENT_TYPE_NODE && !inDocument());
return m_document.get();
}
void setDocument(Document*);
......@@ -319,10 +315,10 @@ public:
// node tree, false otherwise.
bool inDocument() const
{
ASSERT(m_document || !m_inDocument);
return m_inDocument;
ASSERT(m_document || !m_inDocument);
return m_inDocument;
}
bool isReadOnlyNode() const { return nodeType() == ENTITY_REFERENCE_NODE; }
virtual bool childTypeAllowed(NodeType) { return false; }
unsigned childNodeCount() const { return isContainerNode() ? containerChildNodeCount() : 0; }
......@@ -412,7 +408,7 @@ public:
virtual void willRemove();
void createRendererIfNeeded();
virtual RenderStyle* styleForRenderer(RenderObject* parent);
RenderStyle* styleForRenderer(RenderObject* parent);
virtual bool rendererIsNeeded(RenderStyle*);
#if ENABLE(SVG)
virtual bool childShouldCreateRenderer(Node*) const { return true; }
......@@ -497,14 +493,12 @@ protected:
virtual void didMoveToNewOwnerDocument() { }
virtual void getSubresourceAttributeStrings(Vector<String>&) const { }
void setTabIndexExplicitly(short i);
void setTabIndexExplicitly(short);
bool hasRareData() const { return m_hasRareData; }
NodeRareData* rareData() const;
NodeRareData* ensureRareData();
virtual bool virtualHasTagName(const QualifiedName&) const;
private:
virtual NodeRareData* createRareData();
......@@ -513,8 +507,13 @@ private:
Node* containerFirstChild() const;
Node* containerLastChild() const;
bool rareDataFocused() const;
virtual RenderStyle* nonRendererRenderStyle() const;
virtual const AtomicString& virtualPrefix() const;
virtual const AtomicString& virtualLocalName() const;