OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2005 Apple Computer, 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 111 |
112 // Split at pos if in the middle of a text node. | 112 // Split at pos if in the middle of a text node. |
113 if (startNode->isTextNode()) { | 113 if (startNode->isTextNode()) { |
114 Text* textNode = toText(startNode); | 114 Text* textNode = toText(startNode); |
115 if ((unsigned)pos.deprecatedEditingOffset() >= textNode->length()) { | 115 if ((unsigned)pos.deprecatedEditingOffset() >= textNode->length()) { |
116 startNode = NodeTraversal::next(*startNode); | 116 startNode = NodeTraversal::next(*startNode); |
117 ASSERT(startNode); | 117 ASSERT(startNode); |
118 } else if (pos.deprecatedEditingOffset() > 0) | 118 } else if (pos.deprecatedEditingOffset() > 0) |
119 splitTextNode(textNode, pos.deprecatedEditingOffset()); | 119 splitTextNode(textNode, pos.deprecatedEditingOffset()); |
120 } else if (pos.deprecatedEditingOffset() > 0) { | 120 } else if (pos.deprecatedEditingOffset() > 0) { |
121 Node* childAtOffset = startNode->traverseToChildAt(pos.deprecatedEditing
Offset()); | 121 Node* childAtOffset = NodeTraversal::childAt(*startNode, pos.deprecatedE
ditingOffset()); |
122 startNode = childAtOffset ? childAtOffset : NodeTraversal::next(*startNo
de); | 122 startNode = childAtOffset ? childAtOffset : NodeTraversal::next(*startNo
de); |
123 ASSERT(startNode); | 123 ASSERT(startNode); |
124 } | 124 } |
125 | 125 |
126 // If there's nothing inside topBlockquote to move, we're finished. | 126 // If there's nothing inside topBlockquote to move, we're finished. |
127 if (!startNode->isDescendantOf(topBlockquote)) { | 127 if (!startNode->isDescendantOf(topBlockquote)) { |
128 setEndingSelection(VisibleSelection(VisiblePosition(firstPositionInOrBef
oreNode(startNode)), endingSelection().isDirectional())); | 128 setEndingSelection(VisibleSelection(VisiblePosition(firstPositionInOrBef
oreNode(startNode)), endingSelection().isDirectional())); |
129 return; | 129 return; |
130 } | 130 } |
131 | 131 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 182 |
183 // Make sure the cloned block quote renders. | 183 // Make sure the cloned block quote renders. |
184 addBlockPlaceholderIfNeeded(clonedBlockquote.get()); | 184 addBlockPlaceholderIfNeeded(clonedBlockquote.get()); |
185 | 185 |
186 // Put the selection right before the break. | 186 // Put the selection right before the break. |
187 setEndingSelection(VisibleSelection(positionBeforeNode(breakElement.get()),
DOWNSTREAM, endingSelection().isDirectional())); | 187 setEndingSelection(VisibleSelection(positionBeforeNode(breakElement.get()),
DOWNSTREAM, endingSelection().isDirectional())); |
188 rebalanceWhitespace(); | 188 rebalanceWhitespace(); |
189 } | 189 } |
190 | 190 |
191 } // namespace blink | 191 } // namespace blink |
OLD | NEW |