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

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

Issue 2175433002: Remove the unnecessary blockquote after indenting an empty blockquote (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test fail Created 4 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
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/execCommand/indent/indent_empty_quote.html ('k') | no next file » | 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) 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 if (!elementToSplitTo) 129 if (!elementToSplitTo)
130 return; 130 return;
131 131
132 Node* outerBlock = (start.computeContainerNode() == elementToSplitTo) ? star t.computeContainerNode() : splitTreeToNode(start.computeContainerNode(), element ToSplitTo); 132 Node* outerBlock = (start.computeContainerNode() == elementToSplitTo) ? star t.computeContainerNode() : splitTreeToNode(start.computeContainerNode(), element ToSplitTo);
133 133
134 VisiblePosition startOfContents = createVisiblePosition(start); 134 VisiblePosition startOfContents = createVisiblePosition(start);
135 if (!targetBlockquote) { 135 if (!targetBlockquote) {
136 // Create a new blockquote and insert it as a child of the root editable element. We accomplish 136 // Create a new blockquote and insert it as a child of the root editable element. We accomplish
137 // this by splitting all parents of the current paragraph up to that poi nt. 137 // this by splitting all parents of the current paragraph up to that poi nt.
138 targetBlockquote = createBlockElement(); 138 targetBlockquote = createBlockElement();
139 if (outerBlock == start.computeContainerNode()) 139 if (outerBlock == start.computeContainerNode()) {
140 insertNodeAt(targetBlockquote, start, editingState); 140 // When we apply indent to an empty <blockquote>, we should call ins ertNodeAfter().
141 else 141 // See http://crbug.com/625802 for more details.
142 if (outerBlock->hasTagName(blockquoteTag))
143 insertNodeAfter(targetBlockquote, outerBlock, editingState);
144 else
145 insertNodeAt(targetBlockquote, start, editingState);
146 } else
142 insertNodeBefore(targetBlockquote, outerBlock, editingState); 147 insertNodeBefore(targetBlockquote, outerBlock, editingState);
143 if (editingState->isAborted()) 148 if (editingState->isAborted())
144 return; 149 return;
145 startOfContents = VisiblePosition::inParentAfterNode(*targetBlockquote); 150 startOfContents = VisiblePosition::inParentAfterNode(*targetBlockquote);
146 } 151 }
147 152
148 VisiblePosition endOfContents = createVisiblePosition(end); 153 VisiblePosition endOfContents = createVisiblePosition(end);
149 if (startOfContents.isNull() || endOfContents.isNull()) 154 if (startOfContents.isNull() || endOfContents.isNull())
150 return; 155 return;
151 moveParagraphWithClones(startOfContents, endOfContents, targetBlockquote, ou terBlock, editingState); 156 moveParagraphWithClones(startOfContents, endOfContents, targetBlockquote, ou terBlock, editingState);
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 bool indentingAsListItemResult = tryIndentingAsListItem(start, end, editingS tate); 285 bool indentingAsListItemResult = tryIndentingAsListItem(start, end, editingS tate);
281 if (editingState->isAborted()) 286 if (editingState->isAborted())
282 return; 287 return;
283 if (indentingAsListItemResult) 288 if (indentingAsListItemResult)
284 blockquoteForNextIndent = nullptr; 289 blockquoteForNextIndent = nullptr;
285 else 290 else
286 indentIntoBlockquote(start, end, blockquoteForNextIndent, editingState); 291 indentIntoBlockquote(start, end, blockquoteForNextIndent, editingState);
287 } 292 }
288 293
289 } // namespace blink 294 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/execCommand/indent/indent_empty_quote.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698