| 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 18 matching lines...) Expand all Loading... |
| 29 #include "core/dom/QualifiedName.h" | 29 #include "core/dom/QualifiedName.h" |
| 30 | 30 |
| 31 namespace blink { | 31 namespace blink { |
| 32 | 32 |
| 33 // Attr can have Text children | 33 // Attr can have Text children |
| 34 // therefore it has to be a fullblown Node. The plan | 34 // therefore it has to be a fullblown Node. The plan |
| 35 // is to dynamically allocate a textchild and store the | 35 // is to dynamically allocate a textchild and store the |
| 36 // resulting nodevalue in the attribute upon | 36 // resulting nodevalue in the attribute upon |
| 37 // destruction. however, this is not yet implemented. | 37 // destruction. however, this is not yet implemented. |
| 38 | 38 |
| 39 class Attr FINAL : public ContainerNode { | 39 class Attr final : public ContainerNode { |
| 40 DEFINE_WRAPPERTYPEINFO(); | 40 DEFINE_WRAPPERTYPEINFO(); |
| 41 public: | 41 public: |
| 42 static PassRefPtrWillBeRawPtr<Attr> create(Element&, const QualifiedName&); | 42 static PassRefPtrWillBeRawPtr<Attr> create(Element&, const QualifiedName&); |
| 43 static PassRefPtrWillBeRawPtr<Attr> create(Document&, const QualifiedName&,
const AtomicString& value); | 43 static PassRefPtrWillBeRawPtr<Attr> create(Document&, const QualifiedName&,
const AtomicString& value); |
| 44 virtual ~Attr(); | 44 virtual ~Attr(); |
| 45 | 45 |
| 46 String name() const { return m_name.toString(); } | 46 String name() const { return m_name.toString(); } |
| 47 bool specified() const { return true; } | 47 bool specified() const { return true; } |
| 48 Element* ownerElement() const { return m_element; } | 48 Element* ownerElement() const { return m_element; } |
| 49 | 49 |
| 50 const AtomicString& value() const; | 50 const AtomicString& value() const; |
| 51 void setValue(const AtomicString&); | 51 void setValue(const AtomicString&); |
| 52 | 52 |
| 53 const AtomicString& valueForBindings() const; | 53 const AtomicString& valueForBindings() const; |
| 54 void setValueForBindings(const AtomicString&); | 54 void setValueForBindings(const AtomicString&); |
| 55 | 55 |
| 56 const QualifiedName qualifiedName() const; | 56 const QualifiedName qualifiedName() const; |
| 57 | 57 |
| 58 void attachToElement(Element*, const AtomicString&); | 58 void attachToElement(Element*, const AtomicString&); |
| 59 void detachFromElementWithValue(const AtomicString&); | 59 void detachFromElementWithValue(const AtomicString&); |
| 60 | 60 |
| 61 virtual const AtomicString& localName() const OVERRIDE { return m_name.local
Name(); } | 61 virtual const AtomicString& localName() const override { return m_name.local
Name(); } |
| 62 virtual const AtomicString& namespaceURI() const OVERRIDE { return m_name.na
mespaceURI(); } | 62 virtual const AtomicString& namespaceURI() const override { return m_name.na
mespaceURI(); } |
| 63 const AtomicString& prefix() const { return m_name.prefix(); } | 63 const AtomicString& prefix() const { return m_name.prefix(); } |
| 64 | 64 |
| 65 virtual void trace(Visitor*) OVERRIDE; | 65 virtual void trace(Visitor*) override; |
| 66 | 66 |
| 67 private: | 67 private: |
| 68 Attr(Element&, const QualifiedName&); | 68 Attr(Element&, const QualifiedName&); |
| 69 Attr(Document&, const QualifiedName&, const AtomicString& value); | 69 Attr(Document&, const QualifiedName&, const AtomicString& value); |
| 70 | 70 |
| 71 bool isElementNode() const WTF_DELETED_FUNCTION; // This will catch anyone d
oing an unnecessary check. | 71 bool isElementNode() const WTF_DELETED_FUNCTION; // This will catch anyone d
oing an unnecessary check. |
| 72 | 72 |
| 73 void createTextChild(); | 73 void createTextChild(); |
| 74 | 74 |
| 75 void setValueInternal(const AtomicString&); | 75 void setValueInternal(const AtomicString&); |
| 76 | 76 |
| 77 virtual String nodeName() const OVERRIDE { return name(); } | 77 virtual String nodeName() const override { return name(); } |
| 78 virtual NodeType nodeType() const OVERRIDE { return ATTRIBUTE_NODE; } | 78 virtual NodeType nodeType() const override { return ATTRIBUTE_NODE; } |
| 79 | 79 |
| 80 virtual String nodeValue() const OVERRIDE { return value(); } | 80 virtual String nodeValue() const override { return value(); } |
| 81 virtual void setNodeValue(const String&) OVERRIDE; | 81 virtual void setNodeValue(const String&) override; |
| 82 virtual PassRefPtrWillBeRawPtr<Node> cloneNode(bool deep = true) OVERRIDE; | 82 virtual PassRefPtrWillBeRawPtr<Node> cloneNode(bool deep = true) override; |
| 83 | 83 |
| 84 virtual bool isAttributeNode() const OVERRIDE { return true; } | 84 virtual bool isAttributeNode() const override { return true; } |
| 85 virtual bool childTypeAllowed(NodeType) const OVERRIDE; | 85 virtual bool childTypeAllowed(NodeType) const override; |
| 86 | 86 |
| 87 virtual void childrenChanged(const ChildrenChange&) OVERRIDE; | 87 virtual void childrenChanged(const ChildrenChange&) override; |
| 88 | 88 |
| 89 Attribute& elementAttribute(); | 89 Attribute& elementAttribute(); |
| 90 | 90 |
| 91 // Attr wraps either an element/name, or a name/value pair (when it's a stan
dalone Node.) | 91 // Attr wraps either an element/name, or a name/value pair (when it's a stan
dalone Node.) |
| 92 // Note that m_name is always set, but m_element/m_standaloneValue may be nu
ll. | 92 // Note that m_name is always set, but m_element/m_standaloneValue may be nu
ll. |
| 93 RawPtrWillBeMember<Element> m_element; | 93 RawPtrWillBeMember<Element> m_element; |
| 94 QualifiedName m_name; | 94 QualifiedName m_name; |
| 95 // Holds the value if it is a standalone Node, or the local name of the | 95 // Holds the value if it is a standalone Node, or the local name of the |
| 96 // attribute it is attached to on an Element. The latter may (letter case) | 96 // attribute it is attached to on an Element. The latter may (letter case) |
| 97 // differ from m_name's local name. As these two modes are non-overlapping, | 97 // differ from m_name's local name. As these two modes are non-overlapping, |
| 98 // use a single field. | 98 // use a single field. |
| 99 AtomicString m_standaloneValueOrAttachedLocalName; | 99 AtomicString m_standaloneValueOrAttachedLocalName; |
| 100 unsigned m_ignoreChildrenChanged; | 100 unsigned m_ignoreChildrenChanged; |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 DEFINE_NODE_TYPE_CASTS(Attr, isAttributeNode()); | 103 DEFINE_NODE_TYPE_CASTS(Attr, isAttributeNode()); |
| 104 | 104 |
| 105 } // namespace blink | 105 } // namespace blink |
| 106 | 106 |
| 107 #endif // Attr_h | 107 #endif // Attr_h |
| OLD | NEW |