diff options
| author | Steve Block <steveblock@google.com> | 2010-10-18 16:07:38 +0100 |
|---|---|---|
| committer | Steve Block <steveblock@google.com> | 2010-10-18 21:04:02 +0100 |
| commit | e949efd529b667054f1e2abdda96995d6656b2b5 (patch) | |
| tree | 730d672b1ea8aae343eec8825222e0512d434cf2 /WebKit/android | |
| parent | 456bc40a2584f222aecc5331f26ae5ce7a9fc8aa (diff) | |
| download | external_webkit-e949efd529b667054f1e2abdda96995d6656b2b5.zip external_webkit-e949efd529b667054f1e2abdda96995d6656b2b5.tar.gz external_webkit-e949efd529b667054f1e2abdda96995d6656b2b5.tar.bz2 | |
Make sure the focus node is an HTMLInputElement before checking whether it's a password field
Bug: 3105611
Change-Id: I9190b50265d3b1ea9639dbdae1d513aefb93c9f3
Diffstat (limited to 'WebKit/android')
| -rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index 946e242..b776aa8 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -1906,15 +1906,16 @@ void WebViewCore::setSelection(int start, int end) rtc->setSelectionRange(start, end); client->setUiGeneratedSelectionChange(false); WebCore::Frame* focusedFrame = focus->document()->frame(); - if (renderer->isTextArea() - // For password fields, this is done in the UI side via - // bringPointIntoView, since the UI does the drawing. - || !static_cast<WebCore::HTMLInputElement*>(focus)->isPasswordField()) { - WebFrame* webFrame = WebFrame::getWebFrame(focusedFrame); - webFrame->setUserInitiatedAction(true); - focusedFrame->selection()->revealSelection(); - webFrame->setUserInitiatedAction(false); + bool isPasswordField = false; + if (focus->isElementNode()) { + WebCore::Element* element = static_cast<WebCore::Element*>(focus); + if (WebCore::InputElement* inputElement = WebCore::toInputElement(element)) + isPasswordField = static_cast<WebCore::HTMLInputElement*>(inputElement)->isPasswordField(); } + // For password fields, this is done in the UI side via + // bringPointIntoView, since the UI does the drawing. + if (renderer->isTextArea() || !isPasswordField) + focusedFrame->selection()->revealSelection(); } String WebViewCore::modifySelection(const int direction, const int axis) @@ -2590,17 +2591,9 @@ bool WebViewCore::key(const PlatformKeyboardEvent& event) if (focusNode) { WebCore::Frame* frame = focusNode->document()->frame(); WebFrame* webFrame = WebFrame::getWebFrame(frame); - if (isContentEditable(focusNode) || (focusNode->renderer() - && (focusNode->renderer()->isTextArea() - // For password fields, this is done in the UI side via - // bringPointIntoView, since the UI does the drawing. - || !static_cast<WebCore:: HTMLInputElement*>(focusNode)->isPasswordField()))) { - webFrame->setUserInitiatedAction(true); - } eventHandler = frame->eventHandler(); VisibleSelection old = frame->selection()->selection(); bool handled = eventHandler->keyEvent(event); - webFrame->setUserInitiatedAction(false); if (isContentEditable(focusNode)) { // keyEvent will return true even if the contentEditable did not // change its selection. In the case that it does not, we want to |
