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

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

Issue 2442673002: Get rid of createVisibleSelection() taking one Position (Closed)
Patch Set: 2016-10-24T17:42:38 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) 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Google Inc. All rights reserved. 3 * Copyright (C) 2010 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 HTMLElement* blockquote = createBlockElement(); 132 HTMLElement* blockquote = createBlockElement();
133 insertNodeAt(blockquote, start, editingState); 133 insertNodeAt(blockquote, start, editingState);
134 if (editingState->isAborted()) 134 if (editingState->isAborted())
135 return; 135 return;
136 HTMLBRElement* placeholder = HTMLBRElement::create(document()); 136 HTMLBRElement* placeholder = HTMLBRElement::create(document());
137 appendNode(placeholder, blockquote, editingState); 137 appendNode(placeholder, blockquote, editingState);
138 if (editingState->isAborted()) 138 if (editingState->isAborted())
139 return; 139 return;
140 document().updateStyleAndLayoutIgnorePendingStylesheets(); 140 document().updateStyleAndLayoutIgnorePendingStylesheets();
141 setEndingSelection(createVisibleSelection( 141 setEndingSelection(createVisibleSelection(
142 Position::beforeNode(placeholder), TextAffinity::Downstream, 142 SelectionInDOMTree::Builder()
143 endingSelection().isDirectional())); 143 .collapse(Position::beforeNode(placeholder))
144 .setIsDirectional(endingSelection().isDirectional())
145 .build()));
144 return; 146 return;
145 } 147 }
146 148
147 HTMLElement* blockquoteForNextIndent = nullptr; 149 HTMLElement* blockquoteForNextIndent = nullptr;
148 VisiblePosition endOfCurrentParagraph = endOfParagraph(startOfSelection); 150 VisiblePosition endOfCurrentParagraph = endOfParagraph(startOfSelection);
149 VisiblePosition endOfLastParagraph = endOfParagraph(endOfSelection); 151 VisiblePosition endOfLastParagraph = endOfParagraph(endOfSelection);
150 Position endAfterSelection = 152 Position endAfterSelection =
151 endOfParagraph(nextPositionOf(endOfLastParagraph)).deepEquivalent(); 153 endOfParagraph(nextPositionOf(endOfLastParagraph)).deepEquivalent();
152 m_endOfLastParagraph = endOfLastParagraph.deepEquivalent(); 154 m_endOfLastParagraph = endOfLastParagraph.deepEquivalent();
153 155
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 element->setAttribute(styleAttr, m_inlineStyle); 383 element->setAttribute(styleAttr, m_inlineStyle);
382 return element; 384 return element;
383 } 385 }
384 386
385 DEFINE_TRACE(ApplyBlockElementCommand) { 387 DEFINE_TRACE(ApplyBlockElementCommand) {
386 visitor->trace(m_endOfLastParagraph); 388 visitor->trace(m_endOfLastParagraph);
387 CompositeEditCommand::trace(visitor); 389 CompositeEditCommand::trace(visitor);
388 } 390 }
389 391
390 } // namespace blink 392 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698