summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--WebKit/android/jni/WebCoreFrameBridge.cpp2
-rw-r--r--WebKit/android/jni/WebCoreJniOnLoad.cpp2
-rw-r--r--WebKit/android/jni/WebViewCore.cpp20
-rw-r--r--WebKit/android/jni/WebViewCore.h2
4 files changed, 8 insertions, 18 deletions
diff --git a/WebKit/android/jni/WebCoreFrameBridge.cpp b/WebKit/android/jni/WebCoreFrameBridge.cpp
index 868233a..a868260 100644
--- a/WebKit/android/jni/WebCoreFrameBridge.cpp
+++ b/WebKit/android/jni/WebCoreFrameBridge.cpp
@@ -42,6 +42,7 @@
#include "DragClientAndroid.h"
#include "EditorClientAndroid.h"
#include "Element.h"
+#include "FocusController.h"
#include "Font.h"
#include "FormState.h"
#include "Frame.h"
@@ -940,6 +941,7 @@ static void CreateFrame(JNIEnv* env, jobject obj, jobject javaview, jobject jAss
// Set the frame to active to turn on keyboard focus.
frame->init();
frame->selection()->setFocused(true);
+ frame->page()->focusController()->setFocused(true);
deviceMotionC->setWebViewCore(webViewCore);
deviceOrientationC->setWebViewCore(webViewCore);
diff --git a/WebKit/android/jni/WebCoreJniOnLoad.cpp b/WebKit/android/jni/WebCoreJniOnLoad.cpp
index 57fccac..cb3fb57 100644
--- a/WebKit/android/jni/WebCoreJniOnLoad.cpp
+++ b/WebKit/android/jni/WebCoreJniOnLoad.cpp
@@ -35,6 +35,7 @@
#include "DeviceOrientationClientAndroid.h"
#include "DragClientAndroid.h"
#include "EditorClientAndroid.h"
+#include "FocusController.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "FrameLoaderClientAndroid.h"
@@ -233,6 +234,7 @@ EXPORT void benchmark(const char* url, int reloadCount, int width, int height) {
// assertion in the Cache code)
frame->init();
frame->selection()->setFocused(true);
+ frame->page()->focusController()->setFocused(true);
deviceMotion->setWebViewCore(webViewCore);
deviceOrientation->setWebViewCore(webViewCore);
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 6cd1280..7646fd0 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -1846,7 +1846,6 @@ void WebViewCore::setSelection(int start, int end)
client->setUiGeneratedSelectionChange(false);
WebCore::Frame* focusedFrame = focus->document()->frame();
focusedFrame->revealSelection();
- setFocusControllerActive(focusedFrame, true);
}
String WebViewCore::modifySelection(const String& alter, const String& direction, const String& granularity)
@@ -1961,7 +1960,6 @@ void WebViewCore::passToJs(int generation, const WTF::String& current,
client->setUiGeneratedSelectionChange(false);
m_blockTextfieldUpdates = false;
m_textGeneration = generation;
- setFocusControllerActive(focus->document()->frame(), true);
WebCore::RenderTextControl* renderText =
static_cast<WebCore::RenderTextControl*>(renderer);
WTF::String test = renderText->text();
@@ -1997,18 +1995,9 @@ void WebViewCore::scrollFocusedTextInput(float xPercent, int y)
renderText->setScrollTop(y);
}
-void WebViewCore::setFocusControllerActive(WebCore::Frame* frame, bool active)
+void WebViewCore::setFocusControllerActive(bool active)
{
- if (!frame) {
- WebCore::Node* focus = currentFocus();
- if (focus)
- frame = focus->document()->frame();
- else
- frame = m_mainFrame;
- }
- WebCore::FocusController* controller = frame->page()->focusController();
- controller->setActive(active);
- controller->setFocused(active);
+ m_mainFrame->page()->focusController()->setActive(active);
}
void WebViewCore::saveDocumentState(WebCore::Frame* frame)
@@ -2489,7 +2478,6 @@ bool WebViewCore::handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* node
if (renderer && (renderer->isTextField() || renderer->isTextArea())) {
bool ime = !(static_cast<WebCore::HTMLInputElement*>(focusNode))
->readOnly();
- setFocusControllerActive(framePtr, ime);
if (ime) {
RenderTextControl* rtc
= static_cast<RenderTextControl*> (renderer);
@@ -2504,7 +2492,6 @@ bool WebViewCore::handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* node
// keyboard and disable the focus controller because no text input
// is needed.
bool keyboard = focusNode->isContentEditable();
- setFocusControllerActive(framePtr, keyboard);
if (keyboard) {
requestKeyboard(true);
} else {
@@ -2513,7 +2500,6 @@ bool WebViewCore::handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* node
}
} else {
// There is no focusNode, so the keyboard is not needed.
- setFocusControllerActive(framePtr, false);
clearTextEntry();
}
return handled;
@@ -3033,7 +3019,7 @@ static void SetFocusControllerActive(JNIEnv *env, jobject obj, jboolean active)
LOGV("webviewcore::nativeSetFocusControllerActive()\n");
WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj);
LOG_ASSERT(viewImpl, "viewImpl not set in nativeSetFocusControllerActive");
- viewImpl->setFocusControllerActive(0, active);
+ viewImpl->setFocusControllerActive(active);
}
static void SaveDocumentState(JNIEnv *env, jobject obj, jint frame)
diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h
index fe29c81..d29cc88 100644
--- a/WebKit/android/jni/WebViewCore.h
+++ b/WebKit/android/jni/WebViewCore.h
@@ -350,7 +350,7 @@ namespace android {
* Set the FocusController's active and focused states, so that
* the caret will draw (true) or not.
*/
- void setFocusControllerActive(WebCore::Frame*, bool active);
+ void setFocusControllerActive(bool active);
void saveDocumentState(WebCore::Frame* frame);