Diff
Modified: trunk/Source/WebCore/ChangeLog (164247 => 164248)
--- trunk/Source/WebCore/ChangeLog 2014-02-17 21:40:09 UTC (rev 164247)
+++ trunk/Source/WebCore/ChangeLog 2014-02-17 22:12:30 UTC (rev 164248)
@@ -1,3 +1,51 @@
+2014-02-17 Antti Koivisto <[email protected]>
+
+ Node constructor should take Document reference
+ https://bugs.webkit.org/show_bug.cgi?id=128931
+
+ Reviewed by Geoff Garen.
+
+ * dom/Attr.cpp:
+ (WebCore::Attr::Attr):
+ * dom/CharacterData.h:
+ (WebCore::CharacterData::CharacterData):
+ * dom/ContainerNode.cpp:
+ (WebCore::ContainerNode::~ContainerNode):
+ * dom/ContainerNode.h:
+ (WebCore::ContainerNode::ContainerNode):
+ * dom/Document.cpp:
+ (WebCore::Document::Document):
+ * dom/Document.h:
+ (WebCore::Node::Node):
+ * dom/DocumentFragment.cpp:
+ (WebCore::DocumentFragment::DocumentFragment):
+ (WebCore::DocumentFragment::create):
+ * dom/DocumentFragment.h:
+ * dom/DocumentType.cpp:
+ (WebCore::DocumentType::DocumentType):
+ * dom/Element.h:
+ (WebCore::Element::Element):
+ * dom/Entity.h:
+ (WebCore::Entity::Entity):
+ * dom/EntityReference.cpp:
+ (WebCore::EntityReference::EntityReference):
+ * dom/Node.cpp:
+ (WebCore::Node::~Node):
+ (WebCore::Node::willBeDeletedFrom):
+ * dom/Node.h:
+ * dom/Notation.cpp:
+ * dom/Notation.h:
+ (WebCore::Notation::publicId):
+ (WebCore::Notation::systemId):
+ (WebCore::Notation::Notation):
+
+ Remove cruft from this non-instantiated class.
+
+ * dom/ShadowRoot.cpp:
+ (WebCore::ShadowRoot::ShadowRoot):
+ (WebCore::ShadowRoot::~ShadowRoot):
+ * dom/TemplateContentDocumentFragment.h:
+
2014-02-17 Sergio Correia <[email protected]>
Replace uses of PassOwnPtr/OwnPtr with std::unique_ptr in WebCore/inspector
Modified: trunk/Source/WebCore/dom/Attr.cpp (164247 => 164248)
--- trunk/Source/WebCore/dom/Attr.cpp 2014-02-17 21:40:09 UTC (rev 164247)
+++ trunk/Source/WebCore/dom/Attr.cpp 2014-02-17 22:12:30 UTC (rev 164248)
@@ -37,7 +37,7 @@
using namespace HTMLNames;
Attr::Attr(Element* element, const QualifiedName& name)
- : ContainerNode(&element->document())
+ : ContainerNode(element->document())
, m_element(element)
, m_name(name)
, m_ignoreChildrenChanged(0)
@@ -45,7 +45,7 @@
}
Attr::Attr(Document& document, const QualifiedName& name, const AtomicString& standaloneValue)
- : ContainerNode(&document)
+ : ContainerNode(document)
, m_element(0)
, m_name(name)
, m_standaloneValue(standaloneValue)
Modified: trunk/Source/WebCore/dom/CharacterData.h (164247 => 164248)
--- trunk/Source/WebCore/dom/CharacterData.h 2014-02-17 21:40:09 UTC (rev 164247)
+++ trunk/Source/WebCore/dom/CharacterData.h 2014-02-17 22:12:30 UTC (rev 164248)
@@ -49,7 +49,7 @@
protected:
CharacterData(Document& document, const String& text, ConstructionType type)
- : Node(&document, type)
+ : Node(document, type)
, m_data(!text.isNull() ? text : emptyString())
{
ASSERT(type == CreateOther || type == CreateText || type == CreateEditingText);
Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (164247 => 164248)
--- trunk/Source/WebCore/dom/ContainerNode.cpp 2014-02-17 21:40:09 UTC (rev 164247)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp 2014-02-17 22:12:30 UTC (rev 164248)
@@ -150,7 +150,7 @@
ContainerNode::~ContainerNode()
{
- willBeDeletedFrom(&document());
+ willBeDeletedFrom(document());
removeDetachedChildren();
}
Modified: trunk/Source/WebCore/dom/ContainerNode.h (164247 => 164248)
--- trunk/Source/WebCore/dom/ContainerNode.h 2014-02-17 21:40:09 UTC (rev 164247)
+++ trunk/Source/WebCore/dom/ContainerNode.h 2014-02-17 22:12:30 UTC (rev 164248)
@@ -138,7 +138,7 @@
PassRefPtr<RadioNodeList> radioNodeList(const AtomicString&);
protected:
- explicit ContainerNode(Document*, ConstructionType = CreateContainer);
+ explicit ContainerNode(Document&, ConstructionType = CreateContainer);
static void queuePostAttachCallback(NodeCallback, Node&, unsigned = 0);
static bool postAttachCallbacksAreSuspended();
@@ -182,7 +182,7 @@
NODE_TYPE_CASTS(ContainerNode)
-inline ContainerNode::ContainerNode(Document* document, ConstructionType type)
+inline ContainerNode::ContainerNode(Document& document, ConstructionType type)
: Node(document, type)
, m_firstChild(0)
, m_lastChild(0)
Modified: trunk/Source/WebCore/dom/Document.cpp (164247 => 164248)
--- trunk/Source/WebCore/dom/Document.cpp 2014-02-17 21:40:09 UTC (rev 164247)
+++ trunk/Source/WebCore/dom/Document.cpp 2014-02-17 22:12:30 UTC (rev 164248)
@@ -393,7 +393,7 @@
#endif
Document::Document(Frame* frame, const URL& url, unsigned documentClasses, unsigned constructionFlags)
- : ContainerNode(this, CreateDocument)
+ : ContainerNode(*this, CreateDocument)
, TreeScope(*this)
#if ENABLE(TOUCH_EVENTS) && PLATFORM(IOS)
, m_handlingTouchEvent(false)
Modified: trunk/Source/WebCore/dom/Document.h (164247 => 164248)
--- trunk/Source/WebCore/dom/Document.h 2014-02-17 21:40:09 UTC (rev 164247)
+++ trunk/Source/WebCore/dom/Document.h 2014-02-17 22:12:30 UTC (rev 164248)
@@ -1708,14 +1708,14 @@
return this == &document();
}
-inline Node::Node(Document* document, ConstructionType type)
+inline Node::Node(Document& document, ConstructionType type)
: m_nodeFlags(type)
, m_parentNode(0)
- , m_treeScope(document)
+ , m_treeScope(&document)
, m_previous(0)
, m_next(0)
{
- document->incrementReferencingNodeCount();
+ document.incrementReferencingNodeCount();
#if !defined(NDEBUG) || (defined(DUMP_NODE_STATISTICS) && DUMP_NODE_STATISTICS)
trackForDebugging();
Modified: trunk/Source/WebCore/dom/DocumentFragment.cpp (164247 => 164248)
--- trunk/Source/WebCore/dom/DocumentFragment.cpp 2014-02-17 21:40:09 UTC (rev 164247)
+++ trunk/Source/WebCore/dom/DocumentFragment.cpp 2014-02-17 22:12:30 UTC (rev 164248)
@@ -31,19 +31,19 @@
namespace WebCore {
-DocumentFragment::DocumentFragment(Document* document, ConstructionType constructionType)
+DocumentFragment::DocumentFragment(Document& document, ConstructionType constructionType)
: ContainerNode(document, constructionType)
{
}
PassRefPtr<DocumentFragment> DocumentFragment::create(Document& document)
{
- return adoptRef(new DocumentFragment(&document, Node::CreateDocumentFragment));
+ return adoptRef(new DocumentFragment(document, Node::CreateDocumentFragment));
}
PassRefPtr<DocumentFragment> DocumentFragment::create(ScriptExecutionContext& context)
{
- return adoptRef(new DocumentFragment(&toDocument(context), Node::CreateDocumentFragment));
+ return adoptRef(new DocumentFragment(toDocument(context), Node::CreateDocumentFragment));
}
String DocumentFragment::nodeName() const
Modified: trunk/Source/WebCore/dom/DocumentFragment.h (164247 => 164248)
--- trunk/Source/WebCore/dom/DocumentFragment.h 2014-02-17 21:40:09 UTC (rev 164247)
+++ trunk/Source/WebCore/dom/DocumentFragment.h 2014-02-17 22:12:30 UTC (rev 164248)
@@ -43,7 +43,7 @@
virtual bool isTemplateContent() const { return false; }
protected:
- DocumentFragment(Document*, ConstructionType = CreateContainer);
+ DocumentFragment(Document&, ConstructionType = CreateContainer);
virtual String nodeName() const override;
private:
Modified: trunk/Source/WebCore/dom/DocumentType.cpp (164247 => 164248)
--- trunk/Source/WebCore/dom/DocumentType.cpp 2014-02-17 21:40:09 UTC (rev 164247)
+++ trunk/Source/WebCore/dom/DocumentType.cpp 2014-02-17 22:12:30 UTC (rev 164248)
@@ -29,7 +29,7 @@
namespace WebCore {
DocumentType::DocumentType(Document& document, const String& name, const String& publicId, const String& systemId)
- : Node(&document, CreateOther)
+ : Node(document, CreateOther)
, m_name(name)
, m_publicId(publicId)
, m_systemId(systemId)
Modified: trunk/Source/WebCore/dom/Element.h (164247 => 164248)
--- trunk/Source/WebCore/dom/Element.h 2014-02-17 21:40:09 UTC (rev 164247)
+++ trunk/Source/WebCore/dom/Element.h 2014-02-17 22:12:30 UTC (rev 164248)
@@ -569,7 +569,7 @@
protected:
Element(const QualifiedName& tagName, Document& document, ConstructionType type)
- : ContainerNode(&document, type)
+ : ContainerNode(document, type)
, m_tagName(tagName)
{
}
Modified: trunk/Source/WebCore/dom/Entity.h (164247 => 164248)
--- trunk/Source/WebCore/dom/Entity.h 2014-02-17 21:40:09 UTC (rev 164247)
+++ trunk/Source/WebCore/dom/Entity.h 2014-02-17 22:12:30 UTC (rev 164248)
@@ -35,7 +35,9 @@
String notationName() const { ASSERT_NOT_REACHED(); return String(); }
private:
- Entity() : ContainerNode(0) {}
+ Entity(Document& document)
+ : ContainerNode(document)
+ { }
};
} //namespace
Modified: trunk/Source/WebCore/dom/EntityReference.cpp (164247 => 164248)
--- trunk/Source/WebCore/dom/EntityReference.cpp 2014-02-17 21:40:09 UTC (rev 164247)
+++ trunk/Source/WebCore/dom/EntityReference.cpp 2014-02-17 22:12:30 UTC (rev 164248)
@@ -26,7 +26,7 @@
namespace WebCore {
inline EntityReference::EntityReference(Document& document, const String& entityName)
- : ContainerNode(&document)
+ : ContainerNode(document)
, m_entityName(entityName)
{
}
Modified: trunk/Source/WebCore/dom/Node.cpp (164247 => 164248)
--- trunk/Source/WebCore/dom/Node.cpp 2014-02-17 21:40:09 UTC (rev 164247)
+++ trunk/Source/WebCore/dom/Node.cpp 2014-02-17 22:12:30 UTC (rev 164248)
@@ -306,27 +306,24 @@
clearRareData();
if (!isContainerNode())
- willBeDeletedFrom(&document());
+ willBeDeletedFrom(document());
document().decrementReferencingNodeCount();
InspectorCounters::decrementCounter(InspectorCounters::NodeCounter);
}
-void Node::willBeDeletedFrom(Document* document)
+void Node::willBeDeletedFrom(Document& document)
{
if (hasEventTargetData()) {
#if ENABLE(TOUCH_EVENTS) && PLATFORM(IOS)
- if (document)
- document->removeTouchEventListener(this, true);
+ document.removeTouchEventListener(this, true);
#endif
clearEventTargetData();
}
- if (document) {
- if (AXObjectCache* cache = document->existingAXObjectCache())
- cache->remove(this);
- }
+ if (AXObjectCache* cache = document.existingAXObjectCache())
+ cache->remove(this);
}
NodeRareData* Node::rareData() const
Modified: trunk/Source/WebCore/dom/Node.h (164247 => 164248)
--- trunk/Source/WebCore/dom/Node.h 2014-02-17 21:40:09 UTC (rev 164247)
+++ trunk/Source/WebCore/dom/Node.h 2014-02-17 22:12:30 UTC (rev 164248)
@@ -153,7 +153,7 @@
static void dumpStatistics();
virtual ~Node();
- void willBeDeletedFrom(Document*);
+ void willBeDeletedFrom(Document&);
// DOM methods & attributes for Node
@@ -624,7 +624,7 @@
CreateEditingText = CreateText | IsEditingTextFlag,
CreateMathMLElement = CreateStyledElement | IsMathMLFlag,
};
- Node(Document*, ConstructionType);
+ Node(Document&, ConstructionType);
virtual void didMoveToNewDocument(Document* oldDocument);
Modified: trunk/Source/WebCore/dom/Notation.cpp (164247 => 164248)
--- trunk/Source/WebCore/dom/Notation.cpp 2014-02-17 21:40:09 UTC (rev 164247)
+++ trunk/Source/WebCore/dom/Notation.cpp 2014-02-17 22:12:30 UTC (rev 164248)
@@ -1,57 +1 @@
-/*
- * Copyright (C) 2000 Peter Kelly ([email protected])
- * Copyright (C) 2006, 2009 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "Notation.h"
-
-#include "Document.h"
-
-namespace WebCore {
-
-Notation::Notation(Document& document, const String& name, const String& publicId, const String& systemId)
- : ContainerNode(&document)
- , m_name(name)
- , m_publicId(publicId)
- , m_systemId(systemId)
-{
-}
-
-String Notation::nodeName() const
-{
- return m_name;
-}
-
-Node::NodeType Notation::nodeType() const
-{
- return NOTATION_NODE;
-}
-
-PassRefPtr<Node> Notation::cloneNode(bool /*deep*/)
-{
- // Spec says cloning Notation nodes is "implementation dependent". We do not support it.
- return 0;
-}
-
-bool Notation::childTypeAllowed(NodeType) const
-{
- return false;
-}
-
-} // namespace
+// FIXME: remove me
Modified: trunk/Source/WebCore/dom/Notation.h (164247 => 164248)
--- trunk/Source/WebCore/dom/Notation.h 2014-02-17 21:40:09 UTC (rev 164247)
+++ trunk/Source/WebCore/dom/Notation.h 2014-02-17 22:12:30 UTC (rev 164248)
@@ -28,22 +28,15 @@
// FIXME: This class is never instantiated. Maybe it should be removed.
-class Notation final : public ContainerNode {
+class Notation : public ContainerNode {
public:
- const String& publicId() const { return m_publicId; }
- const String& systemId() const { return m_systemId; }
+ String publicId() const { ASSERT_NOT_REACHED(); return String(); }
+ String systemId() const { ASSERT_NOT_REACHED(); return String(); }
private:
- Notation(Document&, const String& name, const String& publicId, const String& systemId);
-
- virtual String nodeName() const override;
- virtual NodeType nodeType() const override;
- virtual PassRefPtr<Node> cloneNode(bool deep) override;
- virtual bool childTypeAllowed(NodeType) const override;
-
- String m_name;
- String m_publicId;
- String m_systemId;
+ Notation(Document& document)
+ : ContainerNode(document)
+ { }
};
} //namespace
Modified: trunk/Source/WebCore/dom/ShadowRoot.cpp (164247 => 164248)
--- trunk/Source/WebCore/dom/ShadowRoot.cpp 2014-02-17 21:40:09 UTC (rev 164247)
+++ trunk/Source/WebCore/dom/ShadowRoot.cpp 2014-02-17 22:12:30 UTC (rev 164248)
@@ -52,7 +52,7 @@
};
ShadowRoot::ShadowRoot(Document& document, ShadowRootType type)
- : DocumentFragment(&document, CreateShadowRoot)
+ : DocumentFragment(document, CreateShadowRoot)
, TreeScope(*this, document)
, m_resetStyleInheritance(false)
, m_type(type)
@@ -66,7 +66,7 @@
// for this ShadowRoot instance because TreeScope destructor
// clears Node::m_treeScope thus ContainerNode is no longer able
// to access it Document reference after that.
- willBeDeletedFrom(&document());
+ willBeDeletedFrom(document());
// We must remove all of our children first before the TreeScope destructor
// runs so we don't go through TreeScopeAdopter for each child with a
Modified: trunk/Source/WebCore/dom/TemplateContentDocumentFragment.h (164247 => 164248)
--- trunk/Source/WebCore/dom/TemplateContentDocumentFragment.h 2014-02-17 21:40:09 UTC (rev 164247)
+++ trunk/Source/WebCore/dom/TemplateContentDocumentFragment.h 2014-02-17 22:12:30 UTC (rev 164248)
@@ -45,7 +45,7 @@
private:
TemplateContentDocumentFragment(Document& document, const Element* host)
- : DocumentFragment(&document, CreateDocumentFragment)
+ : DocumentFragment(document, CreateDocumentFragment)
, m_host(host)
{
}