summaryrefslogtreecommitdiff
path: root/Source/WebCore/dom/TreeScope.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-02-03 09:55:33 +0100
committerSimon Hausmann <simon.hausmann@nokia.com>2012-02-03 09:55:33 +0100
commitcd44dc59cdfc39534aef4d417e9f3c412e3be139 (patch)
tree8d89889ba95ed6ec9322e733846cc9cce9d7dff1 /Source/WebCore/dom/TreeScope.cpp
parentd11f84f5b5cdc0d92a08af01b13472fdd5f9acb9 (diff)
downloadqtwebkit-cd44dc59cdfc39534aef4d417e9f3c412e3be139.tar.gz
Imported WebKit commit fce473cb4d55aa9fe9d0b0322a2fffecb731b961 (http://svn.webkit.org/repository/webkit/trunk@106560)
Diffstat (limited to 'Source/WebCore/dom/TreeScope.cpp')
-rw-r--r--Source/WebCore/dom/TreeScope.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/Source/WebCore/dom/TreeScope.cpp b/Source/WebCore/dom/TreeScope.cpp
index 91f3c295b..71384462e 100644
--- a/Source/WebCore/dom/TreeScope.cpp
+++ b/Source/WebCore/dom/TreeScope.cpp
@@ -26,28 +26,30 @@
#include "config.h"
#include "TreeScope.h"
+#include "ContainerNode.h"
+#include "Document.h"
#include "Element.h"
#include "HTMLAnchorElement.h"
#include "HTMLMapElement.h"
#include "HTMLNames.h"
-#include "NodeRareData.h"
#include "TreeScopeAdopter.h"
+#include <wtf/text/AtomicString.h>
+#include <wtf/text/CString.h>
namespace WebCore {
using namespace HTMLNames;
-TreeScope::TreeScope(Document* document, ConstructionType constructionType)
- : ContainerNode(document, constructionType)
+TreeScope::TreeScope(ContainerNode* rootNode)
+ : m_rootNode(rootNode)
, m_parentTreeScope(0)
, m_numNodeListCaches(0)
{
+ ASSERT(rootNode);
}
TreeScope::~TreeScope()
{
- if (hasRareData())
- clearRareData();
}
void TreeScope::destroyTreeScopeData()
@@ -59,7 +61,7 @@ void TreeScope::destroyTreeScopeData()
void TreeScope::setParentTreeScope(TreeScope* newParentScope)
{
// A document node cannot be re-parented.
- ASSERT(!isDocumentNode());
+ ASSERT(!rootNode()->isDocumentNode());
// Every scope other than document needs a parent scope.
ASSERT(newParentScope);
@@ -105,7 +107,7 @@ HTMLMapElement* TreeScope::getImageMap(const String& url) const
return 0;
size_t hashPos = url.find('#');
String name = (hashPos == notFound ? url : url.substring(hashPos + 1)).impl();
- if (document()->isHTMLDocument())
+ if (rootNode()->document()->isHTMLDocument())
return static_cast<HTMLMapElement*>(m_imageMapsByName.getElementByLowercasedMapName(AtomicString(name.lower()).impl(), this));
return static_cast<HTMLMapElement*>(m_imageMapsByName.getElementByMapName(AtomicString(name).impl(), this));
}
@@ -116,10 +118,10 @@ Element* TreeScope::findAnchor(const String& name)
return 0;
if (Element* element = getElementById(name))
return element;
- for (Node* node = this; node; node = node->traverseNextNode()) {
+ for (Node* node = rootNode(); node; node = node->traverseNextNode()) {
if (node->hasTagName(aTag)) {
HTMLAnchorElement* anchor = static_cast<HTMLAnchorElement*>(node);
- if (document()->inQuirksMode()) {
+ if (rootNode()->document()->inQuirksMode()) {
// Quirks mode, case insensitive comparison of names.
if (equalIgnoringCase(anchor->name(), name))
return anchor;