| OLD | NEW |
| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 m_parentNode->insertBefore(m_node.get(), m_anchorNode.get(), exceptionSt
ate); | 67 m_parentNode->insertBefore(m_node.get(), m_anchorNode.get(), exceptionSt
ate); |
| 68 return !exceptionState.hadException(); | 68 return !exceptionState.hadException(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 virtual bool redo(ExceptionState& exceptionState) OVERRIDE | 71 virtual bool redo(ExceptionState& exceptionState) OVERRIDE |
| 72 { | 72 { |
| 73 m_parentNode->removeChild(m_node.get(), exceptionState); | 73 m_parentNode->removeChild(m_node.get(), exceptionState); |
| 74 return !exceptionState.hadException(); | 74 return !exceptionState.hadException(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 virtual void trace(Visitor* visitor) OVERRIDE |
| 78 { |
| 79 visitor->trace(m_parentNode); |
| 80 visitor->trace(m_node); |
| 81 visitor->trace(m_anchorNode); |
| 82 InspectorHistory::Action::trace(visitor); |
| 83 } |
| 84 |
| 77 private: | 85 private: |
| 78 RefPtr<Node> m_parentNode; | 86 RefPtrWillBeMember<Node> m_parentNode; |
| 79 RefPtr<Node> m_node; | 87 RefPtrWillBeMember<Node> m_node; |
| 80 RefPtr<Node> m_anchorNode; | 88 RefPtrWillBeMember<Node> m_anchorNode; |
| 81 }; | 89 }; |
| 82 | 90 |
| 83 class DOMEditor::InsertBeforeAction FINAL : public InspectorHistory::Action { | 91 class DOMEditor::InsertBeforeAction FINAL : public InspectorHistory::Action { |
| 84 WTF_MAKE_NONCOPYABLE(InsertBeforeAction); | 92 WTF_MAKE_NONCOPYABLE(InsertBeforeAction); |
| 85 public: | 93 public: |
| 86 InsertBeforeAction(Node* parentNode, PassRefPtr<Node> node, Node* anchorNode
) | 94 InsertBeforeAction(Node* parentNode, PassRefPtr<Node> node, Node* anchorNode
) |
| 87 : InspectorHistory::Action("InsertBefore") | 95 : InspectorHistory::Action("InsertBefore") |
| 88 , m_parentNode(parentNode) | 96 , m_parentNode(parentNode) |
| 89 , m_node(node) | 97 , m_node(node) |
| 90 , m_anchorNode(anchorNode) | 98 , m_anchorNode(anchorNode) |
| 91 { | 99 { |
| 92 } | 100 } |
| 93 | 101 |
| 94 virtual bool perform(ExceptionState& exceptionState) OVERRIDE | 102 virtual bool perform(ExceptionState& exceptionState) OVERRIDE |
| 95 { | 103 { |
| 96 if (m_node->parentNode()) { | 104 if (m_node->parentNode()) { |
| 97 m_removeChildAction = adoptRef(new RemoveChildAction(m_node->parentN
ode(), m_node.get())); | 105 m_removeChildAction = adoptRefWillBeNoop(new RemoveChildAction(m_nod
e->parentNode(), m_node.get())); |
| 98 if (!m_removeChildAction->perform(exceptionState)) | 106 if (!m_removeChildAction->perform(exceptionState)) |
| 99 return false; | 107 return false; |
| 100 } | 108 } |
| 101 m_parentNode->insertBefore(m_node.get(), m_anchorNode.get(), exceptionSt
ate); | 109 m_parentNode->insertBefore(m_node.get(), m_anchorNode.get(), exceptionSt
ate); |
| 102 return !exceptionState.hadException(); | 110 return !exceptionState.hadException(); |
| 103 } | 111 } |
| 104 | 112 |
| 105 virtual bool undo(ExceptionState& exceptionState) OVERRIDE | 113 virtual bool undo(ExceptionState& exceptionState) OVERRIDE |
| 106 { | 114 { |
| 107 m_parentNode->removeChild(m_node.get(), exceptionState); | 115 m_parentNode->removeChild(m_node.get(), exceptionState); |
| 108 if (exceptionState.hadException()) | 116 if (exceptionState.hadException()) |
| 109 return false; | 117 return false; |
| 110 if (m_removeChildAction) | 118 if (m_removeChildAction) |
| 111 return m_removeChildAction->undo(exceptionState); | 119 return m_removeChildAction->undo(exceptionState); |
| 112 return true; | 120 return true; |
| 113 } | 121 } |
| 114 | 122 |
| 115 virtual bool redo(ExceptionState& exceptionState) OVERRIDE | 123 virtual bool redo(ExceptionState& exceptionState) OVERRIDE |
| 116 { | 124 { |
| 117 if (m_removeChildAction && !m_removeChildAction->redo(exceptionState)) | 125 if (m_removeChildAction && !m_removeChildAction->redo(exceptionState)) |
| 118 return false; | 126 return false; |
| 119 m_parentNode->insertBefore(m_node.get(), m_anchorNode.get(), exceptionSt
ate); | 127 m_parentNode->insertBefore(m_node.get(), m_anchorNode.get(), exceptionSt
ate); |
| 120 return !exceptionState.hadException(); | 128 return !exceptionState.hadException(); |
| 121 } | 129 } |
| 122 | 130 |
| 131 virtual void trace(Visitor* visitor) OVERRIDE |
| 132 { |
| 133 visitor->trace(m_parentNode); |
| 134 visitor->trace(m_node); |
| 135 visitor->trace(m_anchorNode); |
| 136 visitor->trace(m_removeChildAction); |
| 137 InspectorHistory::Action::trace(visitor); |
| 138 } |
| 139 |
| 123 private: | 140 private: |
| 124 RefPtr<Node> m_parentNode; | 141 RefPtrWillBeMember<Node> m_parentNode; |
| 125 RefPtr<Node> m_node; | 142 RefPtrWillBeMember<Node> m_node; |
| 126 RefPtr<Node> m_anchorNode; | 143 RefPtrWillBeMember<Node> m_anchorNode; |
| 127 RefPtr<RemoveChildAction> m_removeChildAction; | 144 RefPtrWillBeMember<RemoveChildAction> m_removeChildAction; |
| 128 }; | 145 }; |
| 129 | 146 |
| 130 class DOMEditor::RemoveAttributeAction FINAL : public InspectorHistory::Action { | 147 class DOMEditor::RemoveAttributeAction FINAL : public InspectorHistory::Action { |
| 131 WTF_MAKE_NONCOPYABLE(RemoveAttributeAction); | 148 WTF_MAKE_NONCOPYABLE(RemoveAttributeAction); |
| 132 public: | 149 public: |
| 133 RemoveAttributeAction(Element* element, const AtomicString& name) | 150 RemoveAttributeAction(Element* element, const AtomicString& name) |
| 134 : InspectorHistory::Action("RemoveAttribute") | 151 : InspectorHistory::Action("RemoveAttribute") |
| 135 , m_element(element) | 152 , m_element(element) |
| 136 , m_name(name) | 153 , m_name(name) |
| 137 { | 154 { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 148 m_element->setAttribute(m_name, m_value, exceptionState); | 165 m_element->setAttribute(m_name, m_value, exceptionState); |
| 149 return true; | 166 return true; |
| 150 } | 167 } |
| 151 | 168 |
| 152 virtual bool redo(ExceptionState&) OVERRIDE | 169 virtual bool redo(ExceptionState&) OVERRIDE |
| 153 { | 170 { |
| 154 m_element->removeAttribute(m_name); | 171 m_element->removeAttribute(m_name); |
| 155 return true; | 172 return true; |
| 156 } | 173 } |
| 157 | 174 |
| 175 virtual void trace(Visitor* visitor) OVERRIDE |
| 176 { |
| 177 visitor->trace(m_element); |
| 178 InspectorHistory::Action::trace(visitor); |
| 179 } |
| 180 |
| 158 private: | 181 private: |
| 159 RefPtr<Element> m_element; | 182 RefPtrWillBeMember<Element> m_element; |
| 160 AtomicString m_name; | 183 AtomicString m_name; |
| 161 AtomicString m_value; | 184 AtomicString m_value; |
| 162 }; | 185 }; |
| 163 | 186 |
| 164 class DOMEditor::SetAttributeAction FINAL : public InspectorHistory::Action { | 187 class DOMEditor::SetAttributeAction FINAL : public InspectorHistory::Action { |
| 165 WTF_MAKE_NONCOPYABLE(SetAttributeAction); | 188 WTF_MAKE_NONCOPYABLE(SetAttributeAction); |
| 166 public: | 189 public: |
| 167 SetAttributeAction(Element* element, const AtomicString& name, const AtomicS
tring& value) | 190 SetAttributeAction(Element* element, const AtomicString& name, const AtomicS
tring& value) |
| 168 : InspectorHistory::Action("SetAttribute") | 191 : InspectorHistory::Action("SetAttribute") |
| 169 , m_element(element) | 192 , m_element(element) |
| (...skipping 20 matching lines...) Expand all Loading... |
| 190 m_element->removeAttribute(m_name); | 213 m_element->removeAttribute(m_name); |
| 191 return true; | 214 return true; |
| 192 } | 215 } |
| 193 | 216 |
| 194 virtual bool redo(ExceptionState& exceptionState) OVERRIDE | 217 virtual bool redo(ExceptionState& exceptionState) OVERRIDE |
| 195 { | 218 { |
| 196 m_element->setAttribute(m_name, m_value, exceptionState); | 219 m_element->setAttribute(m_name, m_value, exceptionState); |
| 197 return true; | 220 return true; |
| 198 } | 221 } |
| 199 | 222 |
| 223 virtual void trace(Visitor* visitor) OVERRIDE |
| 224 { |
| 225 visitor->trace(m_element); |
| 226 InspectorHistory::Action::trace(visitor); |
| 227 } |
| 228 |
| 200 private: | 229 private: |
| 201 RefPtr<Element> m_element; | 230 RefPtrWillBeMember<Element> m_element; |
| 202 AtomicString m_name; | 231 AtomicString m_name; |
| 203 AtomicString m_value; | 232 AtomicString m_value; |
| 204 bool m_hadAttribute; | 233 bool m_hadAttribute; |
| 205 AtomicString m_oldValue; | 234 AtomicString m_oldValue; |
| 206 }; | 235 }; |
| 207 | 236 |
| 208 class DOMEditor::SetOuterHTMLAction FINAL : public InspectorHistory::Action { | 237 class DOMEditor::SetOuterHTMLAction FINAL : public InspectorHistory::Action { |
| 209 WTF_MAKE_NONCOPYABLE(SetOuterHTMLAction); | 238 WTF_MAKE_NONCOPYABLE(SetOuterHTMLAction); |
| 210 public: | 239 public: |
| 211 SetOuterHTMLAction(Node* node, const String& html) | 240 SetOuterHTMLAction(Node* node, const String& html) |
| 212 : InspectorHistory::Action("SetOuterHTML") | 241 : InspectorHistory::Action("SetOuterHTML") |
| 213 , m_node(node) | 242 , m_node(node) |
| 214 , m_nextSibling(node->nextSibling()) | 243 , m_nextSibling(node->nextSibling()) |
| 215 , m_html(html) | 244 , m_html(html) |
| 216 , m_newNode(0) | 245 , m_newNode(nullptr) |
| 217 , m_history(adoptPtr(new InspectorHistory())) | 246 , m_history(adoptPtrWillBeNoop(new InspectorHistory())) |
| 218 , m_domEditor(adoptPtr(new DOMEditor(m_history.get()))) | 247 , m_domEditor(adoptPtrWillBeNoop(new DOMEditor(m_history.get()))) |
| 219 { | 248 { |
| 220 } | 249 } |
| 221 | 250 |
| 222 virtual bool perform(ExceptionState& exceptionState) OVERRIDE | 251 virtual bool perform(ExceptionState& exceptionState) OVERRIDE |
| 223 { | 252 { |
| 224 m_oldHTML = createMarkup(m_node.get()); | 253 m_oldHTML = createMarkup(m_node.get()); |
| 225 ASSERT(m_node->ownerDocument()); | 254 ASSERT(m_node->ownerDocument()); |
| 226 DOMPatchSupport domPatchSupport(m_domEditor.get(), *m_node->ownerDocumen
t()); | 255 DOMPatchSupport domPatchSupport(m_domEditor.get(), *m_node->ownerDocumen
t()); |
| 227 m_newNode = domPatchSupport.patchNode(m_node.get(), m_html, exceptionSta
te); | 256 m_newNode = domPatchSupport.patchNode(m_node.get(), m_html, exceptionSta
te); |
| 228 return !exceptionState.hadException(); | 257 return !exceptionState.hadException(); |
| 229 } | 258 } |
| 230 | 259 |
| 231 virtual bool undo(ExceptionState& exceptionState) OVERRIDE | 260 virtual bool undo(ExceptionState& exceptionState) OVERRIDE |
| 232 { | 261 { |
| 233 return m_history->undo(exceptionState); | 262 return m_history->undo(exceptionState); |
| 234 } | 263 } |
| 235 | 264 |
| 236 virtual bool redo(ExceptionState& exceptionState) OVERRIDE | 265 virtual bool redo(ExceptionState& exceptionState) OVERRIDE |
| 237 { | 266 { |
| 238 return m_history->redo(exceptionState); | 267 return m_history->redo(exceptionState); |
| 239 } | 268 } |
| 240 | 269 |
| 241 Node* newNode() | 270 Node* newNode() |
| 242 { | 271 { |
| 243 return m_newNode; | 272 return m_newNode; |
| 244 } | 273 } |
| 245 | 274 |
| 275 virtual void trace(Visitor* visitor) OVERRIDE |
| 276 { |
| 277 visitor->trace(m_node); |
| 278 visitor->trace(m_nextSibling); |
| 279 visitor->trace(m_newNode); |
| 280 visitor->trace(m_history); |
| 281 visitor->trace(m_domEditor); |
| 282 InspectorHistory::Action::trace(visitor); |
| 283 } |
| 284 |
| 246 private: | 285 private: |
| 247 RefPtr<Node> m_node; | 286 RefPtrWillBeMember<Node> m_node; |
| 248 RefPtr<Node> m_nextSibling; | 287 RefPtrWillBeMember<Node> m_nextSibling; |
| 249 String m_html; | 288 String m_html; |
| 250 String m_oldHTML; | 289 String m_oldHTML; |
| 251 Node* m_newNode; | 290 RawPtrWillBeMember<Node> m_newNode; |
| 252 OwnPtr<InspectorHistory> m_history; | 291 OwnPtrWillBeMember<InspectorHistory> m_history; |
| 253 OwnPtr<DOMEditor> m_domEditor; | 292 OwnPtrWillBeMember<DOMEditor> m_domEditor; |
| 254 }; | 293 }; |
| 255 | 294 |
| 256 class DOMEditor::ReplaceWholeTextAction FINAL : public InspectorHistory::Action
{ | 295 class DOMEditor::ReplaceWholeTextAction FINAL : public InspectorHistory::Action
{ |
| 257 WTF_MAKE_NONCOPYABLE(ReplaceWholeTextAction); | 296 WTF_MAKE_NONCOPYABLE(ReplaceWholeTextAction); |
| 258 public: | 297 public: |
| 259 ReplaceWholeTextAction(Text* textNode, const String& text) | 298 ReplaceWholeTextAction(Text* textNode, const String& text) |
| 260 : InspectorHistory::Action("ReplaceWholeText") | 299 : InspectorHistory::Action("ReplaceWholeText") |
| 261 , m_textNode(textNode) | 300 , m_textNode(textNode) |
| 262 , m_text(text) | 301 , m_text(text) |
| 263 { | 302 { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 274 m_textNode->replaceWholeText(m_oldText); | 313 m_textNode->replaceWholeText(m_oldText); |
| 275 return true; | 314 return true; |
| 276 } | 315 } |
| 277 | 316 |
| 278 virtual bool redo(ExceptionState&) OVERRIDE | 317 virtual bool redo(ExceptionState&) OVERRIDE |
| 279 { | 318 { |
| 280 m_textNode->replaceWholeText(m_text); | 319 m_textNode->replaceWholeText(m_text); |
| 281 return true; | 320 return true; |
| 282 } | 321 } |
| 283 | 322 |
| 323 virtual void trace(Visitor* visitor) OVERRIDE |
| 324 { |
| 325 visitor->trace(m_textNode); |
| 326 InspectorHistory::Action::trace(visitor); |
| 327 } |
| 328 |
| 284 private: | 329 private: |
| 285 RefPtrWillBePersistent<Text> m_textNode; | 330 RefPtrWillBeMember<Text> m_textNode; |
| 286 String m_text; | 331 String m_text; |
| 287 String m_oldText; | 332 String m_oldText; |
| 288 }; | 333 }; |
| 289 | 334 |
| 290 class DOMEditor::ReplaceChildNodeAction FINAL : public InspectorHistory::Action
{ | 335 class DOMEditor::ReplaceChildNodeAction FINAL : public InspectorHistory::Action
{ |
| 291 WTF_MAKE_NONCOPYABLE(ReplaceChildNodeAction); | 336 WTF_MAKE_NONCOPYABLE(ReplaceChildNodeAction); |
| 292 public: | 337 public: |
| 293 ReplaceChildNodeAction(Node* parentNode, PassRefPtr<Node> newNode, Node* old
Node) | 338 ReplaceChildNodeAction(Node* parentNode, PassRefPtr<Node> newNode, Node* old
Node) |
| 294 : InspectorHistory::Action("ReplaceChildNode") | 339 : InspectorHistory::Action("ReplaceChildNode") |
| 295 , m_parentNode(parentNode) | 340 , m_parentNode(parentNode) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 308 m_parentNode->replaceChild(m_oldNode, m_newNode.get(), exceptionState); | 353 m_parentNode->replaceChild(m_oldNode, m_newNode.get(), exceptionState); |
| 309 return !exceptionState.hadException(); | 354 return !exceptionState.hadException(); |
| 310 } | 355 } |
| 311 | 356 |
| 312 virtual bool redo(ExceptionState& exceptionState) OVERRIDE | 357 virtual bool redo(ExceptionState& exceptionState) OVERRIDE |
| 313 { | 358 { |
| 314 m_parentNode->replaceChild(m_newNode, m_oldNode.get(), exceptionState); | 359 m_parentNode->replaceChild(m_newNode, m_oldNode.get(), exceptionState); |
| 315 return !exceptionState.hadException(); | 360 return !exceptionState.hadException(); |
| 316 } | 361 } |
| 317 | 362 |
| 363 virtual void trace(Visitor* visitor) OVERRIDE |
| 364 { |
| 365 visitor->trace(m_parentNode); |
| 366 visitor->trace(m_newNode); |
| 367 visitor->trace(m_oldNode); |
| 368 InspectorHistory::Action::trace(visitor); |
| 369 } |
| 370 |
| 318 private: | 371 private: |
| 319 RefPtr<Node> m_parentNode; | 372 RefPtrWillBeMember<Node> m_parentNode; |
| 320 RefPtr<Node> m_newNode; | 373 RefPtrWillBeMember<Node> m_newNode; |
| 321 RefPtr<Node> m_oldNode; | 374 RefPtrWillBeMember<Node> m_oldNode; |
| 322 }; | 375 }; |
| 323 | 376 |
| 324 class DOMEditor::SetNodeValueAction FINAL : public InspectorHistory::Action { | 377 class DOMEditor::SetNodeValueAction FINAL : public InspectorHistory::Action { |
| 325 WTF_MAKE_NONCOPYABLE(SetNodeValueAction); | 378 WTF_MAKE_NONCOPYABLE(SetNodeValueAction); |
| 326 public: | 379 public: |
| 327 SetNodeValueAction(Node* node, const String& value) | 380 SetNodeValueAction(Node* node, const String& value) |
| 328 : InspectorHistory::Action("SetNodeValue") | 381 : InspectorHistory::Action("SetNodeValue") |
| 329 , m_node(node) | 382 , m_node(node) |
| 330 , m_value(value) | 383 , m_value(value) |
| 331 { | 384 { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 342 m_node->setNodeValue(m_oldValue); | 395 m_node->setNodeValue(m_oldValue); |
| 343 return true; | 396 return true; |
| 344 } | 397 } |
| 345 | 398 |
| 346 virtual bool redo(ExceptionState&) OVERRIDE | 399 virtual bool redo(ExceptionState&) OVERRIDE |
| 347 { | 400 { |
| 348 m_node->setNodeValue(m_value); | 401 m_node->setNodeValue(m_value); |
| 349 return true; | 402 return true; |
| 350 } | 403 } |
| 351 | 404 |
| 405 virtual void trace(Visitor* visitor) OVERRIDE |
| 406 { |
| 407 visitor->trace(m_node); |
| 408 InspectorHistory::Action::trace(visitor); |
| 409 } |
| 410 |
| 352 private: | 411 private: |
| 353 RefPtr<Node> m_node; | 412 RefPtrWillBeMember<Node> m_node; |
| 354 String m_value; | 413 String m_value; |
| 355 String m_oldValue; | 414 String m_oldValue; |
| 356 }; | 415 }; |
| 357 | 416 |
| 358 DOMEditor::DOMEditor(InspectorHistory* history) : m_history(history) { } | 417 DOMEditor::DOMEditor(InspectorHistory* history) : m_history(history) { } |
| 359 | 418 |
| 360 DOMEditor::~DOMEditor() { } | |
| 361 | |
| 362 bool DOMEditor::insertBefore(Node* parentNode, PassRefPtr<Node> node, Node* anch
orNode, ExceptionState& exceptionState) | 419 bool DOMEditor::insertBefore(Node* parentNode, PassRefPtr<Node> node, Node* anch
orNode, ExceptionState& exceptionState) |
| 363 { | 420 { |
| 364 return m_history->perform(adoptRef(new InsertBeforeAction(parentNode, node,
anchorNode)), exceptionState); | 421 return m_history->perform(adoptRefWillBeNoop(new InsertBeforeAction(parentNo
de, node, anchorNode)), exceptionState); |
| 365 } | 422 } |
| 366 | 423 |
| 367 bool DOMEditor::removeChild(Node* parentNode, Node* node, ExceptionState& except
ionState) | 424 bool DOMEditor::removeChild(Node* parentNode, Node* node, ExceptionState& except
ionState) |
| 368 { | 425 { |
| 369 return m_history->perform(adoptRef(new RemoveChildAction(parentNode, node)),
exceptionState); | 426 return m_history->perform(adoptRefWillBeNoop(new RemoveChildAction(parentNod
e, node)), exceptionState); |
| 370 } | 427 } |
| 371 | 428 |
| 372 bool DOMEditor::setAttribute(Element* element, const String& name, const String&
value, ExceptionState& exceptionState) | 429 bool DOMEditor::setAttribute(Element* element, const String& name, const String&
value, ExceptionState& exceptionState) |
| 373 { | 430 { |
| 374 return m_history->perform(adoptRef(new SetAttributeAction(element, AtomicStr
ing(name), AtomicString(value))), exceptionState); | 431 return m_history->perform(adoptRefWillBeNoop(new SetAttributeAction(element,
AtomicString(name), AtomicString(value))), exceptionState); |
| 375 } | 432 } |
| 376 | 433 |
| 377 bool DOMEditor::removeAttribute(Element* element, const String& name, ExceptionS
tate& exceptionState) | 434 bool DOMEditor::removeAttribute(Element* element, const String& name, ExceptionS
tate& exceptionState) |
| 378 { | 435 { |
| 379 return m_history->perform(adoptRef(new RemoveAttributeAction(element, Atomic
String(name))), exceptionState); | 436 return m_history->perform(adoptRefWillBeNoop(new RemoveAttributeAction(eleme
nt, AtomicString(name))), exceptionState); |
| 380 } | 437 } |
| 381 | 438 |
| 382 bool DOMEditor::setOuterHTML(Node* node, const String& html, Node** newNode, Exc
eptionState& exceptionState) | 439 bool DOMEditor::setOuterHTML(Node* node, const String& html, Node** newNode, Exc
eptionState& exceptionState) |
| 383 { | 440 { |
| 384 RefPtr<SetOuterHTMLAction> action = adoptRef(new SetOuterHTMLAction(node, ht
ml)); | 441 RefPtrWillBeRawPtr<SetOuterHTMLAction> action = adoptRefWillBeNoop(new SetOu
terHTMLAction(node, html)); |
| 385 bool result = m_history->perform(action, exceptionState); | 442 bool result = m_history->perform(action, exceptionState); |
| 386 if (result) | 443 if (result) |
| 387 *newNode = action->newNode(); | 444 *newNode = action->newNode(); |
| 388 return result; | 445 return result; |
| 389 } | 446 } |
| 390 | 447 |
| 391 bool DOMEditor::replaceWholeText(Text* textNode, const String& text, ExceptionSt
ate& exceptionState) | 448 bool DOMEditor::replaceWholeText(Text* textNode, const String& text, ExceptionSt
ate& exceptionState) |
| 392 { | 449 { |
| 393 return m_history->perform(adoptRef(new ReplaceWholeTextAction(textNode, text
)), exceptionState); | 450 return m_history->perform(adoptRefWillBeNoop(new ReplaceWholeTextAction(text
Node, text)), exceptionState); |
| 394 } | 451 } |
| 395 | 452 |
| 396 bool DOMEditor::replaceChild(Node* parentNode, PassRefPtr<Node> newNode, Node* o
ldNode, ExceptionState& exceptionState) | 453 bool DOMEditor::replaceChild(Node* parentNode, PassRefPtr<Node> newNode, Node* o
ldNode, ExceptionState& exceptionState) |
| 397 { | 454 { |
| 398 return m_history->perform(adoptRef(new ReplaceChildNodeAction(parentNode, ne
wNode, oldNode)), exceptionState); | 455 return m_history->perform(adoptRefWillBeNoop(new ReplaceChildNodeAction(pare
ntNode, newNode, oldNode)), exceptionState); |
| 399 } | 456 } |
| 400 | 457 |
| 401 bool DOMEditor::setNodeValue(Node* node, const String& value, ExceptionState& ex
ceptionState) | 458 bool DOMEditor::setNodeValue(Node* node, const String& value, ExceptionState& ex
ceptionState) |
| 402 { | 459 { |
| 403 return m_history->perform(adoptRef(new SetNodeValueAction(node, value)), exc
eptionState); | 460 return m_history->perform(adoptRefWillBeNoop(new SetNodeValueAction(node, va
lue)), exceptionState); |
| 404 } | 461 } |
| 405 | 462 |
| 406 static void populateErrorString(ExceptionState& exceptionState, ErrorString* err
orString) | 463 static void populateErrorString(ExceptionState& exceptionState, ErrorString* err
orString) |
| 407 { | 464 { |
| 408 if (exceptionState.hadException()) | 465 if (exceptionState.hadException()) |
| 409 *errorString = DOMException::getErrorName(exceptionState.code()); | 466 *errorString = DOMException::getErrorName(exceptionState.code()); |
| 410 } | 467 } |
| 411 | 468 |
| 412 bool DOMEditor::insertBefore(Node* parentNode, PassRefPtr<Node> node, Node* anch
orNode, ErrorString* errorString) | 469 bool DOMEditor::insertBefore(Node* parentNode, PassRefPtr<Node> node, Node* anch
orNode, ErrorString* errorString) |
| 413 { | 470 { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 } | 507 } |
| 451 | 508 |
| 452 bool DOMEditor::replaceWholeText(Text* textNode, const String& text, ErrorString
* errorString) | 509 bool DOMEditor::replaceWholeText(Text* textNode, const String& text, ErrorString
* errorString) |
| 453 { | 510 { |
| 454 TrackExceptionState exceptionState; | 511 TrackExceptionState exceptionState; |
| 455 bool result = replaceWholeText(textNode, text, exceptionState); | 512 bool result = replaceWholeText(textNode, text, exceptionState); |
| 456 populateErrorString(exceptionState, errorString); | 513 populateErrorString(exceptionState, errorString); |
| 457 return result; | 514 return result; |
| 458 } | 515 } |
| 459 | 516 |
| 517 void DOMEditor::trace(Visitor* visitor) |
| 518 { |
| 519 visitor->trace(m_history); |
| 520 } |
| 521 |
| 460 } // namespace WebCore | 522 } // namespace WebCore |
| 461 | 523 |
| OLD | NEW |