| 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 152 |
| 153 void SpellCheckRequester::timerFiredToProcessQueuedRequest(TimerBase*) | 153 void SpellCheckRequester::timerFiredToProcessQueuedRequest(TimerBase*) |
| 154 { | 154 { |
| 155 DCHECK(!m_requestQueue.isEmpty()); | 155 DCHECK(!m_requestQueue.isEmpty()); |
| 156 if (m_requestQueue.isEmpty()) | 156 if (m_requestQueue.isEmpty()) |
| 157 return; | 157 return; |
| 158 | 158 |
| 159 invokeRequest(m_requestQueue.takeFirst()); | 159 invokeRequest(m_requestQueue.takeFirst()); |
| 160 } | 160 } |
| 161 | 161 |
| 162 static bool canCheckAsynchronously(const Range* range) | |
| 163 { | |
| 164 if (!range || !range->firstNode() || !range->firstNode()->layoutObject()) | |
| 165 return false; | |
| 166 const Node* node = range->startContainer(); | |
| 167 if (node && node->isElementNode() && !toElement(node)->isSpellCheckingEnable
d()) | |
| 168 return false; | |
| 169 return true; | |
| 170 } | |
| 171 | |
| 172 void SpellCheckRequester::requestCheckingFor(SpellCheckRequest* request) | 162 void SpellCheckRequester::requestCheckingFor(SpellCheckRequest* request) |
| 173 { | 163 { |
| 174 if (!request || !canCheckAsynchronously(request->checkingRange())) | 164 if (!request) |
| 175 return; | 165 return; |
| 176 | 166 |
| 177 DCHECK_EQ(request->data().sequence(), unrequestedTextCheckingSequence); | 167 DCHECK_EQ(request->data().sequence(), unrequestedTextCheckingSequence); |
| 178 int sequence = ++m_lastRequestSequence; | 168 int sequence = ++m_lastRequestSequence; |
| 179 if (sequence == unrequestedTextCheckingSequence) | 169 if (sequence == unrequestedTextCheckingSequence) |
| 180 sequence = ++m_lastRequestSequence; | 170 sequence = ++m_lastRequestSequence; |
| 181 | 171 |
| 182 request->setCheckerAndSequence(this, sequence); | 172 request->setCheckerAndSequence(this, sequence); |
| 183 | 173 |
| 184 if (m_timerToProcessQueuedRequest.isActive() || m_processingRequest) { | 174 if (m_timerToProcessQueuedRequest.isActive() || m_processingRequest) { |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 } | 283 } |
| 294 | 284 |
| 295 DEFINE_TRACE(SpellCheckRequester) | 285 DEFINE_TRACE(SpellCheckRequester) |
| 296 { | 286 { |
| 297 visitor->trace(m_frame); | 287 visitor->trace(m_frame); |
| 298 visitor->trace(m_processingRequest); | 288 visitor->trace(m_processingRequest); |
| 299 visitor->trace(m_requestQueue); | 289 visitor->trace(m_requestQueue); |
| 300 } | 290 } |
| 301 | 291 |
| 302 } // namespace blink | 292 } // namespace blink |
| OLD | NEW |