| 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 void TextCheckingParagraph::invalidateParagraphRangeValues() | 137 void TextCheckingParagraph::invalidateParagraphRangeValues() |
| 138 { | 138 { |
| 139 m_checkingStart = m_checkingEnd = -1; | 139 m_checkingStart = m_checkingEnd = -1; |
| 140 m_offsetAsRange = nullptr; | 140 m_offsetAsRange = nullptr; |
| 141 m_text = String(); | 141 m_text = String(); |
| 142 } | 142 } |
| 143 | 143 |
| 144 int TextCheckingParagraph::rangeLength() const | 144 int TextCheckingParagraph::rangeLength() const |
| 145 { | 145 { |
| 146 ASSERT(m_checkingRange); | 146 ASSERT(m_checkingRange); |
| 147 return TextIterator::rangeLength(paragraphRange().get()); | 147 return TextIterator::rangeLength(paragraphRange()->startPosition(), paragrap
hRange()->endPosition()); |
| 148 } | 148 } |
| 149 | 149 |
| 150 PassRefPtrWillBeRawPtr<Range> TextCheckingParagraph::paragraphRange() const | 150 PassRefPtrWillBeRawPtr<Range> TextCheckingParagraph::paragraphRange() const |
| 151 { | 151 { |
| 152 ASSERT(m_checkingRange); | 152 ASSERT(m_checkingRange); |
| 153 if (!m_paragraphRange) | 153 if (!m_paragraphRange) |
| 154 m_paragraphRange = expandToParagraphBoundary(checkingRange()); | 154 m_paragraphRange = expandToParagraphBoundary(checkingRange()); |
| 155 return m_paragraphRange; | 155 return m_paragraphRange; |
| 156 } | 156 } |
| 157 | 157 |
| 158 PassRefPtrWillBeRawPtr<Range> TextCheckingParagraph::subrange(int characterOffse
t, int characterCount) const | 158 PassRefPtrWillBeRawPtr<Range> TextCheckingParagraph::subrange(int characterOffse
t, int characterCount) const |
| 159 { | 159 { |
| 160 ASSERT(m_checkingRange); | 160 ASSERT(m_checkingRange); |
| 161 return TextIterator::subrange(paragraphRange().get(), characterOffset, chara
cterCount); | 161 return TextIterator::subrange(paragraphRange().get(), characterOffset, chara
cterCount); |
| 162 } | 162 } |
| 163 | 163 |
| 164 int TextCheckingParagraph::offsetTo(const Position& position, ExceptionState& ex
ceptionState) const | 164 int TextCheckingParagraph::offsetTo(const Position& position, ExceptionState& ex
ceptionState) const |
| 165 { | 165 { |
| 166 ASSERT(m_checkingRange); | 166 ASSERT(m_checkingRange); |
| 167 RefPtrWillBeRawPtr<Range> range = offsetAsRange()->cloneRange(); | 167 RefPtrWillBeRawPtr<Range> range = offsetAsRange()->cloneRange(); |
| 168 range->setEnd(position.containerNode(), position.computeOffsetInContainerNod
e(), exceptionState); | 168 range->setEnd(position.containerNode(), position.computeOffsetInContainerNod
e(), exceptionState); |
| 169 if (exceptionState.hadException()) | 169 if (exceptionState.hadException()) |
| 170 return 0; | 170 return 0; |
| 171 return TextIterator::rangeLength(range.get()); | 171 return TextIterator::rangeLength(range->startPosition(), range->endPosition(
)); |
| 172 } | 172 } |
| 173 | 173 |
| 174 bool TextCheckingParagraph::isEmpty() const | 174 bool TextCheckingParagraph::isEmpty() const |
| 175 { | 175 { |
| 176 // Both predicates should have same result, but we check both just for sure. | 176 // Both predicates should have same result, but we check both just for sure. |
| 177 // We need to investigate to remove this redundancy. | 177 // We need to investigate to remove this redundancy. |
| 178 return isRangeEmpty() || isTextEmpty(); | 178 return isRangeEmpty() || isTextEmpty(); |
| 179 } | 179 } |
| 180 | 180 |
| 181 PassRefPtrWillBeRawPtr<Range> TextCheckingParagraph::offsetAsRange() const | 181 PassRefPtrWillBeRawPtr<Range> TextCheckingParagraph::offsetAsRange() const |
| (...skipping 10 matching lines...) Expand all Loading... |
| 192 ASSERT(m_checkingRange); | 192 ASSERT(m_checkingRange); |
| 193 if (m_text.isEmpty()) | 193 if (m_text.isEmpty()) |
| 194 m_text = plainText(paragraphRange().get()); | 194 m_text = plainText(paragraphRange().get()); |
| 195 return m_text; | 195 return m_text; |
| 196 } | 196 } |
| 197 | 197 |
| 198 int TextCheckingParagraph::checkingStart() const | 198 int TextCheckingParagraph::checkingStart() const |
| 199 { | 199 { |
| 200 ASSERT(m_checkingRange); | 200 ASSERT(m_checkingRange); |
| 201 if (m_checkingStart == -1) | 201 if (m_checkingStart == -1) |
| 202 m_checkingStart = TextIterator::rangeLength(offsetAsRange().get()); | 202 m_checkingStart = TextIterator::rangeLength(offsetAsRange()->startPositi
on(), offsetAsRange()->endPosition()); |
| 203 return m_checkingStart; | 203 return m_checkingStart; |
| 204 } | 204 } |
| 205 | 205 |
| 206 int TextCheckingParagraph::checkingEnd() const | 206 int TextCheckingParagraph::checkingEnd() const |
| 207 { | 207 { |
| 208 ASSERT(m_checkingRange); | 208 ASSERT(m_checkingRange); |
| 209 if (m_checkingEnd == -1) | 209 if (m_checkingEnd == -1) |
| 210 m_checkingEnd = checkingStart() + TextIterator::rangeLength(checkingRang
e().get()); | 210 m_checkingEnd = checkingStart() + TextIterator::rangeLength(checkingRang
e()->startPosition(), checkingRange()->endPosition()); |
| 211 return m_checkingEnd; | 211 return m_checkingEnd; |
| 212 } | 212 } |
| 213 | 213 |
| 214 int TextCheckingParagraph::checkingLength() const | 214 int TextCheckingParagraph::checkingLength() const |
| 215 { | 215 { |
| 216 ASSERT(m_checkingRange); | 216 ASSERT(m_checkingRange); |
| 217 if (-1 == m_checkingLength) | 217 if (-1 == m_checkingLength) |
| 218 m_checkingLength = TextIterator::rangeLength(checkingRange().get()); | 218 m_checkingLength = TextIterator::rangeLength(checkingRange()->startPosit
ion(), checkingRange()->endPosition()); |
| 219 return m_checkingLength; | 219 return m_checkingLength; |
| 220 } | 220 } |
| 221 | 221 |
| 222 TextCheckingHelper::TextCheckingHelper(SpellCheckerClient& client, const Positio
n& start, const Position& end) | 222 TextCheckingHelper::TextCheckingHelper(SpellCheckerClient& client, const Positio
n& start, const Position& end) |
| 223 : m_client(&client) | 223 : m_client(&client) |
| 224 , m_start(start) | 224 , m_start(start) |
| 225 , m_end(end) | 225 , m_end(end) |
| 226 { | 226 { |
| 227 } | 227 } |
| 228 | 228 |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 return false; | 565 return false; |
| 566 | 566 |
| 567 const Settings* settings = frame->settings(); | 567 const Settings* settings = frame->settings(); |
| 568 if (!settings) | 568 if (!settings) |
| 569 return false; | 569 return false; |
| 570 | 570 |
| 571 return settings->unifiedTextCheckerEnabled(); | 571 return settings->unifiedTextCheckerEnabled(); |
| 572 } | 572 } |
| 573 | 573 |
| 574 } | 574 } |
| OLD | NEW |