OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // or the input element's end. It will then be updated to only contain the | 67 // or the input element's end. It will then be updated to only contain the |
68 // text in the right range around the selection. | 68 // text in the right range around the selection. |
69 DCHECK_EQ(RootEditableElementOf(start_position), | 69 DCHECK_EQ(RootEditableElementOf(start_position), |
70 RootEditableElementOf(end_position)); | 70 RootEditableElementOf(end_position)); |
71 Element* const root_editable = RootEditableElementOf(start_position); | 71 Element* const root_editable = RootEditableElementOf(start_position); |
72 Element* const root_element = | 72 Element* const root_element = |
73 root_editable ? root_editable : document->documentElement(); | 73 root_editable ? root_editable : document->documentElement(); |
74 | 74 |
75 CharacterIterator forward_iterator( | 75 CharacterIterator forward_iterator( |
76 end_position, | 76 end_position, |
77 Position::LastPositionInNode(root_element).ParentAnchoredEquivalent(), | 77 Position::LastPositionInNode(*root_element).ParentAnchoredEquivalent(), |
78 TextIteratorBehavior::Builder().SetStopsOnFormControls(true).Build()); | 78 TextIteratorBehavior::Builder().SetStopsOnFormControls(true).Build()); |
79 // FIXME: why do we stop going trough the text if we were not able to select | 79 // FIXME: why do we stop going trough the text if we were not able to select |
80 // something on the right? | 80 // something on the right? |
81 if (!forward_iterator.AtEnd()) | 81 if (!forward_iterator.AtEnd()) |
82 forward_iterator.Advance(max_length - half_max_length); | 82 forward_iterator.Advance(max_length - half_max_length); |
83 | 83 |
84 EphemeralRange forward_range = forward_iterator.Range(); | 84 EphemeralRange forward_range = forward_iterator.Range(); |
85 if (forward_range.IsNull() || | 85 if (forward_range.IsNull() || |
86 !Range::Create(*document, end_position, forward_range.StartPosition()) | 86 !Range::Create(*document, end_position, forward_range.StartPosition()) |
87 ->GetText() | 87 ->GetText() |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 121 |
122 unsigned SurroundingText::StartOffsetInContent() const { | 122 unsigned SurroundingText::StartOffsetInContent() const { |
123 return start_offset_in_content_; | 123 return start_offset_in_content_; |
124 } | 124 } |
125 | 125 |
126 unsigned SurroundingText::EndOffsetInContent() const { | 126 unsigned SurroundingText::EndOffsetInContent() const { |
127 return end_offset_in_content_; | 127 return end_offset_in_content_; |
128 } | 128 } |
129 | 129 |
130 } // namespace blink | 130 } // namespace blink |
OLD | NEW |