| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 | 210 |
| 211 m_processingRequest->dispose(); | 211 m_processingRequest->dispose(); |
| 212 m_processingRequest.clear(); | 212 m_processingRequest.clear(); |
| 213 } | 213 } |
| 214 | 214 |
| 215 void SpellCheckRequester::enqueueRequest(SpellCheckRequest* request) { | 215 void SpellCheckRequester::enqueueRequest(SpellCheckRequest* request) { |
| 216 DCHECK(request); | 216 DCHECK(request); |
| 217 bool continuation = false; | 217 bool continuation = false; |
| 218 if (!m_requestQueue.isEmpty()) { | 218 if (!m_requestQueue.isEmpty()) { |
| 219 SpellCheckRequest* lastRequest = m_requestQueue.last(); | 219 SpellCheckRequest* lastRequest = m_requestQueue.last(); |
| 220 // It's a continuation if the number of the last request got incremented in
the new one and | 220 // It's a continuation if the number of the last request got incremented in |
| 221 // both apply to the same editable. | 221 // the new one and both apply to the same editable. |
| 222 continuation = | 222 continuation = |
| 223 request->rootEditableElement() == lastRequest->rootEditableElement() && | 223 request->rootEditableElement() == lastRequest->rootEditableElement() && |
| 224 request->requestNumber() == lastRequest->requestNumber() + 1; | 224 request->requestNumber() == lastRequest->requestNumber() + 1; |
| 225 } | 225 } |
| 226 | 226 |
| 227 // Spellcheck requests for chunks of text in the same element should not overw
rite each other. | 227 // Spellcheck requests for chunks of text in the same element should not |
| 228 // overwrite each other. |
| 228 if (!continuation) { | 229 if (!continuation) { |
| 229 for (auto& requestQueue : m_requestQueue) { | 230 for (auto& requestQueue : m_requestQueue) { |
| 230 if (request->rootEditableElement() != requestQueue->rootEditableElement()) | 231 if (request->rootEditableElement() != requestQueue->rootEditableElement()) |
| 231 continue; | 232 continue; |
| 232 | 233 |
| 233 requestQueue = request; | 234 requestQueue = request; |
| 234 return; | 235 return; |
| 235 } | 236 } |
| 236 } | 237 } |
| 237 | 238 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 didCheck(sequence, results); | 283 didCheck(sequence, results); |
| 283 } | 284 } |
| 284 | 285 |
| 285 DEFINE_TRACE(SpellCheckRequester) { | 286 DEFINE_TRACE(SpellCheckRequester) { |
| 286 visitor->trace(m_frame); | 287 visitor->trace(m_frame); |
| 287 visitor->trace(m_processingRequest); | 288 visitor->trace(m_processingRequest); |
| 288 visitor->trace(m_requestQueue); | 289 visitor->trace(m_requestQueue); |
| 289 } | 290 } |
| 290 | 291 |
| 291 } // namespace blink | 292 } // namespace blink |
| OLD | NEW |