Changeset 164248 in webkit


Ignore:
Timestamp:
Feb 17, 2014, 2:12:30 PM (11 years ago)
Author:
Antti Koivisto
Message:

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:
Location:
trunk/Source/WebCore
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/Source/WebCore/ChangeLog

    r164245 r164248  
     12014-02-17  Antti Koivisto  <antti@apple.com>
     2
     3        Node constructor should take Document reference
     4        https://bugs.webkit.org/show_bug.cgi?id=128931
     5
     6        Reviewed by Geoff Garen.
     7
     8        * dom/Attr.cpp:
     9        (WebCore::Attr::Attr):
     10        * dom/CharacterData.h:
     11        (WebCore::CharacterData::CharacterData):
     12        * dom/ContainerNode.cpp:
     13        (WebCore::ContainerNode::~ContainerNode):
     14        * dom/ContainerNode.h:
     15        (WebCore::ContainerNode::ContainerNode):
     16        * dom/Document.cpp:
     17        (WebCore::Document::Document):
     18        * dom/Document.h:
     19        (WebCore::Node::Node):
     20        * dom/DocumentFragment.cpp:
     21        (WebCore::DocumentFragment::DocumentFragment):
     22        (WebCore::DocumentFragment::create):
     23        * dom/DocumentFragment.h:
     24        * dom/DocumentType.cpp:
     25        (WebCore::DocumentType::DocumentType):
     26        * dom/Element.h:
     27        (WebCore::Element::Element):
     28        * dom/Entity.h:
     29        (WebCore::Entity::Entity):
     30        * dom/EntityReference.cpp:
     31        (WebCore::EntityReference::EntityReference):
     32        * dom/Node.cpp:
     33        (WebCore::Node::~Node):
     34        (WebCore::Node::willBeDeletedFrom):
     35        * dom/Node.h:
     36        * dom/Notation.cpp:
     37        * dom/Notation.h:
     38        (WebCore::Notation::publicId):
     39        (WebCore::Notation::systemId):
     40        (WebCore::Notation::Notation):
     41       
     42            Remove cruft from this non-instantiated class.
     43
     44        * dom/ShadowRoot.cpp:
     45        (WebCore::ShadowRoot::ShadowRoot):
     46        (WebCore::ShadowRoot::~ShadowRoot):
     47        * dom/TemplateContentDocumentFragment.h:
     48
    1492014-02-17  Sergio Correia  <sergio.correia@openbossa.org>
    250
  • TabularUnified trunk/Source/WebCore/dom/Attr.cpp

    r159856 r164248  
    3838
    3939Attr::Attr(Element* element, const QualifiedName& name)
    40     : ContainerNode(&element->document())
     40    : ContainerNode(element->document())
    4141    , m_element(element)
    4242    , m_name(name)
     
    4646
    4747Attr::Attr(Document& document, const QualifiedName& name, const AtomicString& standaloneValue)
    48     : ContainerNode(&document)
     48    : ContainerNode(document)
    4949    , m_element(0)
    5050    , m_name(name)
  • TabularUnified trunk/Source/WebCore/dom/CharacterData.h

    r162158 r164248  
    5050protected:
    5151    CharacterData(Document& document, const String& text, ConstructionType type)
    52         : Node(&document, type)
     52        : Node(document, type)
    5353        , m_data(!text.isNull() ? text : emptyString())
    5454    {
  • TabularUnified trunk/Source/WebCore/dom/ContainerNode.cpp

    r164195 r164248  
    151151ContainerNode::~ContainerNode()
    152152{
    153     willBeDeletedFrom(&document());
     153    willBeDeletedFrom(document());
    154154    removeDetachedChildren();
    155155}
  • TabularUnified trunk/Source/WebCore/dom/ContainerNode.h

    r163754 r164248  
    139139
    140140protected:
    141     explicit ContainerNode(Document*, ConstructionType = CreateContainer);
     141    explicit ContainerNode(Document&, ConstructionType = CreateContainer);
    142142
    143143    static void queuePostAttachCallback(NodeCallback, Node&, unsigned = 0);
     
    183183NODE_TYPE_CASTS(ContainerNode)
    184184
    185 inline ContainerNode::ContainerNode(Document* document, ConstructionType type)
     185inline ContainerNode::ContainerNode(Document& document, ConstructionType type)
    186186    : Node(document, type)
    187187    , m_firstChild(0)
  • TabularUnified trunk/Source/WebCore/dom/Document.cpp

    r164242 r164248  
    394394
    395395Document::Document(Frame* frame, const URL& url, unsigned documentClasses, unsigned constructionFlags)
    396     : ContainerNode(this, CreateDocument)
     396    : ContainerNode(*this, CreateDocument)
    397397    , TreeScope(*this)
    398398#if ENABLE(TOUCH_EVENTS) && PLATFORM(IOS)
  • TabularUnified trunk/Source/WebCore/dom/Document.h

    r164242 r164248  
    17091709}
    17101710
    1711 inline Node::Node(Document* document, ConstructionType type)
     1711inline Node::Node(Document& document, ConstructionType type)
    17121712    : m_nodeFlags(type)
    17131713    , m_parentNode(0)
    1714     , m_treeScope(document)
     1714    , m_treeScope(&document)
    17151715    , m_previous(0)
    17161716    , m_next(0)
    17171717{
    1718     document->incrementReferencingNodeCount();
     1718    document.incrementReferencingNodeCount();
    17191719
    17201720#if !defined(NDEBUG) || (defined(DUMP_NODE_STATISTICS) && DUMP_NODE_STATISTICS)
  • TabularUnified trunk/Source/WebCore/dom/DocumentFragment.cpp

    r162062 r164248  
    3232namespace WebCore {
    3333
    34 DocumentFragment::DocumentFragment(Document* document, ConstructionType constructionType)
     34DocumentFragment::DocumentFragment(Document& document, ConstructionType constructionType)
    3535    : ContainerNode(document, constructionType)
    3636{
     
    3939PassRefPtr<DocumentFragment> DocumentFragment::create(Document& document)
    4040{
    41     return adoptRef(new DocumentFragment(&document, Node::CreateDocumentFragment));
     41    return adoptRef(new DocumentFragment(document, Node::CreateDocumentFragment));
    4242}
    4343
    4444PassRefPtr<DocumentFragment> DocumentFragment::create(ScriptExecutionContext& context)
    4545{
    46     return adoptRef(new DocumentFragment(&toDocument(context), Node::CreateDocumentFragment));
     46    return adoptRef(new DocumentFragment(toDocument(context), Node::CreateDocumentFragment));
    4747}
    4848
  • TabularUnified trunk/Source/WebCore/dom/DocumentFragment.h

    r162139 r164248  
    4444
    4545protected:
    46     DocumentFragment(Document*, ConstructionType = CreateContainer);
     46    DocumentFragment(Document&, ConstructionType = CreateContainer);
    4747    virtual String nodeName() const override;
    4848
  • TabularUnified trunk/Source/WebCore/dom/DocumentType.cpp

    r156550 r164248  
    3030
    3131DocumentType::DocumentType(Document& document, const String& name, const String& publicId, const String& systemId)
    32     : Node(&document, CreateOther)
     32    : Node(document, CreateOther)
    3333    , m_name(name)
    3434    , m_publicId(publicId)
  • TabularUnified trunk/Source/WebCore/dom/Element.h

    r164176 r164248  
    570570protected:
    571571    Element(const QualifiedName& tagName, Document& document, ConstructionType type)
    572         : ContainerNode(&document, type)
     572        : ContainerNode(document, type)
    573573        , m_tagName(tagName)
    574574    {
  • TabularUnified trunk/Source/WebCore/dom/Entity.h

    r34336 r164248  
    3636
    3737private:
    38     Entity() : ContainerNode(0) {}
     38    Entity(Document& document)
     39        : ContainerNode(document)
     40    { }
    3941};
    4042
  • TabularUnified trunk/Source/WebCore/dom/EntityReference.cpp

    r155808 r164248  
    2727
    2828inline EntityReference::EntityReference(Document& document, const String& entityName)
    29     : ContainerNode(&document)
     29    : ContainerNode(document)
    3030    , m_entityName(entityName)
    3131{
  • TabularUnified trunk/Source/WebCore/dom/Node.cpp

    r164242 r164248  
    307307
    308308    if (!isContainerNode())
    309         willBeDeletedFrom(&document());
     309        willBeDeletedFrom(document());
    310310
    311311    document().decrementReferencingNodeCount();
     
    314314}
    315315
    316 void Node::willBeDeletedFrom(Document* document)
     316void Node::willBeDeletedFrom(Document& document)
    317317{
    318318    if (hasEventTargetData()) {
    319319#if ENABLE(TOUCH_EVENTS) && PLATFORM(IOS)
    320         if (document)
    321             document->removeTouchEventListener(this, true);
     320        document.removeTouchEventListener(this, true);
    322321#endif
    323322        clearEventTargetData();
    324323    }
    325324
    326     if (document) {
    327         if (AXObjectCache* cache = document->existingAXObjectCache())
    328             cache->remove(this);
    329     }
     325    if (AXObjectCache* cache = document.existingAXObjectCache())
     326        cache->remove(this);
    330327}
    331328
  • TabularUnified trunk/Source/WebCore/dom/Node.h

    r164195 r164248  
    154154
    155155    virtual ~Node();
    156     void willBeDeletedFrom(Document*);
     156    void willBeDeletedFrom(Document&);
    157157
    158158    // DOM methods & attributes for Node
     
    625625        CreateMathMLElement = CreateStyledElement | IsMathMLFlag,
    626626    };
    627     Node(Document*, ConstructionType);
     627    Node(Document&, ConstructionType);
    628628
    629629    virtual void didMoveToNewDocument(Document* oldDocument);
  • TabularUnified trunk/Source/WebCore/dom/Notation.cpp

    r155808 r164248  
    1 /*
    2  * Copyright (C) 2000 Peter Kelly (pmk@post.com)
    3  * Copyright (C) 2006, 2009 Apple Inc. All rights reserved.
    4  *
    5  * This library is free software; you can redistribute it and/or
    6  * modify it under the terms of the GNU Library General Public
    7  * License as published by the Free Software Foundation; either
    8  * version 2 of the License, or (at your option) any later version.
    9  *
    10  * This library is distributed in the hope that it will be useful,
    11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    13  * Library General Public License for more details.
    14  *
    15  * You should have received a copy of the GNU Library General Public License
    16  * along with this library; see the file COPYING.LIB.  If not, write to
    17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    18  * Boston, MA 02110-1301, USA.
    19  */
    20 
    21 #include "config.h"
    22 #include "Notation.h"
    23 
    24 #include "Document.h"
    25 
    26 namespace WebCore {
    27 
    28 Notation::Notation(Document& document, const String& name, const String& publicId, const String& systemId)
    29     : ContainerNode(&document)
    30     , m_name(name)
    31     , m_publicId(publicId)
    32     , m_systemId(systemId)
    33 {
    34 }
    35 
    36 String Notation::nodeName() const
    37 {
    38     return m_name;
    39 }
    40 
    41 Node::NodeType Notation::nodeType() const
    42 {
    43     return NOTATION_NODE;
    44 }
    45 
    46 PassRefPtr<Node> Notation::cloneNode(bool /*deep*/)
    47 {
    48     // Spec says cloning Notation nodes is "implementation dependent". We do not support it.
    49     return 0;
    50 }
    51 
    52 bool Notation::childTypeAllowed(NodeType) const
    53 {
    54     return false;
    55 }
    56 
    57 } // namespace
     1// FIXME: remove me
  • TabularUnified trunk/Source/WebCore/dom/Notation.h

    r162180 r164248  
    2929// FIXME: This class is never instantiated. Maybe it should be removed.
    3030
    31 class Notation final : public ContainerNode {
     31class Notation : public ContainerNode {
    3232public:
    33     const String& publicId() const { return m_publicId; }
    34     const String& systemId() const { return m_systemId; }
     33    String publicId() const { ASSERT_NOT_REACHED(); return String(); }
     34    String systemId() const { ASSERT_NOT_REACHED(); return String(); }
    3535
    3636private:
    37     Notation(Document&, const String& name, const String& publicId, const String& systemId);
    38 
    39     virtual String nodeName() const override;
    40     virtual NodeType nodeType() const override;
    41     virtual PassRefPtr<Node> cloneNode(bool deep) override;
    42     virtual bool childTypeAllowed(NodeType) const override;
    43 
    44     String m_name;
    45     String m_publicId;
    46     String m_systemId;
     37    Notation(Document& document)
     38        : ContainerNode(document)
     39    { }
    4740};
    4841
  • TabularUnified trunk/Source/WebCore/dom/ShadowRoot.cpp

    r164195 r164248  
    5353
    5454ShadowRoot::ShadowRoot(Document& document, ShadowRootType type)
    55     : DocumentFragment(&document, CreateShadowRoot)
     55    : DocumentFragment(document, CreateShadowRoot)
    5656    , TreeScope(*this, document)
    5757    , m_resetStyleInheritance(false)
     
    6767    // clears Node::m_treeScope thus ContainerNode is no longer able
    6868    // to access it Document reference after that.
    69     willBeDeletedFrom(&document());
     69    willBeDeletedFrom(document());
    7070
    7171    // We must remove all of our children first before the TreeScope destructor
  • TabularUnified trunk/Source/WebCore/dom/TemplateContentDocumentFragment.h

    r162158 r164248  
    4646private:
    4747    TemplateContentDocumentFragment(Document& document, const Element* host)
    48         : DocumentFragment(&document, CreateDocumentFragment)
     48        : DocumentFragment(document, CreateDocumentFragment)
    4949        , m_host(host)
    5050    {
Note: See TracChangeset for help on using the changeset viewer.