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

Side by Side Diff: content/renderer/webscrollbarbehavior_impl_gtkoraura.cc

Issue 234533002: Remove a bunch of TOOLKIT_GTK in content/ and gpu/, as well as NPAPI plugins on linux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, skip changing browser_main_loop.cc because of presubmit issues, will follow up Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/renderer_webkitplatformsupport_impl.cc ('k') | content/shell/browser/shell.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 {
11 11
12 bool WebScrollbarBehaviorImpl::shouldCenterOnThumb( 12 bool WebScrollbarBehaviorImpl::shouldCenterOnThumb(
13 blink::WebScrollbarBehavior::Button mouseButton, 13 blink::WebScrollbarBehavior::Button mouseButton,
14 bool shiftKeyPressed, 14 bool shiftKeyPressed,
15 bool altKeyPressed) { 15 bool altKeyPressed) {
16 #if defined(TOOLKIT_GTK) || (defined(OS_LINUX) && !defined(OS_CHROMEOS)) 16 #if (defined(OS_LINUX) && !defined(OS_CHROMEOS))
17 if (mouseButton == blink::WebScrollbarBehavior::ButtonMiddle) 17 if (mouseButton == blink::WebScrollbarBehavior::ButtonMiddle)
18 return true; 18 return true;
19 #endif 19 #endif
20 return (mouseButton == blink::WebScrollbarBehavior::ButtonLeft) && 20 return (mouseButton == blink::WebScrollbarBehavior::ButtonLeft) &&
21 shiftKeyPressed; 21 shiftKeyPressed;
22 } 22 }
23 23
24 bool WebScrollbarBehaviorImpl::shouldSnapBackToDragOrigin( 24 bool WebScrollbarBehaviorImpl::shouldSnapBackToDragOrigin(
25 const blink::WebPoint& eventPoint, 25 const blink::WebPoint& eventPoint,
26 const blink::WebRect& scrollbarRect, 26 const blink::WebRect& scrollbarRect,
27 bool isHorizontal) { 27 bool isHorizontal) {
28 #if defined(TOOLKIT_GTK)
29 return false;
30 #endif
31
32 // Constants used to figure the drag rect outside which we should snap the 28 // Constants used to figure the drag rect outside which we should snap the
33 // scrollbar thumb back to its origin. These calculations are based on 29 // scrollbar thumb back to its origin. These calculations are based on
34 // observing the behavior of the MSVC8 main window scrollbar + some 30 // observing the behavior of the MSVC8 main window scrollbar + some
35 // guessing/extrapolation. 31 // guessing/extrapolation.
36 static const int kOffEndMultiplier = 3; 32 static const int kOffEndMultiplier = 3;
37 static const int kOffSideMultiplier = 8; 33 static const int kOffSideMultiplier = 8;
38 34
39 // 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
40 // in both dimensions. 36 // in both dimensions.
41 gfx::Rect noSnapRect(scrollbarRect); 37 gfx::Rect noSnapRect(scrollbarRect);
42 const int thickness = isHorizontal ? noSnapRect.height() : noSnapRect.width(); 38 const int thickness = isHorizontal ? noSnapRect.height() : noSnapRect.width();
43 noSnapRect.Inset( 39 noSnapRect.Inset(
44 (isHorizontal ? kOffEndMultiplier : kOffSideMultiplier) * -thickness, 40 (isHorizontal ? kOffEndMultiplier : kOffSideMultiplier) * -thickness,
45 (isHorizontal ? kOffSideMultiplier : kOffEndMultiplier) * -thickness); 41 (isHorizontal ? kOffSideMultiplier : kOffEndMultiplier) * -thickness);
46 42
47 // We should snap iff the event is outside our calculated rect. 43 // We should snap iff the event is outside our calculated rect.
48 return !noSnapRect.Contains(eventPoint); 44 return !noSnapRect.Contains(eventPoint);
49 } 45 }
50 46
51 } // namespace content 47 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/renderer_webkitplatformsupport_impl.cc ('k') | content/shell/browser/shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698