| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 #include "platform/text/TextCheckerClient.h" | 35 #include "platform/text/TextCheckerClient.h" |
| 36 | 36 |
| 37 namespace WebCore { | 37 namespace WebCore { |
| 38 class Frame; | 38 class Frame; |
| 39 class HTMLInputElement; | 39 class HTMLInputElement; |
| 40 } | 40 } |
| 41 | 41 |
| 42 namespace blink { | 42 namespace blink { |
| 43 class WebViewImpl; | 43 class WebViewImpl; |
| 44 | 44 |
| 45 class SpellCheckerClientImpl : public WebCore::SpellCheckerClient, public WebCor
e::TextCheckerClient { | 45 class SpellCheckerClientImpl FINAL : public WebCore::SpellCheckerClient, public
WebCore::TextCheckerClient { |
| 46 public: | 46 public: |
| 47 SpellCheckerClientImpl(WebViewImpl*); | 47 SpellCheckerClientImpl(WebViewImpl*); |
| 48 | 48 |
| 49 virtual ~SpellCheckerClientImpl(); | 49 virtual ~SpellCheckerClientImpl(); |
| 50 | 50 |
| 51 virtual bool isContinuousSpellCheckingEnabled() OVERRIDE; | 51 virtual bool isContinuousSpellCheckingEnabled() OVERRIDE; |
| 52 virtual void toggleContinuousSpellChecking() OVERRIDE; | 52 virtual void toggleContinuousSpellChecking() OVERRIDE; |
| 53 virtual bool isGrammarCheckingEnabled() OVERRIDE; | 53 virtual bool isGrammarCheckingEnabled() OVERRIDE; |
| 54 virtual bool shouldEraseMarkersAfterChangeSelection(WebCore::TextCheckingTyp
e) const OVERRIDE; | 54 virtual bool shouldEraseMarkersAfterChangeSelection(WebCore::TextCheckingTyp
e) const OVERRIDE; |
| 55 virtual void checkSpellingOfString(const String&, int* misspellingLocation,
int* misspellingLength) OVERRIDE; | 55 virtual void checkSpellingOfString(const String&, int* misspellingLocation,
int* misspellingLength) OVERRIDE; |
| 56 virtual void checkGrammarOfString(const String&, WTF::Vector<WebCore::Gramma
rDetail>&, | 56 virtual void checkGrammarOfString(const String&, WTF::Vector<WebCore::Gramma
rDetail>&, |
| 57 int* badGrammarLocation, int* badGrammarLength) OVERRIDE; | 57 int* badGrammarLocation, int* badGrammarLength) OVERRIDE; |
| 58 virtual WTF::String getAutoCorrectSuggestionForMisspelledWord(const WTF::Str
ing&) OVERRIDE; | 58 virtual WTF::String getAutoCorrectSuggestionForMisspelledWord(const WTF::Str
ing&) OVERRIDE; |
| 59 virtual void updateSpellingUIWithMisspelledWord(const WTF::String&) OVERRIDE
; | 59 virtual void updateSpellingUIWithMisspelledWord(const WTF::String&) OVERRIDE
; |
| 60 virtual void showSpellingUI(bool show) OVERRIDE; | 60 virtual void showSpellingUI(bool show) OVERRIDE; |
| 61 virtual bool spellingUIIsShowing() OVERRIDE; | 61 virtual bool spellingUIIsShowing() OVERRIDE; |
| 62 virtual void requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRe
quest>) OVERRIDE; | 62 virtual void requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRe
quest>) OVERRIDE; |
| 63 | 63 |
| 64 virtual WebCore::TextCheckerClient& textChecker() { return *this; } | 64 virtual WebCore::TextCheckerClient& textChecker() OVERRIDE { return *this; } |
| 65 | 65 |
| 66 private: | 66 private: |
| 67 // Returns whether or not the focused control needs spell-checking. | 67 // Returns whether or not the focused control needs spell-checking. |
| 68 // Currently, this function just retrieves the focused node and determines | 68 // Currently, this function just retrieves the focused node and determines |
| 69 // whether or not it is a <textarea> element or an element whose | 69 // whether or not it is a <textarea> element or an element whose |
| 70 // contenteditable attribute is true. | 70 // contenteditable attribute is true. |
| 71 // FIXME: Bug 740540: This code just implements the default behavior | 71 // FIXME: Bug 740540: This code just implements the default behavior |
| 72 // proposed in this issue. We should also retrieve "spellcheck" attributes | 72 // proposed in this issue. We should also retrieve "spellcheck" attributes |
| 73 // for text fields and create a flag to over-write the default behavior. | 73 // for text fields and create a flag to over-write the default behavior. |
| 74 bool shouldSpellcheckByDefault(); | 74 bool shouldSpellcheckByDefault(); |
| 75 | 75 |
| 76 WebViewImpl* m_webView; | 76 WebViewImpl* m_webView; |
| 77 | 77 |
| 78 // This flag is set to false if spell check for this editor is manually | 78 // This flag is set to false if spell check for this editor is manually |
| 79 // turned off. The default setting is SpellCheckAutomatic. | 79 // turned off. The default setting is SpellCheckAutomatic. |
| 80 enum { | 80 enum { |
| 81 SpellCheckAutomatic, | 81 SpellCheckAutomatic, |
| 82 SpellCheckForcedOn, | 82 SpellCheckForcedOn, |
| 83 SpellCheckForcedOff | 83 SpellCheckForcedOff |
| 84 } m_spellCheckThisFieldStatus; | 84 } m_spellCheckThisFieldStatus; |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 } // namespace blink | 87 } // namespace blink |
| 88 | 88 |
| 89 #endif | 89 #endif |
| OLD | NEW |