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) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. | 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 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 26 matching lines...) Expand all Loading... |
37 // is to dynamically allocate a textchild and store the | 37 // is to dynamically allocate a textchild and store the |
38 // resulting nodevalue in the attribute upon | 38 // resulting nodevalue in the attribute upon |
39 // destruction. however, this is not yet implemented. | 39 // destruction. however, this is not yet implemented. |
40 | 40 |
41 class Attr FINAL : public ContainerNode { | 41 class Attr FINAL : public ContainerNode { |
42 public: | 42 public: |
43 static PassRefPtrWillBeRawPtr<Attr> create(Element&, const QualifiedName&); | 43 static PassRefPtrWillBeRawPtr<Attr> create(Element&, const QualifiedName&); |
44 static PassRefPtrWillBeRawPtr<Attr> create(Document&, const QualifiedName&,
const AtomicString& value); | 44 static PassRefPtrWillBeRawPtr<Attr> create(Document&, const QualifiedName&,
const AtomicString& value); |
45 virtual ~Attr(); | 45 virtual ~Attr(); |
46 | 46 |
47 String name() const { return qualifiedName().toString(); } | 47 String name() const { return m_name.toString(); } |
48 bool specified() const { return true; } | 48 bool specified() const { return true; } |
49 Element* ownerElement() const { return m_element; } | 49 Element* ownerElement() const { return m_element; } |
50 | 50 |
51 const AtomicString& value() const; | 51 const AtomicString& value() const; |
52 void setValue(const AtomicString&); | 52 void setValue(const AtomicString&); |
53 | 53 |
54 const AtomicString& valueForBindings() const; | 54 const AtomicString& valueForBindings() const; |
55 void setValueForBindings(const AtomicString&); | 55 void setValueForBindings(const AtomicString&); |
56 | 56 |
57 const QualifiedName& qualifiedName() const { return m_name; } | 57 const QualifiedName qualifiedName() const; |
58 | 58 |
59 void attachToElement(Element*); | 59 void attachToElement(Element*, const AtomicString&); |
60 void detachFromElementWithValue(const AtomicString&); | 60 void detachFromElementWithValue(const AtomicString&); |
61 | 61 |
62 virtual const AtomicString& localName() const OVERRIDE { return m_name.local
Name(); } | 62 virtual const AtomicString& localName() const OVERRIDE { return m_name.local
Name(); } |
63 virtual const AtomicString& namespaceURI() const OVERRIDE { return m_name.na
mespaceURI(); } | 63 virtual const AtomicString& namespaceURI() const OVERRIDE { return m_name.na
mespaceURI(); } |
64 const AtomicString& prefix() const { return m_name.prefix(); } | 64 const AtomicString& prefix() const { return m_name.prefix(); } |
65 | 65 |
66 virtual void trace(Visitor*) OVERRIDE; | 66 virtual void trace(Visitor*) OVERRIDE; |
67 | 67 |
68 private: | 68 private: |
69 Attr(Element&, const QualifiedName&); | 69 Attr(Element&, const QualifiedName&); |
(...skipping 14 matching lines...) Expand all Loading... |
84 virtual bool childTypeAllowed(NodeType) const OVERRIDE; | 84 virtual bool childTypeAllowed(NodeType) const OVERRIDE; |
85 | 85 |
86 virtual void childrenChanged(bool changedByParser = false, Node* beforeChang
e = 0, Node* afterChange = 0, int childCountDelta = 0) OVERRIDE; | 86 virtual void childrenChanged(bool changedByParser = false, Node* beforeChang
e = 0, Node* afterChange = 0, int childCountDelta = 0) OVERRIDE; |
87 | 87 |
88 Attribute& elementAttribute(); | 88 Attribute& elementAttribute(); |
89 | 89 |
90 // Attr wraps either an element/name, or a name/value pair (when it's a stan
dalone Node.) | 90 // Attr wraps either an element/name, or a name/value pair (when it's a stan
dalone Node.) |
91 // Note that m_name is always set, but m_element/m_standaloneValue may be nu
ll. | 91 // Note that m_name is always set, but m_element/m_standaloneValue may be nu
ll. |
92 RawPtrWillBeMember<Element> m_element; | 92 RawPtrWillBeMember<Element> m_element; |
93 QualifiedName m_name; | 93 QualifiedName m_name; |
94 AtomicString m_standaloneValue; | 94 // Holds the value if it is a standalone Node, or the local name of the |
| 95 // attribute it is attached to on an Element. The latter may (letter case) |
| 96 // differ from m_name's local name. As these two modes are non-overlapping, |
| 97 // use a single field. |
| 98 AtomicString m_standaloneValueOrAttachedLocalName; |
95 unsigned m_ignoreChildrenChanged; | 99 unsigned m_ignoreChildrenChanged; |
96 }; | 100 }; |
97 | 101 |
98 DEFINE_NODE_TYPE_CASTS(Attr, isAttributeNode()); | 102 DEFINE_NODE_TYPE_CASTS(Attr, isAttributeNode()); |
99 | 103 |
100 } // namespace WebCore | 104 } // namespace WebCore |
101 | 105 |
102 #endif // Attr_h | 106 #endif // Attr_h |
OLD | NEW |