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

Side by Side Diff: Source/core/inspector/DOMEditor.cpp

Issue 99333011: Make sure getAttribute() / setAttribute() callers use AtomicStrings (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years 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
« no previous file with comments | « Source/core/html/track/TextTrack.h ('k') | Source/core/inspector/InspectorPageAgent.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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 private: 123 private:
124 RefPtr<Node> m_parentNode; 124 RefPtr<Node> m_parentNode;
125 RefPtr<Node> m_node; 125 RefPtr<Node> m_node;
126 RefPtr<Node> m_anchorNode; 126 RefPtr<Node> m_anchorNode;
127 OwnPtr<RemoveChildAction> m_removeChildAction; 127 OwnPtr<RemoveChildAction> m_removeChildAction;
128 }; 128 };
129 129
130 class DOMEditor::RemoveAttributeAction : public InspectorHistory::Action { 130 class DOMEditor::RemoveAttributeAction : public InspectorHistory::Action {
131 WTF_MAKE_NONCOPYABLE(RemoveAttributeAction); 131 WTF_MAKE_NONCOPYABLE(RemoveAttributeAction);
132 public: 132 public:
133 RemoveAttributeAction(Element* element, const String& name) 133 RemoveAttributeAction(Element* element, const AtomicString& name)
134 : InspectorHistory::Action("RemoveAttribute") 134 : InspectorHistory::Action("RemoveAttribute")
135 , m_element(element) 135 , m_element(element)
136 , m_name(name) 136 , m_name(name)
137 { 137 {
138 } 138 }
139 139
140 virtual bool perform(ExceptionState& exceptionState) 140 virtual bool perform(ExceptionState& exceptionState)
141 { 141 {
142 m_value = m_element->getAttribute(m_name); 142 m_value = m_element->getAttribute(m_name);
143 return redo(exceptionState); 143 return redo(exceptionState);
144 } 144 }
145 145
146 virtual bool undo(ExceptionState& exceptionState) 146 virtual bool undo(ExceptionState& exceptionState)
147 { 147 {
148 m_element->setAttribute(m_name, m_value, exceptionState); 148 m_element->setAttribute(m_name, m_value, exceptionState);
149 return true; 149 return true;
150 } 150 }
151 151
152 virtual bool redo(ExceptionState&) 152 virtual bool redo(ExceptionState&)
153 { 153 {
154 m_element->removeAttribute(m_name); 154 m_element->removeAttribute(m_name);
155 return true; 155 return true;
156 } 156 }
157 157
158 private: 158 private:
159 RefPtr<Element> m_element; 159 RefPtr<Element> m_element;
160 String m_name; 160 AtomicString m_name;
161 String m_value; 161 AtomicString m_value;
162 }; 162 };
163 163
164 class DOMEditor::SetAttributeAction : public InspectorHistory::Action { 164 class DOMEditor::SetAttributeAction : public InspectorHistory::Action {
165 WTF_MAKE_NONCOPYABLE(SetAttributeAction); 165 WTF_MAKE_NONCOPYABLE(SetAttributeAction);
166 public: 166 public:
167 SetAttributeAction(Element* element, const String& name, const String& value ) 167 SetAttributeAction(Element* element, const AtomicString& name, const AtomicS tring& value)
168 : InspectorHistory::Action("SetAttribute") 168 : InspectorHistory::Action("SetAttribute")
169 , m_element(element) 169 , m_element(element)
170 , m_name(name) 170 , m_name(name)
171 , m_value(value) 171 , m_value(value)
172 , m_hadAttribute(false) 172 , m_hadAttribute(false)
173 { 173 {
174 } 174 }
175 175
176 virtual bool perform(ExceptionState& exceptionState) 176 virtual bool perform(ExceptionState& exceptionState)
177 { 177 {
(...skipping 13 matching lines...) Expand all
191 } 191 }
192 192
193 virtual bool redo(ExceptionState& exceptionState) 193 virtual bool redo(ExceptionState& exceptionState)
194 { 194 {
195 m_element->setAttribute(m_name, m_value, exceptionState); 195 m_element->setAttribute(m_name, m_value, exceptionState);
196 return true; 196 return true;
197 } 197 }
198 198
199 private: 199 private:
200 RefPtr<Element> m_element; 200 RefPtr<Element> m_element;
201 String m_name; 201 AtomicString m_name;
202 String m_value; 202 AtomicString m_value;
203 bool m_hadAttribute; 203 bool m_hadAttribute;
204 String m_oldValue; 204 AtomicString m_oldValue;
205 }; 205 };
206 206
207 class DOMEditor::SetOuterHTMLAction : public InspectorHistory::Action { 207 class DOMEditor::SetOuterHTMLAction : public InspectorHistory::Action {
208 WTF_MAKE_NONCOPYABLE(SetOuterHTMLAction); 208 WTF_MAKE_NONCOPYABLE(SetOuterHTMLAction);
209 public: 209 public:
210 SetOuterHTMLAction(Node* node, const String& html) 210 SetOuterHTMLAction(Node* node, const String& html)
211 : InspectorHistory::Action("SetOuterHTML") 211 : InspectorHistory::Action("SetOuterHTML")
212 , m_node(node) 212 , m_node(node)
213 , m_nextSibling(node->nextSibling()) 213 , m_nextSibling(node->nextSibling())
214 , m_html(html) 214 , m_html(html)
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 bool DOMEditor::replaceWholeText(Text* textNode, const String& text, ErrorString * errorString) 452 bool DOMEditor::replaceWholeText(Text* textNode, const String& text, ErrorString * errorString)
453 { 453 {
454 TrackExceptionState exceptionState; 454 TrackExceptionState exceptionState;
455 bool result = replaceWholeText(textNode, text, exceptionState); 455 bool result = replaceWholeText(textNode, text, exceptionState);
456 populateErrorString(exceptionState, errorString); 456 populateErrorString(exceptionState, errorString);
457 return result; 457 return result;
458 } 458 }
459 459
460 } // namespace WebCore 460 } // namespace WebCore
461 461
OLDNEW
« no previous file with comments | « Source/core/html/track/TextTrack.h ('k') | Source/core/inspector/InspectorPageAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698