Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(938)

Side by Side Diff: Source/core/editing/MergeIdenticalElementsCommand.cpp

Issue 309283002: Oilpan: convert remaining editing/ RefPtr<Node>s to transition types. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Source/core/editing/SplitElementCommand.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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->rendererIsEditab le() || !m_element2->rendererIsEditable()) 47 if (m_element1->nextSibling() != m_element2 || !m_element1->rendererIsEditab le() || !m_element2->rendererIsEditable())
48 return; 48 return;
49 49
50 m_atChild = m_element2->firstChild(); 50 m_atChild = m_element2->firstChild();
51 51
52 Vector<RefPtr<Node> > children; 52 WillBeHeapVector<RefPtrWillBeMember<Node> > children;
53 for (Node* child = m_element1->firstChild(); child; child = child->nextSibli ng()) 53 for (Node* child = m_element1->firstChild(); child; child = child->nextSibli ng())
54 children.append(child); 54 children.append(child);
55 55
56 size_t size = children.size(); 56 size_t size = children.size();
57 for (size_t i = 0; i < size; ++i) 57 for (size_t i = 0; i < size; ++i)
58 m_element2->insertBefore(children[i].release(), m_atChild.get(), IGNORE_ EXCEPTION); 58 m_element2->insertBefore(children[i].release(), m_atChild.get(), IGNORE_ EXCEPTION);
59 59
60 m_element1->remove(IGNORE_EXCEPTION); 60 m_element1->remove(IGNORE_EXCEPTION);
61 } 61 }
62 62
63 void MergeIdenticalElementsCommand::doUnapply() 63 void MergeIdenticalElementsCommand::doUnapply()
64 { 64 {
65 ASSERT(m_element1); 65 ASSERT(m_element1);
66 ASSERT(m_element2); 66 ASSERT(m_element2);
67 67
68 RefPtr<Node> atChild = m_atChild.release(); 68 RefPtrWillBeRawPtr<Node> atChild = m_atChild.release();
69 69
70 ContainerNode* parent = m_element2->parentNode(); 70 ContainerNode* parent = m_element2->parentNode();
71 if (!parent || !parent->rendererIsEditable()) 71 if (!parent || !parent->rendererIsEditable())
72 return; 72 return;
73 73
74 TrackExceptionState exceptionState; 74 TrackExceptionState exceptionState;
75 75
76 parent->insertBefore(m_element1.get(), m_element2.get(), exceptionState); 76 parent->insertBefore(m_element1.get(), m_element2.get(), exceptionState);
77 if (exceptionState.hadException()) 77 if (exceptionState.hadException())
78 return; 78 return;
79 79
80 Vector<RefPtr<Node> > children; 80 WillBeHeapVector<RefPtrWillBeMember<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) 89 void MergeIdenticalElementsCommand::trace(Visitor* visitor)
90 { 90 {
91 visitor->trace(m_element1); 91 visitor->trace(m_element1);
92 visitor->trace(m_element2); 92 visitor->trace(m_element2);
93 visitor->trace(m_atChild); 93 visitor->trace(m_atChild);
94 SimpleEditCommand::trace(visitor); 94 SimpleEditCommand::trace(visitor);
95 } 95 }
96 96
97 } // namespace WebCore 97 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/editing/SplitElementCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698