summaryrefslogtreecommitdiffstats
path: root/WebKit/chromium/src/EditorClientImpl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/chromium/src/EditorClientImpl.cpp')
-rw-r--r--WebKit/chromium/src/EditorClientImpl.cpp32
1 files changed, 26 insertions, 6 deletions
diff --git a/WebKit/chromium/src/EditorClientImpl.cpp b/WebKit/chromium/src/EditorClientImpl.cpp
index 864988a..4ae4934 100644
--- a/WebKit/chromium/src/EditorClientImpl.cpp
+++ b/WebKit/chromium/src/EditorClientImpl.cpp
@@ -43,9 +43,11 @@
#include "DOMUtilitiesPrivate.h"
#include "WebEditingAction.h"
+#include "WebElement.h"
#include "WebFrameImpl.h"
#include "WebKit.h"
#include "WebInputElement.h"
+#include "WebInputEventConversion.h"
#include "WebNode.h"
#include "WebPasswordAutocompleteListener.h"
#include "WebRange.h"
@@ -90,7 +92,7 @@ bool EditorClientImpl::shouldShowDeleteInterface(HTMLElement* elem)
// Normally, we don't care to show WebCore's deletion UI, so we only enable
// it if in testing mode and the test specifically requests it by using this
// magic class name.
- return WebKit::layoutTestMode()
+ return layoutTestMode()
&& elem->getAttribute(HTMLNames::classAttr) == "needsDeletionUI";
}
@@ -644,12 +646,19 @@ void EditorClientImpl::handleInputMethodKeydown(KeyboardEvent* keyEvent)
// We handle IME within chrome.
}
-void EditorClientImpl::textFieldDidBeginEditing(Element*)
+void EditorClientImpl::textFieldDidBeginEditing(Element* element)
{
+ HTMLInputElement* inputElement = toHTMLInputElement(element);
+ if (m_webView->client() && inputElement)
+ m_webView->client()->textFieldDidBeginEditing(WebInputElement(inputElement));
}
void EditorClientImpl::textFieldDidEndEditing(Element* element)
{
+ HTMLInputElement* inputElement = toHTMLInputElement(element);
+ if (m_webView->client() && inputElement)
+ m_webView->client()->textFieldDidEndEditing(WebInputElement(inputElement));
+
// Notification that focus was lost. Be careful with this, it's also sent
// when the page is being closed.
@@ -664,7 +673,6 @@ void EditorClientImpl::textFieldDidEndEditing(Element* element)
return; // The page is getting closed, don't fill the password.
// Notify any password-listener of the focus change.
- HTMLInputElement* inputElement = WebKit::toHTMLInputElement(element);
if (!inputElement)
return;
@@ -682,15 +690,18 @@ void EditorClientImpl::textFieldDidEndEditing(Element* element)
void EditorClientImpl::textDidChangeInTextField(Element* element)
{
ASSERT(element->hasLocalName(HTMLNames::inputTag));
+ HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(element);
+ if (m_webView->client())
+ m_webView->client()->textFieldDidChange(WebInputElement(inputElement));
+
// Note that we only show the autofill popup in this case if the caret is at
// the end. This matches FireFox and Safari but not IE.
- autofill(static_cast<HTMLInputElement*>(element), false, false,
- true);
+ autofill(inputElement, false, false, true);
}
bool EditorClientImpl::showFormAutofillForNode(Node* node)
{
- HTMLInputElement* inputElement = WebKit::toHTMLInputElement(node);
+ HTMLInputElement* inputElement = toHTMLInputElement(node);
if (inputElement)
return autofill(inputElement, true, true, false);
return false;
@@ -792,6 +803,9 @@ void EditorClientImpl::cancelPendingAutofill()
void EditorClientImpl::onAutocompleteSuggestionAccepted(HTMLInputElement* textField)
{
+ if (m_webView->client())
+ m_webView->client()->didAcceptAutocompleteSuggestion(WebInputElement(textField));
+
WebFrameImpl* webframe = WebFrameImpl::fromFrame(textField->document()->frame());
if (!webframe)
return;
@@ -802,6 +816,12 @@ void EditorClientImpl::onAutocompleteSuggestionAccepted(HTMLInputElement* textFi
bool EditorClientImpl::doTextFieldCommandFromEvent(Element* element,
KeyboardEvent* event)
{
+ HTMLInputElement* inputElement = toHTMLInputElement(element);
+ if (m_webView->client() && inputElement) {
+ m_webView->client()->textFieldDidReceiveKeyDown(WebInputElement(inputElement),
+ WebKeyboardEventBuilder(*event));
+ }
+
// Remember if backspace was pressed for the autofill. It is not clear how to
// find if backspace was pressed from textFieldDidBeginEditing and
// textDidChangeInTextField as when these methods are called the value of the