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

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

Issue 2627103003: [EditCommandSource] Pass source through |CompositeEditCommand| ctor instead of |apply(source)| (Closed)
Patch Set: Created 3 years, 11 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, 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 if (anchorNode->isCharacterDataNode()) 118 if (anchorNode->isCharacterDataNode())
119 return offset < anchorNode->maxCharacterOffset(); 119 return offset < anchorNode->maxCharacterOffset();
120 int currentOffset = 0; 120 int currentOffset = 0;
121 for (Node* node = NodeTraversal::firstChild(*anchorNode); 121 for (Node* node = NodeTraversal::firstChild(*anchorNode);
122 node && currentOffset < offset; node = NodeTraversal::nextSibling(*node)) 122 node && currentOffset < offset; node = NodeTraversal::nextSibling(*node))
123 currentOffset++; 123 currentOffset++;
124 return offset < currentOffset; 124 return offset < currentOffset;
125 } 125 }
126 126
127 ApplyStyleCommand::ApplyStyleCommand(Document& document, 127 ApplyStyleCommand::ApplyStyleCommand(Document& document,
128 EditCommandSource source,
128 const EditingStyle* style, 129 const EditingStyle* style,
129 InputEvent::InputType inputType, 130 InputEvent::InputType inputType,
130 EPropertyLevel propertyLevel) 131 EPropertyLevel propertyLevel)
131 : CompositeEditCommand(document), 132 : CompositeEditCommand(document, source),
132 m_style(style->copy()), 133 m_style(style->copy()),
133 m_inputType(inputType), 134 m_inputType(inputType),
134 m_propertyLevel(propertyLevel), 135 m_propertyLevel(propertyLevel),
135 m_start(mostForwardCaretPosition(endingSelection().start())), 136 m_start(mostForwardCaretPosition(endingSelection().start())),
136 m_end(mostBackwardCaretPosition(endingSelection().end())), 137 m_end(mostBackwardCaretPosition(endingSelection().end())),
137 m_useEndingSelection(true), 138 m_useEndingSelection(true),
138 m_styledInlineElement(nullptr), 139 m_styledInlineElement(nullptr),
139 m_removeOnly(false), 140 m_removeOnly(false),
140 m_isInlineElementToRemoveFunction(0) {} 141 m_isInlineElementToRemoveFunction(0) {}
141 142
(...skipping 1887 matching lines...) Expand 10 before | Expand all | Expand 10 after
2029 2030
2030 DEFINE_TRACE(ApplyStyleCommand) { 2031 DEFINE_TRACE(ApplyStyleCommand) {
2031 visitor->trace(m_style); 2032 visitor->trace(m_style);
2032 visitor->trace(m_start); 2033 visitor->trace(m_start);
2033 visitor->trace(m_end); 2034 visitor->trace(m_end);
2034 visitor->trace(m_styledInlineElement); 2035 visitor->trace(m_styledInlineElement);
2035 CompositeEditCommand::trace(visitor); 2036 CompositeEditCommand::trace(visitor);
2036 } 2037 }
2037 2038
2038 } // namespace blink 2039 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698