return 0;
}
-
-void WebViewCore::updatePluginState(Frame* frame, Node* node, PluginState state) {
-
- // check that the node and frame pointers are (still) valid
- if (!frame || !node || !CacheBuilder::validNode(m_mainFrame, frame, node))
- return;
-
- // check that the node is a plugin view
- PluginView* pluginView = nodeIsPlugin(node);
- if (!pluginView)
- return;
-
- // create the event
- ANPEvent event;
- SkANP::InitEvent(&event, kLifecycle_ANPEventType);
-
- if (state == kLoseFocus_PluginState)
- event.data.lifecycle.action = kLoseFocus_ANPLifecycleAction;
- else if (state == kGainFocus_PluginState)
- event.data.lifecycle.action = kGainFocus_ANPLifecycleAction;
- else
- return;
-
- // send the event
- pluginView->platformPluginWidget()->sendEvent(event);
-}
-
///////////////////////////////////////////////////////////////////////////////
void WebViewCore::moveMouseIfLatest(int moveGeneration,
WebCore::Frame* frame, int x, int y)
return GET_NATIVE_VIEW(env, obj)->pictureReady();
}
-static void UpdatePluginState(JNIEnv* env, jobject obj, jint framePtr, jint nodePtr, jint state)
-{
-#ifdef ANDROID_INSTRUMENT
- TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter);
-#endif
- WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj);
- LOG_ASSERT(viewImpl, "viewImpl not set in nativeUpdatePluginState");
- viewImpl->updatePluginState((WebCore::Frame*) framePtr, (WebCore::Node*) nodePtr,
- (PluginState) state);
-}
-
static void Pause(JNIEnv* env, jobject obj)
{
// This is called for the foreground tab when the browser is put to the
{ "nativeResume", "()V", (void*) Resume },
{ "nativeFreeMemory", "()V", (void*) FreeMemory },
{ "nativeSetJsFlags", "(Ljava/lang/String;)V", (void*) SetJsFlags },
- { "nativeUpdatePluginState", "(III)V", (void*) UpdatePluginState },
{ "nativeUpdateFrameCacheIfLoading", "()V",
(void*) UpdateFrameCacheIfLoading },
{ "nativeProvideVisitedHistory", "([Ljava/lang/String;)V",
jobject m_obj;
jmethodID m_clearTextEntry;
jmethodID m_overrideLoading;
- jmethodID m_sendPluginState;
jmethodID m_scrollBy;
jmethodID m_sendMoveMouse;
jmethodID m_sendMoveMouseIfLatest;
m_javaGlue.m_scrollBy = GetJMethod(env, clazz, "setContentScrollBy", "(IIZ)Z");
m_javaGlue.m_clearTextEntry = GetJMethod(env, clazz, "clearTextEntry", "()V");
m_javaGlue.m_overrideLoading = GetJMethod(env, clazz, "overrideLoading", "(Ljava/lang/String;)V");
- m_javaGlue.m_sendPluginState = GetJMethod(env, clazz, "sendPluginState", "(I)V");
m_javaGlue.m_sendMoveMouse = GetJMethod(env, clazz, "sendMoveMouse", "(IIII)V");
m_javaGlue.m_sendMoveMouseIfLatest = GetJMethod(env, clazz, "sendMoveMouseIfLatest", "(Z)V");
m_javaGlue.m_sendMotionUp = GetJMethod(env, clazz, "sendMotionUp", "(IIIII)V");
m_matches = 0;
m_hasCurrentLocation = false;
m_isFindPaintSetUp = false;
- m_pluginReceivesEvents = false; // initialization is the only time this
- // variable should be set directly, all
- // other changes should be made through
- // setPluginReceivesEvents(bool)
}
~WebView()
" bounds=(%d,%d,w=%d,h=%d)", node->index(), node->nodePointer(),
bounds.x(), bounds.y(), bounds.width(), bounds.height());
m_followedLink = false;
- setPluginReceivesEvents(false);
return;
}
- if (!node->hasCursorRing() || (m_pluginReceivesEvents && node->isPlugin()))
+ if (!node->hasCursorRing() || (node->isPlugin() && node->isFocus()))
return;
CursorRing::Flavor flavor = CursorRing::NORMAL_FLAVOR;
if (!isButton) {
#if DEBUG_NAV_UI
const WebCore::IntRect& ring = (*rings)[0];
DBG_NAV_LOGD("cursorNode=%d (nodePointer=%p) flavor=%s rings=%d"
- " (%d, %d, %d, %d) pluginReceivesEvents=%s isPlugin=%s",
+ " (%d, %d, %d, %d) isPlugin=%s",
node->index(), node->nodePointer(),
flavor == CursorRing::FAKE_FLAVOR ? "FAKE_FLAVOR" :
flavor == CursorRing::NORMAL_ANIMATING ? "NORMAL_ANIMATING" :
flavor == CursorRing::FAKE_ANIMATING ? "FAKE_ANIMATING" : "NORMAL_FLAVOR",
rings->size(), ring.x(), ring.y(), ring.width(), ring.height(),
- m_pluginReceivesEvents ? "true" : "false",
node->isPlugin() ? "true" : "false");
#endif
}
/* returns true if the key had no effect (neither scrolled nor changed cursor) */
bool moveCursor(int keyCode, int count, bool ignoreScroll)
{
- setPluginReceivesEvents(false);
CachedRoot* root = getFrameCache(AllowNewer);
if (!root) {
DBG_NAV_LOG("!root");
return result;
}
-bool pluginEatsNavKey()
-{
- CachedRoot* root = getFrameCache(DontAllowNewer);
- if (!root) {
- DBG_NAV_LOG("!root");
- return false;
- }
- const CachedNode* cursor = root->currentCursor();
- DBG_NAV_LOGD("cursor=%p isPlugin=%s pluginReceivesEvents=%s",
- cursor, cursor && cursor->isPlugin() ? "true" : "false",
- m_pluginReceivesEvents ? "true" : "false");
- // FIXME: check to see if plugin wants keys
- return cursor && cursor->isPlugin() && m_pluginReceivesEvents;
-}
-
void notifyProgressFinished()
{
DBG_NAV_LOGD("cursorIsTextInput=%d", cursorIsTextInput(DontAllowNewer));
0, x, y);
viewInvalidate();
clearTextEntry();
- setPluginReceivesEvents(false);
return pageScrolled;
}
DBG_NAV_LOGD("CachedNode:%p (%d) x=%d y=%d rx=%d ry=%d", result,
updateCursorBounds(root, frame, result);
root->setCursor(const_cast<CachedFrame*>(frame),
const_cast<CachedNode*>(result));
- updatePluginReceivesEvents();
CachedNodeType type = result->type();
if (type == NORMAL_CACHEDNODETYPE) {
sendMotionUp(
m_hasCurrentLocation = false;
}
-void setPluginReceivesEvents(bool value)
-{
- if (value == m_pluginReceivesEvents)
- return;
-
- //send message to plugin in webkit
- JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue.object(env);
- // if it is called during or after DESTROY is handled, the real object of
- // WebView can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue.m_sendPluginState,
- value ? kGainFocus_PluginState : kLoseFocus_PluginState);
- checkException(env);
- m_pluginReceivesEvents = value;
-}
-
-void updatePluginReceivesEvents()
-{
- CachedRoot* root = getFrameCache(DontAllowNewer);
- if (!root)
- return;
- const CachedNode* cursor = root->currentCursor();
- setPluginReceivesEvents(cursor && cursor->isPlugin());
- DBG_NAV_LOGD("m_pluginReceivesEvents=%s cursor=%p", m_pluginReceivesEvents
- ? "true" : "false", cursor);
-}
-
void setFollowedLink(bool followed)
{
if ((m_followedLink = followed) != false) {
int m_generation; // associate unique ID with sent kit focus to match with ui
SkPicture* m_navPictureUI;
bool m_followedLink;
- bool m_pluginReceivesEvents;
SkMSec m_ringAnimationEnd;
// Corresponds to the same-named boolean on the java side.
bool m_heightCanMeasure;
return node ? node->isPlugin() : false;
}
+static bool nativeFocusIsPlugin(JNIEnv *env, jobject obj)
+{
+ const CachedNode* node = getFocusNode(env, obj);
+ return node ? node->isPlugin() : false;
+}
+
static jint nativeFocusNodePointer(JNIEnv *env, jobject obj)
{
const CachedNode* node = getFocusNode(env, obj);
view->setFindIsUp(false);
}
-static void nativeUpdatePluginReceivesEvents(JNIEnv *env, jobject obj)
-{
- GET_NATIVE_VIEW(env, obj)->updatePluginReceivesEvents();
-}
-
static void nativeSetFollowedLink(JNIEnv *env, jobject obj, bool followed)
{
WebView* view = GET_NATIVE_VIEW(env, obj);
view->moveSelection(x, y, ex);
}
-static bool nativePluginEatsNavKey(JNIEnv *env, jobject obj)
-{
- return GET_NATIVE_VIEW(env, obj)->pluginEatsNavKey();
-}
-
static jobject nativeGetSelection(JNIEnv *env, jobject obj)
{
WebView* view = GET_NATIVE_VIEW(env, obj);
(void*) nativeFocusCandidateText },
{ "nativeFocusCandidateTextSize", "()I",
(void*) nativeFocusCandidateTextSize },
+ { "nativeFocusIsPlugin", "()Z",
+ (void*) nativeFocusIsPlugin },
{ "nativeFocusNodePointer", "()I",
(void*) nativeFocusNodePointer },
{ "nativeGetCursorRingBounds", "()Landroid/graphics/Rect;",
(void*) nativeMoveGeneration },
{ "nativeMoveSelection", "(IIZ)V",
(void*) nativeMoveSelection },
- { "nativePluginEatsNavKey", "()Z",
- (void*) nativePluginEatsNavKey },
{ "nativeRecordButtons", "(ZZZ)V",
(void*) nativeRecordButtons },
{ "nativeSelectBestAt", "(Landroid/graphics/Rect;)V",
(void*) nativeUpdateCachedTextfield },
{ "nativeGetBlockLeftEdge", "(IIF)I",
(void*) nativeGetBlockLeftEdge },
- { "nativeUpdatePluginReceivesEvents", "()V",
- (void*) nativeUpdatePluginReceivesEvents }
};
int register_webview(JNIEnv* env)