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

Side by Side Diff: sky/engine/platform/scroll/ScrollAnimator.cpp

Issue 709603006: Remove a bunch of OS(MACOSX) code (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Even more Created 6 years, 1 month 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) 2010, Google Inc. All rights reserved. 2 * Copyright (c) 2010, 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 bool canScrollX = m_scrollableArea->userInputScrollable(HorizontalScrollbar) ; 79 bool canScrollX = m_scrollableArea->userInputScrollable(HorizontalScrollbar) ;
80 bool canScrollY = m_scrollableArea->userInputScrollable(VerticalScrollbar); 80 bool canScrollY = m_scrollableArea->userInputScrollable(VerticalScrollbar);
81 81
82 // Accept the event if we are scrollable in that direction and can still 82 // Accept the event if we are scrollable in that direction and can still
83 // scroll any further. 83 // scroll any further.
84 float deltaX = canScrollX ? e.deltaX() : 0; 84 float deltaX = canScrollX ? e.deltaX() : 0;
85 float deltaY = canScrollY ? e.deltaY() : 0; 85 float deltaY = canScrollY ? e.deltaY() : 0;
86 86
87 bool handled = false; 87 bool handled = false;
88 88
89 #if !OS(MACOSX)
90 ScrollGranularity granularity = e.hasPreciseScrollingDeltas() ? ScrollByPrec isePixel : ScrollByPixel; 89 ScrollGranularity granularity = e.hasPreciseScrollingDeltas() ? ScrollByPrec isePixel : ScrollByPixel;
91 #else
92 ScrollGranularity granularity = ScrollByPixel;
93 #endif
94 90
95 IntSize maxForwardScrollDelta = m_scrollableArea->maximumScrollPosition() - m_scrollableArea->scrollPosition(); 91 IntSize maxForwardScrollDelta = m_scrollableArea->maximumScrollPosition() - m_scrollableArea->scrollPosition();
96 IntSize maxBackwardScrollDelta = m_scrollableArea->scrollPosition() - m_scro llableArea->minimumScrollPosition(); 92 IntSize maxBackwardScrollDelta = m_scrollableArea->scrollPosition() - m_scro llableArea->minimumScrollPosition();
97 if ((deltaX < 0 && maxForwardScrollDelta.width() > 0) 93 if ((deltaX < 0 && maxForwardScrollDelta.width() > 0)
98 || (deltaX > 0 && maxBackwardScrollDelta.width() > 0) 94 || (deltaX > 0 && maxBackwardScrollDelta.width() > 0)
99 || (deltaY < 0 && maxForwardScrollDelta.height() > 0) 95 || (deltaY < 0 && maxForwardScrollDelta.height() > 0)
100 || (deltaY > 0 && maxBackwardScrollDelta.height() > 0)) { 96 || (deltaY > 0 && maxBackwardScrollDelta.height() > 0)) {
101 handled = true; 97 handled = true;
102 98
103 if (deltaY) { 99 if (deltaY) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 138 }
143 139
144 float ScrollAnimator::clampScrollPosition(ScrollbarOrientation orientation, floa t pos) 140 float ScrollAnimator::clampScrollPosition(ScrollbarOrientation orientation, floa t pos)
145 { 141 {
146 float maxScrollPos = m_scrollableArea->maximumScrollPosition(orientation); 142 float maxScrollPos = m_scrollableArea->maximumScrollPosition(orientation);
147 float minScrollPos = m_scrollableArea->minimumScrollPosition(orientation); 143 float minScrollPos = m_scrollableArea->minimumScrollPosition(orientation);
148 return std::max(std::min(pos, maxScrollPos), minScrollPos); 144 return std::max(std::min(pos, maxScrollPos), minScrollPos);
149 } 145 }
150 146
151 } // namespace blink 147 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698