summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/c/dev/ppb_scrollbar_dev.h30
-rw-r--r--ppapi/c/dev/ppp_scrollbar_dev.h10
-rw-r--r--ppapi/cpp/dev/scrollbar_dev.cc7
-rw-r--r--ppapi/cpp/dev/scrollbar_dev.h1
-rw-r--r--ppapi/cpp/dev/widget_client_dev.cc12
-rw-r--r--ppapi/cpp/dev/widget_client_dev.h7
-rw-r--r--ppapi/cpp/instance.h1
-rw-r--r--ppapi/tests/test_scrollbar.cc4
-rw-r--r--ppapi/tests/test_scrollbar.h2
-rw-r--r--ppapi/thunk/ppb_scrollbar_api.h1
-rw-r--r--ppapi/thunk/ppb_scrollbar_thunk.cc12
-rw-r--r--ppapi/thunk/thunk.h4
12 files changed, 81 insertions, 10 deletions
diff --git a/ppapi/c/dev/ppb_scrollbar_dev.h b/ppapi/c/dev/ppb_scrollbar_dev.h
index be51b58..bf892a5 100644
--- a/ppapi/c/dev/ppb_scrollbar_dev.h
+++ b/ppapi/c/dev/ppb_scrollbar_dev.h
@@ -23,11 +23,12 @@ PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_ScrollBy_Dev, 4);
#define PPB_SCROLLBAR_DEV_INTERFACE_0_3 "PPB_Scrollbar(Dev);0.3"
#define PPB_SCROLLBAR_DEV_INTERFACE_0_4 "PPB_Scrollbar(Dev);0.4"
-#define PPB_SCROLLBAR_DEV_INTERFACE PPB_SCROLLBAR_DEV_INTERFACE_0_4
+#define PPB_SCROLLBAR_DEV_INTERFACE_0_5 "PPB_Scrollbar(Dev);0.5"
+#define PPB_SCROLLBAR_DEV_INTERFACE PPB_SCROLLBAR_DEV_INTERFACE_0_5
// The interface for a scrollbar. A scrollbar is a widget, so the functions
// in PPB_Widget can also be used with scrollbar objects.
-struct PPB_Scrollbar_0_4_Dev {
+struct PPB_Scrollbar_0_5_Dev {
// Create a new scrollbar. Returns 0 if the instance is invalid.
PP_Resource (*Create)(PP_Instance instance,
PP_Bool vertical);
@@ -39,6 +40,9 @@ struct PPB_Scrollbar_0_4_Dev {
// Gets the thickness of a scrollbar.
uint32_t (*GetThickness)(PP_Resource resource);
+ // Returns PP_TRUE if the system scrollbar style is an overlap scrollbar.
+ PP_Bool (*IsOverlay)(PP_Resource scrollbar);
+
// Get/set the value of the scrollbar.
uint32_t (*GetValue)(PP_Resource scrollbar);
@@ -64,6 +68,25 @@ struct PPB_Scrollbar_0_4_Dev {
int32_t multiplier);
};
+// Old version without IsOverlay.
+struct PPB_Scrollbar_0_4_Dev {
+ PP_Resource (*Create)(PP_Instance instance,
+ PP_Bool vertical);
+ PP_Bool (*IsScrollbar)(PP_Resource resource);
+ uint32_t (*GetThickness)(PP_Resource resource);
+ uint32_t (*GetValue)(PP_Resource scrollbar);
+ void (*SetValue)(PP_Resource scrollbar,
+ uint32_t value);
+ void (*SetDocumentSize)(PP_Resource scrollbar,
+ uint32_t size);
+ void (*SetTickMarks)(PP_Resource scrollbar,
+ const struct PP_Rect* tick_marks,
+ uint32_t count);
+ void (*ScrollBy)(PP_Resource scrollbar,
+ PP_ScrollBy_Dev unit,
+ int32_t multiplier);
+};
+
// Old version with no resource argument to GetThickness.
struct PPB_Scrollbar_0_3_Dev {
PP_Resource (*Create)(PP_Instance instance,
@@ -83,7 +106,6 @@ struct PPB_Scrollbar_0_3_Dev {
int32_t multiplier);
};
-typedef struct PPB_Scrollbar_0_4_Dev PPB_Scrollbar_Dev;
+typedef struct PPB_Scrollbar_0_5_Dev PPB_Scrollbar_Dev;
#endif /* PPAPI_C_DEV_PPB_SCROLLBAR_DEV_H_ */
-
diff --git a/ppapi/c/dev/ppp_scrollbar_dev.h b/ppapi/c/dev/ppp_scrollbar_dev.h
index 2a8483e..ce0a8f6 100644
--- a/ppapi/c/dev/ppp_scrollbar_dev.h
+++ b/ppapi/c/dev/ppp_scrollbar_dev.h
@@ -5,18 +5,26 @@
#ifndef PPAPI_C_DEV_PPP_SCROLLBAR_DEV_H_
#define PPAPI_C_DEV_PPP_SCROLLBAR_DEV_H_
+#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_stdint.h"
// Interface for the plugin to implement when using a scrollbar widget.
-#define PPP_SCROLLBAR_DEV_INTERFACE "PPP_Scrollbar(Dev);0.2"
+#define PPP_SCROLLBAR_DEV_INTERFACE_0_2 "PPP_Scrollbar(Dev);0.2"
+#define PPP_SCROLLBAR_DEV_INTERFACE_0_3 "PPP_Scrollbar(Dev);0.3"
+#define PPP_SCROLLBAR_DEV_INTERFACE PPP_SCROLLBAR_DEV_INTERFACE_0_3
struct PPP_Scrollbar_Dev {
// Informs the instance that the scrollbar's value has changed.
void (*ValueChanged)(PP_Instance instance,
PP_Resource scrollbar,
uint32_t value);
+
+ // Informs the instance that the user has changed the system scrollbar style.
+ void (*OverlayChanged)(PP_Instance instance,
+ PP_Resource scrollbar,
+ PP_Bool overlay);
};
#endif /* PPAPI_C_DEV_PPP_SCROLLBAR_DEV_H_ */
diff --git a/ppapi/cpp/dev/scrollbar_dev.cc b/ppapi/cpp/dev/scrollbar_dev.cc
index 1f873c0..dc133a9 100644
--- a/ppapi/cpp/dev/scrollbar_dev.cc
+++ b/ppapi/cpp/dev/scrollbar_dev.cc
@@ -41,6 +41,13 @@ uint32_t Scrollbar_Dev::GetThickness() {
return get_interface<PPB_Scrollbar_Dev>()->GetThickness(pp_resource());
}
+bool Scrollbar_Dev::IsOverlay() {
+ if (!has_interface<PPB_Scrollbar_Dev>())
+ return false;
+ return
+ PP_ToBool(get_interface<PPB_Scrollbar_Dev>()->IsOverlay(pp_resource()));
+}
+
uint32_t Scrollbar_Dev::GetValue() {
if (!has_interface<PPB_Scrollbar_Dev>())
return 0;
diff --git a/ppapi/cpp/dev/scrollbar_dev.h b/ppapi/cpp/dev/scrollbar_dev.h
index c742a9b..f7944e9 100644
--- a/ppapi/cpp/dev/scrollbar_dev.h
+++ b/ppapi/cpp/dev/scrollbar_dev.h
@@ -26,6 +26,7 @@ class Scrollbar_Dev : public Widget_Dev {
// PPB_Scrollbar methods:
uint32_t GetThickness();
+ bool IsOverlay();
uint32_t GetValue();
void SetValue(uint32_t value);
void SetDocumentSize(uint32_t size);
diff --git a/ppapi/cpp/dev/widget_client_dev.cc b/ppapi/cpp/dev/widget_client_dev.cc
index 8407810..9f53983 100644
--- a/ppapi/cpp/dev/widget_client_dev.cc
+++ b/ppapi/cpp/dev/widget_client_dev.cc
@@ -51,8 +51,20 @@ void Scrollbar_ValueChanged(PP_Instance instance,
Scrollbar_Dev(scrollbar_id), value);
}
+void Scrollbar_OverlayChanged(PP_Instance instance,
+ PP_Resource scrollbar_id,
+ PP_Bool overlay) {
+ void* object =
+ pp::Instance::GetPerInstanceObject(instance, kPPPScrollbarInterface);
+ if (!object)
+ return;
+ return static_cast<WidgetClient_Dev*>(object)->ScrollbarOverlayChanged(
+ Scrollbar_Dev(scrollbar_id), PP_ToBool(overlay));
+}
+
static PPP_Scrollbar_Dev scrollbar_interface = {
&Scrollbar_ValueChanged,
+ &Scrollbar_OverlayChanged,
};
} // namespace
diff --git a/ppapi/cpp/dev/widget_client_dev.h b/ppapi/cpp/dev/widget_client_dev.h
index a8910e8..c865621 100644
--- a/ppapi/cpp/dev/widget_client_dev.h
+++ b/ppapi/cpp/dev/widget_client_dev.h
@@ -35,6 +35,13 @@ class WidgetClient_Dev {
virtual void ScrollbarValueChanged(Scrollbar_Dev scrollbar,
uint32_t value) = 0;
+ /**
+ * Notification that the given scrollbar's overlay type has changed. This is
+ * the implementation for PPP_Scrollbar_Dev.
+ */
+ virtual void ScrollbarOverlayChanged(Scrollbar_Dev scrollbar,
+ bool type) = 0;
+
private:
Instance* associated_instance_;
};
diff --git a/ppapi/cpp/instance.h b/ppapi/cpp/instance.h
index 1f4bba4..caeb669 100644
--- a/ppapi/cpp/instance.h
+++ b/ppapi/cpp/instance.h
@@ -31,7 +31,6 @@ class Resource;
class Surface3D_Dev;
class URLLoader;
class Var;
-class Widget_Dev;
class Instance {
public:
diff --git a/ppapi/tests/test_scrollbar.cc b/ppapi/tests/test_scrollbar.cc
index 2aa658a..3b38dd8 100644
--- a/ppapi/tests/test_scrollbar.cc
+++ b/ppapi/tests/test_scrollbar.cc
@@ -60,3 +60,7 @@ void TestScrollbar::ScrollbarValueChanged(pp::Scrollbar_Dev scrollbar,
if (scrollbar == scrollbar_)
scrollbar_value_changed_ = true;
}
+
+void TestScrollbar::ScrollbarOverlayChanged(pp::Scrollbar_Dev scrollbar,
+ bool type) {
+}
diff --git a/ppapi/tests/test_scrollbar.h b/ppapi/tests/test_scrollbar.h
index 5211f97..a83194d 100644
--- a/ppapi/tests/test_scrollbar.h
+++ b/ppapi/tests/test_scrollbar.h
@@ -26,6 +26,8 @@ class TestScrollbar : public TestCase,
const pp::Rect& dirty_rect);
virtual void ScrollbarValueChanged(pp::Scrollbar_Dev scrollbar,
uint32_t value);
+ virtual void ScrollbarOverlayChanged(pp::Scrollbar_Dev scrollbar,
+ bool type);
pp::Scrollbar_Dev scrollbar_;
bool scrollbar_value_changed_;
diff --git a/ppapi/thunk/ppb_scrollbar_api.h b/ppapi/thunk/ppb_scrollbar_api.h
index 05b3c17..042eec8 100644
--- a/ppapi/thunk/ppb_scrollbar_api.h
+++ b/ppapi/thunk/ppb_scrollbar_api.h
@@ -15,6 +15,7 @@ class PPB_Scrollbar_API {
virtual ~PPB_Scrollbar_API() {}
virtual uint32_t GetThickness() = 0;
+ virtual bool IsOverlay() = 0;
virtual uint32_t GetValue() = 0;
virtual void SetValue(uint32_t value) = 0;
virtual void SetDocumentSize(uint32_t size) = 0;
diff --git a/ppapi/thunk/ppb_scrollbar_thunk.cc b/ppapi/thunk/ppb_scrollbar_thunk.cc
index 7b67db2..6e66483 100644
--- a/ppapi/thunk/ppb_scrollbar_thunk.cc
+++ b/ppapi/thunk/ppb_scrollbar_thunk.cc
@@ -33,6 +33,13 @@ uint32_t GetThickness(PP_Resource scrollbar) {
return enter.object()->GetThickness();
}
+PP_Bool IsOverlay(PP_Resource scrollbar) {
+ EnterScrollbar enter(scrollbar, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return PP_FromBool(enter.object()->IsOverlay());
+}
+
uint32_t GetValue(PP_Resource scrollbar) {
EnterScrollbar enter(scrollbar, true);
if (enter.failed())
@@ -66,10 +73,11 @@ void ScrollBy(PP_Resource scrollbar, PP_ScrollBy_Dev unit, int32_t multiplier) {
enter.object()->ScrollBy(unit, multiplier);
}
-const PPB_Scrollbar_0_4_Dev g_ppb_scrollbar_thunk = {
+const PPB_Scrollbar_0_5_Dev g_ppb_scrollbar_thunk = {
&Create,
&IsScrollbar,
&GetThickness,
+ &IsOverlay,
&GetValue,
&SetValue,
&SetDocumentSize,
@@ -79,7 +87,7 @@ const PPB_Scrollbar_0_4_Dev g_ppb_scrollbar_thunk = {
} // namespace
-const PPB_Scrollbar_0_4_Dev* GetPPB_Scrollbar_Thunk() {
+const PPB_Scrollbar_0_5_Dev* GetPPB_Scrollbar_Thunk() {
return &g_ppb_scrollbar_thunk;
}
diff --git a/ppapi/thunk/thunk.h b/ppapi/thunk/thunk.h
index ac0008e..c7ac742 100644
--- a/ppapi/thunk/thunk.h
+++ b/ppapi/thunk/thunk.h
@@ -40,7 +40,7 @@ struct PPB_LayerCompositor_Dev;
struct PPB_Messaging;
struct PPB_MouseInputEvent;
struct PPB_QueryPolicy_Dev;
-struct PPB_Scrollbar_0_4_Dev;
+struct PPB_Scrollbar_0_5_Dev;
struct PPB_Surface3D_Dev;
struct PPB_Transport_Dev;
struct PPB_URLLoader;
@@ -95,7 +95,7 @@ const PPB_LayerCompositor_Dev* GetPPB_LayerCompositor_Thunk();
const PPB_QueryPolicy_Dev* GetPPB_QueryPolicy_Thunk();
const PPB_Messaging* GetPPB_Messaging_Thunk();
const PPB_MouseInputEvent* GetPPB_MouseInputEvent_Thunk();
-const PPB_Scrollbar_0_4_Dev* GetPPB_Scrollbar_Thunk();
+const PPB_Scrollbar_0_5_Dev* GetPPB_Scrollbar_Thunk();
const PPB_Surface3D_Dev* GetPPB_Surface3D_Thunk();
const PPB_Transport_Dev* GetPPB_Transport_Thunk();
const PPB_URLLoader* GetPPB_URLLoader_Thunk();