Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: Source/core/dom/Attr.h

Issue 23567024: Have Attr constructor take a Document / Element reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix try bot failures Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/dom/Attr.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 24 matching lines...) Expand all
35 class MutableStylePropertySet; 35 class MutableStylePropertySet;
36 36
37 // Attr can have Text children 37 // Attr can have Text children
38 // therefore it has to be a fullblown Node. The plan 38 // therefore it has to be a fullblown Node. The plan
39 // is to dynamically allocate a textchild and store the 39 // is to dynamically allocate a textchild and store the
40 // resulting nodevalue in the attribute upon 40 // resulting nodevalue in the attribute upon
41 // destruction. however, this is not yet implemented. 41 // destruction. however, this is not yet implemented.
42 42
43 class Attr FINAL : public ContainerNode { 43 class Attr FINAL : public ContainerNode {
44 public: 44 public:
45 static PassRefPtr<Attr> create(Element*, const QualifiedName&); 45 static PassRefPtr<Attr> create(Element&, const QualifiedName&);
46 static PassRefPtr<Attr> create(Document*, const QualifiedName&, const Atomic String& value); 46 static PassRefPtr<Attr> create(Document&, const QualifiedName&, const Atomic String& value);
47 virtual ~Attr(); 47 virtual ~Attr();
48 48
49 String name() const { return qualifiedName().toString(); } 49 String name() const { return qualifiedName().toString(); }
50 bool specified() const { return m_specified; } 50 bool specified() const { return m_specified; }
51 Element* ownerElement() const { return m_element; } 51 Element* ownerElement() const { return m_element; }
52 52
53 const AtomicString& value() const; 53 const AtomicString& value() const;
54 void setValue(const AtomicString&, ExceptionState&); 54 void setValue(const AtomicString&, ExceptionState&);
55 void setValue(const AtomicString&); 55 void setValue(const AtomicString&);
56 56
57 const QualifiedName& qualifiedName() const { return m_name; } 57 const QualifiedName& qualifiedName() const { return m_name; }
58 58
59 bool isId() const; 59 bool isId() const;
60 60
61 void setSpecified(bool specified) { m_specified = specified; } 61 void setSpecified(bool specified) { m_specified = specified; }
62 62
63 void attachToElement(Element*); 63 void attachToElement(Element*);
64 void detachFromElementWithValue(const AtomicString&); 64 void detachFromElementWithValue(const AtomicString&);
65 65
66 virtual const AtomicString& localName() const OVERRIDE { return m_name.local Name(); } 66 virtual const AtomicString& localName() const OVERRIDE { return m_name.local Name(); }
67 virtual const AtomicString& namespaceURI() const OVERRIDE { return m_name.na mespaceURI(); } 67 virtual const AtomicString& namespaceURI() const OVERRIDE { return m_name.na mespaceURI(); }
68 virtual const AtomicString& prefix() const OVERRIDE { return m_name.prefix() ; } 68 virtual const AtomicString& prefix() const OVERRIDE { return m_name.prefix() ; }
69 69
70 virtual void setPrefix(const AtomicString&, ExceptionState&) OVERRIDE; 70 virtual void setPrefix(const AtomicString&, ExceptionState&) OVERRIDE;
71 71
72 private: 72 private:
73 Attr(Element*, const QualifiedName&); 73 Attr(Element&, const QualifiedName&);
74 Attr(Document*, const QualifiedName&, const AtomicString& value); 74 Attr(Document&, const QualifiedName&, const AtomicString& value);
75 75
76 void createTextChild(); 76 void createTextChild();
77 77
78 virtual String nodeName() const OVERRIDE { return name(); } 78 virtual String nodeName() const OVERRIDE { return name(); }
79 virtual NodeType nodeType() const OVERRIDE { return ATTRIBUTE_NODE; } 79 virtual NodeType nodeType() const OVERRIDE { return ATTRIBUTE_NODE; }
80 80
81 virtual String nodeValue() const OVERRIDE { return value(); } 81 virtual String nodeValue() const OVERRIDE { return value(); }
82 virtual void setNodeValue(const String&); 82 virtual void setNodeValue(const String&);
83 virtual PassRefPtr<Node> cloneNode(bool deep = true); 83 virtual PassRefPtr<Node> cloneNode(bool deep = true);
84 84
(...skipping 22 matching lines...) Expand all
107 107
108 inline const Attr* toAttr(const Node* node) 108 inline const Attr* toAttr(const Node* node)
109 { 109 {
110 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isAttributeNode()); 110 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isAttributeNode());
111 return static_cast<const Attr*>(node); 111 return static_cast<const Attr*>(node);
112 } 112 }
113 113
114 } // namespace WebCore 114 } // namespace WebCore
115 115
116 #endif // Attr_h 116 #endif // Attr_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/Attr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698