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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 startPosition = positionBeforeStartNode; | 179 startPosition = positionBeforeStartNode; |
180 if (!isVisuallyEquivalentCandidate(startPosition)) | 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 // TODO(yosin) We should use |PositionMoveType::Character| for |
| 190 // |previousPositionOf()|. |
| 191 startPosition = previousPositionOf(endPosition, PositionMoveType::Charac
ter); |
190 if (placeholder.isNotNull()) | 192 if (placeholder.isNotNull()) |
191 removePlaceholderAt(placeholder); | 193 removePlaceholderAt(placeholder); |
192 } else { | 194 } else { |
193 // Make sure the document is set up to receive m_text | 195 // Make sure the document is set up to receive m_text |
194 startPosition = positionInsideTextNode(startPosition); | 196 startPosition = positionInsideTextNode(startPosition); |
195 ASSERT(startPosition.isOffsetInAnchor()); | 197 ASSERT(startPosition.isOffsetInAnchor()); |
196 ASSERT(startPosition.computeContainerNode()); | 198 ASSERT(startPosition.computeContainerNode()); |
197 ASSERT(startPosition.computeContainerNode()->isTextNode()); | 199 ASSERT(startPosition.computeContainerNode()->isTextNode()); |
198 if (placeholder.isNotNull()) | 200 if (placeholder.isNotNull()) |
199 removePlaceholderAt(placeholder); | 201 removePlaceholderAt(placeholder); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 splitTextNode(textNode, offset); | 266 splitTextNode(textNode, offset); |
265 insertNodeBefore(spanElement, textNode.release()); | 267 insertNodeBefore(spanElement, textNode.release()); |
266 } | 268 } |
267 } | 269 } |
268 | 270 |
269 // return the position following the new tab | 271 // return the position following the new tab |
270 return lastPositionInNode(spanElement.get()); | 272 return lastPositionInNode(spanElement.get()); |
271 } | 273 } |
272 | 274 |
273 } | 275 } |
OLD | NEW |