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 "chrome/renderer/pepper_scrollbar_widget.h" | 5 #include "chrome/renderer/pepper_scrollbar_widget.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/keyboard_codes.h" | 8 #include "base/keyboard_codes.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 case NPWidgetPropertyScrollbarScrollByPage: | 237 case NPWidgetPropertyScrollbarScrollByPage: |
238 case NPWidgetPropertyScrollbarScrollByDocument: | 238 case NPWidgetPropertyScrollbarScrollByDocument: |
239 case NPWidgetPropertyScrollbarScrollByPixels: { | 239 case NPWidgetPropertyScrollbarScrollByPixels: { |
240 bool forward; | 240 bool forward; |
241 float multiplier = 1.0; | 241 float multiplier = 1.0; |
242 | 242 |
243 WebScrollbar::ScrollGranularity granularity; | 243 WebScrollbar::ScrollGranularity granularity; |
244 if (property == NPWidgetPropertyScrollbarScrollByLine) { | 244 if (property == NPWidgetPropertyScrollbarScrollByLine) { |
245 forward = *static_cast<bool*>(value); | 245 forward = *static_cast<bool*>(value); |
246 granularity = WebScrollbar::ScrollByLine; | 246 granularity = WebScrollbar::ScrollByLine; |
247 } else if (property == NPWidgetPropertyScrollbarScrollByLine) { | 247 } else if (property == NPWidgetPropertyScrollbarScrollByPage) { |
248 forward = *static_cast<bool*>(value); | 248 forward = *static_cast<bool*>(value); |
249 granularity = WebScrollbar::ScrollByPage; | 249 granularity = WebScrollbar::ScrollByPage; |
250 } else if (property == NPWidgetPropertyScrollbarScrollByLine) { | 250 } else if (property == NPWidgetPropertyScrollbarScrollByDocument) { |
251 forward = *static_cast<bool*>(value); | 251 forward = *static_cast<bool*>(value); |
252 granularity = WebScrollbar::ScrollByDocument; | 252 granularity = WebScrollbar::ScrollByDocument; |
253 } else { | 253 } else { |
254 multiplier = static_cast<float>(*static_cast<int32*>(value)); | 254 multiplier = static_cast<float>(*static_cast<int32*>(value)); |
255 forward = multiplier >= 0; | 255 forward = multiplier >= 0; |
256 if (multiplier < 0) | 256 if (multiplier < 0) |
257 multiplier *= -1; | 257 multiplier *= -1; |
258 granularity = WebScrollbar::ScrollByPixel; | 258 granularity = WebScrollbar::ScrollByPixel; |
259 } | 259 } |
260 scrollbar_->scroll( | 260 scrollbar_->scroll( |
(...skipping 29 matching lines...) Expand all Loading... |
290 tickmarks->assign(rects, 0); | 290 tickmarks->assign(rects, 0); |
291 } else { | 291 } else { |
292 tickmarks->assign(&tickmarks_[0], tickmarks_.size()); | 292 tickmarks->assign(&tickmarks_[0], tickmarks_.size()); |
293 } | 293 } |
294 } | 294 } |
295 | 295 |
296 void PepperScrollbarWidget::NotifyInvalidate() { | 296 void PepperScrollbarWidget::NotifyInvalidate() { |
297 if (!dirty_rect_.IsEmpty()) | 297 if (!dirty_rect_.IsEmpty()) |
298 WidgetPropertyChanged(NPWidgetPropertyDirtyRect); | 298 WidgetPropertyChanged(NPWidgetPropertyDirtyRect); |
299 } | 299 } |
OLD | NEW |