| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifndef WEBKIT_GLUE_EDITOR_CLIENT_IMPL_H__ | 5 #ifndef WEBKIT_GLUE_EDITOR_CLIENT_IMPL_H__ |
| 6 #define WEBKIT_GLUE_EDITOR_CLIENT_IMPL_H__ | 6 #define WEBKIT_GLUE_EDITOR_CLIENT_IMPL_H__ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 | 9 |
| 10 #include "DOMWindow.h" | 10 #include "DOMWindow.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 virtual std::wstring Describe(WebCore::EAffinity affinity); | 117 virtual std::wstring Describe(WebCore::EAffinity affinity); |
| 118 virtual std::wstring Describe(WebCore::CSSStyleDeclaration* style); | 118 virtual std::wstring Describe(WebCore::CSSStyleDeclaration* style); |
| 119 | 119 |
| 120 // Shows the form autofill popup for |node| if it is an HTMLInputElement and | 120 // Shows the form autofill popup for |node| if it is an HTMLInputElement and |
| 121 // it is empty. This is called when you press the up or down arrow in a | 121 // it is empty. This is called when you press the up or down arrow in a |
| 122 // text-field or when clicking an already focused text-field. | 122 // text-field or when clicking an already focused text-field. |
| 123 // Returns true if the autofill popup has been scheduled to be shown, false | 123 // Returns true if the autofill popup has been scheduled to be shown, false |
| 124 // otherwise. | 124 // otherwise. |
| 125 virtual bool ShowFormAutofillForNode(WebCore::Node* node); | 125 virtual bool ShowFormAutofillForNode(WebCore::Node* node); |
| 126 | 126 |
| 127 // Notification that the text changed in |text_field| due to acceptance of |
| 128 // a suggestion provided by an autofill popup. Having a separate callback |
| 129 // in this case is a simple way to break the cycle that would otherwise occur |
| 130 // if textDidChangeInTextField was called. |
| 131 virtual void OnAutofillSuggestionAccepted( |
| 132 WebCore::HTMLInputElement* text_field); |
| 133 |
| 127 private: | 134 private: |
| 128 void ModifySelection(WebCore::Frame* frame, | 135 void ModifySelection(WebCore::Frame* frame, |
| 129 WebCore::KeyboardEvent* event); | 136 WebCore::KeyboardEvent* event); |
| 130 | 137 |
| 131 // Triggers autofill for |input_element| if applicable. This can be form | 138 // Triggers autofill for |input_element| if applicable. This can be form |
| 132 // autofill (via a popup-menu) or password autofill depending on | 139 // autofill (via a popup-menu) or password autofill depending on |
| 133 // |input_element|. If |form_autofill_only| is true, password autofill is not | 140 // |input_element|. If |form_autofill_only| is true, password autofill is not |
| 134 // triggered. | 141 // triggered. |
| 135 // |autofill_on_empty_value| indicates whether the autofill should be shown | 142 // |autofill_on_empty_value| indicates whether the autofill should be shown |
| 136 // when the text-field is empty. | 143 // when the text-field is empty. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 166 // Returns whether or not the focused control needs spell-checking. | 173 // Returns whether or not the focused control needs spell-checking. |
| 167 // Currently, this function just retrieves the focused node and determines | 174 // Currently, this function just retrieves the focused node and determines |
| 168 // whether or not it is a <textarea> element or an element whose | 175 // whether or not it is a <textarea> element or an element whose |
| 169 // contenteditable attribute is true. | 176 // contenteditable attribute is true. |
| 170 // TODO(hbono): Bug 740540: This code just implements the default behavior | 177 // TODO(hbono): Bug 740540: This code just implements the default behavior |
| 171 // proposed in this issue. We should also retrieve "spellcheck" attributes | 178 // proposed in this issue. We should also retrieve "spellcheck" attributes |
| 172 // for text fields and create a flag to over-write the default behavior. | 179 // for text fields and create a flag to over-write the default behavior. |
| 173 bool ShouldSpellcheckByDefault(); | 180 bool ShouldSpellcheckByDefault(); |
| 174 | 181 |
| 175 // Whether the last entered key was a backspace. | 182 // Whether the last entered key was a backspace. |
| 176 bool backspace_pressed_; | 183 bool backspace_or_delete_pressed_; |
| 177 | 184 |
| 178 // This flag is set to false if spell check for this editor is manually | 185 // This flag is set to false if spell check for this editor is manually |
| 179 // turned off. The default setting is SPELLCHECK_AUTOMATIC. | 186 // turned off. The default setting is SPELLCHECK_AUTOMATIC. |
| 180 enum { | 187 enum { |
| 181 SPELLCHECK_AUTOMATIC, | 188 SPELLCHECK_AUTOMATIC, |
| 182 SPELLCHECK_FORCED_ON, | 189 SPELLCHECK_FORCED_ON, |
| 183 SPELLCHECK_FORCED_OFF | 190 SPELLCHECK_FORCED_OFF |
| 184 }; | 191 }; |
| 185 int spell_check_this_field_status_; | 192 int spell_check_this_field_status_; |
| 186 | 193 |
| 187 // The method factory used to post autofill related tasks. | 194 // The method factory used to post autofill related tasks. |
| 188 ScopedRunnableMethodFactory<EditorClientImpl> autofill_factory_; | 195 ScopedRunnableMethodFactory<EditorClientImpl> autofill_factory_; |
| 189 }; | 196 }; |
| 190 | 197 |
| 191 #endif // WEBKIT_GLUE_EDITOR_CLIENT_IMPL_H__ | 198 #endif // WEBKIT_GLUE_EDITOR_CLIENT_IMPL_H__ |
| OLD | NEW |