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 "third_party/ppapi/c/ppp_scrollbar.h" | 9 #include "third_party/ppapi/c/ppp_scrollbar.h" |
10 #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" | 10 #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 PP_Rect rect = location(); | 130 PP_Rect rect = location(); |
131 Invalidate(&rect); | 131 Invalidate(&rect); |
132 } | 132 } |
133 | 133 |
134 void Scrollbar::ScrollBy(PP_ScrollBy unit, int32_t multiplier) { | 134 void Scrollbar::ScrollBy(PP_ScrollBy unit, int32_t multiplier) { |
135 WebScrollbar::ScrollDirection direction = multiplier >= 0 ? | 135 WebScrollbar::ScrollDirection direction = multiplier >= 0 ? |
136 WebScrollbar::ScrollForward : WebScrollbar::ScrollBackward; | 136 WebScrollbar::ScrollForward : WebScrollbar::ScrollBackward; |
137 float fmultiplier = 1.0; | 137 float fmultiplier = 1.0; |
138 | 138 |
139 WebScrollbar::ScrollGranularity granularity; | 139 WebScrollbar::ScrollGranularity granularity; |
140 if (unit == PP_WIDGET_SCROLL_BY_LINE) { | 140 if (unit == PP_SCROLLBY_LINE) { |
141 granularity = WebScrollbar::ScrollByLine; | 141 granularity = WebScrollbar::ScrollByLine; |
142 } else if (unit == PP_WIDGET_SCROLL_BY_PAGE) { | 142 } else if (unit == PP_SCROLLBY_PAGE) { |
143 granularity = WebScrollbar::ScrollByPage; | 143 granularity = WebScrollbar::ScrollByPage; |
144 } else if (unit == PP_WIDGET_SCROLL_BY_DOCUMENT) { | 144 } else if (unit == PP_SCROLLBY_DOCUMENT) { |
145 granularity = WebScrollbar::ScrollByDocument; | 145 granularity = WebScrollbar::ScrollByDocument; |
146 } else { | 146 } else { |
147 granularity = WebScrollbar::ScrollByPixel; | 147 granularity = WebScrollbar::ScrollByPixel; |
148 fmultiplier = static_cast<float>(multiplier); | 148 fmultiplier = static_cast<float>(multiplier); |
149 if (fmultiplier < 0) | 149 if (fmultiplier < 0) |
150 fmultiplier *= -1; | 150 fmultiplier *= -1; |
151 } | 151 } |
152 scrollbar_->scroll(direction, granularity, fmultiplier); | 152 scrollbar_->scroll(direction, granularity, fmultiplier); |
153 } | 153 } |
154 | 154 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 PP_Rect pp_rect; | 220 PP_Rect pp_rect; |
221 pp_rect.point.x = dirty_.x(); | 221 pp_rect.point.x = dirty_.x(); |
222 pp_rect.point.y = dirty_.y(); | 222 pp_rect.point.y = dirty_.y(); |
223 pp_rect.size.width = dirty_.width(); | 223 pp_rect.size.width = dirty_.width(); |
224 pp_rect.size.height = dirty_.height(); | 224 pp_rect.size.height = dirty_.height(); |
225 dirty_ = gfx::Rect(); | 225 dirty_ = gfx::Rect(); |
226 Invalidate(&pp_rect); | 226 Invalidate(&pp_rect); |
227 } | 227 } |
228 | 228 |
229 } // namespace pepper | 229 } // namespace pepper |
OLD | NEW |