| 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 "third_party/WebKit/public/platform/WebPoint.h" | 7 #include "third_party/WebKit/public/platform/WebPoint.h" |
| 8 #include "third_party/WebKit/public/platform/WebRect.h" | 8 #include "third_party/WebKit/public/platform/WebRect.h" |
| 9 | 9 |
| 10 namespace content { | 10 namespace content { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 static const int kOffSideMultiplier = 8; | 33 static const int kOffSideMultiplier = 8; |
| 34 | 34 |
| 35 // Find the rect within which we shouldn't snap, by expanding the track rect | 35 // Find the rect within which we shouldn't snap, by expanding the track rect |
| 36 // in both dimensions. | 36 // in both dimensions. |
| 37 gfx::Rect noSnapRect(scrollbarRect); | 37 gfx::Rect noSnapRect(scrollbarRect); |
| 38 const int thickness = isHorizontal ? noSnapRect.height() : noSnapRect.width(); | 38 const int thickness = isHorizontal ? noSnapRect.height() : noSnapRect.width(); |
| 39 noSnapRect.Inset( | 39 noSnapRect.Inset( |
| 40 (isHorizontal ? kOffEndMultiplier : kOffSideMultiplier) * -thickness, | 40 (isHorizontal ? kOffEndMultiplier : kOffSideMultiplier) * -thickness, |
| 41 (isHorizontal ? kOffSideMultiplier : kOffEndMultiplier) * -thickness); | 41 (isHorizontal ? kOffSideMultiplier : kOffEndMultiplier) * -thickness); |
| 42 | 42 |
| 43 // We should snap iff the event is outside our calculated rect. | 43 // On most platforms, we should snap iff the event is outside our calculated |
| 44 // rect. On Linux, however, we should not snap for events off the ends, but |
| 45 // not the sides, of the rect. |
| 46 #if (defined(OS_LINUX) && !defined(OS_CHROMEOS)) |
| 47 return isHorizontal ? |
| 48 (eventPoint.y < noSnapRect.y() || eventPoint.y >= noSnapRect.bottom()) : |
| 49 (eventPoint.x < noSnapRect.x() || eventPoint.x >= noSnapRect.right()); |
| 50 #else |
| 44 return !noSnapRect.Contains(eventPoint); | 51 return !noSnapRect.Contains(eventPoint); |
| 52 #endif |
| 45 } | 53 } |
| 46 | 54 |
| 47 } // namespace content | 55 } // namespace content |
| OLD | NEW |