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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 Position start = startOfParagraph(endOfCurrentParagraph).deepEquivalent(); | 123 Position start = startOfParagraph(endOfCurrentParagraph).deepEquivalent(); |
124 enclosingCell = enclosingNodeOfType(start, &isTableCell); | 124 enclosingCell = enclosingNodeOfType(start, &isTableCell); |
125 Node* nodeToSplitTo; | 125 Node* nodeToSplitTo; |
126 if (enclosingCell) | 126 if (enclosingCell) |
127 nodeToSplitTo = enclosingCell; | 127 nodeToSplitTo = enclosingCell; |
128 else if (enclosingList(start.node())) | 128 else if (enclosingList(start.node())) |
129 nodeToSplitTo = enclosingBlock(start.node()); | 129 nodeToSplitTo = enclosingBlock(start.node()); |
130 else | 130 else |
131 nodeToSplitTo = editableRootForPosition(start); | 131 nodeToSplitTo = editableRootForPosition(start); |
132 | 132 |
| 133 if (!nodeToSplitTo) |
| 134 return; |
| 135 |
133 RefPtr<Node> outerBlock = (start.node() == nodeToSplitTo) ? start.node() : s
plitTreeToNode(start.node(), nodeToSplitTo); | 136 RefPtr<Node> outerBlock = (start.node() == nodeToSplitTo) ? start.node() : s
plitTreeToNode(start.node(), nodeToSplitTo); |
134 | 137 |
135 if (!targetBlockquote) { | 138 if (!targetBlockquote) { |
136 // Create a new blockquote and insert it as a child of the root editable
element. We accomplish | 139 // 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. | 140 // this by splitting all parents of the current paragraph up to that poi
nt. |
138 targetBlockquote = createIndentBlockquoteElement(document()); | 141 targetBlockquote = createIndentBlockquoteElement(document()); |
139 insertNodeBefore(targetBlockquote, outerBlock); | 142 insertNodeBefore(targetBlockquote, outerBlock); |
140 } | 143 } |
141 | 144 |
142 moveParagraphWithClones(startOfParagraph(endOfCurrentParagraph), endOfCurren
tParagraph, targetBlockquote.get(), outerBlock.get()); | 145 moveParagraphWithClones(startOfParagraph(endOfCurrentParagraph), endOfCurren
tParagraph, targetBlockquote.get(), outerBlock.get()); |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 | 368 |
366 updateLayout(); | 369 updateLayout(); |
367 | 370 |
368 RefPtr<Range> startRange = TextIterator::rangeFromLocationAndLength(document
()->documentElement(), startIndex, 0, true); | 371 RefPtr<Range> startRange = TextIterator::rangeFromLocationAndLength(document
()->documentElement(), startIndex, 0, true); |
369 RefPtr<Range> endRange = TextIterator::rangeFromLocationAndLength(document()
->documentElement(), endIndex, 0, true); | 372 RefPtr<Range> endRange = TextIterator::rangeFromLocationAndLength(document()
->documentElement(), endIndex, 0, true); |
370 if (startRange && endRange) | 373 if (startRange && endRange) |
371 setEndingSelection(VisibleSelection(startRange->startPosition(), endRang
e->startPosition(), DOWNSTREAM)); | 374 setEndingSelection(VisibleSelection(startRange->startPosition(), endRang
e->startPosition(), DOWNSTREAM)); |
372 } | 375 } |
373 | 376 |
374 } | 377 } |
OLD | NEW |