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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
114 // Create a new blockquote and insert it as a child of the root editable element. We accomplish | 114 // Create a new blockquote and insert it as a child of the root editable element. We accomplish |
115 // this by splitting all parents of the current paragraph up to that poi nt. | 115 // this by splitting all parents of the current paragraph up to that poi nt. |
116 targetBlockquote = createBlockElement(); | 116 targetBlockquote = createBlockElement(); |
117 if (outerBlock == start.containerNode()) | 117 if (outerBlock == start.containerNode()) |
118 insertNodeAt(targetBlockquote, start); | 118 insertNodeAt(targetBlockquote, start); |
119 else | 119 else |
120 insertNodeBefore(targetBlockquote, outerBlock); | 120 insertNodeBefore(targetBlockquote, outerBlock); |
121 startOfContents = VisiblePosition(positionInParentAfterNode(*targetBlock quote)); | 121 startOfContents = VisiblePosition(positionInParentAfterNode(*targetBlock quote)); |
122 } | 122 } |
123 | 123 |
124 moveParagraphWithClones(startOfContents, VisiblePosition(end), targetBlockqu ote.get(), outerBlock.get()); | 124 VisiblePosition endOfContents = VisiblePosition(end); |
Yuta Kitamura
2014/06/23 06:34:06
nit: You can simplify this line with:
Visible
yosin_UTC9
2014/06/23 06:52:19
Done.
| |
125 if (startOfContents.isNull() || endOfContents.isNull()) | |
126 return; | |
127 moveParagraphWithClones(startOfContents, endOfContents, targetBlockquote.get (), outerBlock.get()); | |
125 } | 128 } |
126 | 129 |
127 void IndentOutdentCommand::outdentParagraph() | 130 void IndentOutdentCommand::outdentParagraph() |
128 { | 131 { |
129 VisiblePosition visibleStartOfParagraph = startOfParagraph(endingSelection() .visibleStart()); | 132 VisiblePosition visibleStartOfParagraph = startOfParagraph(endingSelection() .visibleStart()); |
130 VisiblePosition visibleEndOfParagraph = endOfParagraph(visibleStartOfParagra ph); | 133 VisiblePosition visibleEndOfParagraph = endOfParagraph(visibleStartOfParagra ph); |
131 | 134 |
132 Node* enclosingNode = enclosingNodeOfType(visibleStartOfParagraph.deepEquiva lent(), &isListOrIndentBlockquote); | 135 Node* enclosingNode = enclosingNodeOfType(visibleStartOfParagraph.deepEquiva lent(), &isListOrIndentBlockquote); |
133 if (!enclosingNode || !enclosingNode->parentNode()->rendererIsEditable()) // We can't outdent if there is no place to go! | 136 if (!enclosingNode || !enclosingNode->parentNode()->rendererIsEditable()) // We can't outdent if there is no place to go! |
134 return; | 137 return; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
242 | 245 |
243 void IndentOutdentCommand::formatRange(const Position& start, const Position& en d, const Position&, RefPtrWillBeRawPtr<Element>& blockquoteForNextIndent) | 246 void IndentOutdentCommand::formatRange(const Position& start, const Position& en d, const Position&, RefPtrWillBeRawPtr<Element>& blockquoteForNextIndent) |
244 { | 247 { |
245 if (tryIndentingAsListItem(start, end)) | 248 if (tryIndentingAsListItem(start, end)) |
246 blockquoteForNextIndent = nullptr; | 249 blockquoteForNextIndent = nullptr; |
247 else | 250 else |
248 indentIntoBlockquote(start, end, blockquoteForNextIndent); | 251 indentIntoBlockquote(start, end, blockquoteForNextIndent); |
249 } | 252 } |
250 | 253 |
251 } | 254 } |
OLD | NEW |