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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 } | 147 } |
148 if (isHTMLUListElement(*enclosingElement)) { | 148 if (isHTMLUListElement(*enclosingElement)) { |
149 applyCommandToComposite(InsertListCommand::create(document(), InsertList
Command::UnorderedList)); | 149 applyCommandToComposite(InsertListCommand::create(document(), InsertList
Command::UnorderedList)); |
150 return; | 150 return; |
151 } | 151 } |
152 | 152 |
153 // The selection is inside a blockquote i.e. enclosingNode is a blockquote | 153 // The selection is inside a blockquote i.e. enclosingNode is a blockquote |
154 VisiblePosition positionInEnclosingBlock = VisiblePosition(firstPositionInNo
de(enclosingElement)); | 154 VisiblePosition positionInEnclosingBlock = VisiblePosition(firstPositionInNo
de(enclosingElement)); |
155 // If the blockquote is inline, the start of the enclosing block coincides w
ith | 155 // If the blockquote is inline, the start of the enclosing block coincides w
ith |
156 // positionInEnclosingBlock. | 156 // positionInEnclosingBlock. |
157 VisiblePosition startOfEnclosingBlock = (enclosingElement->renderer() && enc
losingElement->renderer()->isInline()) ? positionInEnclosingBlock : startOfBlock
(positionInEnclosingBlock); | 157 VisiblePosition startOfEnclosingBlock = (enclosingElement->layoutObject() &&
enclosingElement->layoutObject()->isInline()) ? positionInEnclosingBlock : star
tOfBlock(positionInEnclosingBlock); |
158 VisiblePosition lastPositionInEnclosingBlock = VisiblePosition(lastPositionI
nNode(enclosingElement)); | 158 VisiblePosition lastPositionInEnclosingBlock = VisiblePosition(lastPositionI
nNode(enclosingElement)); |
159 VisiblePosition endOfEnclosingBlock = endOfBlock(lastPositionInEnclosingBloc
k); | 159 VisiblePosition endOfEnclosingBlock = endOfBlock(lastPositionInEnclosingBloc
k); |
160 if (visibleStartOfParagraph == startOfEnclosingBlock && | 160 if (visibleStartOfParagraph == startOfEnclosingBlock && |
161 visibleEndOfParagraph == endOfEnclosingBlock) { | 161 visibleEndOfParagraph == endOfEnclosingBlock) { |
162 // The blockquote doesn't contain anything outside the paragraph, so it
can be totally removed. | 162 // The blockquote doesn't contain anything outside the paragraph, so it
can be totally removed. |
163 Node* splitPoint = enclosingElement->nextSibling(); | 163 Node* splitPoint = enclosingElement->nextSibling(); |
164 removeNodePreservingChildren(enclosingElement); | 164 removeNodePreservingChildren(enclosingElement); |
165 // outdentRegion() assumes it is operating on the first paragraph of an
enclosing blockquote, but if there are multiply nested blockquotes and we've | 165 // outdentRegion() assumes it is operating on the first paragraph of an
enclosing blockquote, but if there are multiply nested blockquotes and we've |
166 // just removed one, then this assumption isn't true. By splitting the n
ext containing blockquote after this node, we keep this assumption true | 166 // just removed one, then this assumption isn't true. By splitting the n
ext containing blockquote after this node, we keep this assumption true |
167 if (splitPoint) { | 167 if (splitPoint) { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 | 249 |
250 void IndentOutdentCommand::formatRange(const Position& start, const Position& en
d, const Position&, RefPtrWillBeRawPtr<HTMLElement>& blockquoteForNextIndent) | 250 void IndentOutdentCommand::formatRange(const Position& start, const Position& en
d, const Position&, RefPtrWillBeRawPtr<HTMLElement>& blockquoteForNextIndent) |
251 { | 251 { |
252 if (tryIndentingAsListItem(start, end)) | 252 if (tryIndentingAsListItem(start, end)) |
253 blockquoteForNextIndent = nullptr; | 253 blockquoteForNextIndent = nullptr; |
254 else | 254 else |
255 indentIntoBlockquote(start, end, blockquoteForNextIndent); | 255 indentIntoBlockquote(start, end, blockquoteForNextIndent); |
256 } | 256 } |
257 | 257 |
258 } | 258 } |
OLD | NEW |