| 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 RefPtrWillBePersistent<Node> m_parentNode; | 86 RefPtrWillBeMember<Node> m_parentNode; |
| 79 RefPtrWillBePersistent<Node> m_node; | 87 RefPtrWillBeMember<Node> m_node; |
| 80 RefPtrWillBePersistent<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, PassRefPtrWillBeRawPtr<Node> node, Node
* anchorNode) | 94 InsertBeforeAction(Node* parentNode, PassRefPtrWillBeRawPtr<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 RefPtrWillBePersistent<Node> m_parentNode; | 141 RefPtrWillBeMember<Node> m_parentNode; |
| 125 RefPtrWillBePersistent<Node> m_node; | 142 RefPtrWillBeMember<Node> m_node; |
| 126 RefPtrWillBePersistent<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 RefPtrWillBePersistent<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 RefPtrWillBePersistent<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 RefPtrWillBePersistent<Node> m_node; | 286 RefPtrWillBeMember<Node> m_node; |
| 248 RefPtrWillBePersistent<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, PassRefPtrWillBeRawPtr<Node> newNod
e, Node* oldNode) | 338 ReplaceChildNodeAction(Node* parentNode, PassRefPtrWillBeRawPtr<Node> newNod
e, Node* oldNode) |
| 294 : InspectorHistory::Action("ReplaceChildNode") | 339 : InspectorHistory::Action("ReplaceChildNode") |
| 295 , m_parentNode(parentNode) | 340 , m_parentNode(parentNode) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 312 } | 357 } |
| 313 | 358 |
| 314 virtual bool redo(ExceptionState& exceptionState) OVERRIDE | 359 virtual bool redo(ExceptionState& exceptionState) OVERRIDE |
| 315 { | 360 { |
| 316 // FIXME: Oilpan: The first .get() is unnecessary if m_newNode is a | 361 // FIXME: Oilpan: The first .get() is unnecessary if m_newNode is a |
| 317 // Persistent or a Member. | 362 // Persistent or a Member. |
| 318 m_parentNode->replaceChild(m_newNode.get(), m_oldNode.get(), exceptionSt
ate); | 363 m_parentNode->replaceChild(m_newNode.get(), m_oldNode.get(), exceptionSt
ate); |
| 319 return !exceptionState.hadException(); | 364 return !exceptionState.hadException(); |
| 320 } | 365 } |
| 321 | 366 |
| 367 virtual void trace(Visitor* visitor) OVERRIDE |
| 368 { |
| 369 visitor->trace(m_parentNode); |
| 370 visitor->trace(m_newNode); |
| 371 visitor->trace(m_oldNode); |
| 372 InspectorHistory::Action::trace(visitor); |
| 373 } |
| 374 |
| 322 private: | 375 private: |
| 323 RefPtrWillBePersistent<Node> m_parentNode; | 376 RefPtrWillBeMember<Node> m_parentNode; |
| 324 RefPtrWillBePersistent<Node> m_newNode; | 377 RefPtrWillBeMember<Node> m_newNode; |
| 325 RefPtrWillBePersistent<Node> m_oldNode; | 378 RefPtrWillBeMember<Node> m_oldNode; |
| 326 }; | 379 }; |
| 327 | 380 |
| 328 class DOMEditor::SetNodeValueAction FINAL : public InspectorHistory::Action { | 381 class DOMEditor::SetNodeValueAction FINAL : public InspectorHistory::Action { |
| 329 WTF_MAKE_NONCOPYABLE(SetNodeValueAction); | 382 WTF_MAKE_NONCOPYABLE(SetNodeValueAction); |
| 330 public: | 383 public: |
| 331 SetNodeValueAction(Node* node, const String& value) | 384 SetNodeValueAction(Node* node, const String& value) |
| 332 : InspectorHistory::Action("SetNodeValue") | 385 : InspectorHistory::Action("SetNodeValue") |
| 333 , m_node(node) | 386 , m_node(node) |
| 334 , m_value(value) | 387 , m_value(value) |
| 335 { | 388 { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 346 m_node->setNodeValue(m_oldValue); | 399 m_node->setNodeValue(m_oldValue); |
| 347 return true; | 400 return true; |
| 348 } | 401 } |
| 349 | 402 |
| 350 virtual bool redo(ExceptionState&) OVERRIDE | 403 virtual bool redo(ExceptionState&) OVERRIDE |
| 351 { | 404 { |
| 352 m_node->setNodeValue(m_value); | 405 m_node->setNodeValue(m_value); |
| 353 return true; | 406 return true; |
| 354 } | 407 } |
| 355 | 408 |
| 409 virtual void trace(Visitor* visitor) OVERRIDE |
| 410 { |
| 411 visitor->trace(m_node); |
| 412 InspectorHistory::Action::trace(visitor); |
| 413 } |
| 414 |
| 356 private: | 415 private: |
| 357 RefPtrWillBePersistent<Node> m_node; | 416 RefPtrWillBeMember<Node> m_node; |
| 358 String m_value; | 417 String m_value; |
| 359 String m_oldValue; | 418 String m_oldValue; |
| 360 }; | 419 }; |
| 361 | 420 |
| 362 DOMEditor::DOMEditor(InspectorHistory* history) : m_history(history) { } | 421 DOMEditor::DOMEditor(InspectorHistory* history) : m_history(history) { } |
| 363 | 422 |
| 364 DOMEditor::~DOMEditor() { } | |
| 365 | |
| 366 bool DOMEditor::insertBefore(Node* parentNode, PassRefPtrWillBeRawPtr<Node> node
, Node* anchorNode, ExceptionState& exceptionState) | 423 bool DOMEditor::insertBefore(Node* parentNode, PassRefPtrWillBeRawPtr<Node> node
, Node* anchorNode, ExceptionState& exceptionState) |
| 367 { | 424 { |
| 368 return m_history->perform(adoptRef(new InsertBeforeAction(parentNode, node,
anchorNode)), exceptionState); | 425 return m_history->perform(adoptRefWillBeNoop(new InsertBeforeAction(parentNo
de, node, anchorNode)), exceptionState); |
| 369 } | 426 } |
| 370 | 427 |
| 371 bool DOMEditor::removeChild(Node* parentNode, Node* node, ExceptionState& except
ionState) | 428 bool DOMEditor::removeChild(Node* parentNode, Node* node, ExceptionState& except
ionState) |
| 372 { | 429 { |
| 373 return m_history->perform(adoptRef(new RemoveChildAction(parentNode, node)),
exceptionState); | 430 return m_history->perform(adoptRefWillBeNoop(new RemoveChildAction(parentNod
e, node)), exceptionState); |
| 374 } | 431 } |
| 375 | 432 |
| 376 bool DOMEditor::setAttribute(Element* element, const String& name, const String&
value, ExceptionState& exceptionState) | 433 bool DOMEditor::setAttribute(Element* element, const String& name, const String&
value, ExceptionState& exceptionState) |
| 377 { | 434 { |
| 378 return m_history->perform(adoptRef(new SetAttributeAction(element, AtomicStr
ing(name), AtomicString(value))), exceptionState); | 435 return m_history->perform(adoptRefWillBeNoop(new SetAttributeAction(element,
AtomicString(name), AtomicString(value))), exceptionState); |
| 379 } | 436 } |
| 380 | 437 |
| 381 bool DOMEditor::removeAttribute(Element* element, const String& name, ExceptionS
tate& exceptionState) | 438 bool DOMEditor::removeAttribute(Element* element, const String& name, ExceptionS
tate& exceptionState) |
| 382 { | 439 { |
| 383 return m_history->perform(adoptRef(new RemoveAttributeAction(element, Atomic
String(name))), exceptionState); | 440 return m_history->perform(adoptRefWillBeNoop(new RemoveAttributeAction(eleme
nt, AtomicString(name))), exceptionState); |
| 384 } | 441 } |
| 385 | 442 |
| 386 bool DOMEditor::setOuterHTML(Node* node, const String& html, Node** newNode, Exc
eptionState& exceptionState) | 443 bool DOMEditor::setOuterHTML(Node* node, const String& html, Node** newNode, Exc
eptionState& exceptionState) |
| 387 { | 444 { |
| 388 RefPtr<SetOuterHTMLAction> action = adoptRef(new SetOuterHTMLAction(node, ht
ml)); | 445 RefPtrWillBeRawPtr<SetOuterHTMLAction> action = adoptRefWillBeNoop(new SetOu
terHTMLAction(node, html)); |
| 389 bool result = m_history->perform(action, exceptionState); | 446 bool result = m_history->perform(action, exceptionState); |
| 390 if (result) | 447 if (result) |
| 391 *newNode = action->newNode(); | 448 *newNode = action->newNode(); |
| 392 return result; | 449 return result; |
| 393 } | 450 } |
| 394 | 451 |
| 395 bool DOMEditor::replaceWholeText(Text* textNode, const String& text, ExceptionSt
ate& exceptionState) | 452 bool DOMEditor::replaceWholeText(Text* textNode, const String& text, ExceptionSt
ate& exceptionState) |
| 396 { | 453 { |
| 397 return m_history->perform(adoptRef(new ReplaceWholeTextAction(textNode, text
)), exceptionState); | 454 return m_history->perform(adoptRefWillBeNoop(new ReplaceWholeTextAction(text
Node, text)), exceptionState); |
| 398 } | 455 } |
| 399 | 456 |
| 400 bool DOMEditor::replaceChild(Node* parentNode, PassRefPtrWillBeRawPtr<Node> newN
ode, Node* oldNode, ExceptionState& exceptionState) | 457 bool DOMEditor::replaceChild(Node* parentNode, PassRefPtrWillBeRawPtr<Node> newN
ode, Node* oldNode, ExceptionState& exceptionState) |
| 401 { | 458 { |
| 402 return m_history->perform(adoptRef(new ReplaceChildNodeAction(parentNode, ne
wNode, oldNode)), exceptionState); | 459 return m_history->perform(adoptRefWillBeNoop(new ReplaceChildNodeAction(pare
ntNode, newNode, oldNode)), exceptionState); |
| 403 } | 460 } |
| 404 | 461 |
| 405 bool DOMEditor::setNodeValue(Node* node, const String& value, ExceptionState& ex
ceptionState) | 462 bool DOMEditor::setNodeValue(Node* node, const String& value, ExceptionState& ex
ceptionState) |
| 406 { | 463 { |
| 407 return m_history->perform(adoptRef(new SetNodeValueAction(node, value)), exc
eptionState); | 464 return m_history->perform(adoptRefWillBeNoop(new SetNodeValueAction(node, va
lue)), exceptionState); |
| 408 } | 465 } |
| 409 | 466 |
| 410 static void populateErrorString(ExceptionState& exceptionState, ErrorString* err
orString) | 467 static void populateErrorString(ExceptionState& exceptionState, ErrorString* err
orString) |
| 411 { | 468 { |
| 412 if (exceptionState.hadException()) | 469 if (exceptionState.hadException()) |
| 413 *errorString = DOMException::getErrorName(exceptionState.code()); | 470 *errorString = DOMException::getErrorName(exceptionState.code()); |
| 414 } | 471 } |
| 415 | 472 |
| 416 bool DOMEditor::insertBefore(Node* parentNode, PassRefPtrWillBeRawPtr<Node> node
, Node* anchorNode, ErrorString* errorString) | 473 bool DOMEditor::insertBefore(Node* parentNode, PassRefPtrWillBeRawPtr<Node> node
, Node* anchorNode, ErrorString* errorString) |
| 417 { | 474 { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 } | 511 } |
| 455 | 512 |
| 456 bool DOMEditor::replaceWholeText(Text* textNode, const String& text, ErrorString
* errorString) | 513 bool DOMEditor::replaceWholeText(Text* textNode, const String& text, ErrorString
* errorString) |
| 457 { | 514 { |
| 458 TrackExceptionState exceptionState; | 515 TrackExceptionState exceptionState; |
| 459 bool result = replaceWholeText(textNode, text, exceptionState); | 516 bool result = replaceWholeText(textNode, text, exceptionState); |
| 460 populateErrorString(exceptionState, errorString); | 517 populateErrorString(exceptionState, errorString); |
| 461 return result; | 518 return result; |
| 462 } | 519 } |
| 463 | 520 |
| 521 void DOMEditor::trace(Visitor* visitor) |
| 522 { |
| 523 visitor->trace(m_history); |
| 524 } |
| 525 |
| 464 } // namespace WebCore | 526 } // namespace WebCore |
| 465 | 527 |
| OLD | NEW |