| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 , m_requestData(unrequestedTextCheckingSequence, text, mask, processType, do
cumentMarkersInRange, documentMarkerOffsets) | 55 , m_requestData(unrequestedTextCheckingSequence, text, mask, processType, do
cumentMarkersInRange, documentMarkerOffsets) |
| 56 , m_requestNumber(requestNumber) | 56 , m_requestNumber(requestNumber) |
| 57 { | 57 { |
| 58 } | 58 } |
| 59 | 59 |
| 60 SpellCheckRequest::~SpellCheckRequest() | 60 SpellCheckRequest::~SpellCheckRequest() |
| 61 { | 61 { |
| 62 } | 62 } |
| 63 | 63 |
| 64 // static | 64 // static |
| 65 PassRefPtr<SpellCheckRequest> SpellCheckRequest::create(TextCheckingTypeMask tex
tCheckingOptions, TextCheckingProcessType processType, PassRefPtr<Range> checkin
gRange, PassRefPtr<Range> paragraphRange, int requestNubmer) | 65 PassRefPtr<SpellCheckRequest> SpellCheckRequest::create(TextCheckingTypeMask tex
tCheckingOptions, TextCheckingProcessType processType, PassRefPtr<Range> checkin
gRange, PassRefPtr<Range> paragraphRange, int requestNumber) |
| 66 { | 66 { |
| 67 ASSERT(checkingRange); | 67 ASSERT(checkingRange); |
| 68 ASSERT(paragraphRange); | 68 ASSERT(paragraphRange); |
| 69 | 69 |
| 70 String text = checkingRange->text(); | 70 String text = checkingRange->text(); |
| 71 if (!text.length()) | 71 if (!text.length()) |
| 72 return PassRefPtr<SpellCheckRequest>(); | 72 return PassRefPtr<SpellCheckRequest>(); |
| 73 | 73 |
| 74 const Vector<DocumentMarker*>& markers = checkingRange->ownerDocument()->mar
kers()->markersInRange(checkingRange.get(), DocumentMarker::Spelling | DocumentM
arker::Grammar); | 74 const Vector<DocumentMarker*>& markers = checkingRange->ownerDocument()->mar
kers()->markersInRange(checkingRange.get(), DocumentMarker::Spelling | DocumentM
arker::Grammar); |
| 75 Vector<uint32_t> hashes(markers.size()); | 75 Vector<uint32_t> hashes(markers.size()); |
| 76 Vector<unsigned> offsets(markers.size()); | 76 Vector<unsigned> offsets(markers.size()); |
| 77 for (size_t i = 0; i < markers.size(); i++) { | 77 for (size_t i = 0; i < markers.size(); i++) { |
| 78 hashes[i] = markers[i]->hash(); | 78 hashes[i] = markers[i]->hash(); |
| 79 offsets[i] = markers[i]->startOffset(); | 79 offsets[i] = markers[i]->startOffset(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 return adoptRef(new SpellCheckRequest(checkingRange, paragraphRange, text, t
extCheckingOptions, processType, hashes, offsets, requestNubmer)); | 82 return adoptRef(new SpellCheckRequest(checkingRange, paragraphRange, text, t
extCheckingOptions, processType, hashes, offsets, requestNumber)); |
| 83 } | 83 } |
| 84 | 84 |
| 85 const TextCheckingRequestData& SpellCheckRequest::data() const | 85 const TextCheckingRequestData& SpellCheckRequest::data() const |
| 86 { | 86 { |
| 87 return m_requestData; | 87 return m_requestData; |
| 88 } | 88 } |
| 89 | 89 |
| 90 void SpellCheckRequest::didSucceed(const Vector<TextCheckingResult>& results) | 90 void SpellCheckRequest::didSucceed(const Vector<TextCheckingResult>& results) |
| 91 { | 91 { |
| 92 if (!m_requester) | 92 if (!m_requester) |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 didCheck(sequence, results); | 261 didCheck(sequence, results); |
| 262 } | 262 } |
| 263 | 263 |
| 264 void SpellCheckRequester::didCheckCancel(int sequence) | 264 void SpellCheckRequester::didCheckCancel(int sequence) |
| 265 { | 265 { |
| 266 Vector<TextCheckingResult> results; | 266 Vector<TextCheckingResult> results; |
| 267 didCheck(sequence, results); | 267 didCheck(sequence, results); |
| 268 } | 268 } |
| 269 | 269 |
| 270 } // namespace WebCore | 270 } // namespace WebCore |
| OLD | NEW |