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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
167 // we get a chance to insert into it. We check for a placeholder now, t hough, because doing so requires | 167 // we get a chance to insert into it. We check for a placeholder now, t hough, because doing so requires |
168 // the creation of a VisiblePosition, and if we did that post-insertion it would force a layout. | 168 // the creation of a VisiblePosition, and if we did that post-insertion it would force a layout. |
169 } | 169 } |
170 | 170 |
171 // Insert the character at the leftmost candidate. | 171 // Insert the character at the leftmost candidate. |
172 startPosition = startPosition.upstream(); | 172 startPosition = startPosition.upstream(); |
173 | 173 |
174 // It is possible for the node that contains startPosition to contain only u nrendered whitespace, | 174 // It is possible for the node that contains startPosition to contain only u nrendered whitespace, |
175 // and so deleteInsignificantText could remove it. Save the position before the node in case that happens. | 175 // and so deleteInsignificantText could remove it. Save the position before the node in case that happens. |
176 Position positionBeforeStartNode(positionInParentBeforeNode(startPosition.co ntainerNode())); | 176 Position positionBeforeStartNode(positionInParentBeforeNode(startPosition.co ntainerNode())); |
177 deleteInsignificantText(startPosition.upstream(), startPosition.downstream() ); | 177 deleteInsignificantText(startPosition, startPosition.downstream()); |
yosin_UTC9
2013/11/18 05:42:39
I'm not sure why we can remove upstream()...
vanihegde
2013/11/18 05:47:33
It's already done above (line 172)
startPosition =
| |
178 if (!startPosition.inDocument()) | 178 if (!startPosition.inDocument()) |
179 startPosition = positionBeforeStartNode; | 179 startPosition = positionBeforeStartNode; |
180 if (!startPosition.isCandidate()) | 180 if (!startPosition.isCandidate()) |
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") { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
264 splitTextNode(textNode, offset); | 264 splitTextNode(textNode, offset); |
265 insertNodeBefore(spanNode, textNode.release()); | 265 insertNodeBefore(spanNode, 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(spanNode.get()); | 270 return lastPositionInNode(spanNode.get()); |
271 } | 271 } |
272 | 272 |
273 } | 273 } |
OLD | NEW |