summaryrefslogtreecommitdiffstats
path: root/WebKit/android
diff options
context:
space:
mode:
authorLeon Scroggins <>2009-04-14 10:57:12 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-04-14 10:57:12 -0700
commit3c8902f607e797e45524ea76cc30ec24c1ed6d2e (patch)
treeb80791b9b0ea64330717b85d19147744ef5b03d4 /WebKit/android
parent76fc394d65b2db7f55e09874fa383a153e2bd128 (diff)
downloadexternal_webkit-3c8902f607e797e45524ea76cc30ec24c1ed6d2e.zip
external_webkit-3c8902f607e797e45524ea76cc30ec24c1ed6d2e.tar.gz
external_webkit-3c8902f607e797e45524ea76cc30ec24c1ed6d2e.tar.bz2
AI 146153: Make the TextDialog invisible, so that we only show WebKit's rendering of the textfield, yet we retain the benefits of having the TextDialog.
Frame.cpp: Removed a line that should not be there anyway. Somehow when merging in Apple's ENABLE(TEXT_CARET) changes we left in a line that disables the blinking Cursor. Platform.h: Let WebKit draw the cursor. RenderThemeAndroid.cpp: Make the active selection color (the color of a selection in an active <textfield> or <textarea>) visible, and match the selection color shown in other places in Android. WebViewCore.cpp: Make the focused node's document's focus controller active. This allows webkit to draw the cursor. TextDialog.java: Set WillNotDraw to true, and remove our background, so that the TextDialog is completely invisible. Note that I have not changed its visibility to View.VISIBLE, which would have other undesired effects (would not accept touch events, for example). Since we are not drawing, remove onPreDraw, which is no longer necessary. In onSelectionChanged, pass a message to webkit telling it that the selection has changed. It is important that the two threads always agree (albeit webkit may be behind) because the user will now only see the selection drawn by webkit. Remove some old flawed code whose purpose was to keep the selection up to date and do not send key events for arrow keys (which would mess up the selection that was correct thanks to onSelectionChanged). BUG=1781070,1712752,916193,1411370,1160999,1775425,1354814 Automated import of CL 146153
Diffstat (limited to 'WebKit/android')
-rw-r--r--WebKit/android/jni/WebViewCore.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 6daec46..7afd985 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -38,6 +38,7 @@
#include "EditorClientAndroid.h"
#include "EventHandler.h"
#include "EventNames.h"
+#include "FocusController.h"
#include "Font.h"
#include "Frame.h"
#include "FrameLoader.h"
@@ -1187,23 +1188,42 @@ bool WebViewCore::finalKitFocus(WebCore::Frame* frame, WebCore::Node* node,
false, WTF::currentTime());
frame->eventHandler()->handleMouseMoveEvent(mouseEvent);
bool valid = builder.validNode(frame, node);
- if (!donotChangeDOMFocus) {
+ // donotChangeDOMFocus prevents changing the focus because it will later be
+ // changed by handleMouseClick. However, if we hit a textfield,
+ // handleMouseClick is not called. We need to move the focus and set
+ // the focusController to active so that the cursor/selection is shown.
+ if (!donotChangeDOMFocus || (node && node->renderer()
+ && (node->renderer()->isTextField()
+ || node->renderer()->isTextArea()))) {
WebCore::Document* oldDoc = oldFocusNode ? oldFocusNode->document() : 0;
+ // page and oldPage are only used to make the correct FocusController
+ // "active" so that we get a cursor/selection in the appropriate
+ // textfield
+ WebCore::Page* oldPage = oldDoc ? oldDoc->page() : 0;
if (!node) {
if (oldFocusNode)
oldDoc->setFocusedNode(0);
+ if (oldPage)
+ oldPage->focusController()->setActive(false);
return false;
} else if (!valid) {
DBG_NAV_LOGD("sendMarkNodeInvalid node=%p", node);
sendMarkNodeInvalid(node);
if (oldFocusNode)
oldDoc->setFocusedNode(0);
+ if (oldPage)
+ oldPage->focusController()->setActive(false);
return false;
}
// If we jump frames (docs), kill the focus on the old doc
if (oldFocusNode && node->document() != oldDoc) {
oldDoc->setFocusedNode(0);
}
+ WebCore::Page* page = node->document()->page();
+ if (page && oldPage != page)
+ page->focusController()->setActive(true);
+ if (oldPage && page != oldPage)
+ oldPage->focusController()->setActive(false);
if (!node->isTextNode())
static_cast<WebCore::Element*>(node)->focus(false);
if (node->document()->focusedNode() != node) {