Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: Source/core/dom/Attr.cpp

Issue 23567024: Have Attr constructor take a Document / Element reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix try bot failures Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Attr.h ('k') | Source/core/dom/Document.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2012 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2012 Apple Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 19 matching lines...) Expand all
30 #include "core/dom/ExceptionCode.h" 30 #include "core/dom/ExceptionCode.h"
31 #include "core/dom/ScopedEventQueue.h" 31 #include "core/dom/ScopedEventQueue.h"
32 #include "core/dom/Text.h" 32 #include "core/dom/Text.h"
33 #include "wtf/text/AtomicString.h" 33 #include "wtf/text/AtomicString.h"
34 #include "wtf/text/StringBuilder.h" 34 #include "wtf/text/StringBuilder.h"
35 35
36 namespace WebCore { 36 namespace WebCore {
37 37
38 using namespace HTMLNames; 38 using namespace HTMLNames;
39 39
40 Attr::Attr(Element* element, const QualifiedName& name) 40 Attr::Attr(Element& element, const QualifiedName& name)
41 : ContainerNode(&element->document()) 41 : ContainerNode(&element.document())
42 , m_element(element) 42 , m_element(&element)
43 , m_name(name) 43 , m_name(name)
44 , m_ignoreChildrenChanged(0) 44 , m_ignoreChildrenChanged(0)
45 , m_specified(true) 45 , m_specified(true)
46 { 46 {
47 ScriptWrappable::init(this); 47 ScriptWrappable::init(this);
48 } 48 }
49 49
50 Attr::Attr(Document* document, const QualifiedName& name, const AtomicString& st andaloneValue) 50 Attr::Attr(Document& document, const QualifiedName& name, const AtomicString& st andaloneValue)
51 : ContainerNode(document) 51 : ContainerNode(&document)
52 , m_element(0) 52 , m_element(0)
53 , m_name(name) 53 , m_name(name)
54 , m_standaloneValue(standaloneValue) 54 , m_standaloneValue(standaloneValue)
55 , m_ignoreChildrenChanged(0) 55 , m_ignoreChildrenChanged(0)
56 , m_specified(true) 56 , m_specified(true)
57 { 57 {
58 ScriptWrappable::init(this); 58 ScriptWrappable::init(this);
59 } 59 }
60 60
61 PassRefPtr<Attr> Attr::create(Element* element, const QualifiedName& name) 61 PassRefPtr<Attr> Attr::create(Element& element, const QualifiedName& name)
62 { 62 {
63 RefPtr<Attr> attr = adoptRef(new Attr(element, name)); 63 RefPtr<Attr> attr = adoptRef(new Attr(element, name));
64 attr->createTextChild(); 64 attr->createTextChild();
65 return attr.release(); 65 return attr.release();
66 } 66 }
67 67
68 PassRefPtr<Attr> Attr::create(Document* document, const QualifiedName& name, con st AtomicString& value) 68 PassRefPtr<Attr> Attr::create(Document& document, const QualifiedName& name, con st AtomicString& value)
69 { 69 {
70 RefPtr<Attr> attr = adoptRef(new Attr(document, name, value)); 70 RefPtr<Attr> attr = adoptRef(new Attr(document, name, value));
71 attr->createTextChild(); 71 attr->createTextChild();
72 return attr.release(); 72 return attr.release();
73 } 73 }
74 74
75 Attr::~Attr() 75 Attr::~Attr()
76 { 76 {
77 } 77 }
78 78
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 m_element->didModifyAttribute(qualifiedName(), value); 136 m_element->didModifyAttribute(qualifiedName(), value);
137 } 137 }
138 138
139 void Attr::setNodeValue(const String& v) 139 void Attr::setNodeValue(const String& v)
140 { 140 {
141 setValue(v, IGNORE_EXCEPTION); 141 setValue(v, IGNORE_EXCEPTION);
142 } 142 }
143 143
144 PassRefPtr<Node> Attr::cloneNode(bool /*deep*/) 144 PassRefPtr<Node> Attr::cloneNode(bool /*deep*/)
145 { 145 {
146 RefPtr<Attr> clone = adoptRef(new Attr(&document(), qualifiedName(), value() )); 146 RefPtr<Attr> clone = adoptRef(new Attr(document(), qualifiedName(), value()) );
147 cloneChildNodes(clone.get()); 147 cloneChildNodes(clone.get());
148 return clone.release(); 148 return clone.release();
149 } 149 }
150 150
151 // DOM Section 1.1.1 151 // DOM Section 1.1.1
152 bool Attr::childTypeAllowed(NodeType type) const 152 bool Attr::childTypeAllowed(NodeType type) const
153 { 153 {
154 return TEXT_NODE == type; 154 return TEXT_NODE == type;
155 } 155 }
156 156
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 } 208 }
209 209
210 void Attr::attachToElement(Element* element) 210 void Attr::attachToElement(Element* element)
211 { 211 {
212 ASSERT(!m_element); 212 ASSERT(!m_element);
213 m_element = element; 213 m_element = element;
214 m_standaloneValue = nullAtom; 214 m_standaloneValue = nullAtom;
215 } 215 }
216 216
217 } 217 }
OLDNEW
« no previous file with comments | « Source/core/dom/Attr.h ('k') | Source/core/dom/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698