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

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

Issue 1302353002: Get rid of redundant member function PositionAlgorithm<Strategy>::{upstream,downstream} (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-22T04:51:20 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) 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 VisiblePosition end(visiblePositionForIndex(endIndex, endScope.get())); 103 VisiblePosition end(visiblePositionForIndex(endIndex, endScope.get()));
104 if (start.isNotNull() && end.isNotNull()) 104 if (start.isNotNull() && end.isNotNull())
105 setEndingSelection(VisibleSelection(start, end, endingSelection().is Directional())); 105 setEndingSelection(VisibleSelection(start, end, endingSelection().is Directional()));
106 } 106 }
107 } 107 }
108 108
109 void ApplyBlockElementCommand::formatSelection(const VisiblePosition& startOfSel ection, const VisiblePosition& endOfSelection) 109 void ApplyBlockElementCommand::formatSelection(const VisiblePosition& startOfSel ection, const VisiblePosition& endOfSelection)
110 { 110 {
111 // Special case empty unsplittable elements because there's nothing to split 111 // Special case empty unsplittable elements because there's nothing to split
112 // and there's nothing to move. 112 // and there's nothing to move.
113 Position start = startOfSelection.deepEquivalent().downstream(); 113 Position start = mostForwardCaretPosition(startOfSelection.deepEquivalent()) ;
114 if (isAtUnsplittableElement(start)) { 114 if (isAtUnsplittableElement(start)) {
115 RefPtrWillBeRawPtr<HTMLElement> blockquote = createBlockElement(); 115 RefPtrWillBeRawPtr<HTMLElement> blockquote = createBlockElement();
116 insertNodeAt(blockquote, start); 116 insertNodeAt(blockquote, start);
117 RefPtrWillBeRawPtr<HTMLBRElement> placeholder = createBreakElement(docum ent()); 117 RefPtrWillBeRawPtr<HTMLBRElement> placeholder = createBreakElement(docum ent());
118 appendNode(placeholder, blockquote); 118 appendNode(placeholder, blockquote);
119 setEndingSelection(VisibleSelection(positionBeforeNode(placeholder.get() ), TextAffinity::Downstream, endingSelection().isDirectional())); 119 setEndingSelection(VisibleSelection(positionBeforeNode(placeholder.get() ), TextAffinity::Downstream, endingSelection().isDirectional()));
120 return; 120 return;
121 } 121 }
122 122
123 RefPtrWillBeRawPtr<HTMLElement> blockquoteForNextIndent = nullptr; 123 RefPtrWillBeRawPtr<HTMLElement> blockquoteForNextIndent = nullptr;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 return element.release(); 294 return element.release();
295 } 295 }
296 296
297 DEFINE_TRACE(ApplyBlockElementCommand) 297 DEFINE_TRACE(ApplyBlockElementCommand)
298 { 298 {
299 visitor->trace(m_endOfLastParagraph); 299 visitor->trace(m_endOfLastParagraph);
300 CompositeEditCommand::trace(visitor); 300 CompositeEditCommand::trace(visitor);
301 } 301 }
302 302
303 } 303 }
OLDNEW
« no previous file with comments | « Source/core/editing/VisibleUnitsTest.cpp ('k') | Source/core/editing/commands/ApplyStyleCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698