OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |