| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/renderer/webscrollbarbehavior_impl_gtkoraura.h" | 5 #include "content/renderer/webscrollbarbehavior_impl_gtkoraura.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "third_party/WebKit/public/platform/WebPoint.h" | 8 #include "third_party/WebKit/public/platform/WebPoint.h" |
| 9 #include "third_party/WebKit/public/platform/WebRect.h" | 9 #include "third_party/WebKit/public/platform/WebRect.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 | 12 |
| 13 bool WebScrollbarBehaviorImpl::shouldCenterOnThumb( | 13 bool WebScrollbarBehaviorImpl::shouldCenterOnThumb( |
| 14 blink::WebScrollbarBehavior::Button mouseButton, | 14 blink::WebPointerProperties::Button mouseButton, |
| 15 bool shiftKeyPressed, | 15 bool shiftKeyPressed, |
| 16 bool altKeyPressed) { | 16 bool altKeyPressed) { |
| 17 #if (defined(OS_LINUX) && !defined(OS_CHROMEOS)) | 17 #if (defined(OS_LINUX) && !defined(OS_CHROMEOS)) |
| 18 if (mouseButton == blink::WebScrollbarBehavior::ButtonMiddle) | 18 if (mouseButton == blink::WebPointerProperties::Button::Middle) |
| 19 return true; | 19 return true; |
| 20 #endif | 20 #endif |
| 21 return (mouseButton == blink::WebScrollbarBehavior::ButtonLeft) && | 21 return (mouseButton == blink::WebPointerProperties::Button::Left) && |
| 22 shiftKeyPressed; | 22 shiftKeyPressed; |
| 23 } | 23 } |
| 24 | 24 |
| 25 bool WebScrollbarBehaviorImpl::shouldSnapBackToDragOrigin( | 25 bool WebScrollbarBehaviorImpl::shouldSnapBackToDragOrigin( |
| 26 const blink::WebPoint& eventPoint, | 26 const blink::WebPoint& eventPoint, |
| 27 const blink::WebRect& scrollbarRect, | 27 const blink::WebRect& scrollbarRect, |
| 28 bool isHorizontal) { | 28 bool isHorizontal) { |
| 29 // Constants used to figure the drag rect outside which we should snap the | 29 // Constants used to figure the drag rect outside which we should snap the |
| 30 // scrollbar thumb back to its origin. These calculations are based on | 30 // scrollbar thumb back to its origin. These calculations are based on |
| 31 // observing the behavior of the MSVC8 main window scrollbar + some | 31 // observing the behavior of the MSVC8 main window scrollbar + some |
| (...skipping 21 matching lines...) Expand all Loading... |
| 53 #if (defined(OS_LINUX) && !defined(OS_CHROMEOS)) | 53 #if (defined(OS_LINUX) && !defined(OS_CHROMEOS)) |
| 54 return isHorizontal ? | 54 return isHorizontal ? |
| 55 (eventPoint.y < noSnapRect.y() || eventPoint.y >= noSnapRect.bottom()) : | 55 (eventPoint.y < noSnapRect.y() || eventPoint.y >= noSnapRect.bottom()) : |
| 56 (eventPoint.x < noSnapRect.x() || eventPoint.x >= noSnapRect.right()); | 56 (eventPoint.x < noSnapRect.x() || eventPoint.x >= noSnapRect.right()); |
| 57 #else | 57 #else |
| 58 return !noSnapRect.Contains(eventPoint); | 58 return !noSnapRect.Contains(eventPoint); |
| 59 #endif | 59 #endif |
| 60 } | 60 } |
| 61 | 61 |
| 62 } // namespace content | 62 } // namespace content |
| OLD | NEW |