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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 // Insert the character at the leftmost candidate. | 170 // Insert the character at the leftmost candidate. |
171 startPosition = startPosition.upstream(); | 171 startPosition = startPosition.upstream(); |
172 | 172 |
173 // It is possible for the node that contains startPosition to contain only u
nrendered whitespace, | 173 // It is possible for the node that contains startPosition to contain only u
nrendered whitespace, |
174 // and so deleteInsignificantText could remove it. Save the position before
the node in case that happens. | 174 // and so deleteInsignificantText could remove it. Save the position before
the node in case that happens. |
175 ASSERT(startPosition.computeContainerNode()); | 175 ASSERT(startPosition.computeContainerNode()); |
176 Position positionBeforeStartNode(positionInParentBeforeNode(*startPosition.c
omputeContainerNode())); | 176 Position positionBeforeStartNode(positionInParentBeforeNode(*startPosition.c
omputeContainerNode())); |
177 deleteInsignificantText(startPosition, startPosition.downstream()); | 177 deleteInsignificantText(startPosition, startPosition.downstream()); |
178 if (!startPosition.inDocument()) | 178 if (!startPosition.inDocument()) |
179 startPosition = positionBeforeStartNode; | 179 startPosition = positionBeforeStartNode; |
180 if (!startPosition.isCandidate()) | 180 if (!isVisuallyEquivalentCandidate(startPosition)) |
181 startPosition = startPosition.downstream(); | 181 startPosition = startPosition.downstream(); |
182 | 182 |
183 startPosition = positionAvoidingSpecialElementBoundary(startPosition); | 183 startPosition = positionAvoidingSpecialElementBoundary(startPosition); |
184 | 184 |
185 Position endPosition; | 185 Position endPosition; |
186 | 186 |
187 if (m_text == "\t") { | 187 if (m_text == "\t") { |
188 endPosition = insertTab(startPosition); | 188 endPosition = insertTab(startPosition); |
189 startPosition = endPosition.previous(); | 189 startPosition = endPosition.previous(); |
190 if (placeholder.isNotNull()) | 190 if (placeholder.isNotNull()) |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 splitTextNode(textNode, offset); | 264 splitTextNode(textNode, offset); |
265 insertNodeBefore(spanElement, textNode.release()); | 265 insertNodeBefore(spanElement, textNode.release()); |
266 } | 266 } |
267 } | 267 } |
268 | 268 |
269 // return the position following the new tab | 269 // return the position following the new tab |
270 return lastPositionInNode(spanElement.get()); | 270 return lastPositionInNode(spanElement.get()); |
271 } | 271 } |
272 | 272 |
273 } | 273 } |
OLD | NEW |