| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 } | 45 } |
| 46 | 46 |
| 47 Attr::Attr(Document& document, const QualifiedName& name, const AtomicString& st
andaloneValue) | 47 Attr::Attr(Document& document, const QualifiedName& name, const AtomicString& st
andaloneValue) |
| 48 : Node(&document, CreateOther) | 48 : Node(&document, CreateOther) |
| 49 , m_element(nullptr) | 49 , m_element(nullptr) |
| 50 , m_name(name) | 50 , m_name(name) |
| 51 , m_standaloneValueOrAttachedLocalName(standaloneValue) | 51 , m_standaloneValueOrAttachedLocalName(standaloneValue) |
| 52 { | 52 { |
| 53 } | 53 } |
| 54 | 54 |
| 55 PassRefPtrWillBeRawPtr<Attr> Attr::create(Element& element, const QualifiedName&
name) | 55 RawPtr<Attr> Attr::create(Element& element, const QualifiedName& name) |
| 56 { | 56 { |
| 57 return adoptRefWillBeNoop(new Attr(element, name)); | 57 return (new Attr(element, name)); |
| 58 } | 58 } |
| 59 | 59 |
| 60 PassRefPtrWillBeRawPtr<Attr> Attr::create(Document& document, const QualifiedNam
e& name, const AtomicString& value) | 60 RawPtr<Attr> Attr::create(Document& document, const QualifiedName& name, const A
tomicString& value) |
| 61 { | 61 { |
| 62 return adoptRefWillBeNoop(new Attr(document, name, value)); | 62 return (new Attr(document, name, value)); |
| 63 } | 63 } |
| 64 | 64 |
| 65 Attr::~Attr() | 65 Attr::~Attr() |
| 66 { | 66 { |
| 67 } | 67 } |
| 68 | 68 |
| 69 const QualifiedName Attr::qualifiedName() const | 69 const QualifiedName Attr::qualifiedName() const |
| 70 { | 70 { |
| 71 if (m_element && !m_standaloneValueOrAttachedLocalName.isNull()) { | 71 if (m_element && !m_standaloneValueOrAttachedLocalName.isNull()) { |
| 72 // In the unlikely case the Element attribute has a local name | 72 // In the unlikely case the Element attribute has a local name |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 setValue(value); | 108 setValue(value); |
| 109 } | 109 } |
| 110 | 110 |
| 111 void Attr::setNodeValue(const String& v) | 111 void Attr::setNodeValue(const String& v) |
| 112 { | 112 { |
| 113 // Attr uses AtomicString type for its value to save memory as there | 113 // Attr uses AtomicString type for its value to save memory as there |
| 114 // is duplication among Elements' attributes values. | 114 // is duplication among Elements' attributes values. |
| 115 setValue(AtomicString(v)); | 115 setValue(AtomicString(v)); |
| 116 } | 116 } |
| 117 | 117 |
| 118 PassRefPtrWillBeRawPtr<Node> Attr::cloneNode(bool /*deep*/) | 118 RawPtr<Node> Attr::cloneNode(bool /*deep*/) |
| 119 { | 119 { |
| 120 UseCounter::count(document(), UseCounter::AttrCloneNode); | 120 UseCounter::count(document(), UseCounter::AttrCloneNode); |
| 121 return adoptRefWillBeNoop(new Attr(document(), m_name, value())); | 121 return (new Attr(document(), m_name, value())); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void Attr::detachFromElementWithValue(const AtomicString& value) | 124 void Attr::detachFromElementWithValue(const AtomicString& value) |
| 125 { | 125 { |
| 126 ASSERT(m_element); | 126 ASSERT(m_element); |
| 127 m_standaloneValueOrAttachedLocalName = value; | 127 m_standaloneValueOrAttachedLocalName = value; |
| 128 m_element = nullptr; | 128 m_element = nullptr; |
| 129 } | 129 } |
| 130 | 130 |
| 131 void Attr::attachToElement(Element* element, const AtomicString& attachedLocalNa
me) | 131 void Attr::attachToElement(Element* element, const AtomicString& attachedLocalNa
me) |
| 132 { | 132 { |
| 133 ASSERT(!m_element); | 133 ASSERT(!m_element); |
| 134 m_element = element; | 134 m_element = element; |
| 135 m_standaloneValueOrAttachedLocalName = attachedLocalName; | 135 m_standaloneValueOrAttachedLocalName = attachedLocalName; |
| 136 } | 136 } |
| 137 | 137 |
| 138 DEFINE_TRACE(Attr) | 138 DEFINE_TRACE(Attr) |
| 139 { | 139 { |
| 140 visitor->trace(m_element); | 140 visitor->trace(m_element); |
| 141 Node::trace(visitor); | 141 Node::trace(visitor); |
| 142 } | 142 } |
| 143 | 143 |
| 144 } // namespace blink | 144 } // namespace blink |
| OLD | NEW |