summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--JavaScriptCore/wtf/Platform.h2
-rw-r--r--WebCore/page/Frame.cpp1
-rw-r--r--WebCore/platform/android/RenderThemeAndroid.cpp19
-rw-r--r--WebKit/android/jni/WebViewCore.cpp22
4 files changed, 31 insertions, 13 deletions
diff --git a/JavaScriptCore/wtf/Platform.h b/JavaScriptCore/wtf/Platform.h
index 1813114..9ab0af8 100644
--- a/JavaScriptCore/wtf/Platform.h
+++ b/JavaScriptCore/wtf/Platform.h
@@ -188,7 +188,7 @@
#define LOG_DISABLED 1
// Prevents Webkit from drawing the caret in textfields and textareas
// This prevents unnecessary invals.
-#define ENABLE_TEXT_CARET 0
+#define ENABLE_TEXT_CARET 1
#endif // ANDROID
/* CPU */
diff --git a/WebCore/page/Frame.cpp b/WebCore/page/Frame.cpp
index d379e13..f0cd1ec 100644
--- a/WebCore/page/Frame.cpp
+++ b/WebCore/page/Frame.cpp
@@ -614,7 +614,6 @@ void Frame::selectionLayoutChanged()
bool shouldBlink = m_caretVisible
&& selection()->isCaret() && selection()->isContentEditable();
- shouldBlink = false;
// If the caret moved, stop the blink timer so we can restart with a
// black caret in the new location.
if (caretRectChanged || !shouldBlink)
diff --git a/WebCore/platform/android/RenderThemeAndroid.cpp b/WebCore/platform/android/RenderThemeAndroid.cpp
index 66ad2c7..f9f4101 100644
--- a/WebCore/platform/android/RenderThemeAndroid.cpp
+++ b/WebCore/platform/android/RenderThemeAndroid.cpp
@@ -24,19 +24,16 @@
*/
#include "config.h"
-
-#include "FormControlElement.h"
-
#include "RenderThemeAndroid.h"
+#include "Color.h"
+#include "FormControlElement.h"
+#include "GraphicsContext.h"
+#include "PlatformGraphicsContext.h"
#include "RenderSkinAndroid.h"
#include "RenderSkinButton.h"
#include "RenderSkinCombo.h"
#include "RenderSkinRadio.h"
-
-#include "GraphicsContext.h"
-#include "PlatformGraphicsContext.h"
-
#include "SkCanvas.h"
#define MAX_COMBO_HEIGHT 20
@@ -52,6 +49,10 @@
namespace WebCore {
+// This is the color of selection in a textfield. It was obtained by checking
+// the color of selection in TextViews in the system.
+const RGBA32 SELECTION_COLOR = makeRGB(255, 146, 0);
+
static SkCanvas* getCanvasFromInfo(const RenderObject::PaintInfo& info)
{
return info.context->platformContext()->mCanvas;
@@ -86,9 +87,7 @@ bool RenderThemeAndroid::stateChanged(RenderObject* o, ControlState state) const
Color RenderThemeAndroid::platformActiveSelectionBackgroundColor() const
{
- // Make these transparent because we handle the selection background
- // in our custom widget.
- return Color(Color::transparent);
+ return Color(SELECTION_COLOR);
}
Color RenderThemeAndroid::platformInactiveSelectionBackgroundColor() const
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) {