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

Side by Side Diff: third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp

Issue 2432173005: Get rid of VisibleSelection::selectionFromContentsOfNode() (Closed)
Patch Set: 2016-10-20T17:14:18 Created 4 years, 2 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 } 226 }
227 } 227 }
228 228
229 HTMLElement* holder = insertFragmentForTestRendering(editableRoot); 229 HTMLElement* holder = insertFragmentForTestRendering(editableRoot);
230 if (!holder) { 230 if (!holder) {
231 removeInterchangeNodes(m_fragment.get()); 231 removeInterchangeNodes(m_fragment.get());
232 return; 232 return;
233 } 233 }
234 234
235 const EphemeralRange range = 235 const EphemeralRange range =
236 VisibleSelection::selectionFromContentsOfNode(holder) 236 createVisibleSelection(
237 SelectionInDOMTree::Builder().selectAllChildren(*holder).build())
237 .toNormalizedEphemeralRange(); 238 .toNormalizedEphemeralRange();
238 String text = plainText(range, static_cast<TextIteratorBehavior>( 239 String text = plainText(range, static_cast<TextIteratorBehavior>(
239 TextIteratorEmitsOriginalText | 240 TextIteratorEmitsOriginalText |
240 TextIteratorIgnoresStyleVisibility)); 241 TextIteratorIgnoresStyleVisibility));
241 242
242 removeInterchangeNodes(holder); 243 removeInterchangeNodes(holder);
243 removeUnrenderedNodes(holder); 244 removeUnrenderedNodes(holder);
244 restoreAndRemoveTestRenderingNodesToFragment(holder); 245 restoreAndRemoveTestRenderingNodesToFragment(holder);
245 246
246 // Give the root a chance to change the text. 247 // Give the root a chance to change the text.
(...skipping 1845 matching lines...) Expand 10 before | Expand all | Expand 10 after
2092 visitor->trace(m_startOfInsertedContent); 2093 visitor->trace(m_startOfInsertedContent);
2093 visitor->trace(m_endOfInsertedContent); 2094 visitor->trace(m_endOfInsertedContent);
2094 visitor->trace(m_insertionStyle); 2095 visitor->trace(m_insertionStyle);
2095 visitor->trace(m_documentFragment); 2096 visitor->trace(m_documentFragment);
2096 visitor->trace(m_startOfInsertedRange); 2097 visitor->trace(m_startOfInsertedRange);
2097 visitor->trace(m_endOfInsertedRange); 2098 visitor->trace(m_endOfInsertedRange);
2098 CompositeEditCommand::trace(visitor); 2099 CompositeEditCommand::trace(visitor);
2099 } 2100 }
2100 2101
2101 } // namespace blink 2102 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698