| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 DCHECK(m_refChild->parentNode()) << m_refChild; | 45 DCHECK(m_refChild->parentNode()) << m_refChild; |
| 46 | 46 |
| 47 DCHECK(hasEditableStyle(*m_refChild->parentNode()) || | 47 DCHECK(hasEditableStyle(*m_refChild->parentNode()) || |
| 48 !m_refChild->parentNode()->inActiveDocument()) | 48 !m_refChild->parentNode()->inActiveDocument()) |
| 49 << m_refChild->parentNode(); | 49 << m_refChild->parentNode(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void InsertNodeBeforeCommand::doApply(EditingState*) { | 52 void InsertNodeBeforeCommand::doApply(EditingState*) { |
| 53 ContainerNode* parent = m_refChild->parentNode(); | 53 ContainerNode* parent = m_refChild->parentNode(); |
| 54 document().updateStyleAndLayoutTree(); | 54 document().updateStyleAndLayoutTree(); |
| 55 if (!parent || (m_shouldAssumeContentIsAlwaysEditable == | 55 if (!parent || |
| 56 DoNotAssumeContentIsAlwaysEditable && | 56 (m_shouldAssumeContentIsAlwaysEditable == |
| 57 !hasEditableStyle(*parent))) | 57 DoNotAssumeContentIsAlwaysEditable && |
| 58 !hasEditableStyle(*parent))) |
| 58 return; | 59 return; |
| 59 DCHECK(hasEditableStyle(*parent)) << parent; | 60 DCHECK(hasEditableStyle(*parent)) << parent; |
| 60 | 61 |
| 61 parent->insertBefore(m_insertChild.get(), m_refChild.get(), | 62 parent->insertBefore(m_insertChild.get(), m_refChild.get(), |
| 62 IGNORE_EXCEPTION_FOR_TESTING); | 63 IGNORE_EXCEPTION_FOR_TESTING); |
| 63 } | 64 } |
| 64 | 65 |
| 65 void InsertNodeBeforeCommand::doUnapply() { | 66 void InsertNodeBeforeCommand::doUnapply() { |
| 66 document().updateStyleAndLayoutTree(); | 67 document().updateStyleAndLayoutTree(); |
| 67 if (!hasEditableStyle(*m_insertChild)) | 68 if (!hasEditableStyle(*m_insertChild)) |
| 68 return; | 69 return; |
| 69 | 70 |
| 70 m_insertChild->remove(IGNORE_EXCEPTION_FOR_TESTING); | 71 m_insertChild->remove(IGNORE_EXCEPTION_FOR_TESTING); |
| 71 } | 72 } |
| 72 | 73 |
| 73 DEFINE_TRACE(InsertNodeBeforeCommand) { | 74 DEFINE_TRACE(InsertNodeBeforeCommand) { |
| 74 visitor->trace(m_insertChild); | 75 visitor->trace(m_insertChild); |
| 75 visitor->trace(m_refChild); | 76 visitor->trace(m_refChild); |
| 76 SimpleEditCommand::trace(visitor); | 77 SimpleEditCommand::trace(visitor); |
| 77 } | 78 } |
| 78 | 79 |
| 79 } // namespace blink | 80 } // namespace blink |
| OLD | NEW |