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 22 matching lines...) Expand all Loading... |
33 #include "platform/mac/BlockExceptions.h" | 33 #include "platform/mac/BlockExceptions.h" |
34 #include "platform/mac/EmptyProtocolDefinitions.h" | 34 #include "platform/mac/EmptyProtocolDefinitions.h" |
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 #include "wtf/UnusedParam.h" | |
44 | 43 |
45 using namespace WebCore; | 44 using namespace WebCore; |
46 using namespace std; | 45 using namespace std; |
47 | 46 |
48 static bool supportsUIStateTransitionProgress() | 47 static bool supportsUIStateTransitionProgress() |
49 { | 48 { |
50 // FIXME: This is temporary until all platforms that support ScrollbarPainte
r support this part of the API. | 49 // FIXME: This is temporary until all platforms that support ScrollbarPainte
r support this part of the API. |
51 static bool globalSupportsUIStateTransitionProgress = [NSClassFromString(@"N
SScrollerImp") instancesRespondToSelector:@selector(mouseEnteredScroller)]; | 50 static bool globalSupportsUIStateTransitionProgress = [NSClassFromString(@"N
SScrollerImp") instancesRespondToSelector:@selector(mouseEnteredScroller)]; |
52 return globalSupportsUIStateTransitionProgress; | 51 return globalSupportsUIStateTransitionProgress; |
53 } | 52 } |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 return self; | 201 return self; |
203 } | 202 } |
204 | 203 |
205 - (void)invalidate | 204 - (void)invalidate |
206 { | 205 { |
207 _scrollableArea = 0; | 206 _scrollableArea = 0; |
208 } | 207 } |
209 | 208 |
210 - (NSRect)contentAreaRectForScrollerImpPair:(id)scrollerImpPair | 209 - (NSRect)contentAreaRectForScrollerImpPair:(id)scrollerImpPair |
211 { | 210 { |
212 UNUSED_PARAM(scrollerImpPair); | |
213 if (!_scrollableArea) | 211 if (!_scrollableArea) |
214 return NSZeroRect; | 212 return NSZeroRect; |
215 | 213 |
216 WebCore::IntSize contentsSize = _scrollableArea->contentsSize(); | 214 WebCore::IntSize contentsSize = _scrollableArea->contentsSize(); |
217 return NSMakeRect(0, 0, contentsSize.width(), contentsSize.height()); | 215 return NSMakeRect(0, 0, contentsSize.width(), contentsSize.height()); |
218 } | 216 } |
219 | 217 |
220 - (BOOL)inLiveResizeForScrollerImpPair:(id)scrollerImpPair | 218 - (BOOL)inLiveResizeForScrollerImpPair:(id)scrollerImpPair |
221 { | 219 { |
222 UNUSED_PARAM(scrollerImpPair); | |
223 if (!_scrollableArea) | 220 if (!_scrollableArea) |
224 return NO; | 221 return NO; |
225 | 222 |
226 return _scrollableArea->inLiveResize(); | 223 return _scrollableArea->inLiveResize(); |
227 } | 224 } |
228 | 225 |
229 - (NSPoint)mouseLocationInContentAreaForScrollerImpPair:(id)scrollerImpPair | 226 - (NSPoint)mouseLocationInContentAreaForScrollerImpPair:(id)scrollerImpPair |
230 { | 227 { |
231 UNUSED_PARAM(scrollerImpPair); | |
232 if (!_scrollableArea) | 228 if (!_scrollableArea) |
233 return NSZeroPoint; | 229 return NSZeroPoint; |
234 | 230 |
235 return _scrollableArea->lastKnownMousePosition(); | 231 return _scrollableArea->lastKnownMousePosition(); |
236 } | 232 } |
237 | 233 |
238 - (NSPoint)scrollerImpPair:(id)scrollerImpPair convertContentPoint:(NSPoint)poin
tInContentArea toScrollerImp:(id)scrollerImp | 234 - (NSPoint)scrollerImpPair:(id)scrollerImpPair convertContentPoint:(NSPoint)poin
tInContentArea toScrollerImp:(id)scrollerImp |
239 { | 235 { |
240 UNUSED_PARAM(scrollerImpPair); | |
241 | 236 |
242 if (!_scrollableArea || !scrollerImp) | 237 if (!_scrollableArea || !scrollerImp) |
243 return NSZeroPoint; | 238 return NSZeroPoint; |
244 | 239 |
245 WebCore::Scrollbar* scrollbar = 0; | 240 WebCore::Scrollbar* scrollbar = 0; |
246 if ([scrollerImp isHorizontal]) | 241 if ([scrollerImp isHorizontal]) |
247 scrollbar = _scrollableArea->horizontalScrollbar(); | 242 scrollbar = _scrollableArea->horizontalScrollbar(); |
248 else | 243 else |
249 scrollbar = _scrollableArea->verticalScrollbar(); | 244 scrollbar = _scrollableArea->verticalScrollbar(); |
250 | 245 |
251 // It is possible to have a null scrollbar here since it is possible for thi
s delegate | 246 // It is possible to have a null scrollbar here since it is possible for thi
s delegate |
252 // method to be called between the moment when a scrollbar has been set to 0
and the | 247 // method to be called between the moment when a scrollbar has been set to 0
and the |
253 // moment when its destructor has been called. We should probably de-couple
some | 248 // moment when its destructor has been called. We should probably de-couple
some |
254 // of the clean-up work in ScrollbarThemeMac::unregisterScrollbar() to avoid
this | 249 // of the clean-up work in ScrollbarThemeMac::unregisterScrollbar() to avoid
this |
255 // issue. | 250 // issue. |
256 if (!scrollbar) | 251 if (!scrollbar) |
257 return NSZeroPoint; | 252 return NSZeroPoint; |
258 | 253 |
259 ASSERT(scrollerImp == scrollbarPainterForScrollbar(scrollbar)); | 254 ASSERT(scrollerImp == scrollbarPainterForScrollbar(scrollbar)); |
260 | 255 |
261 return scrollbar->convertFromContainingView(WebCore::IntPoint(pointInContent
Area)); | 256 return scrollbar->convertFromContainingView(WebCore::IntPoint(pointInContent
Area)); |
262 } | 257 } |
263 | 258 |
264 - (void)scrollerImpPair:(id)scrollerImpPair setContentAreaNeedsDisplayInRect:(NS
Rect)rect | 259 - (void)scrollerImpPair:(id)scrollerImpPair setContentAreaNeedsDisplayInRect:(NS
Rect)rect |
265 { | 260 { |
266 UNUSED_PARAM(scrollerImpPair); | |
267 UNUSED_PARAM(rect); | |
268 | |
269 if (!_scrollableArea) | 261 if (!_scrollableArea) |
270 return; | 262 return; |
271 | 263 |
272 if (!_scrollableArea->scrollbarsCanBeActive()) | 264 if (!_scrollableArea->scrollbarsCanBeActive()) |
273 return; | 265 return; |
274 | 266 |
275 _scrollableArea->scrollAnimator()->contentAreaWillPaint(); | 267 _scrollableArea->scrollAnimator()->contentAreaWillPaint(); |
276 } | 268 } |
277 | 269 |
278 - (void)scrollerImpPair:(id)scrollerImpPair updateScrollerStyleForNewRecommended
ScrollerStyle:(NSScrollerStyle)newRecommendedScrollerStyle | 270 - (void)scrollerImpPair:(id)scrollerImpPair updateScrollerStyleForNewRecommended
ScrollerStyle:(NSScrollerStyle)newRecommendedScrollerStyle |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 // If we don't need to initialize the animation, just reset the values i
n case they have changed. | 557 // If we don't need to initialize the animation, just reset the values i
n case they have changed. |
566 [_expansionTransitionAnimation.get() setStartValue:[scrollbarPainter uiS
tateTransitionProgress]]; | 558 [_expansionTransitionAnimation.get() setStartValue:[scrollbarPainter uiS
tateTransitionProgress]]; |
567 [_expansionTransitionAnimation.get() setEndValue:1.0]; | 559 [_expansionTransitionAnimation.get() setEndValue:1.0]; |
568 [_expansionTransitionAnimation.get() setDuration:duration]; | 560 [_expansionTransitionAnimation.get() setDuration:duration]; |
569 } | 561 } |
570 [_expansionTransitionAnimation.get() startAnimation]; | 562 [_expansionTransitionAnimation.get() startAnimation]; |
571 } | 563 } |
572 | 564 |
573 - (void)scrollerImp:(id)scrollerImp overlayScrollerStateChangedTo:(NSUInteger)ne
wOverlayScrollerState | 565 - (void)scrollerImp:(id)scrollerImp overlayScrollerStateChangedTo:(NSUInteger)ne
wOverlayScrollerState |
574 { | 566 { |
575 UNUSED_PARAM(scrollerImp); | |
576 UNUSED_PARAM(newOverlayScrollerState); | |
577 } | 567 } |
578 | 568 |
579 - (void)invalidate | 569 - (void)invalidate |
580 { | 570 { |
581 _scrollbar = 0; | 571 _scrollbar = 0; |
582 BEGIN_BLOCK_OBJC_EXCEPTIONS; | 572 BEGIN_BLOCK_OBJC_EXCEPTIONS; |
583 [_knobAlphaAnimation.get() invalidate]; | 573 [_knobAlphaAnimation.get() invalidate]; |
584 [_trackAlphaAnimation.get() invalidate]; | 574 [_trackAlphaAnimation.get() invalidate]; |
585 [_uiStateTransitionAnimation.get() invalidate]; | 575 [_uiStateTransitionAnimation.get() invalidate]; |
586 [_expansionTransitionAnimation.get() invalidate]; | 576 [_expansionTransitionAnimation.get() invalidate]; |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1294 return; | 1284 return; |
1295 | 1285 |
1296 m_visibleScrollerThumbRect = rectInViewCoordinates; | 1286 m_visibleScrollerThumbRect = rectInViewCoordinates; |
1297 } | 1287 } |
1298 | 1288 |
1299 bool ScrollAnimatorMac::canUseCoordinatedScrollbar() { | 1289 bool ScrollAnimatorMac::canUseCoordinatedScrollbar() { |
1300 return isScrollbarOverlayAPIAvailable(); | 1290 return isScrollbarOverlayAPIAvailable(); |
1301 } | 1291 } |
1302 | 1292 |
1303 } // namespace WebCore | 1293 } // namespace WebCore |
OLD | NEW |