Chromium Code Reviews| Index: third_party/WebKit/Source/web/TextCheckerClientImpl.cpp |
| diff --git a/third_party/WebKit/Source/web/TextCheckerClientImpl.cpp b/third_party/WebKit/Source/web/TextCheckerClientImpl.cpp |
| index 6318c420e4cd26e8183e84b9dcd41409c7a2f419..b53918eb5c64f56ca786fd3b5c3067ebbdbf676b 100644 |
| --- a/third_party/WebKit/Source/web/TextCheckerClientImpl.cpp |
| +++ b/third_party/WebKit/Source/web/TextCheckerClientImpl.cpp |
| @@ -5,15 +5,22 @@ |
| #include "web/TextCheckerClientImpl.h" |
| #include "public/web/WebTextCheckClient.h" |
| #include "public/web/WebTextCheckingResult.h" |
| +#include "web/WebLocalFrameImpl.h" |
| #include "web/WebTextCheckingCompletionImpl.h" |
| #include "web/WebViewImpl.h" |
| namespace blink { |
| -TextCheckerClientImpl::TextCheckerClientImpl(WebViewImpl* webView) |
| - : m_webView(webView) {} |
| +TextCheckerClientImpl::TextCheckerClientImpl(WebLocalFrameImpl* webLocalFrame) |
| + : m_webLocalFrame(webLocalFrame) {} |
| -TextCheckerClientImpl::~TextCheckerClientImpl() = default; |
| +DEFINE_TRACE(TextCheckerClientImpl) { |
| + visitor->trace(m_webLocalFrame); |
| +} |
| + |
| +WebTextCheckClient* TextCheckerClientImpl::webTextCheckClient() const { |
| + return m_webLocalFrame->viewImpl()->textCheckClient(); |
|
haraken
2017/04/04 05:19:22
Add a TODO and mention that textCheckClient should
Xiaocheng
2017/04/04 19:28:56
Done.
|
| +} |
| void TextCheckerClientImpl::checkSpellingOfString(const String& text, |
| int* misspellingLocation, |
| @@ -24,9 +31,9 @@ void TextCheckerClientImpl::checkSpellingOfString(const String& text, |
| int spellLength = 0; |
| // Check to see if the provided text is spelled correctly. |
| - if (m_webView->textCheckClient()) { |
| - m_webView->textCheckClient()->checkSpelling(text, spellLocation, |
| - spellLength, nullptr); |
| + if (webTextCheckClient()) { |
| + webTextCheckClient()->checkSpelling(text, spellLocation, spellLength, |
| + nullptr); |
| } else { |
| spellLocation = 0; |
| spellLength = 0; |
| @@ -42,17 +49,17 @@ void TextCheckerClientImpl::checkSpellingOfString(const String& text, |
| void TextCheckerClientImpl::requestCheckingOfString( |
| TextCheckingRequest* request) { |
| - if (!m_webView->textCheckClient()) |
| + if (!webTextCheckClient()) |
| return; |
| const String& text = request->data().text(); |
| - m_webView->textCheckClient()->requestCheckingOfText( |
| + webTextCheckClient()->requestCheckingOfText( |
| text, new WebTextCheckingCompletionImpl(request)); |
| } |
| void TextCheckerClientImpl::cancelAllPendingRequests() { |
| - if (!m_webView->textCheckClient()) |
| + if (!webTextCheckClient()) |
| return; |
| - m_webView->textCheckClient()->cancelAllPendingRequests(); |
| + webTextCheckClient()->cancelAllPendingRequests(); |
| } |
| } // namespace blink |