Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Unified Diff: third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.cpp

Issue 2635173002: Ensure same invocation order as creation order for SpellCheckRequests (Closed)
Patch Set: Use std::find_if Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/spelling/spellcheck-queue.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.cpp
diff --git a/third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.cpp b/third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.cpp
index 112ad5a083ab7695e41038857ee311e71b36518e..364778b711376b38da2cf5ffccc1e8731642f007 100644
--- a/third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.cpp
+++ b/third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.cpp
@@ -33,6 +33,7 @@
#include "core/editing/spellcheck/SpellChecker.h"
#include "core/frame/LocalFrame.h"
#include "core/frame/Settings.h"
+#include "core/html/TextControlElement.h"
#include "platform/text/TextCheckerClient.h"
namespace blink {
@@ -226,13 +227,14 @@ void SpellCheckRequester::enqueueRequest(SpellCheckRequest* request) {
// Spellcheck requests for chunks of text in the same element should not
// overwrite each other.
if (!continuation) {
- for (auto& requestQueue : m_requestQueue) {
- if (request->rootEditableElement() != requestQueue->rootEditableElement())
- continue;
-
- requestQueue = request;
- return;
- }
+ RequestQueue::const_iterator sameElementRequest =
+ std::find_if(m_requestQueue.begin(), m_requestQueue.end(),
+ [request](const SpellCheckRequest* queuedRequest) -> bool {
+ return request->rootEditableElement() ==
+ queuedRequest->rootEditableElement();
+ });
+ if (sameElementRequest != m_requestQueue.end())
+ m_requestQueue.remove(sameElementRequest);
}
m_requestQueue.append(request);
@@ -249,8 +251,8 @@ void SpellCheckRequester::didCheck(int sequence,
frame().spellChecker().markAndReplaceFor(m_processingRequest, results);
- if (m_lastProcessedSequence < sequence)
- m_lastProcessedSequence = sequence;
+ DCHECK_LT(m_lastProcessedSequence, sequence);
+ m_lastProcessedSequence = sequence;
clearProcessingRequest();
if (!m_requestQueue.isEmpty())
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/spelling/spellcheck-queue.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698