OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |