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

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

Issue 2451613003: Get rid of createVisibleSelection() taking two Position (Closed)
Patch Set: 2016-10-26T11:29:45 Created 4 years, 1 month 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, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2008, 2009 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 m_isInlineElementToRemoveFunction(isInlineElementToRemoveFunction) {} 183 m_isInlineElementToRemoveFunction(isInlineElementToRemoveFunction) {}
184 184
185 void ApplyStyleCommand::updateStartEnd(const Position& newStart, 185 void ApplyStyleCommand::updateStartEnd(const Position& newStart,
186 const Position& newEnd) { 186 const Position& newEnd) {
187 DCHECK_GE(comparePositions(newEnd, newStart), 0); 187 DCHECK_GE(comparePositions(newEnd, newStart), 0);
188 188
189 if (!m_useEndingSelection && (newStart != m_start || newEnd != m_end)) 189 if (!m_useEndingSelection && (newStart != m_start || newEnd != m_end))
190 m_useEndingSelection = true; 190 m_useEndingSelection = true;
191 191
192 document().updateStyleAndLayoutIgnorePendingStylesheets(); 192 document().updateStyleAndLayoutIgnorePendingStylesheets();
193 setEndingSelection(createVisibleSelection(newStart, newEnd, 193 setEndingSelection(createVisibleSelection(
194 VP_DEFAULT_AFFINITY, 194 SelectionInDOMTree::Builder()
195 endingSelection().isDirectional())); 195 .collapse(newStart)
196 .extend(newEnd)
197 .setIsDirectional(endingSelection().isDirectional())
198 .build()));
196 m_start = newStart; 199 m_start = newStart;
197 m_end = newEnd; 200 m_end = newEnd;
198 } 201 }
199 202
200 Position ApplyStyleCommand::startPosition() { 203 Position ApplyStyleCommand::startPosition() {
201 if (m_useEndingSelection) 204 if (m_useEndingSelection)
202 return endingSelection().start(); 205 return endingSelection().start();
203 206
204 return m_start; 207 return m_start;
205 } 208 }
(...skipping 1822 matching lines...) Expand 10 before | Expand all | Expand 10 after
2028 2031
2029 DEFINE_TRACE(ApplyStyleCommand) { 2032 DEFINE_TRACE(ApplyStyleCommand) {
2030 visitor->trace(m_style); 2033 visitor->trace(m_style);
2031 visitor->trace(m_start); 2034 visitor->trace(m_start);
2032 visitor->trace(m_end); 2035 visitor->trace(m_end);
2033 visitor->trace(m_styledInlineElement); 2036 visitor->trace(m_styledInlineElement);
2034 CompositeEditCommand::trace(visitor); 2037 CompositeEditCommand::trace(visitor);
2035 } 2038 }
2036 2039
2037 } // namespace blink 2040 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698