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 14 matching lines...) Expand all Loading... |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 #include "core/editing/MergeIdenticalElementsCommand.h" | 27 #include "core/editing/MergeIdenticalElementsCommand.h" |
28 | 28 |
29 #include "bindings/v8/ExceptionState.h" | 29 #include "bindings/v8/ExceptionState.h" |
30 #include "bindings/v8/ExceptionStatePlaceholder.h" | 30 #include "bindings/v8/ExceptionStatePlaceholder.h" |
31 #include "core/dom/Element.h" | 31 #include "core/dom/Element.h" |
32 | 32 |
33 namespace WebCore { | 33 namespace WebCore { |
34 | 34 |
35 MergeIdenticalElementsCommand::MergeIdenticalElementsCommand(PassRefPtr<Element>
first, PassRefPtr<Element> second) | 35 MergeIdenticalElementsCommand::MergeIdenticalElementsCommand(PassRefPtrWillBeRaw
Ptr<Element> first, PassRefPtrWillBeRawPtr<Element> second) |
36 : SimpleEditCommand(first->document()) | 36 : SimpleEditCommand(first->document()) |
37 , m_element1(first) | 37 , m_element1(first) |
38 , m_element2(second) | 38 , m_element2(second) |
39 { | 39 { |
40 ASSERT(m_element1); | 40 ASSERT(m_element1); |
41 ASSERT(m_element2); | 41 ASSERT(m_element2); |
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() |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 Vector<RefPtr<Node> > children; | 80 Vector<RefPtr<Node> > children; |
81 for (Node* child = m_element2->firstChild(); child && child != atChild; chil
d = child->nextSibling()) | 81 for (Node* child = m_element2->firstChild(); child && child != atChild; chil
d = child->nextSibling()) |
82 children.append(child); | 82 children.append(child); |
83 | 83 |
84 size_t size = children.size(); | 84 size_t size = children.size(); |
85 for (size_t i = 0; i < size; ++i) | 85 for (size_t i = 0; i < size; ++i) |
86 m_element1->appendChild(children[i].release(), exceptionState); | 86 m_element1->appendChild(children[i].release(), exceptionState); |
87 } | 87 } |
88 | 88 |
| 89 void MergeIdenticalElementsCommand::trace(Visitor* visitor) |
| 90 { |
| 91 visitor->trace(m_element1); |
| 92 visitor->trace(m_element2); |
| 93 visitor->trace(m_atChild); |
| 94 SimpleEditCommand::trace(visitor); |
| 95 } |
| 96 |
89 } // namespace WebCore | 97 } // namespace WebCore |
OLD | NEW |