| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 // Don't remove the placeholder yet, otherwise the block we're inserting
into would collapse before | 157 // Don't remove the placeholder yet, otherwise the block we're inserting
into would collapse before |
| 158 // we get a chance to insert into it. We check for a placeholder now, t
hough, because doing so requires | 158 // we get a chance to insert into it. We check for a placeholder now, t
hough, because doing so requires |
| 159 // the creation of a VisiblePosition, and if we did that post-insertion
it would force a layout. | 159 // the creation of a VisiblePosition, and if we did that post-insertion
it would force a layout. |
| 160 } | 160 } |
| 161 | 161 |
| 162 // Insert the character at the leftmost candidate. | 162 // Insert the character at the leftmost candidate. |
| 163 startPosition = startPosition.upstream(); | 163 startPosition = startPosition.upstream(); |
| 164 | 164 |
| 165 // It is possible for the node that contains startPosition to contain only u
nrendered whitespace, | 165 // It is possible for the node that contains startPosition to contain only u
nrendered whitespace, |
| 166 // and so deleteInsignificantText could remove it. Save the position before
the node in case that happens. | 166 // and so deleteInsignificantText could remove it. Save the position before
the node in case that happens. |
| 167 Position positionBeforeStartNode(positionInParentBeforeNode(startPosition.co
ntainerNode())); | 167 ASSERT(startPosition.containerNode()); |
| 168 Position positionBeforeStartNode(positionInParentBeforeNode(*startPosition.c
ontainerNode())); |
| 168 deleteInsignificantText(startPosition, startPosition.downstream()); | 169 deleteInsignificantText(startPosition, startPosition.downstream()); |
| 169 if (!startPosition.inDocument()) | 170 if (!startPosition.inDocument()) |
| 170 startPosition = positionBeforeStartNode; | 171 startPosition = positionBeforeStartNode; |
| 171 if (!startPosition.isCandidate()) | 172 if (!startPosition.isCandidate()) |
| 172 startPosition = startPosition.downstream(); | 173 startPosition = startPosition.downstream(); |
| 173 | 174 |
| 174 startPosition = positionAvoidingSpecialElementBoundary(startPosition); | 175 startPosition = positionAvoidingSpecialElementBoundary(startPosition); |
| 175 | 176 |
| 176 Position endPosition; | 177 Position endPosition; |
| 177 | 178 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 splitTextNode(textNode, offset); | 254 splitTextNode(textNode, offset); |
| 254 insertNodeBefore(spanNode, textNode.release()); | 255 insertNodeBefore(spanNode, textNode.release()); |
| 255 } | 256 } |
| 256 } | 257 } |
| 257 | 258 |
| 258 // return the position following the new tab | 259 // return the position following the new tab |
| 259 return lastPositionInNode(spanNode.get()); | 260 return lastPositionInNode(spanNode.get()); |
| 260 } | 261 } |
| 261 | 262 |
| 262 } | 263 } |
| OLD | NEW |