summaryrefslogtreecommitdiffstats
path: root/WebKit/android/plugins/PluginWidgetAndroid.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/android/plugins/PluginWidgetAndroid.cpp')
-rw-r--r--WebKit/android/plugins/PluginWidgetAndroid.cpp32
1 files changed, 28 insertions, 4 deletions
diff --git a/WebKit/android/plugins/PluginWidgetAndroid.cpp b/WebKit/android/plugins/PluginWidgetAndroid.cpp
index 4dc12a3..06506ba 100644
--- a/WebKit/android/plugins/PluginWidgetAndroid.cpp
+++ b/WebKit/android/plugins/PluginWidgetAndroid.cpp
@@ -132,7 +132,19 @@ void PluginWidgetAndroid::setWindow(NPWindow* window, bool isTransparent) {
m_pluginBounds.fRight, m_pluginBounds.fBottom);
const bool boundsChanged = m_pluginBounds != oldPluginBounds;
- sendSizeAndVisibilityEvents(boundsChanged);
+
+ //TODO hack to ensure that we grab the most recent screen dimensions and scale
+ ANPRectI screenCoords;
+ m_core->getVisibleScreen(screenCoords);
+ float scale = m_core->scale();
+ bool scaleChanged = m_cachedZoomLevel != scale;
+ setVisibleScreen(screenCoords, scale);
+
+ // if the scale changed then setVisibleScreen will call this function and
+ // this call will potentially fire a duplicate draw event
+ if (!scaleChanged) {
+ sendSizeAndVisibilityEvents(boundsChanged);
+ }
layoutSurface(boundsChanged);
if (m_drawingModel != kSurface_ANPDrawingModel) {
@@ -144,8 +156,14 @@ void PluginWidgetAndroid::setWindow(NPWindow* window, bool isTransparent) {
bool PluginWidgetAndroid::setDrawingModel(ANPDrawingModel model) {
- if (model == kOpenGL_ANPDrawingModel && m_layer == 0)
- m_layer = new WebCore::MediaLayer();
+ if (model == kOpenGL_ANPDrawingModel && m_layer == 0) {
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
+ jobject webview = m_core->getWebViewJavaObject();
+ jobject weakWebViewRef = 0;
+ if (webview)
+ weakWebViewRef = env->NewWeakGlobalRef(webview);
+ m_layer = new WebCore::MediaLayer(weakWebViewRef);
+ }
else if (model != kOpenGL_ANPDrawingModel && m_layer != 0)
m_layer->unref();
@@ -192,6 +210,12 @@ void PluginWidgetAndroid::inval(const WebCore::IntRect& rect,
}
}
+void PluginWidgetAndroid::viewInvalidate() {
+ WebCore::IntRect rect(m_pluginBounds.fLeft, m_pluginBounds.fTop,
+ m_pluginBounds.width(), m_pluginBounds.height());
+ m_core->viewInvalidate(rect);
+}
+
void PluginWidgetAndroid::draw(SkCanvas* canvas) {
if (NULL == m_flipPixelRef || !m_flipPixelRef->isDirty()) {
return;
@@ -563,7 +587,7 @@ void PluginWidgetAndroid::scrollToVisiblePluginRect() {
#if DEBUG_VISIBLE_RECTS
PLUGIN_LOG("%s call scrollBy (%d,%d)", __FUNCTION__, deltaX, deltaY);
#endif
- core->scrollBy(deltaX, deltaY, true);
+ core->scrollTo(rectCenterX, rectCenterY, true);
}
void PluginWidgetAndroid::requestFullScreen() {