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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 Position InsertTextCommand::PositionInsideTextNode( | 52 Position InsertTextCommand::PositionInsideTextNode( |
53 const Position& p, | 53 const Position& p, |
54 EditingState* editing_state) { | 54 EditingState* editing_state) { |
55 Position pos = p; | 55 Position pos = p; |
56 if (IsTabHTMLSpanElementTextNode(pos.AnchorNode())) { | 56 if (IsTabHTMLSpanElementTextNode(pos.AnchorNode())) { |
57 Text* text_node = GetDocument().CreateEditingTextNode(""); | 57 Text* text_node = GetDocument().CreateEditingTextNode(""); |
58 InsertNodeAtTabSpanPosition(text_node, pos, editing_state); | 58 InsertNodeAtTabSpanPosition(text_node, pos, editing_state); |
59 if (editing_state->IsAborted()) | 59 if (editing_state->IsAborted()) |
60 return Position(); | 60 return Position(); |
61 return Position::FirstPositionInNode(text_node); | 61 return Position::FirstPositionInNode(*text_node); |
62 } | 62 } |
63 | 63 |
64 // Prepare for text input by looking at the specified position. | 64 // Prepare for text input by looking at the specified position. |
65 // It may be necessary to insert a text node to receive characters. | 65 // It may be necessary to insert a text node to receive characters. |
66 if (!pos.ComputeContainerNode()->IsTextNode()) { | 66 if (!pos.ComputeContainerNode()->IsTextNode()) { |
67 Text* text_node = GetDocument().CreateEditingTextNode(""); | 67 Text* text_node = GetDocument().CreateEditingTextNode(""); |
68 InsertNodeAt(text_node, pos, editing_state); | 68 InsertNodeAt(text_node, pos, editing_state); |
69 if (editing_state->IsAborted()) | 69 if (editing_state->IsAborted()) |
70 return Position(); | 70 return Position(); |
71 return Position::FirstPositionInNode(text_node); | 71 return Position::FirstPositionInNode(*text_node); |
72 } | 72 } |
73 | 73 |
74 return pos; | 74 return pos; |
75 } | 75 } |
76 | 76 |
77 void InsertTextCommand::SetEndingSelectionWithoutValidation( | 77 void InsertTextCommand::SetEndingSelectionWithoutValidation( |
78 const Position& start_position, | 78 const Position& start_position, |
79 const Position& end_position) { | 79 const Position& end_position) { |
80 // We could have inserted a part of composed character sequence, | 80 // We could have inserted a part of composed character sequence, |
81 // so we are basically treating ending selection as a range to avoid | 81 // so we are basically treating ending selection as a range to avoid |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 } | 332 } |
333 } | 333 } |
334 if (editing_state->IsAborted()) | 334 if (editing_state->IsAborted()) |
335 return Position(); | 335 return Position(); |
336 | 336 |
337 // return the position following the new tab | 337 // return the position following the new tab |
338 return Position::LastPositionInNode(span_element); | 338 return Position::LastPositionInNode(span_element); |
339 } | 339 } |
340 | 340 |
341 } // namespace blink | 341 } // namespace blink |
OLD | NEW |