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 r
ights reserved. |
3 * Copyright (C) 2005 Alexey Proskuryakov. | 3 * Copyright (C) 2005 Alexey Proskuryakov. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 else | 140 else |
141 resultRange->setEnd(textRunRange->endContainer(), textRunRan
ge->endOffset(), IGNORE_EXCEPTION); | 141 resultRange->setEnd(textRunRange->endContainer(), textRunRan
ge->endOffset(), IGNORE_EXCEPTION); |
142 } | 142 } |
143 docTextPosition += len; | 143 docTextPosition += len; |
144 break; | 144 break; |
145 } | 145 } |
146 docTextPosition += len; | 146 docTextPosition += len; |
147 } | 147 } |
148 | 148 |
149 if (!startRangeFound) | 149 if (!startRangeFound) |
150 return 0; | 150 return nullptr; |
151 | 151 |
152 if (length() && end() > docTextPosition) { // end() is out of bounds | 152 if (length() && end() > docTextPosition) { // end() is out of bounds |
153 resultRange->setEnd(textRunRange->endContainer(), textRunRange->endOffse
t(), IGNORE_EXCEPTION); | 153 resultRange->setEnd(textRunRange->endContainer(), textRunRange->endOffse
t(), IGNORE_EXCEPTION); |
154 } | 154 } |
155 | 155 |
156 return resultRange.release(); | 156 return resultRange.release(); |
157 } | 157 } |
158 | 158 |
159 PlainTextRange PlainTextRange::create(const Node& scope, const Range& range) | 159 PlainTextRange PlainTextRange::create(const Node& scope, const Range& range) |
160 { | 160 { |
(...skipping 15 matching lines...) Expand all Loading... |
176 size_t start = TextIterator::rangeLength(testRange.get()); | 176 size_t start = TextIterator::rangeLength(testRange.get()); |
177 | 177 |
178 testRange->setEnd(range.endContainer(), range.endOffset(), IGNORE_EXCEPTION)
; | 178 testRange->setEnd(range.endContainer(), range.endOffset(), IGNORE_EXCEPTION)
; |
179 ASSERT(testRange->startContainer() == &scope); | 179 ASSERT(testRange->startContainer() == &scope); |
180 size_t end = TextIterator::rangeLength(testRange.get()); | 180 size_t end = TextIterator::rangeLength(testRange.get()); |
181 | 181 |
182 return PlainTextRange(start, end); | 182 return PlainTextRange(start, end); |
183 } | 183 } |
184 | 184 |
185 } | 185 } |
OLD | NEW |