summaryrefslogtreecommitdiffstats
path: root/WebKit/android
diff options
context:
space:
mode:
authorDerek Sollenberger <djsollen@google.com>2010-01-12 12:19:00 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2010-01-12 12:19:00 -0800
commit8752c4d3c7d623f1f6314e8b662d3626c849ca97 (patch)
tree6cf2a93e5584eec818237177f5fd1550e696d8fe /WebKit/android
parent4843cf010e538098e485802576b5a16d7f5cb5f1 (diff)
parentf8ffa7aeb28d4325cdeb0d7bddcf9397d761f97f (diff)
downloadexternal_webkit-8752c4d3c7d623f1f6314e8b662d3626c849ca97.zip
external_webkit-8752c4d3c7d623f1f6314e8b662d3626c849ca97.tar.gz
external_webkit-8752c4d3c7d623f1f6314e8b662d3626c849ca97.tar.bz2
am f8ffa7ae: Merge "adding event to notify the plugin when it is on/off screen." into eclair-mr2
Merge commit 'f8ffa7aeb28d4325cdeb0d7bddcf9397d761f97f' into eclair-mr2-plus-aosp * commit 'f8ffa7aeb28d4325cdeb0d7bddcf9397d761f97f': adding event to notify the plugin when it is on/off screen.
Diffstat (limited to 'WebKit/android')
-rw-r--r--WebKit/android/plugins/PluginWidgetAndroid.cpp13
-rw-r--r--WebKit/android/plugins/PluginWidgetAndroid.h1
-rw-r--r--WebKit/android/plugins/android_npapi.h10
3 files changed, 23 insertions, 1 deletions
diff --git a/WebKit/android/plugins/PluginWidgetAndroid.cpp b/WebKit/android/plugins/PluginWidgetAndroid.cpp
index 5ee3e0f..113a3bc 100644
--- a/WebKit/android/plugins/PluginWidgetAndroid.cpp
+++ b/WebKit/android/plugins/PluginWidgetAndroid.cpp
@@ -53,6 +53,7 @@ PluginWidgetAndroid::PluginWidgetAndroid(WebCore::PluginView* view)
m_pluginBounds.setEmpty();
m_hasFocus = false;
m_isFullScreen = false;
+ m_visible = true;
m_zoomLevel = 0;
m_embeddedView = NULL;
}
@@ -283,6 +284,18 @@ void PluginWidgetAndroid::setVisibleScreen(const ANPRectI& visibleDocRect, float
if (oldScreenW != newScreenW || oldScreenH != newScreenH)
computeVisibleFrameRect();
+
+ bool visible = SkIRect::Intersects(m_visibleDocRect, m_pluginBounds);
+ if(m_visible != visible) {
+ // change the visibility
+ m_visible = visible;
+ // send the event
+ ANPEvent event;
+ SkANP::InitEvent(&event, kLifecycle_ANPEventType);
+ event.data.lifecycle.action = visible ? kOnScreen_ANPLifecycleAction
+ : kOffScreen_ANPLifecycleAction;
+ sendEvent(event);
+ }
}
void PluginWidgetAndroid::setVisibleRects(const ANPRectI rects[], int32_t count) {
diff --git a/WebKit/android/plugins/PluginWidgetAndroid.h b/WebKit/android/plugins/PluginWidgetAndroid.h
index c7cccd1..93ad4a8 100644
--- a/WebKit/android/plugins/PluginWidgetAndroid.h
+++ b/WebKit/android/plugins/PluginWidgetAndroid.h
@@ -156,6 +156,7 @@ private:
SkIRect m_requestedFrameRect;
bool m_hasFocus;
bool m_isFullScreen;
+ bool m_visible;
float m_zoomLevel;
jobject m_embeddedView;
diff --git a/WebKit/android/plugins/android_npapi.h b/WebKit/android/plugins/android_npapi.h
index 10f7ac9..4173528 100644
--- a/WebKit/android/plugins/android_npapi.h
+++ b/WebKit/android/plugins/android_npapi.h
@@ -847,7 +847,7 @@ enum ANPLifecycleActions {
/** The web view containing this plugin has been paused. See documentation
on the android activity lifecycle for more information.
*/
- kPause_ANPLifecycleAction = 0,
+ kPause_ANPLifecycleAction = 0,
/** The web view containing this plugin has been resumed. See documentation
on the android activity lifecycle for more information.
*/
@@ -879,6 +879,14 @@ enum ANPLifecycleActions {
its original coordinates.
*/
kExitFullScreen_ANPLifecycleAction = 7,
+ /** The plugin is visible to the user on the screen. This event will always
+ occur after a kOffScreen_ANPLifecycleAction event.
+ */
+ kOnScreen_ANPLifecycleAction = 8,
+ /** The plugin is no longer visible to the user on the screen. This event
+ will always occur prior to an kOnScreen_ANPLifecycleAction event.
+ */
+ kOffScreen_ANPLifecycleAction = 9,
};
typedef uint32_t ANPLifecycleAction;