OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All |
| 3 * rights reserved. |
3 * Copyright (C) 2005 Alexey Proskuryakov. | 4 * Copyright (C) 2005 Alexey Proskuryakov. |
4 * | 5 * |
5 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
7 * are met: | 8 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 11 * 2. Redistributions in binary form must reproduce the above copyright |
11 * notice, this list of conditions and the following disclaimer in the | 12 * notice, this list of conditions and the following disclaimer in the |
12 * documentation and/or other materials provided with the distribution. | 13 * documentation and/or other materials provided with the distribution. |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 for (; !it.atEnd(); it.advance()) { | 89 for (; !it.atEnd(); it.advance()) { |
89 int len = it.length(); | 90 int len = it.length(); |
90 | 91 |
91 textRunStartPosition = it.startPositionInCurrentContainer(); | 92 textRunStartPosition = it.startPositionInCurrentContainer(); |
92 textRunEndPosition = it.endPositionInCurrentContainer(); | 93 textRunEndPosition = it.endPositionInCurrentContainer(); |
93 | 94 |
94 bool foundStart = | 95 bool foundStart = |
95 start() >= docTextPosition && start() <= docTextPosition + len; | 96 start() >= docTextPosition && start() <= docTextPosition + len; |
96 bool foundEnd = end() >= docTextPosition && end() <= docTextPosition + len; | 97 bool foundEnd = end() >= docTextPosition && end() <= docTextPosition + len; |
97 | 98 |
98 // Fix textRunRange->endPosition(), but only if foundStart || foundEnd, beca
use it is only | 99 // Fix textRunRange->endPosition(), but only if foundStart || foundEnd, |
99 // in those cases that textRunRange is used. | 100 // because it is only in those cases that textRunRange is used. |
100 if (foundEnd) { | 101 if (foundEnd) { |
101 // FIXME: This is a workaround for the fact that the end of a run | 102 // FIXME: This is a workaround for the fact that the end of a run |
102 // is often at the wrong position for emitted '\n's or if the | 103 // is often at the wrong position for emitted '\n's or if the |
103 // layoutObject of the current node is a replaced element. | 104 // layoutObject of the current node is a replaced element. |
104 if (len == 1 && | 105 if (len == 1 && |
105 (it.characterAt(0) == '\n' || it.isInsideAtomicInlineElement())) { | 106 (it.characterAt(0) == '\n' || it.isInsideAtomicInlineElement())) { |
106 it.advance(); | 107 it.advance(); |
107 if (!it.atEnd()) { | 108 if (!it.atEnd()) { |
108 textRunEndPosition = it.startPositionInCurrentContainer(); | 109 textRunEndPosition = it.startPositionInCurrentContainer(); |
109 } else { | 110 } else { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 188 |
188 return PlainTextRange(start, end); | 189 return PlainTextRange(start, end); |
189 } | 190 } |
190 | 191 |
191 PlainTextRange PlainTextRange::create(const ContainerNode& scope, | 192 PlainTextRange PlainTextRange::create(const ContainerNode& scope, |
192 const Range& range) { | 193 const Range& range) { |
193 return create(scope, EphemeralRange(&range)); | 194 return create(scope, EphemeralRange(&range)); |
194 } | 195 } |
195 | 196 |
196 } // namespace blink | 197 } // namespace blink |
OLD | NEW |