| 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 // The Mac interface forwards most of these commands to the application layer, | 5 // The Mac interface forwards most of these commands to the application layer, |
| 6 // and I'm not really sure what to do about most of them. | 6 // and I'm not really sure what to do about most of them. |
| 7 | 7 |
| 8 #include "config.h" | 8 #include "config.h" |
| 9 #include "webkit/glue/editor_client_impl.h" | 9 #include "webkit/glue/editor_client_impl.h" |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "KeyboardEvent.h" | 21 #include "KeyboardEvent.h" |
| 22 #include "PlatformKeyboardEvent.h" | 22 #include "PlatformKeyboardEvent.h" |
| 23 #include "PlatformString.h" | 23 #include "PlatformString.h" |
| 24 #include "RenderObject.h" | 24 #include "RenderObject.h" |
| 25 | 25 |
| 26 #undef LOG | 26 #undef LOG |
| 27 #include "base/message_loop.h" | 27 #include "base/message_loop.h" |
| 28 #include "base/string_util.h" | 28 #include "base/string_util.h" |
| 29 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" | 29 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" |
| 30 #include "webkit/glue/autofill_form.h" | 30 #include "webkit/glue/autofill_form.h" |
| 31 #include "webkit/glue/dom_operations.h" |
| 31 #include "webkit/glue/editor_client_impl.h" | 32 #include "webkit/glue/editor_client_impl.h" |
| 32 #include "webkit/glue/glue_util.h" | 33 #include "webkit/glue/glue_util.h" |
| 33 #include "webkit/glue/webkit_glue.h" | 34 #include "webkit/glue/webkit_glue.h" |
| 34 #include "webkit/glue/webview.h" | 35 #include "webkit/glue/webview.h" |
| 35 #include "webkit/glue/webview_impl.h" | 36 #include "webkit/glue/webview_impl.h" |
| 36 | 37 |
| 37 // Arbitrary depth limit for the undo stack, to keep it from using | 38 // Arbitrary depth limit for the undo stack, to keep it from using |
| 38 // unbounded memory. This is the maximum number of distinct undoable | 39 // unbounded memory. This is the maximum number of distinct undoable |
| 39 // actions -- unbroken stretches of typed characters are coalesced | 40 // actions -- unbroken stretches of typed characters are coalesced |
| 40 // into a single action. | 41 // into a single action. |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 // Hide any showing popup. | 658 // Hide any showing popup. |
| 658 web_view_->HideAutoCompletePopup(); | 659 web_view_->HideAutoCompletePopup(); |
| 659 } | 660 } |
| 660 | 661 |
| 661 void EditorClientImpl::textDidChangeInTextField(WebCore::Element* element) { | 662 void EditorClientImpl::textDidChangeInTextField(WebCore::Element* element) { |
| 662 DCHECK(element->hasLocalName(WebCore::HTMLNames::inputTag)); | 663 DCHECK(element->hasLocalName(WebCore::HTMLNames::inputTag)); |
| 663 Autofill(static_cast<WebCore::HTMLInputElement*>(element), false); | 664 Autofill(static_cast<WebCore::HTMLInputElement*>(element), false); |
| 664 } | 665 } |
| 665 | 666 |
| 666 void EditorClientImpl::ShowAutofillForNode(WebCore::Node* node) { | 667 void EditorClientImpl::ShowAutofillForNode(WebCore::Node* node) { |
| 667 if (node->nodeType() == WebCore::Node::ELEMENT_NODE) { | 668 WebCore::HTMLInputElement* input_element = |
| 668 WebCore::Element* element = static_cast<WebCore::Element*>(node); | 669 webkit_glue::NodeToHTMLInputElement(node); |
| 669 if (element->hasLocalName(WebCore::HTMLNames::inputTag)) { | 670 if (input_element) |
| 670 WebCore::HTMLInputElement* input_element = | 671 Autofill(input_element, true); |
| 671 static_cast<WebCore::HTMLInputElement*>(element); | |
| 672 Autofill(input_element, true); | |
| 673 } | |
| 674 } | |
| 675 } | 672 } |
| 676 | 673 |
| 677 void EditorClientImpl::Autofill(WebCore::HTMLInputElement* input_element, | 674 void EditorClientImpl::Autofill(WebCore::HTMLInputElement* input_element, |
| 678 bool autofill_on_empty_value) { | 675 bool autofill_on_empty_value) { |
| 679 // Cancel any pending DoAutofill calls. | 676 // Cancel any pending DoAutofill calls. |
| 680 autofill_factory_.RevokeAll(); | 677 autofill_factory_.RevokeAll(); |
| 681 | 678 |
| 682 // Let's try to trigger autofill for that field, if applicable. | 679 // Let's try to trigger autofill for that field, if applicable. |
| 683 if (!input_element->isEnabled() || !input_element->isTextField() || | 680 if (!input_element->isEnabled() || !input_element->isTextField() || |
| 684 input_element->isPasswordField() || !input_element->autoComplete()) { | 681 input_element->isPasswordField() || !input_element->autoComplete()) { |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 } | 905 } |
| 909 return L"(UNKNOWN AFFINITY)"; | 906 return L"(UNKNOWN AFFINITY)"; |
| 910 } | 907 } |
| 911 | 908 |
| 912 std::wstring EditorClientImpl::Describe(WebCore::CSSStyleDeclaration* style) { | 909 std::wstring EditorClientImpl::Describe(WebCore::CSSStyleDeclaration* style) { |
| 913 // TODO(pamg): Implement me. It's not clear what WebKit produces for this | 910 // TODO(pamg): Implement me. It's not clear what WebKit produces for this |
| 914 // (their [style description] method), and none of the layout tests provide | 911 // (their [style description] method), and none of the layout tests provide |
| 915 // an example. But because none of them use it, it's not yet important. | 912 // an example. But because none of them use it, it's not yet important. |
| 916 return std::wstring(); | 913 return std::wstring(); |
| 917 } | 914 } |
| OLD | NEW |