| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 | 78 |
| 79 RefPtrWillBeRawPtr<Range> textRunRange = nullptr; | 79 RefPtrWillBeRawPtr<Range> textRunRange = nullptr; |
| 80 | 80 |
| 81 TextIteratorBehaviorFlags behaviorFlags = TextIteratorEmitsObjectReplacement
Character; | 81 TextIteratorBehaviorFlags behaviorFlags = TextIteratorEmitsObjectReplacement
Character; |
| 82 if (getRangeFor == ForSelection) | 82 if (getRangeFor == ForSelection) |
| 83 behaviorFlags |= TextIteratorEmitsCharactersBetweenAllVisiblePositions; | 83 behaviorFlags |= TextIteratorEmitsCharactersBetweenAllVisiblePositions; |
| 84 TextIterator it(rangeOfContents(const_cast<ContainerNode*>(&scope)).get(), b
ehaviorFlags); | 84 TextIterator it(rangeOfContents(const_cast<ContainerNode*>(&scope)).get(), b
ehaviorFlags); |
| 85 | 85 |
| 86 // FIXME: the atEnd() check shouldn't be necessary, workaround for <http://b
ugs.webkit.org/show_bug.cgi?id=6289>. | 86 // FIXME: the atEnd() check shouldn't be necessary, workaround for <http://b
ugs.webkit.org/show_bug.cgi?id=6289>. |
| 87 if (!start() && !length() && it.atEnd()) { | 87 if (!start() && !length() && it.atEnd()) { |
| 88 textRunRange = it.range(); | 88 resultRange->setStart(it.startContainer(), 0, ASSERT_NO_EXCEPTION); |
| 89 | 89 resultRange->setEnd(it.startContainer(), 0, ASSERT_NO_EXCEPTION); |
| 90 resultRange->setStart(textRunRange->startContainer(), 0, ASSERT_NO_EXCEP
TION); | |
| 91 resultRange->setEnd(textRunRange->startContainer(), 0, ASSERT_NO_EXCEPTI
ON); | |
| 92 | |
| 93 return resultRange.release(); | 90 return resultRange.release(); |
| 94 } | 91 } |
| 95 | 92 |
| 96 for (; !it.atEnd(); it.advance()) { | 93 for (; !it.atEnd(); it.advance()) { |
| 97 int len = it.length(); | 94 int len = it.length(); |
| 98 textRunRange = it.range(); | 95 textRunRange = it.range(); |
| 99 | 96 |
| 100 bool foundStart = start() >= docTextPosition && start() <= docTextPositi
on + len; | 97 bool foundStart = start() >= docTextPosition && start() <= docTextPositi
on + len; |
| 101 bool foundEnd = end() >= docTextPosition && end() <= docTextPosition + l
en; | 98 bool foundEnd = end() >= docTextPosition && end() <= docTextPosition + l
en; |
| 102 | 99 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 size_t start = TextIterator::rangeLength(testRange.get()); | 176 size_t start = TextIterator::rangeLength(testRange.get()); |
| 180 | 177 |
| 181 testRange->setEnd(range.endContainer(), range.endOffset(), IGNORE_EXCEPTION)
; | 178 testRange->setEnd(range.endContainer(), range.endOffset(), IGNORE_EXCEPTION)
; |
| 182 ASSERT(testRange->startContainer() == &scope); | 179 ASSERT(testRange->startContainer() == &scope); |
| 183 size_t end = TextIterator::rangeLength(testRange.get()); | 180 size_t end = TextIterator::rangeLength(testRange.get()); |
| 184 | 181 |
| 185 return PlainTextRange(start, end); | 182 return PlainTextRange(start, end); |
| 186 } | 183 } |
| 187 | 184 |
| 188 } | 185 } |
| OLD | NEW |