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

Side by Side Diff: Source/core/editing/BreakBlockquoteCommand.cpp

Issue 434393003: Use tighter typing in editing: VisiblePosition & VisibleSelection (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/PositionIterator.cpp ('k') | Source/core/editing/Caret.cpp » ('j') | 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 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 rebalanceWhitespace(); 95 rebalanceWhitespace();
96 return; 96 return;
97 } 97 }
98 98
99 // Don't move a line break just after the caret. Doing so would create an e xtra, empty paragraph 99 // Don't move a line break just after the caret. Doing so would create an e xtra, empty paragraph
100 // in the new blockquote. 100 // in the new blockquote.
101 if (lineBreakExistsAtVisiblePosition(visiblePos)) 101 if (lineBreakExistsAtVisiblePosition(visiblePos))
102 pos = pos.next(); 102 pos = pos.next();
103 103
104 // Adjust the position so we don't split at the beginning of a quote. 104 // Adjust the position so we don't split at the beginning of a quote.
105 while (isFirstVisiblePositionInNode(VisiblePosition(pos), enclosingNodeOfTyp e(pos, isMailHTMLBlockquoteElement))) 105 while (isFirstVisiblePositionInNode(VisiblePosition(pos), toHTMLQuoteElement (enclosingNodeOfType(pos, isMailHTMLBlockquoteElement))))
106 pos = pos.previous(); 106 pos = pos.previous();
107 107
108 // startNode is the first node that we need to move to the new blockquote. 108 // startNode is the first node that we need to move to the new blockquote.
109 Node* startNode = pos.deprecatedNode(); 109 Node* startNode = pos.deprecatedNode();
110 ASSERT(startNode); 110 ASSERT(startNode);
111 111
112 // Split at pos if in the middle of a text node. 112 // Split at pos if in the middle of a text node.
113 if (startNode->isTextNode()) { 113 if (startNode->isTextNode()) {
114 Text* textNode = toText(startNode); 114 Text* textNode = toText(startNode);
115 if ((unsigned)pos.deprecatedEditingOffset() >= textNode->length()) { 115 if ((unsigned)pos.deprecatedEditingOffset() >= textNode->length()) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 182
183 // Make sure the cloned block quote renders. 183 // Make sure the cloned block quote renders.
184 addBlockPlaceholderIfNeeded(clonedBlockquote.get()); 184 addBlockPlaceholderIfNeeded(clonedBlockquote.get());
185 185
186 // Put the selection right before the break. 186 // Put the selection right before the break.
187 setEndingSelection(VisibleSelection(positionBeforeNode(breakElement.get()), DOWNSTREAM, endingSelection().isDirectional())); 187 setEndingSelection(VisibleSelection(positionBeforeNode(breakElement.get()), DOWNSTREAM, endingSelection().isDirectional()));
188 rebalanceWhitespace(); 188 rebalanceWhitespace();
189 } 189 }
190 190
191 } // namespace blink 191 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/dom/PositionIterator.cpp ('k') | Source/core/editing/Caret.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698