| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 ASSERT(m_element1->nextSibling() == m_element2); | 42 ASSERT(m_element1->nextSibling() == m_element2); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void MergeIdenticalElementsCommand::doApply() | 45 void MergeIdenticalElementsCommand::doApply() |
| 46 { | 46 { |
| 47 if (m_element1->nextSibling() != m_element2 || !m_element1->hasEditableStyle
() || !m_element2->hasEditableStyle()) | 47 if (m_element1->nextSibling() != m_element2 || !m_element1->hasEditableStyle
() || !m_element2->hasEditableStyle()) |
| 48 return; | 48 return; |
| 49 | 49 |
| 50 m_atChild = m_element2->firstChild(); | 50 m_atChild = m_element2->firstChild(); |
| 51 | 51 |
| 52 WillBeHeapVector<RefPtrWillBeMember<Node> > children; | 52 NodeVector children; |
| 53 for (Node* child = m_element1->firstChild(); child; child = child->nextSibli
ng()) | 53 getChildNodes(*m_element1, children); |
| 54 children.append(child); | |
| 55 | 54 |
| 56 size_t size = children.size(); | 55 size_t size = children.size(); |
| 57 for (size_t i = 0; i < size; ++i) | 56 for (size_t i = 0; i < size; ++i) |
| 58 m_element2->insertBefore(children[i].release(), m_atChild.get(), IGNORE_
EXCEPTION); | 57 m_element2->insertBefore(children[i].release(), m_atChild.get(), IGNORE_
EXCEPTION); |
| 59 | 58 |
| 60 m_element1->remove(IGNORE_EXCEPTION); | 59 m_element1->remove(IGNORE_EXCEPTION); |
| 61 } | 60 } |
| 62 | 61 |
| 63 void MergeIdenticalElementsCommand::doUnapply() | 62 void MergeIdenticalElementsCommand::doUnapply() |
| 64 { | 63 { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 88 | 87 |
| 89 void MergeIdenticalElementsCommand::trace(Visitor* visitor) | 88 void MergeIdenticalElementsCommand::trace(Visitor* visitor) |
| 90 { | 89 { |
| 91 visitor->trace(m_element1); | 90 visitor->trace(m_element1); |
| 92 visitor->trace(m_element2); | 91 visitor->trace(m_element2); |
| 93 visitor->trace(m_atChild); | 92 visitor->trace(m_atChild); |
| 94 SimpleEditCommand::trace(visitor); | 93 SimpleEditCommand::trace(visitor); |
| 95 } | 94 } |
| 96 | 95 |
| 97 } // namespace blink | 96 } // namespace blink |
| OLD | NEW |