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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 return; | 62 return; |
63 DCHECK(!document->needsLayoutTreeUpdate()); | 63 DCHECK(!document->needsLayoutTreeUpdate()); |
64 | 64 |
65 // The forward range starts at the selection end and ends at the document's | 65 // The forward range starts at the selection end and ends at the document's |
66 // end. It will then be updated to only contain the text in the text in the | 66 // end. It will then be updated to only contain the text in the text in the |
67 // right range around the selection. | 67 // right range around the selection. |
68 CharacterIterator forwardIterator( | 68 CharacterIterator forwardIterator( |
69 endPosition, Position::lastPositionInNode(document->documentElement()) | 69 endPosition, Position::lastPositionInNode(document->documentElement()) |
70 .parentAnchoredEquivalent(), | 70 .parentAnchoredEquivalent(), |
71 TextIteratorStopsOnFormControls); | 71 TextIteratorStopsOnFormControls); |
72 // FIXME: why do we stop going trough the text if we were not able to select s
omething on the right? | 72 // FIXME: why do we stop going trough the text if we were not able to select |
| 73 // something on the right? |
73 if (!forwardIterator.atEnd()) | 74 if (!forwardIterator.atEnd()) |
74 forwardIterator.advance(maxLength - halfMaxLength); | 75 forwardIterator.advance(maxLength - halfMaxLength); |
75 | 76 |
76 EphemeralRange forwardRange = forwardIterator.range(); | 77 EphemeralRange forwardRange = forwardIterator.range(); |
77 if (forwardRange.isNull() || | 78 if (forwardRange.isNull() || |
78 !Range::create(*document, endPosition, forwardRange.startPosition()) | 79 !Range::create(*document, endPosition, forwardRange.startPosition()) |
79 ->text() | 80 ->text() |
80 .length()) | 81 .length()) |
81 return; | 82 return; |
82 | 83 |
(...skipping 28 matching lines...) Expand all Loading... |
111 | 112 |
112 unsigned SurroundingText::startOffsetInContent() const { | 113 unsigned SurroundingText::startOffsetInContent() const { |
113 return m_startOffsetInContent; | 114 return m_startOffsetInContent; |
114 } | 115 } |
115 | 116 |
116 unsigned SurroundingText::endOffsetInContent() const { | 117 unsigned SurroundingText::endOffsetInContent() const { |
117 return m_endOffsetInContent; | 118 return m_endOffsetInContent; |
118 } | 119 } |
119 | 120 |
120 } // namespace blink | 121 } // namespace blink |
OLD | NEW |