Changeset 62893 in webkit
- Timestamp:
- Jul 8, 2010 10:25:47 PM (14 years ago)
- Location:
- trunk/WebKit/chromium
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/chromium/ChangeLog
r62876 r62893 1 2010-07-08 Jay Civelli <jcivelli@chromium.org> 2 3 Reviewed by Darin Fisher. 4 5 [chromium] Exposing the EditorClient text field related methods 6 to the WebViewClient. Also adding some more accessors methods 7 to the WebNode and WebInputElement. 8 This is needed to move the password autocomplete out of the 9 Chromium WebKit API to the Chromium code. 10 https://bugs.webkit.org/show_bug.cgi?id=41286 11 12 * public/WebInputElement.h: 13 * public/WebNode.h: 14 (WebKit::operator!=): 15 (WebKit::operator<): 16 * public/WebViewClient.h: 17 (WebKit::WebViewClient::textFieldDidBeginEditing): 18 (WebKit::WebViewClient::textFieldDidEndEditing): 19 (WebKit::WebViewClient::textDidChangeInTextField): 20 (WebKit::WebViewClient::textFieldHandlingKeyDown): 21 (WebKit::WebViewClient::didAcceptAutocompleteSuggestion): 22 * src/EditorClientImpl.cpp: 23 (WebKit::EditorClientImpl::textFieldDidBeginEditing): 24 (WebKit::EditorClientImpl::textFieldDidEndEditing): 25 (WebKit::EditorClientImpl::textDidChangeInTextField): 26 (WebKit::EditorClientImpl::onAutocompleteSuggestionAccepted): 27 (WebKit::EditorClientImpl::doTextFieldCommandFromEvent): 28 * src/WebInputElement.cpp: 29 (WebKit::WebInputElement::readOnly): 30 (WebKit::WebInputElement::setSelectionRange): 31 (WebKit::WebInputElement::selectionStart): 32 (WebKit::WebInputElement::selectionEnd): 33 * src/WebNode.cpp: 34 (WebKit::WebNode::lessThan): 35 1 36 2010-07-08 Aaron Boodman <aa@chromium.org> 2 37 -
trunk/WebKit/chromium/public/WebInputElement.h
r62705 r62893 81 81 82 82 WEBKIT_API bool autoComplete() const; 83 WEBKIT_API bool isReadOnly() const; 83 84 WEBKIT_API bool isEnabledFormControl() const; 84 85 WEBKIT_API InputType inputType() const; … … 97 98 WEBKIT_API void dispatchFormControlChangeEvent(); 98 99 WEBKIT_API void setSelectionRange(int, int); 100 WEBKIT_API int selectionStart(); 101 WEBKIT_API int selectionEnd(); 99 102 100 103 #if WEBKIT_IMPLEMENTATION -
trunk/WebKit/chromium/public/WebNode.h
r62770 r62893 62 62 63 63 WEBKIT_API bool equals(const WebNode&) const; 64 64 // Required for using WebNodes in std maps. Note the order used is 65 // arbitrary and should not be expected to have any specific meaning. 66 WEBKIT_API bool lessThan(const WebNode&) const; 67 65 68 bool isNull() const { return m_private.isNull(); } 66 69 … … 151 154 } 152 155 156 inline bool operator<(const WebNode& a, const WebNode& b) 157 { 158 return a.lessThan(b); 159 } 160 153 161 } // namespace WebKit 154 162 -
trunk/WebKit/chromium/public/WebViewClient.h
r62039 r62893 46 46 class WebAccessibilityObject; 47 47 class WebDragData; 48 class WebElement; 48 49 class WebFileChooserCompletion; 49 50 class WebFrame; 50 51 class WebGeolocationService; 51 52 class WebImage; 53 class WebInputElement; 54 class WebKeyboardEvent; 52 55 class WebNode; 53 56 class WebNotificationPresenter; … … 133 136 virtual void didEndEditing() { } 134 137 138 // These methods are called when the users edits a text-field. 139 virtual void textFieldDidBeginEditing(const WebInputElement&) { } 140 virtual void textFieldDidEndEditing(const WebInputElement&) { } 141 virtual void textFieldDidChange(const WebInputElement&) { } 142 virtual void textFieldDidReceiveKeyDown(const WebInputElement&, const WebKeyboardEvent&) { } 143 135 144 // This method is called in response to WebView's handleInputEvent() 136 145 // when the default action for the current keyboard event is not … … 313 322 virtual void didClearAutoFillSelection(const WebNode&) { } 314 323 324 // Informs the browser that the user has selected an autocomplete (password 325 // or field) suggestion from the drop-down. The input element text has 326 // already been set to the selected suggestion. 327 virtual void didAcceptAutocompleteSuggestion(const WebInputElement&) { } 328 315 329 // Geolocation --------------------------------------------------------- 316 330 -
trunk/WebKit/chromium/src/EditorClientImpl.cpp
r62272 r62893 44 44 #include "DOMUtilitiesPrivate.h" 45 45 #include "WebEditingAction.h" 46 #include "WebElement.h" 46 47 #include "WebFrameImpl.h" 47 48 #include "WebKit.h" 48 49 #include "WebInputElement.h" 50 #include "WebInputEventConversion.h" 49 51 #include "WebNode.h" 50 52 #include "WebPasswordAutocompleteListener.h" … … 91 93 // it if in testing mode and the test specifically requests it by using this 92 94 // magic class name. 93 return WebKit::layoutTestMode()95 return layoutTestMode() 94 96 && elem->getAttribute(HTMLNames::classAttr) == "needsDeletionUI"; 95 97 } … … 645 647 } 646 648 647 void EditorClientImpl::textFieldDidBeginEditing(Element*) 648 { 649 void EditorClientImpl::textFieldDidBeginEditing(Element* element) 650 { 651 HTMLInputElement* inputElement = toHTMLInputElement(element); 652 if (m_webView->client() && inputElement) 653 m_webView->client()->textFieldDidBeginEditing(WebInputElement(inputElement)); 649 654 } 650 655 651 656 void EditorClientImpl::textFieldDidEndEditing(Element* element) 652 657 { 658 HTMLInputElement* inputElement = toHTMLInputElement(element); 659 if (m_webView->client() && inputElement) 660 m_webView->client()->textFieldDidEndEditing(WebInputElement(inputElement)); 661 653 662 // Notification that focus was lost. Be careful with this, it's also sent 654 663 // when the page is being closed. … … 665 674 666 675 // Notify any password-listener of the focus change. 667 HTMLInputElement* inputElement = WebKit::toHTMLInputElement(element);668 676 if (!inputElement) 669 677 return; … … 683 691 { 684 692 ASSERT(element->hasLocalName(HTMLNames::inputTag)); 693 HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(element); 694 if (m_webView->client()) 695 m_webView->client()->textFieldDidChange(WebInputElement(inputElement)); 696 685 697 // Note that we only show the autofill popup in this case if the caret is at 686 698 // the end. This matches FireFox and Safari but not IE. 687 autofill(static_cast<HTMLInputElement*>(element), false, false, 688 true); 699 autofill(inputElement, false, false, true); 689 700 } 690 701 691 702 bool EditorClientImpl::showFormAutofillForNode(Node* node) 692 703 { 693 HTMLInputElement* inputElement = WebKit::toHTMLInputElement(node);704 HTMLInputElement* inputElement = toHTMLInputElement(node); 694 705 if (inputElement) 695 706 return autofill(inputElement, true, true, false); … … 793 804 void EditorClientImpl::onAutocompleteSuggestionAccepted(HTMLInputElement* textField) 794 805 { 806 if (m_webView->client()) 807 m_webView->client()->didAcceptAutocompleteSuggestion(WebInputElement(textField)); 808 795 809 WebFrameImpl* webframe = WebFrameImpl::fromFrame(textField->document()->frame()); 796 810 if (!webframe) … … 803 817 KeyboardEvent* event) 804 818 { 819 HTMLInputElement* inputElement = toHTMLInputElement(element); 820 if (m_webView->client() && inputElement) { 821 m_webView->client()->textFieldDidReceiveKeyDown(WebInputElement(inputElement), 822 WebKeyboardEventBuilder(*event)); 823 } 824 805 825 // Remember if backspace was pressed for the autofill. It is not clear how to 806 826 // find if backspace was pressed from textFieldDidBeginEditing and -
trunk/WebKit/chromium/src/WebInputElement.cpp
r62705 r62893 44 44 { 45 45 return constUnwrap<HTMLInputElement>()->autoComplete(); 46 } 47 48 bool WebInputElement::isReadOnly() const 49 { 50 return constUnwrap<HTMLInputElement>()->readOnly(); 46 51 } 47 52 … … 126 131 } 127 132 133 int WebInputElement::selectionStart() 134 { 135 return unwrap<HTMLInputElement>()->selectionStart(); 136 } 137 138 int WebInputElement::selectionEnd() 139 { 140 return unwrap<HTMLInputElement>()->selectionEnd(); 141 } 142 128 143 WebInputElement::WebInputElement(const PassRefPtr<HTMLInputElement>& elem) 129 144 : WebFormControlElement(elem) -
trunk/WebKit/chromium/src/WebNode.cpp
r58967 r62893 68 68 } 69 69 70 bool WebNode::lessThan(const WebNode& n) const 71 { 72 return (m_private.get() < n.m_private.get()); 73 } 74 70 75 WebNode::NodeType WebNode::nodeType() const 71 76 {
Note: See TracChangeset
for help on using the changeset viewer.