summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DEPS2
-rw-r--r--webkit/glue/plugins/pepper_plugin_instance.cc90
-rw-r--r--webkit/glue/plugins/pepper_plugin_instance.h6
-rw-r--r--webkit/glue/plugins/pepper_scrollbar.cc6
4 files changed, 99 insertions, 5 deletions
diff --git a/DEPS b/DEPS
index de3afd0..d0cdfaf 100644
--- a/DEPS
+++ b/DEPS
@@ -158,7 +158,7 @@ deps = {
Var("libvpx_revision"),
"src/third_party/ppapi":
- "http://ppapi.googlecode.com/svn/trunk@133",
+ "http://ppapi.googlecode.com/svn/trunk@141",
"src/third_party/libjingle/source":
"http://libjingle.googlecode.com/svn/branches/nextsnap@" +
diff --git a/webkit/glue/plugins/pepper_plugin_instance.cc b/webkit/glue/plugins/pepper_plugin_instance.cc
index 7ddbcaf..197b386 100644
--- a/webkit/glue/plugins/pepper_plugin_instance.cc
+++ b/webkit/glue/plugins/pepper_plugin_instance.cc
@@ -14,6 +14,7 @@
#include "third_party/ppapi/c/pp_var.h"
#include "third_party/ppapi/c/ppb_instance.h"
#include "third_party/ppapi/c/ppp_instance.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h"
#include "third_party/WebKit/WebKit/chromium/public/WebDocument.h"
#include "third_party/WebKit/WebKit/chromium/public/WebElement.h"
#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
@@ -22,6 +23,7 @@
#include "third_party/WebKit/WebKit/chromium/public/WebRect.h"
#include "webkit/glue/plugins/pepper_device_context_2d.h"
#include "webkit/glue/plugins/pepper_event_conversion.h"
+#include "webkit/glue/plugins/pepper_image_data.h"
#include "webkit/glue/plugins/pepper_plugin_delegate.h"
#include "webkit/glue/plugins/pepper_plugin_module.h"
#include "webkit/glue/plugins/pepper_url_loader.h"
@@ -37,6 +39,64 @@ namespace pepper {
namespace {
+#define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, np_name) \
+ COMPILE_ASSERT(int(WebCursorInfo::webkit_name) == int(np_name), \
+ mismatching_enums)
+
+COMPILE_ASSERT_MATCHING_ENUM(TypePointer, PP_CURSORTYPE_POINTER);
+COMPILE_ASSERT_MATCHING_ENUM(TypeCross, PP_CURSORTYPE_CROSS);
+COMPILE_ASSERT_MATCHING_ENUM(TypeHand, PP_CURSORTYPE_HAND);
+COMPILE_ASSERT_MATCHING_ENUM(TypeIBeam, PP_CURSORTYPE_IBEAM);
+COMPILE_ASSERT_MATCHING_ENUM(TypeWait, PP_CURSORTYPE_WAIT);
+COMPILE_ASSERT_MATCHING_ENUM(TypeHelp, PP_CURSORTYPE_HELP);
+COMPILE_ASSERT_MATCHING_ENUM(TypeEastResize, PP_CURSORTYPE_EASTRESIZE);
+COMPILE_ASSERT_MATCHING_ENUM(TypeNorthResize, PP_CURSORTYPE_NORTHRESIZE);
+COMPILE_ASSERT_MATCHING_ENUM(TypeNorthEastResize,
+ PP_CURSORTYPE_NORTHEASTRESIZE);
+COMPILE_ASSERT_MATCHING_ENUM(TypeNorthWestResize,
+ PP_CURSORTYPE_NORTHWESTRESIZE);
+COMPILE_ASSERT_MATCHING_ENUM(TypeSouthResize, PP_CURSORTYPE_SOUTHRESIZE);
+COMPILE_ASSERT_MATCHING_ENUM(TypeSouthEastResize,
+ PP_CURSORTYPE_SOUTHEASTRESIZE);
+COMPILE_ASSERT_MATCHING_ENUM(TypeSouthWestResize,
+ PP_CURSORTYPE_SOUTHWESTRESIZE);
+COMPILE_ASSERT_MATCHING_ENUM(TypeWestResize, PP_CURSORTYPE_WESTRESIZE);
+COMPILE_ASSERT_MATCHING_ENUM(TypeNorthSouthResize,
+ PP_CURSORTYPE_NORTHSOUTHRESIZE);
+COMPILE_ASSERT_MATCHING_ENUM(TypeEastWestResize, PP_CURSORTYPE_EASTWESTRESIZE);
+COMPILE_ASSERT_MATCHING_ENUM(TypeNorthEastSouthWestResize,
+ PP_CURSORTYPE_NORTHEASTSOUTHWESTRESIZE);
+COMPILE_ASSERT_MATCHING_ENUM(TypeNorthWestSouthEastResize,
+ PP_CURSORTYPE_NORTHWESTSOUTHEASTRESIZE);
+COMPILE_ASSERT_MATCHING_ENUM(TypeColumnResize, PP_CURSORTYPE_COLUMNRESIZE);
+COMPILE_ASSERT_MATCHING_ENUM(TypeRowResize, PP_CURSORTYPE_ROWRESIZE);
+COMPILE_ASSERT_MATCHING_ENUM(TypeMiddlePanning, PP_CURSORTYPE_MIDDLEPANNING);
+COMPILE_ASSERT_MATCHING_ENUM(TypeEastPanning, PP_CURSORTYPE_EASTPANNING);
+COMPILE_ASSERT_MATCHING_ENUM(TypeNorthPanning, PP_CURSORTYPE_NORTHPANNING);
+COMPILE_ASSERT_MATCHING_ENUM(TypeNorthEastPanning,
+ PP_CURSORTYPE_NORTHEASTPANNING);
+COMPILE_ASSERT_MATCHING_ENUM(TypeNorthWestPanning,
+ PP_CURSORTYPE_NORTHWESTPANNING);
+COMPILE_ASSERT_MATCHING_ENUM(TypeSouthPanning, PP_CURSORTYPE_SOUTHPANNING);
+COMPILE_ASSERT_MATCHING_ENUM(TypeSouthEastPanning,
+ PP_CURSORTYPE_SOUTHEASTPANNING);
+COMPILE_ASSERT_MATCHING_ENUM(TypeSouthWestPanning,
+ PP_CURSORTYPE_SOUTHWESTPANNING);
+COMPILE_ASSERT_MATCHING_ENUM(TypeWestPanning, PP_CURSORTYPE_WESTPANNING);
+COMPILE_ASSERT_MATCHING_ENUM(TypeMove, PP_CURSORTYPE_MOVE);
+COMPILE_ASSERT_MATCHING_ENUM(TypeVerticalText, PP_CURSORTYPE_VERTICALTEXT);
+COMPILE_ASSERT_MATCHING_ENUM(TypeCell, PP_CURSORTYPE_CELL);
+COMPILE_ASSERT_MATCHING_ENUM(TypeContextMenu, PP_CURSORTYPE_CONTEXTMENU);
+COMPILE_ASSERT_MATCHING_ENUM(TypeAlias, PP_CURSORTYPE_ALIAS);
+COMPILE_ASSERT_MATCHING_ENUM(TypeProgress, PP_CURSORTYPE_PROGRESS);
+COMPILE_ASSERT_MATCHING_ENUM(TypeNoDrop, PP_CURSORTYPE_NODROP);
+COMPILE_ASSERT_MATCHING_ENUM(TypeCopy, PP_CURSORTYPE_COPY);
+COMPILE_ASSERT_MATCHING_ENUM(TypeNone, PP_CURSORTYPE_NONE);
+COMPILE_ASSERT_MATCHING_ENUM(TypeNotAllowed, PP_CURSORTYPE_NOTALLOWED);
+COMPILE_ASSERT_MATCHING_ENUM(TypeZoomIn, PP_CURSORTYPE_ZOOMIN);
+COMPILE_ASSERT_MATCHING_ENUM(TypeZoomOut, PP_CURSORTYPE_ZOOMOUT);
+COMPILE_ASSERT_MATCHING_ENUM(TypeCustom, PP_CURSORTYPE_CUSTOM);
+
void RectToPPRect(const gfx::Rect& input, PP_Rect* output) {
*output = PP_MakeRectFromXYWH(input.x(), input.y(),
input.width(), input.height());
@@ -70,11 +130,31 @@ bool IsFullFrame(PP_Instance instance_id) {
return instance->full_frame();
}
+bool SetCursor(PP_Instance instance_id,
+ PP_CursorType type,
+ PP_Resource custom_image_id,
+ const PP_Point* hot_spot) {
+ PluginInstance* instance = PluginInstance::FromPPInstance(instance_id);
+ if (!instance)
+ return false;
+
+ scoped_refptr<ImageData> custom_image(
+ Resource::GetAs<ImageData>(custom_image_id));
+ if (custom_image.get()) {
+ // TODO: implement custom cursors.
+ NOTIMPLEMENTED();
+ return false;
+ }
+
+ return instance->SetCursor(type);
+}
+
const PPB_Instance ppb_instance = {
&GetWindowObject,
&GetOwnerElementObject,
&BindGraphicsDeviceContext,
&IsFullFrame,
+ &SetCursor,
};
} // namespace
@@ -170,6 +250,11 @@ bool PluginInstance::BindGraphicsDeviceContext(PP_Resource device_id) {
return true;
}
+bool PluginInstance::SetCursor(PP_CursorType type) {
+ cursor_.reset(new WebCursorInfo(static_cast<WebCursorInfo::Type>(type)));
+ return true;
+}
+
void PluginInstance::Delete() {
instance_interface_->Delete(GetPPInstance());
@@ -210,7 +295,10 @@ bool PluginInstance::HandleInputEvent(const WebKit::WebInputEvent& event,
if (!pp_event.get())
return false;
- return instance_interface_->HandleEvent(GetPPInstance(), pp_event.get());
+ bool rv = instance_interface_->HandleEvent(GetPPInstance(), pp_event.get());
+ if (cursor_.get())
+ *cursor_info = *cursor_;
+ return rv;
}
PP_Var PluginInstance::GetInstanceObject() {
diff --git a/webkit/glue/plugins/pepper_plugin_instance.h b/webkit/glue/plugins/pepper_plugin_instance.h
index 8de9090..f24fa05 100644
--- a/webkit/glue/plugins/pepper_plugin_instance.h
+++ b/webkit/glue/plugins/pepper_plugin_instance.h
@@ -10,8 +10,10 @@
#include "base/basictypes.h"
#include "base/ref_counted.h"
+#include "base/scoped_ptr.h"
#include "base/string16.h"
#include "gfx/rect.h"
+#include "third_party/ppapi/c/pp_cursor_type.h"
#include "third_party/ppapi/c/pp_instance.h"
#include "third_party/ppapi/c/pp_resource.h"
#include "third_party/WebKit/WebKit/chromium/public/WebCanvas.h"
@@ -77,6 +79,7 @@ class PluginInstance : public base::RefCounted<PluginInstance> {
PP_Var GetOwnerElementObject();
bool BindGraphicsDeviceContext(PP_Resource device_id);
bool full_frame() const { return full_frame_; }
+ bool SetCursor(PP_CursorType type);
// PPP_Instance pass-through.
void Delete();
@@ -133,6 +136,9 @@ class PluginInstance : public base::RefCounted<PluginInstance> {
// The id of the current find operation, or -1 if none is in process.
int find_identifier_;
+ // Containes the cursor if it's set by the plugin.
+ scoped_ptr<WebKit::WebCursorInfo> cursor_;
+
DISALLOW_COPY_AND_ASSIGN(PluginInstance);
};
diff --git a/webkit/glue/plugins/pepper_scrollbar.cc b/webkit/glue/plugins/pepper_scrollbar.cc
index ecca72e..155bd64 100644
--- a/webkit/glue/plugins/pepper_scrollbar.cc
+++ b/webkit/glue/plugins/pepper_scrollbar.cc
@@ -137,11 +137,11 @@ void Scrollbar::ScrollBy(PP_ScrollBy unit, int32_t multiplier) {
float fmultiplier = 1.0;
WebScrollbar::ScrollGranularity granularity;
- if (unit == PP_WIDGET_SCROLL_BY_LINE) {
+ if (unit == PP_SCROLLBY_LINE) {
granularity = WebScrollbar::ScrollByLine;
- } else if (unit == PP_WIDGET_SCROLL_BY_PAGE) {
+ } else if (unit == PP_SCROLLBY_PAGE) {
granularity = WebScrollbar::ScrollByPage;
- } else if (unit == PP_WIDGET_SCROLL_BY_DOCUMENT) {
+ } else if (unit == PP_SCROLLBY_DOCUMENT) {
granularity = WebScrollbar::ScrollByDocument;
} else {
granularity = WebScrollbar::ScrollByPixel;