| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 void MergeIdenticalElementsCommand::doApply(EditingState*) { | 44 void MergeIdenticalElementsCommand::doApply(EditingState*) { |
| 45 if (m_element1->nextSibling() != m_element2 || | 45 if (m_element1->nextSibling() != m_element2 || |
| 46 !hasEditableStyle(*m_element1) || !hasEditableStyle(*m_element2)) | 46 !hasEditableStyle(*m_element1) || !hasEditableStyle(*m_element2)) |
| 47 return; | 47 return; |
| 48 | 48 |
| 49 m_atChild = m_element2->firstChild(); | 49 m_atChild = m_element2->firstChild(); |
| 50 | 50 |
| 51 NodeVector children; | 51 NodeVector children; |
| 52 getChildNodes(*m_element1, children); | 52 getChildNodes(*m_element1, children); |
| 53 | 53 |
| 54 for (auto& child : children) | 54 for (auto& child : children) { |
| 55 m_element2->insertBefore(child.release(), m_atChild.get(), | 55 m_element2->insertBefore(child.release(), m_atChild.get(), |
| 56 IGNORE_EXCEPTION); | 56 IGNORE_EXCEPTION_FOR_TESTING); |
| 57 } |
| 57 | 58 |
| 58 m_element1->remove(IGNORE_EXCEPTION); | 59 m_element1->remove(IGNORE_EXCEPTION_FOR_TESTING); |
| 59 } | 60 } |
| 60 | 61 |
| 61 void MergeIdenticalElementsCommand::doUnapply() { | 62 void MergeIdenticalElementsCommand::doUnapply() { |
| 62 DCHECK(m_element1); | 63 DCHECK(m_element1); |
| 63 DCHECK(m_element2); | 64 DCHECK(m_element2); |
| 64 | 65 |
| 65 Node* atChild = m_atChild.release(); | 66 Node* atChild = m_atChild.release(); |
| 66 | 67 |
| 67 ContainerNode* parent = m_element2->parentNode(); | 68 ContainerNode* parent = m_element2->parentNode(); |
| 68 if (!parent || !hasEditableStyle(*parent)) | 69 if (!parent || !hasEditableStyle(*parent)) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 84 } | 85 } |
| 85 | 86 |
| 86 DEFINE_TRACE(MergeIdenticalElementsCommand) { | 87 DEFINE_TRACE(MergeIdenticalElementsCommand) { |
| 87 visitor->trace(m_element1); | 88 visitor->trace(m_element1); |
| 88 visitor->trace(m_element2); | 89 visitor->trace(m_element2); |
| 89 visitor->trace(m_atChild); | 90 visitor->trace(m_atChild); |
| 90 SimpleEditCommand::trace(visitor); | 91 SimpleEditCommand::trace(visitor); |
| 91 } | 92 } |
| 92 | 93 |
| 93 } // namespace blink | 94 } // namespace blink |
| OLD | NEW |