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

Side by Side Diff: Source/web/WebPluginScrollbarImpl.cpp

Issue 1147283002: Add ScrollDirectionPhysical enum in Scroll types. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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
OLDNEW
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
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 ? ScrollPhysicalRight : ScrollPhysicalDown;
224 else 224 else
225 dir = horizontal ? ScrollLeft : ScrollUp; 225 dir = horizontal ? ScrollPhysicalLeft : ScrollPhysicalUp;
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)
231 { 231 {
232 OwnPtr<GraphicsContext> context = GraphicsContext::deprecatedCreateWithCanva s(canvas); 232 OwnPtr<GraphicsContext> context = GraphicsContext::deprecatedCreateWithCanva s(canvas);
233 m_scrollbar->paint(context.get(), rect); 233 m_scrollbar->paint(context.get(), rect);
234 } 234 }
235 235
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::ScrollDirection 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(toPhysicalDirection(scrollDirection, true, true), scrollGranularity);
bokan 2015/05/21 18:54:43 I'd rather make WebViewImpl::mapKeyCodeForScroll u
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
OLDNEW
« Source/platform/scroll/ScrollTypes.h ('K') | « Source/web/WebPluginContainerImpl.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698