| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "webkit/glue/plugins/pepper_scrollbar.h" | 5 #include "webkit/glue/plugins/pepper_scrollbar.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "skia/ext/platform_canvas.h" |
| 9 #include "third_party/ppapi/c/ppp_scrollbar.h" | 10 #include "third_party/ppapi/c/ppp_scrollbar.h" |
| 10 #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" | 11 #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" |
| 11 #include "third_party/WebKit/WebKit/chromium/public/WebRect.h" | 12 #include "third_party/WebKit/WebKit/chromium/public/WebRect.h" |
| 12 #include "third_party/WebKit/WebKit/chromium/public/WebScrollbar.h" | 13 #include "third_party/WebKit/WebKit/chromium/public/WebScrollbar.h" |
| 13 #include "third_party/WebKit/WebKit/chromium/public/WebVector.h" | 14 #include "third_party/WebKit/WebKit/chromium/public/WebVector.h" |
| 14 #include "webkit/glue/plugins/pepper_event_conversion.h" | 15 #include "webkit/glue/plugins/pepper_event_conversion.h" |
| 15 #include "webkit/glue/plugins/pepper_image_data.h" | 16 #include "webkit/glue/plugins/pepper_image_data.h" |
| 16 #include "webkit/glue/plugins/pepper_plugin_instance.h" | 17 #include "webkit/glue/plugins/pepper_plugin_instance.h" |
| 17 #include "webkit/glue/plugins/pepper_plugin_module.h" | 18 #include "webkit/glue/plugins/pepper_plugin_module.h" |
| 18 #include "webkit/glue/webkit_glue.h" | 19 #include "webkit/glue/webkit_glue.h" |
| 19 | 20 |
| 21 #if defined(OS_WIN) |
| 22 #include "base/win_util.h" |
| 23 #endif |
| 24 |
| 20 using WebKit::WebInputEvent; | 25 using WebKit::WebInputEvent; |
| 21 using WebKit::WebRect; | 26 using WebKit::WebRect; |
| 22 using WebKit::WebScrollbar; | 27 using WebKit::WebScrollbar; |
| 23 | 28 |
| 24 namespace pepper { | 29 namespace pepper { |
| 25 | 30 |
| 26 namespace { | 31 namespace { |
| 27 | 32 |
| 28 PP_Resource Create(PP_Instance instance_id, bool vertical) { | 33 PP_Resource Create(PP_Instance instance_id, bool vertical) { |
| 29 PluginInstance* instance = PluginInstance::FromPPInstance(instance_id); | 34 PluginInstance* instance = PluginInstance::FromPPInstance(instance_id); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 159 |
| 155 bool Scrollbar::Paint(const PP_Rect* rect, ImageData* image) { | 160 bool Scrollbar::Paint(const PP_Rect* rect, ImageData* image) { |
| 156 gfx::Rect gfx_rect(rect->point.x, | 161 gfx::Rect gfx_rect(rect->point.x, |
| 157 rect->point.y, | 162 rect->point.y, |
| 158 rect->size.width, | 163 rect->size.width, |
| 159 rect->size.height); | 164 rect->size.height); |
| 160 skia::PlatformCanvas* canvas = image->mapped_canvas(); | 165 skia::PlatformCanvas* canvas = image->mapped_canvas(); |
| 161 if (!canvas) | 166 if (!canvas) |
| 162 return false; | 167 return false; |
| 163 scrollbar_->paint(webkit_glue::ToWebCanvas(canvas), gfx_rect); | 168 scrollbar_->paint(webkit_glue::ToWebCanvas(canvas), gfx_rect); |
| 169 |
| 170 #if defined(OS_WIN) |
| 171 if (win_util::GetWinVersion() == win_util::WINVERSION_XP) { |
| 172 canvas->getTopPlatformDevice().makeOpaque( |
| 173 gfx_rect.x(), gfx_rect.y(), gfx_rect.width(), gfx_rect.height()); |
| 174 } |
| 175 #endif |
| 176 |
| 164 return true; | 177 return true; |
| 165 } | 178 } |
| 166 | 179 |
| 167 bool Scrollbar::HandleEvent(const PP_Event* event) { | 180 bool Scrollbar::HandleEvent(const PP_Event* event) { |
| 168 scoped_ptr<WebInputEvent> web_input_event(CreateWebInputEvent(*event)); | 181 scoped_ptr<WebInputEvent> web_input_event(CreateWebInputEvent(*event)); |
| 169 if (!web_input_event.get()) | 182 if (!web_input_event.get()) |
| 170 return false; | 183 return false; |
| 171 | 184 |
| 172 return scrollbar_->handleInputEvent(*web_input_event.get()); | 185 return scrollbar_->handleInputEvent(*web_input_event.get()); |
| 173 } | 186 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 PP_Rect pp_rect; | 233 PP_Rect pp_rect; |
| 221 pp_rect.point.x = dirty_.x(); | 234 pp_rect.point.x = dirty_.x(); |
| 222 pp_rect.point.y = dirty_.y(); | 235 pp_rect.point.y = dirty_.y(); |
| 223 pp_rect.size.width = dirty_.width(); | 236 pp_rect.size.width = dirty_.width(); |
| 224 pp_rect.size.height = dirty_.height(); | 237 pp_rect.size.height = dirty_.height(); |
| 225 dirty_ = gfx::Rect(); | 238 dirty_ = gfx::Rect(); |
| 226 Invalidate(&pp_rect); | 239 Invalidate(&pp_rect); |
| 227 } | 240 } |
| 228 | 241 |
| 229 } // namespace pepper | 242 } // namespace pepper |
| OLD | NEW |