summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDerek Sollenberger <djsollen@google.com>2009-08-05 11:53:29 -0400
committerDerek Sollenberger <djsollen@google.com>2009-08-06 08:25:18 -0400
commit243869ecee2d4b5ab0f796fcc6692ece5b03c15e (patch)
tree7ed5135cf1a0427c6bfb48957680877233755921
parentcc42ddfc59bb9fa5aa3b916a27f682fa6fb128a0 (diff)
downloadexternal_webkit-243869ecee2d4b5ab0f796fcc6692ece5b03c15e.zip
external_webkit-243869ecee2d4b5ab0f796fcc6692ece5b03c15e.tar.gz
external_webkit-243869ecee2d4b5ab0f796fcc6692ece5b03c15e.tar.bz2
first cut at adding zoom support for plugins.
-rw-r--r--WebKit/android/plugins/PluginWidgetAndroid.cpp13
-rw-r--r--WebKit/android/plugins/PluginWidgetAndroid.h1
-rw-r--r--WebKit/android/plugins/android_npapi.h22
3 files changed, 29 insertions, 7 deletions
diff --git a/WebKit/android/plugins/PluginWidgetAndroid.cpp b/WebKit/android/plugins/PluginWidgetAndroid.cpp
index 72714b4..c947b3b 100644
--- a/WebKit/android/plugins/PluginWidgetAndroid.cpp
+++ b/WebKit/android/plugins/PluginWidgetAndroid.cpp
@@ -48,6 +48,7 @@ PluginWidgetAndroid::PluginWidgetAndroid(WebCore::PluginView* view)
m_requestedFrameRect.setEmpty();
m_visibleDocRect.setEmpty();
m_hasFocus = false;
+ m_zoomLevel = 0;
}
PluginWidgetAndroid::~PluginWidgetAndroid() {
@@ -222,7 +223,17 @@ ANPSurface* PluginWidgetAndroid::createSurface(ANPSurfaceType ignored) {
void PluginWidgetAndroid::setVisibleScreen(const ANPRectI& visibleDocRect, float zoom) {
- //TODO send an event to the plugin that communicates the 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);
+ }
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 c278ffb..151d6ef 100644
--- a/WebKit/android/plugins/PluginWidgetAndroid.h
+++ b/WebKit/android/plugins/PluginWidgetAndroid.h
@@ -147,6 +147,7 @@ private:
SkIRect m_requestedFrameRect;
OwnPtr<android::PluginSurface> m_surface;
bool m_hasFocus;
+ float m_zoomLevel;
/* We limit the number of rectangles to minimize storage and ensure adequate
speed.
diff --git a/WebKit/android/plugins/android_npapi.h b/WebKit/android/plugins/android_npapi.h
index 47a7494..f67d074 100644
--- a/WebKit/android/plugins/android_npapi.h
+++ b/WebKit/android/plugins/android_npapi.h
@@ -150,21 +150,22 @@ enum ANPDrawingModels {
};
typedef int32_t ANPDrawingModel;
-/** Request to receive/disable events. If the pointer is NULL then all input will
- be disabled. Otherwise, the input type will be enabled iff its corresponding
+/** Request to receive/disable events. If the pointer is NULL then all flags will
+ be disabled. Otherwise, the event type will be enabled iff its corresponding
bit in the EventFlags bit field is set.
NPN_SetValue(inst, ANPAcceptEvents, (void*)EventFlags)
*/
#define kAcceptEvents_ANPSetValue ((NPPVariable)1001)
-/* The EventFlags are a set of bits used to determine which types of input the
+/* The EventFlags are a set of bits used to determine which types of events the
plugin wishes to receive. For example, if the value is 0x03 then both key
and touch events will be provided to the plugin.
*/
enum ANPEventFlag {
- kKey_ANPEventFlag = 0x01,
- kTouch_ANPEventFlag = 0x02,
+ kKey_ANPEventFlag = 0x01,
+ kTouch_ANPEventFlag = 0x02,
+ kZoom_ANPEventFlag = 0x04, // triggers zoom & surface changed events
};
typedef uint32_t ANPEventFlags;
@@ -755,6 +756,11 @@ 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;
@@ -794,6 +800,9 @@ enum ANPLifecycleActions {
kGainFocus_ANPLifecycleAction = 2,
kLoseFocus_ANPLifecycleAction = 3,
kFreeMemory_ANPLifecycleAction = 4,
+ /** The page has finished loading. This happens when the page's top level
+ frame reports that it has completed loading.
+ */
kOnLoad_ANPLifecycleAction = 5,
};
typedef uint32_t ANPLifecycleAction;
@@ -868,7 +877,8 @@ struct ANPEvent {
} changed;
} data;
} surface;
- int32_t other[8];
+ float zoomLevel;
+ int32_t other[8];
} data;
};