Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: webkit/plugins/ppapi/ppb_scrollbar_impl.cc

Issue 7206016: Convert most remaining resources to use the API/thunk system. The significant (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/plugins/ppapi/ppb_scrollbar_impl.h ('k') | webkit/plugins/ppapi/ppb_surface_3d_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/plugins/ppapi/ppb_scrollbar_impl.h" 5 #include "webkit/plugins/ppapi/ppb_scrollbar_impl.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 "ppapi/c/dev/ppp_scrollbar_dev.h" 9 #include "ppapi/c/dev/ppp_scrollbar_dev.h"
10 #include "skia/ext/platform_canvas.h" 10 #include "skia/ext/platform_canvas.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 granularity = WebScrollbar::ScrollByDocument; 159 granularity = WebScrollbar::ScrollByDocument;
160 } else { 160 } else {
161 granularity = WebScrollbar::ScrollByPixel; 161 granularity = WebScrollbar::ScrollByPixel;
162 fmultiplier = static_cast<float>(multiplier); 162 fmultiplier = static_cast<float>(multiplier);
163 if (fmultiplier < 0) 163 if (fmultiplier < 0)
164 fmultiplier *= -1; 164 fmultiplier *= -1;
165 } 165 }
166 scrollbar_->scroll(direction, granularity, fmultiplier); 166 scrollbar_->scroll(direction, granularity, fmultiplier);
167 } 167 }
168 168
169 bool PPB_Scrollbar_Impl::Paint(const PP_Rect* rect, PPB_ImageData_Impl* image) { 169 PP_Bool PPB_Scrollbar_Impl::HandleEvent(const PP_InputEvent* event) {
170 gfx::Rect gfx_rect(rect->point.x, 170 scoped_ptr<WebInputEvent> web_input_event(CreateWebInputEvent(*event));
171 rect->point.y, 171 if (!web_input_event.get())
172 rect->size.width, 172 return PP_FALSE;
173 rect->size.height); 173
174 return PP_FromBool(scrollbar_->handleInputEvent(*web_input_event.get()));
175 }
176
177 PP_Bool PPB_Scrollbar_Impl::PaintInternal(const gfx::Rect& rect,
178 PPB_ImageData_Impl* image) {
174 skia::PlatformCanvas* canvas = image->mapped_canvas(); 179 skia::PlatformCanvas* canvas = image->mapped_canvas();
175 if (!canvas) 180 if (!canvas)
176 return false; 181 return PP_FALSE;
177 scrollbar_->paint(webkit_glue::ToWebCanvas(canvas), gfx_rect); 182 scrollbar_->paint(webkit_glue::ToWebCanvas(canvas), rect);
178 183
179 #if defined(OS_WIN) 184 #if defined(OS_WIN)
180 if (base::win::GetVersion() == base::win::VERSION_XP) { 185 if (base::win::GetVersion() == base::win::VERSION_XP)
181 skia::MakeOpaque(canvas, gfx_rect.x(), gfx_rect.y(), 186 skia::MakeOpaque(canvas, rect.x(), rect.y(), rect.width(), rect.height());
182 gfx_rect.width(), gfx_rect.height());
183 }
184 #endif 187 #endif
185 188
186 return true; 189 return PP_TRUE;
187 }
188
189 bool PPB_Scrollbar_Impl::HandleEvent(const PP_InputEvent* event) {
190 scoped_ptr<WebInputEvent> web_input_event(CreateWebInputEvent(*event));
191 if (!web_input_event.get())
192 return false;
193
194 return scrollbar_->handleInputEvent(*web_input_event.get());
195 } 190 }
196 191
197 void PPB_Scrollbar_Impl::SetLocationInternal(const PP_Rect* location) { 192 void PPB_Scrollbar_Impl::SetLocationInternal(const PP_Rect* location) {
198 scrollbar_->setLocation(WebRect(location->point.x, 193 scrollbar_->setLocation(WebRect(location->point.x,
199 location->point.y, 194 location->point.y,
200 location->size.width, 195 location->size.width,
201 location->size.height)); 196 location->size.height));
202 } 197 }
203 198
204 void PPB_Scrollbar_Impl::valueChanged(WebKit::WebScrollbar* scrollbar) { 199 void PPB_Scrollbar_Impl::valueChanged(WebKit::WebScrollbar* scrollbar) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 pp_rect.point.y = dirty_.y(); 242 pp_rect.point.y = dirty_.y();
248 pp_rect.size.width = dirty_.width(); 243 pp_rect.size.width = dirty_.width();
249 pp_rect.size.height = dirty_.height(); 244 pp_rect.size.height = dirty_.height();
250 dirty_ = gfx::Rect(); 245 dirty_ = gfx::Rect();
251 Invalidate(&pp_rect); 246 Invalidate(&pp_rect);
252 } 247 }
253 248
254 } // namespace ppapi 249 } // namespace ppapi
255 } // namespace webkit 250 } // namespace webkit
256 251
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppb_scrollbar_impl.h ('k') | webkit/plugins/ppapi/ppb_surface_3d_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698