summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDerek Sollenberger <djsollen@google.com>2011-01-19 13:34:23 -0500
committerDerek Sollenberger <djsollen@google.com>2011-01-19 13:53:54 -0500
commit2cd8cb1433fe8d27130b9a2676ed266797e9cc2e (patch)
tree7dbb96564c002e0e1f7d33b2eb1faf0dc8caeb11
parentd10917eefc01ed269cafbf7eeaca0ba3d3cf9c3b (diff)
downloadexternal_webkit-2cd8cb1433fe8d27130b9a2676ed266797e9cc2e.zip
external_webkit-2cd8cb1433fe8d27130b9a2676ed266797e9cc2e.tar.gz
external_webkit-2cd8cb1433fe8d27130b9a2676ed266797e9cc2e.tar.bz2
Trigger OnScreen events when the page loads.
bug: 3368632 Change-Id: I13dbf1c809f32887f5d659e6fead60a61110eddd
-rw-r--r--WebKit/android/jni/WebViewCore.cpp21
-rw-r--r--WebKit/android/jni/WebViewCore.h5
-rw-r--r--WebKit/android/plugins/PluginWidgetAndroid.cpp2
3 files changed, 22 insertions, 6 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index de85f19..8907794 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -1854,6 +1854,8 @@ void WebViewCore::notifyPluginsOnFrameLoad(const Frame* frame) {
SkANP::InitEvent(&event, kLifecycle_ANPEventType);
event.data.lifecycle.action = kOnLoad_ANPLifecycleAction;
sendPluginEvent(event);
+ // trigger the on/off screen notification if the page was reloaded
+ sendPluginVisibleScreen();
}
// else if frame's parent has completed
else if (!frame->tree()->parent()->loader()->isLoading()) {
@@ -1868,6 +1870,12 @@ void WebViewCore::notifyPluginsOnFrameLoad(const Frame* frame) {
SkANP::InitEvent(&event, kLifecycle_ANPEventType);
event.data.lifecycle.action = kOnLoad_ANPLifecycleAction;
(*iter)->sendEvent(event);
+
+ // trigger the on/off screen notification if the page was reloaded
+ ANPRectI visibleRect;
+ getVisibleScreen(visibleRect);
+ (*iter)->setVisibleScreen(visibleRect, m_scale);
+
break;
}
currentFrame = currentFrame->tree()->parent();
@@ -1876,6 +1884,14 @@ void WebViewCore::notifyPluginsOnFrameLoad(const Frame* frame) {
}
}
+void WebViewCore::getVisibleScreen(ANPRectI& visibleRect)
+{
+ visibleRect.left = m_scrollOffsetX;
+ visibleRect.top = m_scrollOffsetY;
+ visibleRect.right = m_scrollOffsetX + m_screenWidth;
+ visibleRect.bottom = m_scrollOffsetY + m_screenHeight;
+}
+
void WebViewCore::sendPluginVisibleScreen()
{
/* We may want to cache the previous values and only send the notification
@@ -1883,10 +1899,7 @@ void WebViewCore::sendPluginVisibleScreen()
*/
ANPRectI visibleRect;
- visibleRect.left = m_scrollOffsetX;
- visibleRect.top = m_scrollOffsetY;
- visibleRect.right = m_scrollOffsetX + m_screenWidth;
- visibleRect.bottom = m_scrollOffsetY + m_screenHeight;
+ getVisibleScreen(visibleRect);
PluginWidgetAndroid** iter = m_plugins.begin();
PluginWidgetAndroid** stop = m_plugins.end();
diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h
index 4d1110f..161b046 100644
--- a/WebKit/android/jni/WebViewCore.h
+++ b/WebKit/android/jni/WebViewCore.h
@@ -444,9 +444,12 @@ namespace android {
// send the current screen size/zoom to all of the plugins in our list
void sendPluginVisibleScreen();
- // send onLoad event to plugins who are descendents of the given frame
+ // send onLoad event to plugins who are descendents of the given frame
void notifyPluginsOnFrameLoad(const Frame*);
+ // gets a rect representing the current on-screen portion of the document
+ void getVisibleScreen(ANPRectI&);
+
// send this event to all of the plugins in our list
void sendPluginEvent(const ANPEvent&);
diff --git a/WebKit/android/plugins/PluginWidgetAndroid.cpp b/WebKit/android/plugins/PluginWidgetAndroid.cpp
index b995f17..7c779c1 100644
--- a/WebKit/android/plugins/PluginWidgetAndroid.cpp
+++ b/WebKit/android/plugins/PluginWidgetAndroid.cpp
@@ -65,7 +65,7 @@ PluginWidgetAndroid::PluginWidgetAndroid(WebCore::PluginView* view)
m_pluginBounds.setEmpty();
m_hasFocus = false;
m_isFullScreen = false;
- m_visible = true;
+ m_visible = false;
m_zoomLevel = 0;
m_embeddedView = NULL;
m_embeddedViewAttached = false;