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

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

Issue 2406163004: Simplify the usage of PositionWithAffinity (Closed)
Patch Set: 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 enclosingCell != 179 enclosingCell !=
180 enclosingNodeOfType(endOfNextParagraph.position(), &isTableCell)) 180 enclosingNodeOfType(endOfNextParagraph.position(), &isTableCell))
181 blockquoteForNextIndent = nullptr; 181 blockquoteForNextIndent = nullptr;
182 182
183 // indentIntoBlockquote could move more than one paragraph if the paragraph 183 // indentIntoBlockquote could move more than one paragraph if the paragraph
184 // is in a list item or a table. As a result, endAfterSelection could refer 184 // is in a list item or a table. As a result, endAfterSelection could refer
185 // to a position no longer in the document. 185 // to a position no longer in the document.
186 if (endAfterSelection.isNotNull() && !endAfterSelection.isConnected()) 186 if (endAfterSelection.isNotNull() && !endAfterSelection.isConnected())
187 break; 187 break;
188 // Sanity check: Make sure our moveParagraph calls didn't remove 188 // Sanity check: Make sure our moveParagraph calls didn't remove
189 // endOfNextParagraph.position().anchorNode() If somehow, e.g. mutation 189 // endOfNextParagraph.anchorNode() If somehow, e.g. mutation
190 // event handler, we did, return to prevent crashes. 190 // event handler, we did, return to prevent crashes.
191 if (endOfNextParagraph.isNotNull() && 191 if (endOfNextParagraph.isNotNull() && !endOfNextParagraph.isConnected())
192 !endOfNextParagraph.position().isConnected())
193 return; 192 return;
194 193
195 document().updateStyleAndLayoutIgnorePendingStylesheets(); 194 document().updateStyleAndLayoutIgnorePendingStylesheets();
196 endOfCurrentParagraph = createVisiblePosition(endOfNextParagraph); 195 endOfCurrentParagraph = createVisiblePosition(endOfNextParagraph);
197 } 196 }
198 } 197 }
199 198
200 static bool isNewLineAtPosition(const Position& position) { 199 static bool isNewLineAtPosition(const Position& position) {
201 Node* textNode = position.computeContainerNode(); 200 Node* textNode = position.computeContainerNode();
202 int offset = position.offsetInContainerNode(); 201 int offset = position.offsetInContainerNode();
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 element->setAttribute(styleAttr, m_inlineStyle); 381 element->setAttribute(styleAttr, m_inlineStyle);
383 return element; 382 return element;
384 } 383 }
385 384
386 DEFINE_TRACE(ApplyBlockElementCommand) { 385 DEFINE_TRACE(ApplyBlockElementCommand) {
387 visitor->trace(m_endOfLastParagraph); 386 visitor->trace(m_endOfLastParagraph);
388 CompositeEditCommand::trace(visitor); 387 CompositeEditCommand::trace(visitor);
389 } 388 }
390 389
391 } // namespace blink 390 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698