summaryrefslogtreecommitdiffstats
path: root/WebKit
diff options
context:
space:
mode:
authorDerek Sollenberger <djsollen@google.com>2009-08-07 11:17:15 -0400
committerDerek Sollenberger <djsollen@google.com>2009-08-07 11:17:15 -0400
commit41258a73c8673221dc99884672b8643987e1747e (patch)
treec2c2ce4aa9f364717beea7ad884c8f267ca02897 /WebKit
parentf23992e0665067a10a2769e62c9a41574793f7f2 (diff)
downloadexternal_webkit-41258a73c8673221dc99884672b8643987e1747e.zip
external_webkit-41258a73c8673221dc99884672b8643987e1747e.tar.gz
external_webkit-41258a73c8673221dc99884672b8643987e1747e.tar.bz2
enabling plugin surfaces to manually scale based on the zoom level.
Diffstat (limited to 'WebKit')
-rw-r--r--WebKit/android/plugins/ANPSurfaceInterface.cpp4
-rw-r--r--WebKit/android/plugins/PluginWidgetAndroid.cpp16
-rw-r--r--WebKit/android/plugins/PluginWidgetAndroid.h7
-rw-r--r--WebKit/android/plugins/android_npapi.h9
4 files changed, 11 insertions, 25 deletions
diff --git a/WebKit/android/plugins/ANPSurfaceInterface.cpp b/WebKit/android/plugins/ANPSurfaceInterface.cpp
index 835f45a..20df7f8 100644
--- a/WebKit/android/plugins/ANPSurfaceInterface.cpp
+++ b/WebKit/android/plugins/ANPSurfaceInterface.cpp
@@ -33,11 +33,11 @@
using namespace WebCore;
-static ANPSurface* anp_newSurface(NPP instance, ANPSurfaceType type) {
+static ANPSurface* anp_newSurface(NPP instance, ANPSurfaceType type, bool fixedSize) {
if (instance && instance->ndata) {
PluginView* view = static_cast<PluginView*>(instance->ndata);
PluginWidgetAndroid* widget = view->platformPluginWidget();
- return widget->createSurface(type);
+ return widget->createSurface(type, fixedSize);
}
return NULL;
}
diff --git a/WebKit/android/plugins/PluginWidgetAndroid.cpp b/WebKit/android/plugins/PluginWidgetAndroid.cpp
index 6e05360..f1f0a15 100644
--- a/WebKit/android/plugins/PluginWidgetAndroid.cpp
+++ b/WebKit/android/plugins/PluginWidgetAndroid.cpp
@@ -210,11 +210,11 @@ bool PluginWidgetAndroid::isAcceptingEvent(ANPEventFlag flag) {
return m_eventFlags & flag;
}
-ANPSurface* PluginWidgetAndroid::createSurface(ANPSurfaceType ignored) {
+ANPSurface* PluginWidgetAndroid::createSurface(ANPSurfaceType ignored, bool fixedSize) {
if (m_drawingModel != kSurface_ANPDrawingModel) {
return NULL;
}
- m_surface.set(new android::PluginSurface(this, !isAcceptingEvent(kZoom_ANPEventFlag)));
+ m_surface.set(new android::PluginSurface(this, fixedSize));
ANPSurface* surface = new ANPSurface;
surface->data = m_surface.get();
surface->type = ignored;
@@ -223,17 +223,7 @@ ANPSurface* PluginWidgetAndroid::createSurface(ANPSurfaceType ignored) {
void PluginWidgetAndroid::setVisibleScreen(const ANPRectI& visibleDocRect, float zoom) {
- //send an event to the plugin that communicates the zoom
- if (isAcceptingEvent(kZoom_ANPEventFlag) && m_zoomLevel != zoom) {
- //store the local zoom level
- m_zoomLevel = zoom;
-
- //trigger the event
- ANPEvent event;
- SkANP::InitEvent(&event, kZoomLevel_ANPEventType);
- event.data.zoomLevel = zoom;
- sendEvent(event);
- }
+ // TODO update the bitmap size based on the zoom? (for kBitmap_ANPDrawingModel)
int oldScreenW = m_visibleDocRect.width();
int oldScreenH = m_visibleDocRect.height();
diff --git a/WebKit/android/plugins/PluginWidgetAndroid.h b/WebKit/android/plugins/PluginWidgetAndroid.h
index 151d6ef..72e6660 100644
--- a/WebKit/android/plugins/PluginWidgetAndroid.h
+++ b/WebKit/android/plugins/PluginWidgetAndroid.h
@@ -112,9 +112,12 @@ struct PluginWidgetAndroid {
/* Create an ANPSurface that the plugin may draw in to. The drawing model
must be kSurface_ANPDrawingModel for this call to succeed. The type
- specifies what kind of pixel access will be available.
+ specifies what kind of pixel access will be available. If true the
+ fixedSize param signals that the browser will auto-scale the surface for
+ the plugin (e.g. in the case of zooming). If false the surface will be
+ resized when zoomed and the plugin must manually scale to the new size.
*/
- ANPSurface* createSurface(ANPSurfaceType type);
+ ANPSurface* createSurface(ANPSurfaceType type, bool fixedSize);
/* Notify the plugin of the currently visible screen coordinates (document
space) and the current zoom level.
diff --git a/WebKit/android/plugins/android_npapi.h b/WebKit/android/plugins/android_npapi.h
index f67d074..71890ea 100644
--- a/WebKit/android/plugins/android_npapi.h
+++ b/WebKit/android/plugins/android_npapi.h
@@ -165,7 +165,6 @@ typedef int32_t ANPDrawingModel;
enum ANPEventFlag {
kKey_ANPEventFlag = 0x01,
kTouch_ANPEventFlag = 0x02,
- kZoom_ANPEventFlag = 0x04, // triggers zoom & surface changed events
};
typedef uint32_t ANPEventFlags;
@@ -218,7 +217,7 @@ struct ANPSurfaceInterfaceV0 : ANPInterface {
/** Creates a new surface handle based on the given surface type. If the
given surface type is not supported then NULL is returned.
*/
- ANPSurface* (*newSurface)(NPP instance, ANPSurfaceType);
+ ANPSurface* (*newSurface)(NPP instance, ANPSurfaceType, bool fixedSize);
/** Given a valid surface handle (i.e. one created by calling newSurface)
the underlying surface is removed and the pointer is set to NULL.
*/
@@ -756,11 +755,6 @@ enum ANPEventTypes {
kDraw_ANPEventType = 4,
kLifecycle_ANPEventType = 5,
kSurface_ANPEventType = 6,
- /** Reports the current zoom level of the page. The event is only received
- if the plugin has specified that it wants to handle scaling the surface,
- by setting the kDynamicSurface_ANPEventFlag.
- */
- kZoomLevel_ANPEventType = 7,
};
typedef int32_t ANPEventType;
@@ -877,7 +871,6 @@ struct ANPEvent {
} changed;
} data;
} surface;
- float zoomLevel;
int32_t other[8];
} data;
};