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

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

Issue 203313002: Measure how often Attr needs its associated Element (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 virtual ~Attr(); 45 virtual ~Attr();
46 46
47 String name() const { return qualifiedName().toString(); } 47 String name() const { return qualifiedName().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&, ExceptionState&); 52 void setValue(const AtomicString&, ExceptionState&);
53 void setValue(const AtomicString&); 53 void setValue(const AtomicString&);
54 54
55 const AtomicString& valueForBindings() const;
56 void setValueForBindings(const AtomicString&);
57
58 virtual String nodeValue() const OVERRIDE { return value(); }
59 virtual void setNodeValue(const String&) OVERRIDE;
60
55 const QualifiedName& qualifiedName() const { return m_name; } 61 const QualifiedName& qualifiedName() const { return m_name; }
56 62
57 void attachToElement(Element*); 63 void attachToElement(Element*);
58 void detachFromElementWithValue(const AtomicString&); 64 void detachFromElementWithValue(const AtomicString&);
59 65
60 virtual const AtomicString& localName() const OVERRIDE { return m_name.local Name(); } 66 virtual const AtomicString& localName() const OVERRIDE { return m_name.local Name(); }
61 virtual const AtomicString& namespaceURI() const OVERRIDE { return m_name.na mespaceURI(); } 67 virtual const AtomicString& namespaceURI() const OVERRIDE { return m_name.na mespaceURI(); }
62 const AtomicString& prefix() const { return m_name.prefix(); } 68 const AtomicString& prefix() const { return m_name.prefix(); }
63 69
64 private: 70 private:
65 Attr(Element&, const QualifiedName&); 71 Attr(Element&, const QualifiedName&);
66 Attr(Document&, const QualifiedName&, const AtomicString& value); 72 Attr(Document&, const QualifiedName&, const AtomicString& value);
67 73
68 void createTextChild(); 74 void createTextChild();
69 75
70 virtual String nodeName() const OVERRIDE { return name(); } 76 virtual String nodeName() const OVERRIDE { return name(); }
71 virtual NodeType nodeType() const OVERRIDE { return ATTRIBUTE_NODE; } 77 virtual NodeType nodeType() const OVERRIDE { return ATTRIBUTE_NODE; }
72 78
73 virtual String nodeValue() const OVERRIDE { return value(); }
74 virtual void setNodeValue(const String&) OVERRIDE;
75 virtual PassRefPtr<Node> cloneNode(bool deep = true) OVERRIDE; 79 virtual PassRefPtr<Node> cloneNode(bool deep = true) OVERRIDE;
76 80
77 virtual bool isAttributeNode() const OVERRIDE { return true; } 81 virtual bool isAttributeNode() const OVERRIDE { return true; }
78 virtual bool childTypeAllowed(NodeType) const OVERRIDE; 82 virtual bool childTypeAllowed(NodeType) const OVERRIDE;
79 83
80 virtual void childrenChanged(bool changedByParser = false, Node* beforeChang e = 0, Node* afterChange = 0, int childCountDelta = 0) OVERRIDE; 84 virtual void childrenChanged(bool changedByParser = false, Node* beforeChang e = 0, Node* afterChange = 0, int childCountDelta = 0) OVERRIDE;
81 85
82 Attribute& elementAttribute(); 86 Attribute& elementAttribute();
83 87
84 // Attr wraps either an element/name, or a name/value pair (when it's a stan dalone Node.) 88 // Attr wraps either an element/name, or a name/value pair (when it's a stan dalone Node.)
85 // Note that m_name is always set, but m_element/m_standaloneValue may be nu ll. 89 // m_name is always set. When m_element is null m_standaloneValue is not exp osed to bindings.
86 Element* m_element; 90 Element* m_element;
87 QualifiedName m_name; 91 QualifiedName m_name;
88 AtomicString m_standaloneValue; 92 AtomicString m_standaloneValue;
89 unsigned m_ignoreChildrenChanged; 93 unsigned m_ignoreChildrenChanged;
90 }; 94 };
91 95
92 DEFINE_NODE_TYPE_CASTS(Attr, isAttributeNode()); 96 DEFINE_NODE_TYPE_CASTS(Attr, isAttributeNode());
93 97
94 } // namespace WebCore 98 } // namespace WebCore
95 99
96 #endif // Attr_h 100 #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