summaryrefslogtreecommitdiffstats
path: root/webkit/glue/plugins/pepper_scrollbar.cc
diff options
context:
space:
mode:
Diffstat (limited to 'webkit/glue/plugins/pepper_scrollbar.cc')
-rw-r--r--webkit/glue/plugins/pepper_scrollbar.cc34
1 files changed, 23 insertions, 11 deletions
diff --git a/webkit/glue/plugins/pepper_scrollbar.cc b/webkit/glue/plugins/pepper_scrollbar.cc
index 48db8d4..a8943d2 100644
--- a/webkit/glue/plugins/pepper_scrollbar.cc
+++ b/webkit/glue/plugins/pepper_scrollbar.cc
@@ -6,7 +6,8 @@
#include "base/logging.h"
#include "base/message_loop.h"
-#include "third_party/ppapi/c/ppp_scrollbar.h"
+#include "skia/ext/platform_canvas.h"
+#include "third_party/ppapi/c/dev/ppp_scrollbar_dev.h"
#include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h"
#include "third_party/WebKit/WebKit/chromium/public/WebRect.h"
#include "third_party/WebKit/WebKit/chromium/public/WebScrollbar.h"
@@ -17,6 +18,10 @@
#include "webkit/glue/plugins/pepper_plugin_module.h"
#include "webkit/glue/webkit_glue.h"
+#if defined(OS_WIN)
+#include "base/win_util.h"
+#endif
+
using WebKit::WebInputEvent;
using WebKit::WebRect;
using WebKit::WebScrollbar;
@@ -28,7 +33,7 @@ namespace {
PP_Resource Create(PP_Instance instance_id, bool vertical) {
PluginInstance* instance = PluginInstance::FromPPInstance(instance_id);
if (!instance)
- return NULL;
+ return 0;
scoped_refptr<Scrollbar> scrollbar(new Scrollbar(instance, vertical));
return scrollbar->GetReference();
@@ -69,15 +74,13 @@ void SetTickMarks(PP_Resource resource,
scrollbar->SetTickMarks(tick_marks, count);
}
-void ScrollBy(PP_Resource resource,
- PP_ScrollBy unit,
- int32_t multiplier) {
+void ScrollBy(PP_Resource resource, PP_ScrollBy_Dev unit, int32_t multiplier) {
scoped_refptr<Scrollbar> scrollbar(Resource::GetAs<Scrollbar>(resource));
if (scrollbar)
scrollbar->ScrollBy(unit, multiplier);
}
-const PPB_Scrollbar ppb_scrollbar = {
+const PPB_Scrollbar_Dev ppb_scrollbar = {
&Create,
&IsScrollbar,
&GetThickness,
@@ -101,7 +104,7 @@ Scrollbar::~Scrollbar() {
}
// static
-const PPB_Scrollbar* Scrollbar::GetInterface() {
+const PPB_Scrollbar_Dev* Scrollbar::GetInterface() {
return &ppb_scrollbar;
}
@@ -129,7 +132,7 @@ void Scrollbar::SetTickMarks(const PP_Rect* tick_marks, uint32_t count) {
Invalidate(&rect);
}
-void Scrollbar::ScrollBy(PP_ScrollBy unit, int32_t multiplier) {
+void Scrollbar::ScrollBy(PP_ScrollBy_Dev unit, int32_t multiplier) {
WebScrollbar::ScrollDirection direction = multiplier >= 0 ?
WebScrollbar::ScrollForward : WebScrollbar::ScrollBackward;
float fmultiplier = 1.0;
@@ -159,10 +162,18 @@ bool Scrollbar::Paint(const PP_Rect* rect, ImageData* image) {
if (!canvas)
return false;
scrollbar_->paint(webkit_glue::ToWebCanvas(canvas), gfx_rect);
+
+#if defined(OS_WIN)
+ if (win_util::GetWinVersion() == win_util::WINVERSION_XP) {
+ canvas->getTopPlatformDevice().makeOpaque(
+ gfx_rect.x(), gfx_rect.y(), gfx_rect.width(), gfx_rect.height());
+ }
+#endif
+
return true;
}
-bool Scrollbar::HandleEvent(const PP_Event* event) {
+bool Scrollbar::HandleEvent(const PP_InputEvent* event) {
scoped_ptr<WebInputEvent> web_input_event(CreateWebInputEvent(*event));
if (!web_input_event.get())
return false;
@@ -178,8 +189,9 @@ void Scrollbar::SetLocationInternal(const PP_Rect* location) {
}
void Scrollbar::valueChanged(WebKit::WebScrollbar* scrollbar) {
- const PPP_Scrollbar* ppp_scrollbar = static_cast<const PPP_Scrollbar*>(
- module()->GetPluginInterface(PPP_SCROLLBAR_INTERFACE));
+ const PPP_Scrollbar_Dev* ppp_scrollbar =
+ static_cast<const PPP_Scrollbar_Dev*>(
+ module()->GetPluginInterface(PPP_SCROLLBAR_DEV_INTERFACE));
if (!ppp_scrollbar)
return;
ScopedResourceId resource(this);