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

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

Issue 224113002: Oilpan: move Range object to the oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use STACK_ALLOCATED() + incorporate ager's overview of macros in this area. Created 6 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 removeInterchangeNodes(m_fragment.get()); 158 removeInterchangeNodes(m_fragment.get());
159 return; 159 return;
160 } 160 }
161 161
162 RefPtr<Element> holder = insertFragmentForTestRendering(editableRoot.get()); 162 RefPtr<Element> holder = insertFragmentForTestRendering(editableRoot.get());
163 if (!holder) { 163 if (!holder) {
164 removeInterchangeNodes(m_fragment.get()); 164 removeInterchangeNodes(m_fragment.get());
165 return; 165 return;
166 } 166 }
167 167
168 RefPtr<Range> range = VisibleSelection::selectionFromContentsOfNode(holder.g et()).toNormalizedRange(); 168 RefPtrWillBeRawPtr<Range> range = VisibleSelection::selectionFromContentsOfN ode(holder.get()).toNormalizedRange();
169 String text = plainText(range.get(), static_cast<TextIteratorBehavior>(TextI teratorEmitsOriginalText | TextIteratorIgnoresStyleVisibility)); 169 String text = plainText(range.get(), static_cast<TextIteratorBehavior>(TextI teratorEmitsOriginalText | TextIteratorIgnoresStyleVisibility));
170 170
171 removeInterchangeNodes(holder.get()); 171 removeInterchangeNodes(holder.get());
172 removeUnrenderedNodes(holder.get()); 172 removeUnrenderedNodes(holder.get());
173 restoreAndRemoveTestRenderingNodesToFragment(holder.get()); 173 restoreAndRemoveTestRenderingNodesToFragment(holder.get());
174 174
175 // Give the root a chance to change the text. 175 // Give the root a chance to change the text.
176 RefPtrWillBeRawPtr<BeforeTextInsertedEvent> evt = BeforeTextInsertedEvent::c reate(text); 176 RefPtrWillBeRawPtr<BeforeTextInsertedEvent> evt = BeforeTextInsertedEvent::c reate(text);
177 editableRoot->dispatchEvent(evt, ASSERT_NO_EXCEPTION); 177 editableRoot->dispatchEvent(evt, ASSERT_NO_EXCEPTION);
178 if (text != evt->text() || !editableRoot->rendererIsRichlyEditable()) { 178 if (text != evt->text() || !editableRoot->rendererIsRichlyEditable()) {
(...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1494 removeNodeAndPruneAncestors(nodeAfterInsertionPos.get()); 1494 removeNodeAndPruneAncestors(nodeAfterInsertionPos.get());
1495 1495
1496 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en d); 1496 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en d);
1497 1497
1498 setEndingSelection(selectionAfterReplace); 1498 setEndingSelection(selectionAfterReplace);
1499 1499
1500 return true; 1500 return true;
1501 } 1501 }
1502 1502
1503 } // namespace WebCore 1503 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698