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

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

Issue 2848823002: Add DCHECK() to check ApplyStyleCommand::DoApply() to work on non-null range (Closed)
Patch Set: 2017-04-28T14:02:57 Created 3 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 } 192 }
193 193
194 Position ApplyStyleCommand::EndPosition() { 194 Position ApplyStyleCommand::EndPosition() {
195 if (use_ending_selection_) 195 if (use_ending_selection_)
196 return EndingSelection().end(); 196 return EndingSelection().end();
197 197
198 return end_; 198 return end_;
199 } 199 }
200 200
201 void ApplyStyleCommand::DoApply(EditingState* editing_state) { 201 void ApplyStyleCommand::DoApply(EditingState* editing_state) {
202 DCHECK(StartPosition().IsNotNull());
203 DCHECK(EndPosition().IsNotNull());
202 switch (property_level_) { 204 switch (property_level_) {
203 case kPropertyDefault: { 205 case kPropertyDefault: {
204 // Apply the block-centric properties of the style. 206 // Apply the block-centric properties of the style.
205 EditingStyle* block_style = style_->ExtractAndRemoveBlockProperties(); 207 EditingStyle* block_style = style_->ExtractAndRemoveBlockProperties();
206 if (!block_style->IsEmpty()) { 208 if (!block_style->IsEmpty()) {
207 ApplyBlockStyle(block_style, editing_state); 209 ApplyBlockStyle(block_style, editing_state);
208 if (editing_state->IsAborted()) 210 if (editing_state->IsAborted())
209 return; 211 return;
210 } 212 }
211 // Apply any remaining styles to the inline elements. 213 // Apply any remaining styles to the inline elements.
(...skipping 1832 matching lines...) Expand 10 before | Expand all | Expand 10 after
2044 2046
2045 DEFINE_TRACE(ApplyStyleCommand) { 2047 DEFINE_TRACE(ApplyStyleCommand) {
2046 visitor->Trace(style_); 2048 visitor->Trace(style_);
2047 visitor->Trace(start_); 2049 visitor->Trace(start_);
2048 visitor->Trace(end_); 2050 visitor->Trace(end_);
2049 visitor->Trace(styled_inline_element_); 2051 visitor->Trace(styled_inline_element_);
2050 CompositeEditCommand::Trace(visitor); 2052 CompositeEditCommand::Trace(visitor);
2051 } 2053 }
2052 2054
2053 } // namespace blink 2055 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698