OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2010, 2011 Apple 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 24 matching lines...) Expand all Loading... |
35 #include "platform/mac/NSScrollerImpDetails.h" | 35 #include "platform/mac/NSScrollerImpDetails.h" |
36 #include "platform/scroll/ScrollView.h" | 36 #include "platform/scroll/ScrollView.h" |
37 #include "platform/scroll/ScrollableArea.h" | 37 #include "platform/scroll/ScrollableArea.h" |
38 #include "platform/scroll/ScrollbarTheme.h" | 38 #include "platform/scroll/ScrollbarTheme.h" |
39 #include "platform/scroll/ScrollbarThemeMacCommon.h" | 39 #include "platform/scroll/ScrollbarThemeMacCommon.h" |
40 #include "platform/scroll/ScrollbarThemeMacOverlayAPI.h" | 40 #include "platform/scroll/ScrollbarThemeMacOverlayAPI.h" |
41 #include "wtf/MainThread.h" | 41 #include "wtf/MainThread.h" |
42 #include "wtf/PassOwnPtr.h" | 42 #include "wtf/PassOwnPtr.h" |
43 | 43 |
44 using namespace blink; | 44 using namespace blink; |
45 using namespace std; | |
46 | 45 |
47 static bool supportsUIStateTransitionProgress() | 46 static bool supportsUIStateTransitionProgress() |
48 { | 47 { |
49 // FIXME: This is temporary until all platforms that support ScrollbarPainte
r support this part of the API. | 48 // FIXME: This is temporary until all platforms that support ScrollbarPainte
r support this part of the API. |
50 static bool globalSupportsUIStateTransitionProgress = [NSClassFromString(@"N
SScrollerImp") instancesRespondToSelector:@selector(mouseEnteredScroller)]; | 49 static bool globalSupportsUIStateTransitionProgress = [NSClassFromString(@"N
SScrollerImp") instancesRespondToSelector:@selector(mouseEnteredScroller)]; |
51 return globalSupportsUIStateTransitionProgress; | 50 return globalSupportsUIStateTransitionProgress; |
52 } | 51 } |
53 | 52 |
54 static bool supportsExpansionTransitionProgress() | 53 static bool supportsExpansionTransitionProgress() |
55 { | 54 { |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 } | 679 } |
681 | 680 |
682 FloatPoint ScrollAnimatorMac::adjustScrollPositionIfNecessary(const FloatPoint&
position) const | 681 FloatPoint ScrollAnimatorMac::adjustScrollPositionIfNecessary(const FloatPoint&
position) const |
683 { | 682 { |
684 if (!m_scrollableArea->constrainsScrollingToContentEdge()) | 683 if (!m_scrollableArea->constrainsScrollingToContentEdge()) |
685 return position; | 684 return position; |
686 | 685 |
687 IntPoint minPos = m_scrollableArea->minimumScrollPosition(); | 686 IntPoint minPos = m_scrollableArea->minimumScrollPosition(); |
688 IntPoint maxPos = m_scrollableArea->maximumScrollPosition(); | 687 IntPoint maxPos = m_scrollableArea->maximumScrollPosition(); |
689 | 688 |
690 float newX = max<float>(min<float>(position.x(), maxPos.x()), minPos.x()); | 689 float newX = std::max<float>(std::min<float>(position.x(), maxPos.x()), minP
os.x()); |
691 float newY = max<float>(min<float>(position.y(), maxPos.y()), minPos.y()); | 690 float newY = std::max<float>(std::min<float>(position.y(), maxPos.y()), minP
os.y()); |
692 | 691 |
693 return FloatPoint(newX, newY); | 692 return FloatPoint(newX, newY); |
694 } | 693 } |
695 | 694 |
696 void ScrollAnimatorMac::adjustScrollPositionToBoundsIfNecessary() | 695 void ScrollAnimatorMac::adjustScrollPositionToBoundsIfNecessary() |
697 { | 696 { |
698 bool currentlyConstrainsToContentEdge = m_scrollableArea->constrainsScrollin
gToContentEdge(); | 697 bool currentlyConstrainsToContentEdge = m_scrollableArea->constrainsScrollin
gToContentEdge(); |
699 m_scrollableArea->setConstrainsScrollingToContentEdge(true); | 698 m_scrollableArea->setConstrainsScrollingToContentEdge(true); |
700 | 699 |
701 IntPoint currentScrollPosition = absoluteScrollPosition(); | 700 IntPoint currentScrollPosition = absoluteScrollPosition(); |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1288 return; | 1287 return; |
1289 | 1288 |
1290 m_visibleScrollerThumbRect = rectInViewCoordinates; | 1289 m_visibleScrollerThumbRect = rectInViewCoordinates; |
1291 } | 1290 } |
1292 | 1291 |
1293 bool ScrollAnimatorMac::canUseCoordinatedScrollbar() { | 1292 bool ScrollAnimatorMac::canUseCoordinatedScrollbar() { |
1294 return ScrollbarThemeMacCommon::isOverlayAPIAvailable(); | 1293 return ScrollbarThemeMacCommon::isOverlayAPIAvailable(); |
1295 } | 1294 } |
1296 | 1295 |
1297 } // namespace blink | 1296 } // namespace blink |
OLD | NEW |