| 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 29 matching lines...) Expand all Loading... |
| 40 m_node(node), | 40 m_node(node), |
| 41 m_shouldAssumeContentIsAlwaysEditable( | 41 m_shouldAssumeContentIsAlwaysEditable( |
| 42 shouldAssumeContentIsAlwaysEditable) { | 42 shouldAssumeContentIsAlwaysEditable) { |
| 43 DCHECK(m_node); | 43 DCHECK(m_node); |
| 44 DCHECK(m_node->parentNode()); | 44 DCHECK(m_node->parentNode()); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void RemoveNodeCommand::doApply(EditingState* editingState) { | 47 void RemoveNodeCommand::doApply(EditingState* editingState) { |
| 48 ContainerNode* parent = m_node->parentNode(); | 48 ContainerNode* parent = m_node->parentNode(); |
| 49 document().updateStyleAndLayoutTree(); | 49 document().updateStyleAndLayoutTree(); |
| 50 if (!parent || (m_shouldAssumeContentIsAlwaysEditable == | 50 if (!parent || |
| 51 DoNotAssumeContentIsAlwaysEditable && | 51 (m_shouldAssumeContentIsAlwaysEditable == |
| 52 !hasEditableStyle(*parent) && parent->inActiveDocument())) | 52 DoNotAssumeContentIsAlwaysEditable && |
| 53 !hasEditableStyle(*parent) && parent->inActiveDocument())) |
| 53 return; | 54 return; |
| 54 DCHECK(hasEditableStyle(*parent) || !parent->inActiveDocument()) << parent; | 55 DCHECK(hasEditableStyle(*parent) || !parent->inActiveDocument()) << parent; |
| 55 | 56 |
| 56 m_parent = parent; | 57 m_parent = parent; |
| 57 m_refChild = m_node->nextSibling(); | 58 m_refChild = m_node->nextSibling(); |
| 58 | 59 |
| 59 m_node->remove(IGNORE_EXCEPTION_FOR_TESTING); | 60 m_node->remove(IGNORE_EXCEPTION_FOR_TESTING); |
| 60 // Node::remove dispatch synchronous events such as IFRAME unload events, | 61 // Node::remove dispatch synchronous events such as IFRAME unload events, |
| 61 // and event handlers may break the document. We check the document state | 62 // and event handlers may break the document. We check the document state |
| 62 // here in order to prevent further processing in bad situation. | 63 // here in order to prevent further processing in bad situation. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 74 } | 75 } |
| 75 | 76 |
| 76 DEFINE_TRACE(RemoveNodeCommand) { | 77 DEFINE_TRACE(RemoveNodeCommand) { |
| 77 visitor->trace(m_node); | 78 visitor->trace(m_node); |
| 78 visitor->trace(m_parent); | 79 visitor->trace(m_parent); |
| 79 visitor->trace(m_refChild); | 80 visitor->trace(m_refChild); |
| 80 SimpleEditCommand::trace(visitor); | 81 SimpleEditCommand::trace(visitor); |
| 81 } | 82 } |
| 82 | 83 |
| 83 } // namespace blink | 84 } // namespace blink |
| OLD | NEW |