summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Reed <reed@google.com>2009-05-28 15:09:41 -0400
committerMike Reed <reed@google.com>2009-05-28 15:38:10 -0400
commit2af78f0088820a0b10e92b3d4e07e2688e8555f1 (patch)
treed26d5765ca464bce242f523785561cae0cf8db15
parentbe9123233ec803662e74d4333c1aab0bb201bb84 (diff)
downloadexternal_webkit-2af78f0088820a0b10e92b3d4e07e2688e8555f1.zip
external_webkit-2af78f0088820a0b10e92b3d4e07e2688e8555f1.tar.gz
external_webkit-2af78f0088820a0b10e92b3d4e07e2688e8555f1.tar.bz2
hack to set focus for plugins
expose pluginview from pluginwidget
-rw-r--r--WebKit/android/jni/WebViewCore.cpp14
-rw-r--r--WebKit/android/plugins/PluginWidgetAndroid.h4
2 files changed, 17 insertions, 1 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 89013ff..c1df546 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -1273,6 +1273,15 @@ void WebViewCore::setKitFocus(int moveGeneration, int buildGeneration,
finalKitFocus(frame, node, x, y);
}
+static bool nodeIsPlugin(Node* node) {
+ RenderObject* renderer = node->renderer();
+ if (renderer->isWidget()) {
+ Widget* widget = static_cast<RenderWidget*>(renderer)->widget();
+ return widget && widget->isPluginView();
+ }
+ return NULL;
+}
+
// Update mouse position and may change focused node.
bool WebViewCore::finalKitFocus(WebCore::Frame* frame, WebCore::Node* node,
int x, int y)
@@ -1300,6 +1309,11 @@ bool WebViewCore::finalKitFocus(WebCore::Frame* frame, WebCore::Node* node,
builder.setLastFocus(node);
m_lastFocused = node;
m_lastFocusedBounds = node->getRect();
+
+ // hack to give the plugin focus (for keys). better fix on the way
+ if (nodeIsPlugin(node)) {
+ node->document()->setFocusedNode(node);
+ }
return true;
}
diff --git a/WebKit/android/plugins/PluginWidgetAndroid.h b/WebKit/android/plugins/PluginWidgetAndroid.h
index e8f5e6a..157651c 100644
--- a/WebKit/android/plugins/PluginWidgetAndroid.h
+++ b/WebKit/android/plugins/PluginWidgetAndroid.h
@@ -49,7 +49,9 @@ struct PluginWidgetAndroid {
// destroyed.
PluginWidgetAndroid(WebCore::PluginView* view);
~PluginWidgetAndroid();
-
+
+ WebCore::PluginView* pluginView() const { return m_pluginView; }
+
/* Can't determine our core at construction time, so PluginView calls this
as soon as it has a parent.
*/