| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 | 210 |
| 211 void WebPluginScrollbarImpl::setDocumentSize(int size) | 211 void WebPluginScrollbarImpl::setDocumentSize(int size) |
| 212 { | 212 { |
| 213 int length = m_scrollbar->orientation() == HorizontalScrollbar ? m_scrollbar
->width() : m_scrollbar->height(); | 213 int length = m_scrollbar->orientation() == HorizontalScrollbar ? m_scrollbar
->width() : m_scrollbar->height(); |
| 214 m_scrollbar->setEnabled(size > length); | 214 m_scrollbar->setEnabled(size > length); |
| 215 m_scrollbar->setProportion(length, size); | 215 m_scrollbar->setProportion(length, size); |
| 216 } | 216 } |
| 217 | 217 |
| 218 void WebPluginScrollbarImpl::scroll(ScrollDirection direction, ScrollGranularity
granularity, float multiplier) | 218 void WebPluginScrollbarImpl::scroll(ScrollDirection direction, ScrollGranularity
granularity, float multiplier) |
| 219 { | 219 { |
| 220 blink::ScrollDirection dir; | 220 blink::ScrollDirectionPhysical dir; |
| 221 bool horizontal = m_scrollbar->orientation() == HorizontalScrollbar; | 221 bool horizontal = m_scrollbar->orientation() == HorizontalScrollbar; |
| 222 if (direction == ScrollForward) | 222 if (direction == ScrollForward) |
| 223 dir = horizontal ? ScrollRight : ScrollDown; | 223 dir = horizontal ? ScrollRight : ScrollDown; |
| 224 else | 224 else |
| 225 dir = horizontal ? ScrollLeft : ScrollUp; | 225 dir = horizontal ? ScrollLeft : ScrollUp; |
| 226 | 226 |
| 227 m_group->scroll(dir, static_cast<blink::ScrollGranularity>(granularity), mul
tiplier); | 227 m_group->scroll(dir, static_cast<blink::ScrollGranularity>(granularity), mul
tiplier); |
| 228 } | 228 } |
| 229 | 229 |
| 230 void WebPluginScrollbarImpl::paint(WebCanvas* canvas, const WebRect& rect) | 230 void WebPluginScrollbarImpl::paint(WebCanvas* canvas, const WebRect& rect) |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 default: | 347 default: |
| 348 return false; | 348 return false; |
| 349 } | 349 } |
| 350 } | 350 } |
| 351 | 351 |
| 352 if (keyboard.isSystemKey || (keyboard.modifiers & WebInputEvent::ShiftKe
y)) | 352 if (keyboard.isSystemKey || (keyboard.modifiers & WebInputEvent::ShiftKe
y)) |
| 353 return false; | 353 return false; |
| 354 | 354 |
| 355 keyCode = keyboard.windowsKeyCode; | 355 keyCode = keyboard.windowsKeyCode; |
| 356 } | 356 } |
| 357 blink::ScrollDirection scrollDirection; | 357 blink::ScrollDirectionPhysical scrollDirection; |
| 358 blink::ScrollGranularity scrollGranularity; | 358 blink::ScrollGranularity scrollGranularity; |
| 359 if (WebViewImpl::mapKeyCodeForScroll(keyCode, &scrollDirection, &scrollGranu
larity)) { | 359 if (WebViewImpl::mapKeyCodeForScroll(keyCode, &scrollDirection, &scrollGranu
larity)) { |
| 360 // Will return false if scroll direction wasn't compatible with this scr
ollbar. | 360 // Will return false if scroll direction wasn't compatible with this scr
ollbar. |
| 361 return m_group->scroll(scrollDirection, scrollGranularity); | 361 return m_group->scroll(scrollDirection, scrollGranularity); |
| 362 } | 362 } |
| 363 return false; | 363 return false; |
| 364 } | 364 } |
| 365 | 365 |
| 366 float WebPluginScrollbarImpl::elasticOverscroll() const | 366 float WebPluginScrollbarImpl::elasticOverscroll() const |
| 367 { | 367 { |
| 368 return m_scrollbar->elasticOverscroll(); | 368 return m_scrollbar->elasticOverscroll(); |
| 369 } | 369 } |
| 370 | 370 |
| 371 void WebPluginScrollbarImpl::setElasticOverscroll(float elasticOverscroll) | 371 void WebPluginScrollbarImpl::setElasticOverscroll(float elasticOverscroll) |
| 372 { | 372 { |
| 373 m_scrollbar->setElasticOverscroll(elasticOverscroll); | 373 m_scrollbar->setElasticOverscroll(elasticOverscroll); |
| 374 } | 374 } |
| 375 | 375 |
| 376 } // namespace blink | 376 } // namespace blink |
| OLD | NEW |