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

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

Issue 424493003: Use tighter typing in editing: CompositeEditCommand (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2008 Apple 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 14 matching lines...) Expand all
25 25
26 #include "config.h" 26 #include "config.h"
27 #include "core/editing/IndentOutdentCommand.h" 27 #include "core/editing/IndentOutdentCommand.h"
28 28
29 #include "core/HTMLNames.h" 29 #include "core/HTMLNames.h"
30 #include "core/dom/Document.h" 30 #include "core/dom/Document.h"
31 #include "core/dom/ElementTraversal.h" 31 #include "core/dom/ElementTraversal.h"
32 #include "core/editing/InsertListCommand.h" 32 #include "core/editing/InsertListCommand.h"
33 #include "core/editing/VisibleUnits.h" 33 #include "core/editing/VisibleUnits.h"
34 #include "core/editing/htmlediting.h" 34 #include "core/editing/htmlediting.h"
35 #include "core/html/HTMLBRElement.h"
35 #include "core/html/HTMLElement.h" 36 #include "core/html/HTMLElement.h"
36 #include "core/rendering/RenderObject.h" 37 #include "core/rendering/RenderObject.h"
37 38
38 namespace blink { 39 namespace blink {
39 40
40 using namespace HTMLNames; 41 using namespace HTMLNames;
41 42
42 static bool isListOrIndentBlockquote(const Node* node) 43 static bool isListOrIndentBlockquote(const Node* node)
43 { 44 {
44 return node && (isHTMLUListElement(*node) || isHTMLOListElement(*node) || no de->hasTagName(blockquoteTag)); 45 return node && (isHTMLUListElement(*node) || isHTMLOListElement(*node) || no de->hasTagName(blockquoteTag));
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 } else { 187 } else {
187 // We split the blockquote at where we start outdenting. 188 // We split the blockquote at where we start outdenting.
188 Node* highestInlineNode = highestEnclosingNodeOfType(visibleStartOfP aragraph.deepEquivalent(), isInline, CannotCrossEditingBoundary, enclosingBlockF low); 189 Node* highestInlineNode = highestEnclosingNodeOfType(visibleStartOfP aragraph.deepEquivalent(), isInline, CannotCrossEditingBoundary, enclosingBlockF low);
189 splitElement(toElement(enclosingNode), (highestInlineNode) ? highest InlineNode : visibleStartOfParagraph.deepEquivalent().deprecatedNode()); 190 splitElement(toElement(enclosingNode), (highestInlineNode) ? highest InlineNode : visibleStartOfParagraph.deepEquivalent().deprecatedNode());
190 } 191 }
191 } 192 }
192 VisiblePosition startOfParagraphToMove(startOfParagraph(visibleStartOfParagr aph)); 193 VisiblePosition startOfParagraphToMove(startOfParagraph(visibleStartOfParagr aph));
193 VisiblePosition endOfParagraphToMove(endOfParagraph(visibleEndOfParagraph)); 194 VisiblePosition endOfParagraphToMove(endOfParagraph(visibleEndOfParagraph));
194 if (startOfParagraphToMove.isNull() || endOfParagraphToMove.isNull()) 195 if (startOfParagraphToMove.isNull() || endOfParagraphToMove.isNull())
195 return; 196 return;
196 RefPtrWillBeRawPtr<Node> placeholder = createBreakElement(document()); 197 RefPtrWillBeRawPtr<HTMLBRElement> placeholder = createBreakElement(document( ));
197 insertNodeBefore(placeholder, splitBlockquoteNode); 198 insertNodeBefore(placeholder, splitBlockquoteNode);
198 moveParagraph(startOfParagraphToMove, endOfParagraphToMove, VisiblePosition( positionBeforeNode(placeholder.get())), true); 199 moveParagraph(startOfParagraphToMove, endOfParagraphToMove, VisiblePosition( positionBeforeNode(placeholder.get())), true);
199 } 200 }
200 201
201 // FIXME: We should merge this function with ApplyBlockElementCommand::formatSel ection 202 // FIXME: We should merge this function with ApplyBlockElementCommand::formatSel ection
202 void IndentOutdentCommand::outdentRegion(const VisiblePosition& startOfSelection , const VisiblePosition& endOfSelection) 203 void IndentOutdentCommand::outdentRegion(const VisiblePosition& startOfSelection , const VisiblePosition& endOfSelection)
203 { 204 {
204 VisiblePosition endOfCurrentParagraph = endOfParagraph(startOfSelection); 205 VisiblePosition endOfCurrentParagraph = endOfParagraph(startOfSelection);
205 VisiblePosition endOfLastParagraph = endOfParagraph(endOfSelection); 206 VisiblePosition endOfLastParagraph = endOfParagraph(endOfSelection);
206 207
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 246
246 void IndentOutdentCommand::formatRange(const Position& start, const Position& en d, const Position&, RefPtrWillBeRawPtr<HTMLElement>& blockquoteForNextIndent) 247 void IndentOutdentCommand::formatRange(const Position& start, const Position& en d, const Position&, RefPtrWillBeRawPtr<HTMLElement>& blockquoteForNextIndent)
247 { 248 {
248 if (tryIndentingAsListItem(start, end)) 249 if (tryIndentingAsListItem(start, end))
249 blockquoteForNextIndent = nullptr; 250 blockquoteForNextIndent = nullptr;
250 else 251 else
251 indentIntoBlockquote(start, end, blockquoteForNextIndent); 252 indentIntoBlockquote(start, end, blockquoteForNextIndent);
252 } 253 }
253 254
254 } 255 }
OLDNEW
« no previous file with comments | « Source/core/editing/FormatBlockCommand.cpp ('k') | Source/core/editing/InsertLineBreakCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698