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

Side by Side Diff: Source/core/editing/commands/InsertParagraphSeparatorCommand.cpp

Issue 1300303002: Introduce isVisuallyEquivalentCandidate() as replacement of PositionAlgorithm::isCandidate() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-21T01:27:16 Rebase Created 5 years, 4 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 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2005, 2006 Apple Computer, 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 || isHTMLFormElement(*startBlock) 177 || isHTMLFormElement(*startBlock)
178 // FIXME: If the node is hidden, we don't have a canonical position so w e will do the wrong thing for tables and <hr>. https://bugs.webkit.org/show_bug. cgi?id=40342 178 // FIXME: If the node is hidden, we don't have a canonical position so w e will do the wrong thing for tables and <hr>. https://bugs.webkit.org/show_bug. cgi?id=40342
179 || (!canonicalPos.isNull() && isRenderedTableElement(canonicalPos.anchor Node())) 179 || (!canonicalPos.isNull() && isRenderedTableElement(canonicalPos.anchor Node()))
180 || (!canonicalPos.isNull() && isHTMLHRElement(*canonicalPos.anchorNode() ))) { 180 || (!canonicalPos.isNull() && isHTMLHRElement(*canonicalPos.anchorNode() ))) {
181 applyCommandToComposite(InsertLineBreakCommand::create(document())); 181 applyCommandToComposite(InsertLineBreakCommand::create(document()));
182 return; 182 return;
183 } 183 }
184 184
185 // Use the leftmost candidate. 185 // Use the leftmost candidate.
186 insertionPosition = insertionPosition.upstream(); 186 insertionPosition = insertionPosition.upstream();
187 if (!insertionPosition.isCandidate()) 187 if (!isVisuallyEquivalentCandidate(insertionPosition))
188 insertionPosition = insertionPosition.downstream(); 188 insertionPosition = insertionPosition.downstream();
189 189
190 // Adjust the insertion position after the delete 190 // Adjust the insertion position after the delete
191 insertionPosition = positionAvoidingSpecialElementBoundary(insertionPosition ); 191 insertionPosition = positionAvoidingSpecialElementBoundary(insertionPosition );
192 VisiblePosition visiblePos(insertionPosition, affinity); 192 VisiblePosition visiblePos(insertionPosition, affinity);
193 calculateStyleBeforeInsertion(insertionPosition); 193 calculateStyleBeforeInsertion(insertionPosition);
194 194
195 //--------------------------------------------------------------------- 195 //---------------------------------------------------------------------
196 // Handle special case of typing return on an empty list item 196 // Handle special case of typing return on an empty list item
197 if (breakOutOfEmptyListItem()) 197 if (breakOutOfEmptyListItem())
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 } 433 }
434 434
435 DEFINE_TRACE(InsertParagraphSeparatorCommand) 435 DEFINE_TRACE(InsertParagraphSeparatorCommand)
436 { 436 {
437 visitor->trace(m_style); 437 visitor->trace(m_style);
438 CompositeEditCommand::trace(visitor); 438 CompositeEditCommand::trace(visitor);
439 } 439 }
440 440
441 441
442 } // namespace blink 442 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/VisibleUnits.cpp ('k') | Source/core/editing/commands/InsertTextCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698