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

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

Issue 1997563002: Get rid of a redundant function alias positionBeforeNode() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-05-19T22:35:34 rebase Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2005 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 { 103 {
104 HTMLElement* startSpecialContainer = nullptr; 104 HTMLElement* startSpecialContainer = nullptr;
105 HTMLElement* endSpecialContainer = nullptr; 105 HTMLElement* endSpecialContainer = nullptr;
106 106
107 start = m_selectionToDelete.start(); 107 start = m_selectionToDelete.start();
108 end = m_selectionToDelete.end(); 108 end = m_selectionToDelete.end();
109 109
110 // For HRs, we'll get a position at (HR,1) when hitting delete from the begi nning of the previous line, or (HR,0) when forward deleting, 110 // For HRs, we'll get a position at (HR,1) when hitting delete from the begi nning of the previous line, or (HR,0) when forward deleting,
111 // but in these cases, we want to delete it, so manually expand the selectio n 111 // but in these cases, we want to delete it, so manually expand the selectio n
112 if (isHTMLHRElement(*start.anchorNode())) 112 if (isHTMLHRElement(*start.anchorNode()))
113 start = positionBeforeNode(start.anchorNode()); 113 start = Position::beforeNode(start.anchorNode());
114 else if (isHTMLHRElement(*end.anchorNode())) 114 else if (isHTMLHRElement(*end.anchorNode()))
115 end = Position::afterNode(end.anchorNode()); 115 end = Position::afterNode(end.anchorNode());
116 116
117 // FIXME: This is only used so that moveParagraphs can avoid the bugs in spe cial element expansion. 117 // FIXME: This is only used so that moveParagraphs can avoid the bugs in spe cial element expansion.
118 if (!m_expandForSpecialElements) 118 if (!m_expandForSpecialElements)
119 return; 119 return;
120 120
121 while (1) { 121 while (1) {
122 startSpecialContainer = 0; 122 startSpecialContainer = 0;
123 endSpecialContainer = 0; 123 endSpecialContainer = 0;
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 bool upstreamStartIsBR = isHTMLBRElement(*nodeAfterUpstreamStart); 317 bool upstreamStartIsBR = isHTMLBRElement(*nodeAfterUpstreamStart);
318 bool downstreamStartIsBR = isHTMLBRElement(*nodeAfterDownstreamStart); 318 bool downstreamStartIsBR = isHTMLBRElement(*nodeAfterDownstreamStart);
319 bool isBROnLineByItself = upstreamStartIsBR && downstreamStartIsBR && nodeAf terDownstreamStart == nodeAfterUpstreamEnd; 319 bool isBROnLineByItself = upstreamStartIsBR && downstreamStartIsBR && nodeAf terDownstreamStart == nodeAfterUpstreamEnd;
320 if (isBROnLineByItself) { 320 if (isBROnLineByItself) {
321 removeNode(nodeAfterDownstreamStart, editingState); 321 removeNode(nodeAfterDownstreamStart, editingState);
322 return true; 322 return true;
323 } 323 }
324 324
325 // FIXME: This code doesn't belong in here. 325 // FIXME: This code doesn't belong in here.
326 // We detect the case where the start is an empty line consisting of BR not wrapped in a block element. 326 // We detect the case where the start is an empty line consisting of BR not wrapped in a block element.
327 if (upstreamStartIsBR && downstreamStartIsBR && !(isStartOfBlock(createVisib lePosition(positionBeforeNode(nodeAfterUpstreamStart))) && isEndOfBlock(createVi siblePosition(Position::afterNode(nodeAfterUpstreamStart))))) { 327 if (upstreamStartIsBR && downstreamStartIsBR && !(isStartOfBlock(createVisib lePosition(Position::beforeNode(nodeAfterUpstreamStart))) && isEndOfBlock(create VisiblePosition(Position::afterNode(nodeAfterUpstreamStart))))) {
328 m_startsAtEmptyLine = true; 328 m_startsAtEmptyLine = true;
329 m_endingPosition = m_downstreamEnd; 329 m_endingPosition = m_downstreamEnd;
330 } 330 }
331 331
332 return false; 332 return false;
333 } 333 }
334 334
335 static Position firstEditablePositionInNode(Node* node) 335 static Position firstEditablePositionInNode(Node* node)
336 { 336 {
337 DCHECK(node); 337 DCHECK(node);
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 visitor->trace(m_deleteIntoBlockquoteStyle); 962 visitor->trace(m_deleteIntoBlockquoteStyle);
963 visitor->trace(m_startRoot); 963 visitor->trace(m_startRoot);
964 visitor->trace(m_endRoot); 964 visitor->trace(m_endRoot);
965 visitor->trace(m_startTableRow); 965 visitor->trace(m_startTableRow);
966 visitor->trace(m_endTableRow); 966 visitor->trace(m_endTableRow);
967 visitor->trace(m_temporaryPlaceholder); 967 visitor->trace(m_temporaryPlaceholder);
968 CompositeEditCommand::trace(visitor); 968 CompositeEditCommand::trace(visitor);
969 } 969 }
970 970
971 } // namespace blink 971 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698