]>
git.saurik.com Git - iphone-api.git/blob - WebCore/Attr.h
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
28 #include "ContainerNode.h"
29 #include "Attribute.h"
33 // Attr can have Text and EntityReference children
34 // therefore it has to be a fullblown Node. The plan
35 // is to dynamically allocate a textchild and store the
36 // resulting nodevalue in the Attribute upon
37 // destruction. however, this is not yet implemented.
39 class Attr
: public ContainerNode
{
40 friend class NamedAttrMap
;
42 Attr(Element
*, Document
*, PassRefPtr
<Attribute
>);
45 // Call this after calling the constructor so the
46 // Attr node isn't floating when we append the text node.
47 void createTextChild();
49 // DOM methods & attributes for Attr
50 String
name() const { return qualifiedName().toString(); }
51 bool specified() const { return m_specified
; }
52 Element
* ownerElement() const { return m_element
; }
54 String
value() const { return m_attribute
->value(); }
55 void setValue(const String
&, ExceptionCode
&);
57 // DOM methods overridden from parent classes
58 virtual String
nodeName() const;
59 virtual NodeType
nodeType() const;
60 const AtomicString
& localName() const;
61 const AtomicString
& namespaceURI() const;
62 const AtomicString
& prefix() const;
63 virtual void setPrefix(const AtomicString
&, ExceptionCode
&);
65 virtual String
nodeValue() const;
66 virtual void setNodeValue(const String
&, ExceptionCode
&);
67 virtual PassRefPtr
<Node
> cloneNode(bool deep
);
69 // Other methods (not part of DOM)
70 virtual bool isAttributeNode() const { return true; }
71 virtual bool childTypeAllowed(NodeType
);
73 virtual void childrenChanged(bool changedByParser
= false, Node
* beforeChange
= 0, Node
* afterChange
= 0, int childCountDelta
= 0);
75 Attribute
* attr() const { return m_attribute
.get(); }
76 const QualifiedName
& qualifiedName() const { return m_attribute
->name(); }
78 // An extension to get presentational information for attributes.
79 CSSStyleDeclaration
* style() { return m_attribute
->style(); }
81 void setSpecified(bool specified
) { m_specified
= specified
; }
84 virtual const AtomicString
& virtualPrefix() const { return prefix(); }
85 virtual const AtomicString
& virtualLocalName() const { return localName(); }
86 virtual const AtomicString
& virtualNamespaceURI() const { return namespaceURI(); }
89 RefPtr
<Attribute
> m_attribute
;
90 unsigned m_ignoreChildrenChanged
: 31;
94 } // namespace WebCore