Title: [102398] trunk/Source/WebCore
- Revision
- 102398
- Author
- [email protected]
- Date
- 2011-12-08 16:52:01 -0800 (Thu, 08 Dec 2011)
Log Message
Add a scrollbarPainterForScrollbar helper function
https://bugs.webkit.org/show_bug.cgi?id=74139
Reviewed by Sam Weinig.
* platform/mac/ScrollAnimatorMac.mm:
(macScrollbarTheme):
(scrollbarPainterForScrollbar):
(WebCore::ScrollAnimatorMac::mouseEnteredScrollbar):
(WebCore::ScrollAnimatorMac::mouseExitedScrollbar):
(WebCore::ScrollAnimatorMac::didAddVerticalScrollbar):
(WebCore::ScrollAnimatorMac::willRemoveVerticalScrollbar):
(WebCore::ScrollAnimatorMac::didAddHorizontalScrollbar):
(WebCore::ScrollAnimatorMac::willRemoveHorizontalScrollbar):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (102397 => 102398)
--- trunk/Source/WebCore/ChangeLog 2011-12-09 00:42:00 UTC (rev 102397)
+++ trunk/Source/WebCore/ChangeLog 2011-12-09 00:52:01 UTC (rev 102398)
@@ -1,3 +1,20 @@
+2011-12-08 Anders Carlsson <[email protected]>
+
+ Add a scrollbarPainterForScrollbar helper function
+ https://bugs.webkit.org/show_bug.cgi?id=74139
+
+ Reviewed by Sam Weinig.
+
+ * platform/mac/ScrollAnimatorMac.mm:
+ (macScrollbarTheme):
+ (scrollbarPainterForScrollbar):
+ (WebCore::ScrollAnimatorMac::mouseEnteredScrollbar):
+ (WebCore::ScrollAnimatorMac::mouseExitedScrollbar):
+ (WebCore::ScrollAnimatorMac::didAddVerticalScrollbar):
+ (WebCore::ScrollAnimatorMac::willRemoveVerticalScrollbar):
+ (WebCore::ScrollAnimatorMac::didAddHorizontalScrollbar):
+ (WebCore::ScrollAnimatorMac::willRemoveHorizontalScrollbar):
+
2011-12-08 James Robinson <[email protected]>
[chromium] Move NonCompositedContentHost to WebKit
Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (102397 => 102398)
--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm 2011-12-09 00:42:00 UTC (rev 102397)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm 2011-12-09 00:52:01 UTC (rev 102398)
@@ -52,6 +52,20 @@
static bool globalSupportsUIStateTransitionProgress = [NSClassFromString(@"NSScrollerImp") instancesRespondToSelector:@selector(mouseEnteredScroller)];
return globalSupportsUIStateTransitionProgress;
}
+
+static ScrollbarThemeMac* macScrollbarTheme()
+{
+ ScrollbarTheme* scrollbarTheme = ScrollbarTheme::theme();
+ return !scrollbarTheme->isMockTheme() ? static_cast<ScrollbarThemeMac*>(scrollbarTheme) : 0;
+}
+
+static ScrollbarPainter scrollbarPainterForScrollbar(Scrollbar* scrollbar)
+{
+ if (ScrollbarThemeMac* scrollbarTheme = macScrollbarTheme())
+ return scrollbarTheme->painterForScrollbar(scrollbar);
+
+ return nil;
+}
#endif
@interface NSObject (ScrollAnimationHelperDetails)
@@ -557,14 +571,6 @@
return adoptPtr(new ScrollAnimatorMac(scrollableArea));
}
-#if USE(SCROLLBAR_PAINTER)
-static ScrollbarThemeMac* macScrollbarTheme()
-{
- ScrollbarTheme* scrollbarTheme = ScrollbarTheme::theme();
- return !scrollbarTheme->isMockTheme() ? static_cast<ScrollbarThemeMac*>(scrollbarTheme) : 0;
-}
-#endif
-
ScrollAnimatorMac::ScrollAnimatorMac(ScrollableArea* scrollableArea)
: ScrollAnimator(scrollableArea)
#if USE(SCROLLBAR_PAINTER)
@@ -765,10 +771,8 @@
#if USE(SCROLLBAR_PAINTER)
if (!supportsUIStateTransitionProgress())
return;
- if (ScrollbarThemeMac* theme = macScrollbarTheme()) {
- ScrollbarPainter painter = theme->painterForScrollbar(scrollbar);
+ if (ScrollbarPainter painter = scrollbarPainterForScrollbar(scrollbar))
[painter mouseEnteredScroller];
- }
#else
UNUSED_PARAM(scrollbar);
#endif
@@ -781,10 +785,8 @@
#if USE(SCROLLBAR_PAINTER)
if (!supportsUIStateTransitionProgress())
return;
- if (ScrollbarThemeMac* theme = macScrollbarTheme()) {
- ScrollbarPainter painter = theme->painterForScrollbar(scrollbar);
+ if (ScrollbarPainter painter = scrollbarPainterForScrollbar(scrollbar))
[painter mouseExitedScroller];
- }
#else
UNUSED_PARAM(scrollbar);
#endif
@@ -856,8 +858,7 @@
void ScrollAnimatorMac::didAddVerticalScrollbar(Scrollbar* scrollbar)
{
#if USE(SCROLLBAR_PAINTER)
- if (ScrollbarThemeMac* theme = macScrollbarTheme()) {
- ScrollbarPainter painter = theme->painterForScrollbar(scrollbar);
+ if (ScrollbarPainter painter = scrollbarPainterForScrollbar(scrollbar)) {
[painter setDelegate:m_scrollbarPainterDelegate.get()];
[m_scrollbarPainterController.get() setVerticalScrollerImp:painter];
if (scrollableArea()->inLiveResize())
@@ -871,8 +872,7 @@
void ScrollAnimatorMac::willRemoveVerticalScrollbar(Scrollbar* scrollbar)
{
#if USE(SCROLLBAR_PAINTER)
- if (ScrollbarThemeMac* theme = macScrollbarTheme()) {
- ScrollbarPainter painter = theme->painterForScrollbar(scrollbar);
+ if (ScrollbarPainter painter = scrollbarPainterForScrollbar(scrollbar)) {
[painter setDelegate:nil];
[m_scrollbarPainterController.get() setVerticalScrollerImp:nil];
}
@@ -884,8 +884,7 @@
void ScrollAnimatorMac::didAddHorizontalScrollbar(Scrollbar* scrollbar)
{
#if USE(SCROLLBAR_PAINTER)
- if (ScrollbarThemeMac* theme = macScrollbarTheme()) {
- ScrollbarPainter painter = theme->painterForScrollbar(scrollbar);
+ if (ScrollbarPainter painter = scrollbarPainterForScrollbar(scrollbar)) {
[painter setDelegate:m_scrollbarPainterDelegate.get()];
[m_scrollbarPainterController.get() setHorizontalScrollerImp:painter];
if (scrollableArea()->inLiveResize())
@@ -899,8 +898,7 @@
void ScrollAnimatorMac::willRemoveHorizontalScrollbar(Scrollbar* scrollbar)
{
#if USE(SCROLLBAR_PAINTER)
- if (ScrollbarThemeMac* theme = macScrollbarTheme()) {
- ScrollbarPainter painter = theme->painterForScrollbar(scrollbar);
+ if (ScrollbarPainter painter = scrollbarPainterForScrollbar(scrollbar)) {
[painter setDelegate:nil];
[m_scrollbarPainterController.get() setHorizontalScrollerImp:nil];
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes