| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 // static | 61 // static |
| 62 PassRefPtr<SpellCheckRequest> SpellCheckRequest::create(TextCheckingTypeMask tex
tCheckingOptions, TextCheckingProcessType processType, PassRefPtr<Range> checkin
gRange, PassRefPtr<Range> paragraphRange, int requestNumber) | 62 PassRefPtr<SpellCheckRequest> SpellCheckRequest::create(TextCheckingTypeMask tex
tCheckingOptions, TextCheckingProcessType processType, PassRefPtr<Range> checkin
gRange, PassRefPtr<Range> paragraphRange, int requestNumber) |
| 63 { | 63 { |
| 64 ASSERT(checkingRange); | 64 ASSERT(checkingRange); |
| 65 ASSERT(paragraphRange); | 65 ASSERT(paragraphRange); |
| 66 | 66 |
| 67 String text = checkingRange->text(); | 67 String text = checkingRange->text(); |
| 68 if (!text.length()) | 68 if (!text.length()) |
| 69 return PassRefPtr<SpellCheckRequest>(); | 69 return PassRefPtr<SpellCheckRequest>(); |
| 70 | 70 |
| 71 const Vector<DocumentMarker*>& markers = checkingRange->ownerDocument().mark
ers()->markersInRange(checkingRange.get(), DocumentMarker::SpellCheckClientMarke
rs()); | 71 const Vector<DocumentMarker*>& markers = checkingRange->ownerDocument().mark
ers().markersInRange(checkingRange.get(), DocumentMarker::SpellCheckClientMarker
s()); |
| 72 Vector<uint32_t> hashes(markers.size()); | 72 Vector<uint32_t> hashes(markers.size()); |
| 73 Vector<unsigned> offsets(markers.size()); | 73 Vector<unsigned> offsets(markers.size()); |
| 74 for (size_t i = 0; i < markers.size(); i++) { | 74 for (size_t i = 0; i < markers.size(); i++) { |
| 75 hashes[i] = markers[i]->hash(); | 75 hashes[i] = markers[i]->hash(); |
| 76 offsets[i] = markers[i]->startOffset(); | 76 offsets[i] = markers[i]->startOffset(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 return adoptRef(new SpellCheckRequest(checkingRange, paragraphRange, text, t
extCheckingOptions, processType, hashes, offsets, requestNumber)); | 79 return adoptRef(new SpellCheckRequest(checkingRange, paragraphRange, text, t
extCheckingOptions, processType, hashes, offsets, requestNumber)); |
| 80 } | 80 } |
| 81 | 81 |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 | 245 |
| 246 void SpellCheckRequester::didCheckSucceed(int sequence, const Vector<TextCheckin
gResult>& results) | 246 void SpellCheckRequester::didCheckSucceed(int sequence, const Vector<TextCheckin
gResult>& results) |
| 247 { | 247 { |
| 248 TextCheckingRequestData requestData = m_processingRequest->data(); | 248 TextCheckingRequestData requestData = m_processingRequest->data(); |
| 249 if (requestData.sequence() == sequence) { | 249 if (requestData.sequence() == sequence) { |
| 250 DocumentMarker::MarkerTypes markers = DocumentMarker::SpellCheckClientMa
rkers(); | 250 DocumentMarker::MarkerTypes markers = DocumentMarker::SpellCheckClientMa
rkers(); |
| 251 if (!requestData.maskContains(TextCheckingTypeSpelling)) | 251 if (!requestData.maskContains(TextCheckingTypeSpelling)) |
| 252 markers.remove(DocumentMarker::Spelling); | 252 markers.remove(DocumentMarker::Spelling); |
| 253 if (!requestData.maskContains(TextCheckingTypeGrammar)) | 253 if (!requestData.maskContains(TextCheckingTypeGrammar)) |
| 254 markers.remove(DocumentMarker::Grammar); | 254 markers.remove(DocumentMarker::Grammar); |
| 255 m_frame.document()->markers()->removeMarkers(m_processingRequest->checki
ngRange().get(), markers); | 255 m_frame.document()->markers().removeMarkers(m_processingRequest->checkin
gRange().get(), markers); |
| 256 } | 256 } |
| 257 didCheck(sequence, results); | 257 didCheck(sequence, results); |
| 258 } | 258 } |
| 259 | 259 |
| 260 void SpellCheckRequester::didCheckCancel(int sequence) | 260 void SpellCheckRequester::didCheckCancel(int sequence) |
| 261 { | 261 { |
| 262 Vector<TextCheckingResult> results; | 262 Vector<TextCheckingResult> results; |
| 263 didCheck(sequence, results); | 263 didCheck(sequence, results); |
| 264 } | 264 } |
| 265 | 265 |
| 266 } // namespace WebCore | 266 } // namespace WebCore |
| OLD | NEW |