| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 document().updateStyleAndLayoutTree(); | 49 document().updateStyleAndLayoutTree(); |
| 50 if (!parent || (m_shouldAssumeContentIsAlwaysEditable == | 50 if (!parent || (m_shouldAssumeContentIsAlwaysEditable == |
| 51 DoNotAssumeContentIsAlwaysEditable && | 51 DoNotAssumeContentIsAlwaysEditable && |
| 52 !hasEditableStyle(*parent) && parent->inActiveDocument())) | 52 !hasEditableStyle(*parent) && parent->inActiveDocument())) |
| 53 return; | 53 return; |
| 54 DCHECK(hasEditableStyle(*parent) || !parent->inActiveDocument()) << parent; | 54 DCHECK(hasEditableStyle(*parent) || !parent->inActiveDocument()) << parent; |
| 55 | 55 |
| 56 m_parent = parent; | 56 m_parent = parent; |
| 57 m_refChild = m_node->nextSibling(); | 57 m_refChild = m_node->nextSibling(); |
| 58 | 58 |
| 59 m_node->remove(IGNORE_EXCEPTION); | 59 m_node->remove(IGNORE_EXCEPTION_FOR_TESTING); |
| 60 // Node::remove dispatch synchronous events such as IFRAME unload events, | 60 // Node::remove dispatch synchronous events such as IFRAME unload events, |
| 61 // and event handlers may break the document. We check the document state | 61 // and event handlers may break the document. We check the document state |
| 62 // here in order to prevent further processing in bad situation. | 62 // here in order to prevent further processing in bad situation. |
| 63 ABORT_EDITING_COMMAND_IF(!m_node->document().frame()); | 63 ABORT_EDITING_COMMAND_IF(!m_node->document().frame()); |
| 64 ABORT_EDITING_COMMAND_IF(!m_node->document().documentElement()); | 64 ABORT_EDITING_COMMAND_IF(!m_node->document().documentElement()); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void RemoveNodeCommand::doUnapply() { | 67 void RemoveNodeCommand::doUnapply() { |
| 68 ContainerNode* parent = m_parent.release(); | 68 ContainerNode* parent = m_parent.release(); |
| 69 Node* refChild = m_refChild.release(); | 69 Node* refChild = m_refChild.release(); |
| 70 if (!parent || !hasEditableStyle(*parent)) | 70 if (!parent || !hasEditableStyle(*parent)) |
| 71 return; | 71 return; |
| 72 | 72 |
| 73 parent->insertBefore(m_node.get(), refChild, IGNORE_EXCEPTION); | 73 parent->insertBefore(m_node.get(), refChild, IGNORE_EXCEPTION_FOR_TESTING); |
| 74 } | 74 } |
| 75 | 75 |
| 76 DEFINE_TRACE(RemoveNodeCommand) { | 76 DEFINE_TRACE(RemoveNodeCommand) { |
| 77 visitor->trace(m_node); | 77 visitor->trace(m_node); |
| 78 visitor->trace(m_parent); | 78 visitor->trace(m_parent); |
| 79 visitor->trace(m_refChild); | 79 visitor->trace(m_refChild); |
| 80 SimpleEditCommand::trace(visitor); | 80 SimpleEditCommand::trace(visitor); |
| 81 } | 81 } |
| 82 | 82 |
| 83 } // namespace blink | 83 } // namespace blink |
| OLD | NEW |