OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 { | 158 { |
159 ASSERT(m_checkingRange); | 159 ASSERT(m_checkingRange); |
160 if (!m_paragraphRange) | 160 if (!m_paragraphRange) |
161 m_paragraphRange = expandToParagraphBoundary(checkingRange()); | 161 m_paragraphRange = expandToParagraphBoundary(checkingRange()); |
162 return m_paragraphRange; | 162 return m_paragraphRange; |
163 } | 163 } |
164 | 164 |
165 PassRefPtrWillBeRawPtr<Range> TextCheckingParagraph::subrange(int characterOffse
t, int characterCount) const | 165 PassRefPtrWillBeRawPtr<Range> TextCheckingParagraph::subrange(int characterOffse
t, int characterCount) const |
166 { | 166 { |
167 ASSERT(m_checkingRange); | 167 ASSERT(m_checkingRange); |
168 EphemeralRange range = calculateCharacterSubrange(EphemeralRange(paragraphRa
nge().get()), characterOffset, characterCount); | 168 return createRange(calculateCharacterSubrange(EphemeralRange(paragraphRange(
).get()), characterOffset, characterCount)); |
169 if (range.isNull()) | |
170 return nullptr; | |
171 return Range::create(range.document(), range.startPosition(), range.endPosit
ion()); | |
172 } | 169 } |
173 | 170 |
174 int TextCheckingParagraph::offsetTo(const Position& position, ExceptionState& ex
ceptionState) const | 171 int TextCheckingParagraph::offsetTo(const Position& position, ExceptionState& ex
ceptionState) const |
175 { | 172 { |
176 ASSERT(m_checkingRange); | 173 ASSERT(m_checkingRange); |
177 RefPtrWillBeRawPtr<Range> range = offsetAsRange()->cloneRange(); | 174 RefPtrWillBeRawPtr<Range> range = offsetAsRange()->cloneRange(); |
178 range->setEnd(position.computeContainerNode(), position.computeOffsetInConta
inerNode(), exceptionState); | 175 range->setEnd(position.computeContainerNode(), position.computeOffsetInConta
inerNode(), exceptionState); |
179 if (exceptionState.hadException()) | 176 if (exceptionState.hadException()) |
180 return 0; | 177 return 0; |
181 return TextIterator::rangeLength(range->startPosition(), range->endPosition(
)); | 178 return TextIterator::rangeLength(range->startPosition(), range->endPosition(
)); |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 return false; | 568 return false; |
572 | 569 |
573 const Settings* settings = frame->settings(); | 570 const Settings* settings = frame->settings(); |
574 if (!settings) | 571 if (!settings) |
575 return false; | 572 return false; |
576 | 573 |
577 return settings->unifiedTextCheckerEnabled(); | 574 return settings->unifiedTextCheckerEnabled(); |
578 } | 575 } |
579 | 576 |
580 } | 577 } |
OLD | NEW |