OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 } else if (pos.anchorNode()->isTextNode()) { | 140 } else if (pos.anchorNode()->isTextNode()) { |
141 // Split a text node | 141 // Split a text node |
142 Text* textNode = toText(pos.anchorNode()); | 142 Text* textNode = toText(pos.anchorNode()); |
143 splitTextNode(textNode, pos.computeOffsetInContainerNode()); | 143 splitTextNode(textNode, pos.computeOffsetInContainerNode()); |
144 insertNodeBefore(nodeToInsert, textNode, editingState); | 144 insertNodeBefore(nodeToInsert, textNode, editingState); |
145 if (editingState->isAborted()) | 145 if (editingState->isAborted()) |
146 return; | 146 return; |
147 Position endingPosition = Position::firstPositionInNode(textNode); | 147 Position endingPosition = Position::firstPositionInNode(textNode); |
148 | 148 |
149 // Handle whitespace that occurs after the split | 149 // Handle whitespace that occurs after the split |
150 document().updateLayoutIgnorePendingStylesheets(); | 150 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
151 // TODO(yosin) |isRenderedCharacter()| should be removed, and we should | 151 // TODO(yosin) |isRenderedCharacter()| should be removed, and we should |
152 // use |VisiblePosition::characterAfter()|. | 152 // use |VisiblePosition::characterAfter()|. |
153 if (!isRenderedCharacter(endingPosition)) { | 153 if (!isRenderedCharacter(endingPosition)) { |
154 Position positionBeforeTextNode(positionInParentBeforeNode(*textNode
)); | 154 Position positionBeforeTextNode(positionInParentBeforeNode(*textNode
)); |
155 // Clear out all whitespace and insert one non-breaking space | 155 // Clear out all whitespace and insert one non-breaking space |
156 deleteInsignificantTextDownstream(endingPosition); | 156 deleteInsignificantTextDownstream(endingPosition); |
157 DCHECK(!textNode->layoutObject() || textNode->layoutObject()->style(
)->collapseWhiteSpace()); | 157 DCHECK(!textNode->layoutObject() || textNode->layoutObject()->style(
)->collapseWhiteSpace()); |
158 // Deleting insignificant whitespace will remove textNode if it cont
ains nothing but insignificant whitespace. | 158 // Deleting insignificant whitespace will remove textNode if it cont
ains nothing but insignificant whitespace. |
159 if (textNode->inShadowIncludingDocument()) { | 159 if (textNode->inShadowIncludingDocument()) { |
160 insertTextIntoNode(textNode, 0, nonBreakingSpaceString()); | 160 insertTextIntoNode(textNode, 0, nonBreakingSpaceString()); |
(...skipping 27 matching lines...) Expand all Loading... |
188 // before the line break (if the line break is at the end of a block it
isn't selectable). | 188 // before the line break (if the line break is at the end of a block it
isn't selectable). |
189 // So, this next call sets the endingSelection() to a caret just after t
he line break | 189 // So, this next call sets the endingSelection() to a caret just after t
he line break |
190 // that we inserted, or just before it if it's at the end of a block. | 190 // that we inserted, or just before it if it's at the end of a block. |
191 setEndingSelection(endingSelection().visibleEnd()); | 191 setEndingSelection(endingSelection().visibleEnd()); |
192 } | 192 } |
193 | 193 |
194 rebalanceWhitespace(); | 194 rebalanceWhitespace(); |
195 } | 195 } |
196 | 196 |
197 } // namespace blink | 197 } // namespace blink |
OLD | NEW |