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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 , m_text(text) | 42 , m_text(text) |
43 , m_selectInsertedText(selectInsertedText) | 43 , m_selectInsertedText(selectInsertedText) |
44 , m_rebalanceType(rebalanceType) | 44 , m_rebalanceType(rebalanceType) |
45 { | 45 { |
46 } | 46 } |
47 | 47 |
48 Position InsertTextCommand::positionInsideTextNode(const Position& p) | 48 Position InsertTextCommand::positionInsideTextNode(const Position& p) |
49 { | 49 { |
50 Position pos = p; | 50 Position pos = p; |
51 if (isTabHTMLSpanElementTextNode(pos.anchorNode())) { | 51 if (isTabHTMLSpanElementTextNode(pos.anchorNode())) { |
52 RefPtrWillBeRawPtr<Node> textNode = document().createEditingTextNode("")
; | 52 RefPtrWillBeRawPtr<Text> textNode = document().createEditingTextNode("")
; |
53 insertNodeAtTabSpanPosition(textNode.get(), pos); | 53 insertNodeAtTabSpanPosition(textNode.get(), pos); |
54 return firstPositionInNode(textNode.get()); | 54 return firstPositionInNode(textNode.get()); |
55 } | 55 } |
56 | 56 |
57 // Prepare for text input by looking at the specified position. | 57 // Prepare for text input by looking at the specified position. |
58 // It may be necessary to insert a text node to receive characters. | 58 // It may be necessary to insert a text node to receive characters. |
59 if (!pos.containerNode()->isTextNode()) { | 59 if (!pos.containerNode()->isTextNode()) { |
60 RefPtrWillBeRawPtr<Node> textNode = document().createEditingTextNode("")
; | 60 RefPtrWillBeRawPtr<Text> textNode = document().createEditingTextNode("")
; |
61 insertNodeAt(textNode.get(), pos); | 61 insertNodeAt(textNode.get(), pos); |
62 return firstPositionInNode(textNode.get()); | 62 return firstPositionInNode(textNode.get()); |
63 } | 63 } |
64 | 64 |
65 return pos; | 65 return pos; |
66 } | 66 } |
67 | 67 |
68 void InsertTextCommand::setEndingSelectionWithoutValidation(const Position& star
tPosition, const Position& endPosition) | 68 void InsertTextCommand::setEndingSelectionWithoutValidation(const Position& star
tPosition, const Position& endPosition) |
69 { | 69 { |
70 // We could have inserted a part of composed character sequence, | 70 // We could have inserted a part of composed character sequence, |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 splitTextNode(textNode, offset); | 262 splitTextNode(textNode, offset); |
263 insertNodeBefore(spanElement, textNode.release()); | 263 insertNodeBefore(spanElement, textNode.release()); |
264 } | 264 } |
265 } | 265 } |
266 | 266 |
267 // return the position following the new tab | 267 // return the position following the new tab |
268 return lastPositionInNode(spanElement.get()); | 268 return lastPositionInNode(spanElement.get()); |
269 } | 269 } |
270 | 270 |
271 } | 271 } |
OLD | NEW |