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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 return; | 150 return; |
151 moveParagraphWithClones(startOfContents, endOfContents, targetBlockquote, ou
terBlock, editingState); | 151 moveParagraphWithClones(startOfContents, endOfContents, targetBlockquote, ou
terBlock, editingState); |
152 } | 152 } |
153 | 153 |
154 void IndentOutdentCommand::outdentParagraph(EditingState* editingState) | 154 void IndentOutdentCommand::outdentParagraph(EditingState* editingState) |
155 { | 155 { |
156 VisiblePosition visibleStartOfParagraph = startOfParagraph(endingSelection()
.visibleStart()); | 156 VisiblePosition visibleStartOfParagraph = startOfParagraph(endingSelection()
.visibleStart()); |
157 VisiblePosition visibleEndOfParagraph = endOfParagraph(visibleStartOfParagra
ph); | 157 VisiblePosition visibleEndOfParagraph = endOfParagraph(visibleStartOfParagra
ph); |
158 | 158 |
159 HTMLElement* enclosingElement = toHTMLElement(enclosingNodeOfType(visibleSta
rtOfParagraph.deepEquivalent(), &isHTMLListOrBlockquoteElement)); | 159 HTMLElement* enclosingElement = toHTMLElement(enclosingNodeOfType(visibleSta
rtOfParagraph.deepEquivalent(), &isHTMLListOrBlockquoteElement)); |
160 if (!enclosingElement || !enclosingElement->parentNode()->hasEditableStyle()
) // We can't outdent if there is no place to go! | 160 if (!enclosingElement || !hasEditableStyle(*enclosingElement->parentNode()))
// We can't outdent if there is no place to go! |
161 return; | 161 return; |
162 | 162 |
163 // Use InsertListCommand to remove the selection from the list | 163 // Use InsertListCommand to remove the selection from the list |
164 if (isHTMLOListElement(*enclosingElement)) { | 164 if (isHTMLOListElement(*enclosingElement)) { |
165 applyCommandToComposite(InsertListCommand::create(document(), InsertList
Command::OrderedList), editingState); | 165 applyCommandToComposite(InsertListCommand::create(document(), InsertList
Command::OrderedList), editingState); |
166 return; | 166 return; |
167 } | 167 } |
168 if (isHTMLUListElement(*enclosingElement)) { | 168 if (isHTMLUListElement(*enclosingElement)) { |
169 applyCommandToComposite(InsertListCommand::create(document(), InsertList
Command::UnorderedList), editingState); | 169 applyCommandToComposite(InsertListCommand::create(document(), InsertList
Command::UnorderedList), editingState); |
170 return; | 170 return; |
(...skipping 12 matching lines...) Expand all Loading... |
183 Node* splitPoint = enclosingElement->nextSibling(); | 183 Node* splitPoint = enclosingElement->nextSibling(); |
184 removeNodePreservingChildren(enclosingElement, editingState); | 184 removeNodePreservingChildren(enclosingElement, editingState); |
185 if (editingState->isAborted()) | 185 if (editingState->isAborted()) |
186 return; | 186 return; |
187 // outdentRegion() assumes it is operating on the first paragraph of an
enclosing blockquote, but if there are multiply nested blockquotes and we've | 187 // outdentRegion() assumes it is operating on the first paragraph of an
enclosing blockquote, but if there are multiply nested blockquotes and we've |
188 // just removed one, then this assumption isn't true. By splitting the n
ext containing blockquote after this node, we keep this assumption true | 188 // just removed one, then this assumption isn't true. By splitting the n
ext containing blockquote after this node, we keep this assumption true |
189 if (splitPoint) { | 189 if (splitPoint) { |
190 if (Element* splitPointParent = splitPoint->parentElement()) { | 190 if (Element* splitPointParent = splitPoint->parentElement()) { |
191 if (splitPointParent->hasTagName(blockquoteTag) | 191 if (splitPointParent->hasTagName(blockquoteTag) |
192 && !splitPoint->hasTagName(blockquoteTag) | 192 && !splitPoint->hasTagName(blockquoteTag) |
193 && splitPointParent->parentNode()->hasEditableStyle()) // We
can't outdent if there is no place to go! | 193 && hasEditableStyle(*splitPointParent->parentNode())) // We
can't outdent if there is no place to go! |
194 splitElement(splitPointParent, splitPoint); | 194 splitElement(splitPointParent, splitPoint); |
195 } | 195 } |
196 } | 196 } |
197 | 197 |
198 document().updateStyleAndLayoutIgnorePendingStylesheets(); | 198 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
199 visibleStartOfParagraph = createVisiblePosition(visibleStartOfParagraph.
deepEquivalent()); | 199 visibleStartOfParagraph = createVisiblePosition(visibleStartOfParagraph.
deepEquivalent()); |
200 visibleEndOfParagraph = createVisiblePosition(visibleEndOfParagraph.deep
Equivalent()); | 200 visibleEndOfParagraph = createVisiblePosition(visibleEndOfParagraph.deep
Equivalent()); |
201 if (visibleStartOfParagraph.isNotNull() && !isStartOfParagraph(visibleSt
artOfParagraph)) { | 201 if (visibleStartOfParagraph.isNotNull() && !isStartOfParagraph(visibleSt
artOfParagraph)) { |
202 insertNodeAt(HTMLBRElement::create(document()), visibleStartOfParagr
aph.deepEquivalent(), editingState); | 202 insertNodeAt(HTMLBRElement::create(document()), visibleStartOfParagr
aph.deepEquivalent(), editingState); |
203 if (editingState->isAborted()) | 203 if (editingState->isAborted()) |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 bool indentingAsListItemResult = tryIndentingAsListItem(start, end, editingS
tate); | 280 bool indentingAsListItemResult = tryIndentingAsListItem(start, end, editingS
tate); |
281 if (editingState->isAborted()) | 281 if (editingState->isAborted()) |
282 return; | 282 return; |
283 if (indentingAsListItemResult) | 283 if (indentingAsListItemResult) |
284 blockquoteForNextIndent = nullptr; | 284 blockquoteForNextIndent = nullptr; |
285 else | 285 else |
286 indentIntoBlockquote(start, end, blockquoteForNextIndent, editingState); | 286 indentIntoBlockquote(start, end, blockquoteForNextIndent, editingState); |
287 } | 287 } |
288 | 288 |
289 } // namespace blink | 289 } // namespace blink |
OLD | NEW |