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

Unified Diff: Source/core/platform/mac/ScrollbarThemeMac.mm

Issue 21296003: Split ScrollbarThemeMac into Overlay and NonOverlay subclasses (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@composited_scrollbar_after_refactor
Patch Set: Clean up Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/platform/mac/ScrollbarThemeMac.mm
diff --git a/Source/core/platform/mac/ScrollbarThemeMac.mm b/Source/core/platform/mac/ScrollbarThemeMac.mm
index cba3ababb6f58ebd92c7480f8f1088011c9ae0b1..37f713e852981d84cba6149a491a28dd7b0704f2 100644
--- a/Source/core/platform/mac/ScrollbarThemeMac.mm
+++ b/Source/core/platform/mac/ScrollbarThemeMac.mm
@@ -59,9 +59,15 @@ using namespace WebCore;
namespace WebCore {
-typedef HashMap<ScrollbarThemeClient*, RetainPtr<ScrollbarPainter> > ScrollbarPainterMap;
+typedef HashMap<ScrollbarThemeClient*, ScrollbarThemeClient*> ScrollbarMap;
-static ScrollbarPainterMap* scrollbarMap()
+static ScrollbarMap* scrollbarMap()
ccameron 2013/07/31 02:10:25 scrollbarMap contains all scrollbars (so that they
+{
+ static ScrollbarMap* map = new ScrollbarMap;
+ return map;
+}
+
+ScrollbarThemeMacOverlay::ScrollbarPainterMap* ScrollbarThemeMacOverlay::scrollbarPainterMap()
{
static ScrollbarPainterMap* map = new ScrollbarPainterMap;
return map;
@@ -89,11 +95,11 @@ static ScrollbarPainterMap* scrollbarMap()
if (theme->isMockTheme())
return;
- static_cast<ScrollbarThemeMac*>(ScrollbarTheme::theme())->preferencesChanged();
+ static_cast<ScrollbarThemeMacCommon*>(ScrollbarTheme::theme())->preferencesChanged();
if (scrollbarMap()->isEmpty())
return;
- ScrollbarPainterMap::iterator end = scrollbarMap()->end();
- for (ScrollbarPainterMap::iterator it = scrollbarMap()->begin(); it != end; ++it) {
+ ScrollbarMap::iterator end = scrollbarMap()->end();
+ for (ScrollbarMap::iterator it = scrollbarMap()->begin(); it != end; ++it) {
it->key->styleChanged();
it->key->invalidate();
}
@@ -107,7 +113,7 @@ static ScrollbarPainterMap* scrollbarMap()
if (theme->isMockTheme())
return;
- static_cast<ScrollbarThemeMac*>(ScrollbarTheme::theme())->preferencesChanged();
+ static_cast<ScrollbarThemeMacCommon*>(ScrollbarTheme::theme())->preferencesChanged();
}
+ (void)registerAsObserver
@@ -121,22 +127,22 @@ static ScrollbarPainterMap* scrollbarMap()
namespace WebCore {
// FIXME: Get these numbers from CoreUI.
-static int cRealButtonLength[] = { 28, 21 };
-static int cButtonHitInset[] = { 3, 2 };
+int ScrollbarThemeMacNonOverlay::cRealButtonLength[ScrollbarControlSizeCount] = { 28, 21 };
+int ScrollbarThemeMacNonOverlay::cButtonHitInset[ScrollbarControlSizeCount] = { 3, 2 };
// cRealButtonLength - cButtonInset
-static int cButtonLength[] = { 14, 10 };
-static int cScrollbarThickness[] = { 15, 11 };
-static int cButtonInset[] = { 14, 11 };
-static int cThumbMinLength[] = { 26, 20 };
+int ScrollbarThemeMacNonOverlay::cButtonLength[ScrollbarControlSizeCount] = { 14, 10 };
+int ScrollbarThemeMacNonOverlay::cScrollbarThickness[ScrollbarControlSizeCount] = { 15, 11 };
+int ScrollbarThemeMacNonOverlay::cButtonInset[ScrollbarControlSizeCount] = { 14, 11 };
+int ScrollbarThemeMacNonOverlay::cThumbMinLength[ScrollbarControlSizeCount] = { 26, 20 };
enne (OOO) 2013/07/31 18:23:59 Can you keep these as non-class statics? Is there
ccameron 2013/07/31 20:26:57 I sort-of liked them being scoped to be private to
-static int cOuterButtonLength[] = { 16, 14 }; // The outer button in a double button pair is a bit bigger.
-static int cOuterButtonOverlap = 2;
+int ScrollbarThemeMacNonOverlay::cOuterButtonLength[ScrollbarControlSizeCount] = { 16, 14 }; // The outer button in a double button pair is a bit bigger.
+int ScrollbarThemeMacNonOverlay::cOuterButtonOverlap = 2;
-static float gInitialButtonDelay = 0.5f;
-static float gAutoscrollButtonDelay = 0.05f;
-static bool gJumpOnTrackClick = false;
+float ScrollbarThemeMacCommon::gInitialButtonDelay = 0.5f;
+float ScrollbarThemeMacCommon::gAutoscrollButtonDelay = 0.05f;
+bool ScrollbarThemeMacCommon::gJumpOnTrackClick = false;
-static ScrollbarButtonsPlacement gButtonPlacement = ScrollbarButtonsDoubleEnd;
+ScrollbarButtonsPlacement ScrollbarThemeMacNonOverlay::gButtonPlacement = ScrollbarButtonsDoubleEnd;
static bool supportsExpandedScrollbars()
{
@@ -145,7 +151,7 @@ static bool supportsExpandedScrollbars()
return globalSupportsExpandedScrollbars;
}
-static void updateArrowPlacement()
+void ScrollbarThemeMacNonOverlay::updateButtonPlacement()
{
if (isScrollbarOverlayAPIAvailable())
enne (OOO) 2013/07/31 18:23:59 No need to check this here, since this is a non ov
ccameron 2013/07/31 20:26:57 Oops -- yes, it's dead code -- removed (hmm, I'd r
return;
@@ -158,15 +164,20 @@ static void updateArrowPlacement()
else if ([buttonPlacement isEqualToString:@"DoubleBoth"])
gButtonPlacement = ScrollbarButtonsDoubleBoth;
else {
-
gButtonPlacement = ScrollbarButtonsDoubleEnd;
}
}
ScrollbarTheme* ScrollbarTheme::nativeTheme()
{
- DEFINE_STATIC_LOCAL(ScrollbarThemeMac, theme, ());
- return &theme;
+ if (isScrollbarOverlayAPIAvailable()) {
+ DEFINE_STATIC_LOCAL(ScrollbarThemeMacOverlay, theme, ());
+ return &theme;
+ } else {
+ DEFINE_STATIC_LOCAL(ScrollbarThemeMacNonOverlay, theme, ());
+ return &theme;
+ }
+ return NULL;
}
static WebKit::WebThemeEngine::State scrollbarStateToThemeState(ScrollbarThemeClient* scrollbar)
@@ -181,45 +192,52 @@ static WebKit::WebThemeEngine::State scrollbarStateToThemeState(ScrollbarThemeCl
return WebKit::WebThemeEngine::StateActive;
}
-void ScrollbarThemeMac::registerScrollbar(ScrollbarThemeClient* scrollbar)
+void ScrollbarThemeMacOverlay::registerScrollbar(ScrollbarThemeClient* scrollbar)
{
- if (isScrollbarOverlayAPIAvailable()) {
- bool isHorizontal = scrollbar->orientation() == HorizontalScrollbar;
- ScrollbarPainter scrollbarPainter = [NSClassFromString(@"NSScrollerImp") scrollerImpWithStyle:recommendedScrollerStyle() controlSize:(NSControlSize)scrollbar->controlSize() horizontal:isHorizontal replacingScrollerImp:nil];
- scrollbarMap()->add(scrollbar, scrollbarPainter);
- updateEnabledState(scrollbar);
- updateScrollbarOverlayStyle(scrollbar);
- } else {
- scrollbarMap()->add(scrollbar, nil);
- }
+ ScrollbarThemeMacCommon::registerScrollbar(scrollbar);
+
+ bool isHorizontal = scrollbar->orientation() == HorizontalScrollbar;
+ ScrollbarPainter scrollbarPainter = [NSClassFromString(@"NSScrollerImp") scrollerImpWithStyle:recommendedScrollerStyle() controlSize:(NSControlSize)scrollbar->controlSize() horizontal:isHorizontal replacingScrollerImp:nil];
+ scrollbarPainterMap()->add(scrollbar, scrollbarPainter);
+ updateEnabledState(scrollbar);
+ updateScrollbarOverlayStyle(scrollbar);
}
-void ScrollbarThemeMac::unregisterScrollbar(ScrollbarThemeClient* scrollbar)
+void ScrollbarThemeMacCommon::registerScrollbar(ScrollbarThemeClient* scrollbar)
+{
+ scrollbarMap()->add(scrollbar, scrollbar);
+}
+
+void ScrollbarThemeMacOverlay::unregisterScrollbar(ScrollbarThemeClient* scrollbar)
+{
+ scrollbarPainterMap()->remove(scrollbar);
+
+ ScrollbarThemeMacCommon::unregisterScrollbar(scrollbar);
+}
+
+void ScrollbarThemeMacCommon::unregisterScrollbar(ScrollbarThemeClient* scrollbar)
{
scrollbarMap()->remove(scrollbar);
}
-void ScrollbarThemeMac::setNewPainterForScrollbar(ScrollbarThemeClient* scrollbar, ScrollbarPainter newPainter)
+void ScrollbarThemeMacOverlay::setNewPainterForScrollbar(ScrollbarThemeClient* scrollbar, ScrollbarPainter newPainter)
{
- scrollbarMap()->set(scrollbar, newPainter);
+ scrollbarPainterMap()->set(scrollbar, newPainter);
updateEnabledState(scrollbar);
updateScrollbarOverlayStyle(scrollbar);
}
-ScrollbarPainter ScrollbarThemeMac::painterForScrollbar(ScrollbarThemeClient* scrollbar)
+ScrollbarPainter ScrollbarThemeMacOverlay::painterForScrollbar(ScrollbarThemeClient* scrollbar)
{
- return scrollbarMap()->get(scrollbar).get();
+ return scrollbarPainterMap()->get(scrollbar).get();
}
-// Override ScrollbarThemeMac::paint() to add support for the following:
+// Override ScrollbarThemeMacCommon::paint() to add support for the following:
// - drawing using WebThemeEngine functions
// - drawing tickmarks
// - Skia specific changes
-bool ScrollbarThemeMac::paint(ScrollbarThemeClient* scrollbar, GraphicsContext* context, const IntRect& damageRect)
+bool ScrollbarThemeMacNonOverlay::paint(ScrollbarThemeClient* scrollbar, GraphicsContext* context, const IntRect& damageRect)
{
- if (isScrollbarOverlayAPIAvailable())
- return ScrollbarThemeComposite::paint(scrollbar, context, damageRect);
-
// Get the tickmarks for the frameview.
Vector<IntRect> tickmarks;
scrollbar->getTickmarks(tickmarks);
@@ -307,7 +325,7 @@ bool ScrollbarThemeMac::paint(ScrollbarThemeClient* scrollbar, GraphicsContext*
return true;
}
-void ScrollbarThemeMac::paintGivenTickmarks(GraphicsContext* context, ScrollbarThemeClient* scrollbar, const IntRect& rect, const Vector<IntRect>& tickmarks)
+void ScrollbarThemeMacCommon::paintGivenTickmarks(GraphicsContext* context, ScrollbarThemeClient* scrollbar, const IntRect& rect, const Vector<IntRect>& tickmarks)
{
if (scrollbar->orientation() != VerticalScrollbar)
return;
@@ -339,7 +357,7 @@ void ScrollbarThemeMac::paintGivenTickmarks(GraphicsContext* context, ScrollbarT
}
}
-void ScrollbarThemeMac::paintOverhangAreas(ScrollView* view, GraphicsContext* context, const IntRect& horizontalOverhangRect, const IntRect& verticalOverhangRect, const IntRect& dirtyRect)
+void ScrollbarThemeMacCommon::paintOverhangAreas(ScrollView* view, GraphicsContext* context, const IntRect& horizontalOverhangRect, const IntRect& verticalOverhangRect, const IntRect& dirtyRect)
{
// The extent of each shadow in pixels.
const int kShadowSize = 4;
@@ -461,7 +479,7 @@ void ScrollbarThemeMac::paintOverhangAreas(ScrollView* view, GraphicsContext* co
}
}
-void ScrollbarThemeMac::paintTickmarks(GraphicsContext* context, ScrollbarThemeClient* scrollbar, const IntRect& rect)
+void ScrollbarThemeMacCommon::paintTickmarks(GraphicsContext* context, ScrollbarThemeClient* scrollbar, const IntRect& rect)
{
// Note: This is only used for css-styled scrollbars on mac.
if (scrollbar->orientation() != VerticalScrollbar)
@@ -482,7 +500,7 @@ void ScrollbarThemeMac::paintTickmarks(GraphicsContext* context, ScrollbarThemeC
paintGivenTickmarks(context, scrollbar, tickmarkTrackRect, tickmarks);
}
-void ScrollbarThemeMac::paintTrackBackground(GraphicsContext* context, ScrollbarThemeClient* scrollbar, const IntRect& rect) {
+void ScrollbarThemeMacOverlay::paintTrackBackground(GraphicsContext* context, ScrollbarThemeClient* scrollbar, const IntRect& rect) {
ASSERT(isScrollbarOverlayAPIAvailable());
GraphicsContextStateSaver stateSaver(*context);
@@ -498,7 +516,7 @@ void ScrollbarThemeMac::paintTrackBackground(GraphicsContext* context, Scrollbar
[scrollbarPainter drawKnobSlotInRect:trackRect highlight:NO];
}
-void ScrollbarThemeMac::paintThumb(GraphicsContext* context, ScrollbarThemeClient* scrollbar, const IntRect& rect) {
+void ScrollbarThemeMacOverlay::paintThumb(GraphicsContext* context, ScrollbarThemeClient* scrollbar, const IntRect& rect) {
ASSERT(isScrollbarOverlayAPIAvailable());
GraphicsContextStateSaver stateSaver(*context);
@@ -519,12 +537,11 @@ void ScrollbarThemeMac::paintThumb(GraphicsContext* context, ScrollbarThemeClien
[scrollbarPainter setBoundsSize: NSSizeFromCGSize(scrollbar->frameRect().size())];
}
-ScrollbarThemeMac::ScrollbarThemeMac()
+ScrollbarThemeMacCommon::ScrollbarThemeMacCommon()
{
static bool initialized;
if (!initialized) {
initialized = true;
- gButtonPlacement = isScrollbarOverlayAPIAvailable() ? ScrollbarButtonsNone : ScrollbarButtonsDoubleEnd;
[WebScrollbarPrefsObserver registerAsObserver];
preferencesChanged();
}
@@ -534,40 +551,39 @@ ScrollbarThemeMac::ScrollbarThemeMac()
m_overhangPattern = Pattern::create(patternImage, true, true);
}
-ScrollbarThemeMac::~ScrollbarThemeMac()
+ScrollbarThemeMacCommon::~ScrollbarThemeMacCommon()
{
}
-void ScrollbarThemeMac::preferencesChanged()
+void ScrollbarThemeMacCommon::preferencesChanged()
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults synchronize];
- updateArrowPlacement();
+ updateButtonPlacement();
gInitialButtonDelay = [defaults floatForKey:@"NSScrollerButtonDelay"];
gAutoscrollButtonDelay = [defaults floatForKey:@"NSScrollerButtonPeriod"];
gJumpOnTrackClick = [defaults boolForKey:@"AppleScrollerPagingBehavior"];
}
-int ScrollbarThemeMac::scrollbarThickness(ScrollbarControlSize controlSize)
+int ScrollbarThemeMacOverlay::scrollbarThickness(ScrollbarControlSize controlSize)
{
- if (isScrollbarOverlayAPIAvailable()) {
- ScrollbarPainter scrollbarPainter = [NSClassFromString(@"NSScrollerImp") scrollerImpWithStyle:recommendedScrollerStyle() controlSize:controlSize horizontal:NO replacingScrollerImp:nil];
- if (supportsExpandedScrollbars())
- [scrollbarPainter setExpanded:YES];
- return [scrollbarPainter trackBoxWidth];
- } else
- return cScrollbarThickness[controlSize];
+ ScrollbarPainter scrollbarPainter = [NSClassFromString(@"NSScrollerImp") scrollerImpWithStyle:recommendedScrollerStyle() controlSize:controlSize horizontal:NO replacingScrollerImp:nil];
+ if (supportsExpandedScrollbars())
+ [scrollbarPainter setExpanded:YES];
+ return [scrollbarPainter trackBoxWidth];
}
-bool ScrollbarThemeMac::usesOverlayScrollbars() const
+int ScrollbarThemeMacNonOverlay::scrollbarThickness(ScrollbarControlSize controlSize)
{
- if (isScrollbarOverlayAPIAvailable())
- return recommendedScrollerStyle() == NSScrollerStyleOverlay;
- else
- return false;
+ return cScrollbarThickness[controlSize];
}
-void ScrollbarThemeMac::updateScrollbarOverlayStyle(ScrollbarThemeClient* scrollbar)
+bool ScrollbarThemeMacOverlay::usesOverlayScrollbars() const
+{
+ return recommendedScrollerStyle() == NSScrollerStyleOverlay;
enne (OOO) 2013/07/31 18:23:59 Here's where I have a question about naming. My s
ccameron 2013/07/31 20:26:57 Yes -- that's it exactly. Maybe ScrollbarThemeMac(
+}
+
+void ScrollbarThemeMacOverlay::updateScrollbarOverlayStyle(ScrollbarThemeClient* scrollbar)
{
ScrollbarPainter painter = painterForScrollbar(scrollbar);
switch (scrollbar->scrollbarOverlayStyle()) {
@@ -583,22 +599,27 @@ void ScrollbarThemeMac::updateScrollbarOverlayStyle(ScrollbarThemeClient* scroll
}
}
-double ScrollbarThemeMac::initialAutoscrollTimerDelay()
+double ScrollbarThemeMacCommon::initialAutoscrollTimerDelay()
{
return gInitialButtonDelay;
}
-double ScrollbarThemeMac::autoscrollTimerDelay()
+double ScrollbarThemeMacCommon::autoscrollTimerDelay()
{
return gAutoscrollButtonDelay;
}
+
+ScrollbarButtonsPlacement ScrollbarThemeMacOverlay::buttonsPlacement() const
+{
+ return ScrollbarButtonsNone;
+}
-ScrollbarButtonsPlacement ScrollbarThemeMac::buttonsPlacement() const
+ScrollbarButtonsPlacement ScrollbarThemeMacNonOverlay::buttonsPlacement() const
{
return gButtonPlacement;
}
-bool ScrollbarThemeMac::hasButtons(ScrollbarThemeClient* scrollbar)
+bool ScrollbarThemeMacNonOverlay::hasButtons(ScrollbarThemeClient* scrollbar)
{
return scrollbar->enabled() && buttonsPlacement() != ScrollbarButtonsNone
&& (scrollbar->orientation() == HorizontalScrollbar
@@ -606,21 +627,25 @@ bool ScrollbarThemeMac::hasButtons(ScrollbarThemeClient* scrollbar)
: scrollbar->height()) >= 2 * (cRealButtonLength[scrollbar->controlSize()] - cButtonHitInset[scrollbar->controlSize()]);
}
-bool ScrollbarThemeMac::hasThumb(ScrollbarThemeClient* scrollbar)
+bool ScrollbarThemeMacOverlay::hasThumb(ScrollbarThemeClient* scrollbar)
{
- int minLengthForThumb;
- if (isScrollbarOverlayAPIAvailable()) {
- ScrollbarPainter painter = painterForScrollbar(scrollbar);
- minLengthForThumb = [painter knobMinLength] + [painter trackOverlapEndInset] + [painter knobOverlapEndInset]
- + 2 * ([painter trackEndInset] + [painter knobEndInset]);
- } else
- minLengthForThumb = 2 * cButtonInset[scrollbar->controlSize()] + cThumbMinLength[scrollbar->controlSize()] + 1;
- return scrollbar->enabled() && (scrollbar->orientation() == HorizontalScrollbar ?
- scrollbar->width() :
+ ScrollbarPainter painter = painterForScrollbar(scrollbar);
+ int minLengthForThumb = [painter knobMinLength] + [painter trackOverlapEndInset] + [painter knobOverlapEndInset]
+ + 2 * ([painter trackEndInset] + [painter knobEndInset]);
+ return scrollbar->enabled() && (scrollbar->orientation() == HorizontalScrollbar ?
+ scrollbar->width() :
scrollbar->height()) >= minLengthForThumb;
}
-static IntRect buttonRepaintRect(const IntRect& buttonRect, ScrollbarOrientation orientation, ScrollbarControlSize controlSize, bool start)
+bool ScrollbarThemeMacNonOverlay::hasThumb(ScrollbarThemeClient* scrollbar)
+{
+ int minLengthForThumb = 2 * cButtonInset[scrollbar->controlSize()] + cThumbMinLength[scrollbar->controlSize()] + 1;
+ return scrollbar->enabled() && (scrollbar->orientation() == HorizontalScrollbar ?
+ scrollbar->width() :
+ scrollbar->height()) >= minLengthForThumb;
+}
+
+IntRect ScrollbarThemeMacNonOverlay::buttonRepaintRect(const IntRect& buttonRect, ScrollbarOrientation orientation, ScrollbarControlSize controlSize, bool start)
{
ASSERT(gButtonPlacement != ScrollbarButtonsNone);
@@ -638,7 +663,12 @@ static IntRect buttonRepaintRect(const IntRect& buttonRect, ScrollbarOrientation
return paintRect;
}
-IntRect ScrollbarThemeMac::backButtonRect(ScrollbarThemeClient* scrollbar, ScrollbarPart part, bool painting)
+IntRect ScrollbarThemeMacOverlay::backButtonRect(ScrollbarThemeClient* scrollbar, ScrollbarPart part, bool painting)
+{
+ return IntRect();
ccameron 2013/07/31 02:10:25 Note here that for Overlay, buttonsPlacement() is
enne (OOO) 2013/07/31 18:23:59 Can this ASSERT that's the case too as documentati
ccameron 2013/07/31 20:26:57 Good call. Done.
+}
+
+IntRect ScrollbarThemeMacNonOverlay::backButtonRect(ScrollbarThemeClient* scrollbar, ScrollbarPart part, bool painting)
{
IntRect result;
@@ -672,7 +702,12 @@ IntRect ScrollbarThemeMac::backButtonRect(ScrollbarThemeClient* scrollbar, Scrol
return result;
}
-IntRect ScrollbarThemeMac::forwardButtonRect(ScrollbarThemeClient* scrollbar, ScrollbarPart part, bool painting)
+IntRect ScrollbarThemeMacOverlay::forwardButtonRect(ScrollbarThemeClient* scrollbar, ScrollbarPart part, bool painting)
+{
+ return IntRect();
+}
+
+IntRect ScrollbarThemeMacNonOverlay::forwardButtonRect(ScrollbarThemeClient* scrollbar, ScrollbarPart part, bool painting)
{
IntRect result;
@@ -712,7 +747,12 @@ IntRect ScrollbarThemeMac::forwardButtonRect(ScrollbarThemeClient* scrollbar, Sc
return result;
}
-IntRect ScrollbarThemeMac::trackRect(ScrollbarThemeClient* scrollbar, bool painting)
+IntRect ScrollbarThemeMacOverlay::trackRect(ScrollbarThemeClient* scrollbar, bool painting)
+{
+ return scrollbar->frameRect();
ccameron 2013/07/31 02:10:25 Likewise, hasButtons in the full verison would alw
enne (OOO) 2013/07/31 18:23:59 You mean false?
ccameron 2013/07/31 20:26:57 Yes (!hasButtons...) added an assert to be more ex
+}
+
+IntRect ScrollbarThemeMacNonOverlay::trackRect(ScrollbarThemeClient* scrollbar, bool painting)
{
if (painting || !hasButtons(scrollbar))
return scrollbar->frameRect();
@@ -749,16 +789,17 @@ IntRect ScrollbarThemeMac::trackRect(ScrollbarThemeClient* scrollbar, bool paint
return IntRect(scrollbar->x(), scrollbar->y() + startWidth, thickness, scrollbar->height() - totalWidth);
}
-int ScrollbarThemeMac::minimumThumbLength(ScrollbarThemeClient* scrollbar)
+int ScrollbarThemeMacOverlay::minimumThumbLength(ScrollbarThemeClient* scrollbar)
{
- if (isScrollbarOverlayAPIAvailable()) {
- return [painterForScrollbar(scrollbar) knobMinLength];
- } else {
- return cThumbMinLength[scrollbar->controlSize()];
- }
+ return [painterForScrollbar(scrollbar) knobMinLength];
+}
+
+int ScrollbarThemeMacNonOverlay::minimumThumbLength(ScrollbarThemeClient* scrollbar)
+{
+ return cThumbMinLength[scrollbar->controlSize()];
}
-bool ScrollbarThemeMac::shouldCenterOnThumb(ScrollbarThemeClient*, const PlatformMouseEvent& evt)
+bool ScrollbarThemeMacCommon::shouldCenterOnThumb(ScrollbarThemeClient*, const PlatformMouseEvent& evt)
{
if (evt.button() != LeftButton)
return false;
@@ -767,12 +808,12 @@ bool ScrollbarThemeMac::shouldCenterOnThumb(ScrollbarThemeClient*, const Platfor
return evt.altKey();
}
-bool ScrollbarThemeMac::shouldDragDocumentInsteadOfThumb(ScrollbarThemeClient*, const PlatformMouseEvent& event)
+bool ScrollbarThemeMacCommon::shouldDragDocumentInsteadOfThumb(ScrollbarThemeClient*, const PlatformMouseEvent& event)
{
return event.altKey();
}
-int ScrollbarThemeMac::scrollbarPartToHIPressedState(ScrollbarPart part)
+int ScrollbarThemeMacCommon::scrollbarPartToHIPressedState(ScrollbarPart part)
{
switch (part) {
case BackButtonStartPart:
@@ -790,10 +831,9 @@ int ScrollbarThemeMac::scrollbarPartToHIPressedState(ScrollbarPart part)
}
}
-void ScrollbarThemeMac::updateEnabledState(ScrollbarThemeClient* scrollbar)
+void ScrollbarThemeMacOverlay::updateEnabledState(ScrollbarThemeClient* scrollbar)
{
- if (isScrollbarOverlayAPIAvailable())
- [painterForScrollbar(scrollbar) setEnabled:scrollbar->enabled()];
+ [painterForScrollbar(scrollbar) setEnabled:scrollbar->enabled()];
}
} // namespace WebCore
« Source/core/platform/mac/ScrollAnimatorMac.mm ('K') | « Source/core/platform/mac/ScrollbarThemeMac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698