Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/spellcheck/renderer/spellcheck_provider.h" | 5 #include "components/spellcheck/renderer/spellcheck_provider.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "components/spellcheck/common/spellcheck_marker.h" | 9 #include "components/spellcheck/common/spellcheck_marker.h" |
| 10 #include "components/spellcheck/common/spellcheck_messages.h" | 10 #include "components/spellcheck/common/spellcheck_messages.h" |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 322 // substring of the cached text. | 322 // substring of the cached text. |
| 323 if (text_length < last_length && | 323 if (text_length < last_length && |
| 324 !last_request_.compare(0, text_length, request)) { | 324 !last_request_.compare(0, text_length, request)) { |
| 325 size_t result_size = 0; | 325 size_t result_size = 0; |
| 326 for (size_t i = 0; i < last_results_.size(); ++i) { | 326 for (size_t i = 0; i < last_results_.size(); ++i) { |
| 327 size_t start = last_results_[i].location; | 327 size_t start = last_results_[i].location; |
| 328 size_t end = start + last_results_[i].length; | 328 size_t end = start + last_results_[i].length; |
| 329 if (start <= text_length && end <= text_length) | 329 if (start <= text_length && end <= text_length) |
| 330 ++result_size; | 330 ++result_size; |
| 331 } | 331 } |
| 332 if (result_size > 0) { | 332 blink::WebVector<blink::WebTextCheckingResult> results(result_size); |
|
groby-ooo-7-16
2016/11/15 19:36:57
So, I might be misreading this, but it looks to me
timvolodine
2016/11/17 20:53:15
Yes much more compact indeed.
Done.
| |
| 333 blink::WebVector<blink::WebTextCheckingResult> results(result_size); | 333 for (size_t i = 0; i < result_size; ++i) { |
| 334 for (size_t i = 0; i < result_size; ++i) { | 334 results[i].decoration = last_results_[i].decoration; |
| 335 results[i].decoration = last_results_[i].decoration; | 335 results[i].location = last_results_[i].location; |
| 336 results[i].location = last_results_[i].location; | 336 results[i].length = last_results_[i].length; |
| 337 results[i].length = last_results_[i].length; | 337 results[i].replacement = last_results_[i].replacement; |
| 338 results[i].replacement = last_results_[i].replacement; | |
| 339 } | |
| 340 completion->didFinishCheckingText(results); | |
| 341 return true; | |
| 342 } | 338 } |
| 339 completion->didFinishCheckingText(results); | |
| 340 return true; | |
|
groby-ooo-7-16
2016/11/15 19:36:57
I don't think this works as intended. SatisfyReque
timvolodine
2016/11/17 20:53:15
So currently a substring without misspellings will
| |
| 343 } | 341 } |
| 344 | 342 |
| 345 return false; | 343 return false; |
| 346 } | 344 } |
| 347 | 345 |
| 348 void SpellCheckProvider::OnDestruct() { | 346 void SpellCheckProvider::OnDestruct() { |
| 349 delete this; | 347 delete this; |
| 350 } | 348 } |
| OLD | NEW |