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

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

Issue 21108004: Separate ScrollbarThemeMac into separate files (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@second_refactor
Patch Set: Incorporate review feedback 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 2ebd912ed922e1d1d488bd5b6bca98726edfea3e..6b7975afda383154e0d4041417ded5f1da86bce1 100644
--- a/Source/core/platform/mac/ScrollbarThemeMac.mm
+++ b/Source/core/platform/mac/ScrollbarThemeMac.mm
@@ -39,6 +39,8 @@
#include "core/platform/mac/LocalCurrentGraphicsContext.h"
#include "core/platform/mac/NSScrollerImpDetails.h"
#include "core/platform/mac/ScrollAnimatorMac.h"
+#include "core/platform/mac/ScrollbarThemeMacNonOverlayAPI.h"
+#include "core/platform/mac/ScrollbarThemeMacOverlayAPI.h"
#include "public/platform/mac/WebThemeEngine.h"
#include "public/platform/Platform.h"
#include "public/platform/WebRect.h"
@@ -67,14 +69,6 @@ static ScrollbarMap* scrollbarMap()
return map;
}
-typedef HashMap<ScrollbarThemeClient*, RetainPtr<ScrollbarPainter> > ScrollbarPainterMap;
-
-static ScrollbarPainterMap* scrollbarPainterMap()
-{
- static ScrollbarPainterMap* map = new ScrollbarPainterMap;
- return map;
-}
-
}
@interface WebScrollbarPrefsObserver : NSObject
@@ -128,45 +122,10 @@ static ScrollbarPainterMap* scrollbarPainterMap()
namespace WebCore {
-// FIXME: Get these numbers from CoreUI.
-static int cRealButtonLength[] = { 28, 21 };
-static int cButtonHitInset[] = { 3, 2 };
-// cRealButtonLength - cButtonInset
-static int cButtonLength[] = { 14, 10 };
-static int cScrollbarThickness[] = { 15, 11 };
-static int cButtonInset[] = { 14, 11 };
-static int cThumbMinLength[] = { 26, 20 };
-
-static int cOuterButtonLength[] = { 16, 14 }; // The outer button in a double button pair is a bit bigger.
-static int cOuterButtonOverlap = 2;
-
static float gInitialButtonDelay = 0.5f;
static float gAutoscrollButtonDelay = 0.05f;
static bool gJumpOnTrackClick = false;
-static ScrollbarButtonsPlacement gButtonPlacement = ScrollbarButtonsDoubleEnd;
-
-static bool supportsExpandedScrollbars()
-{
- // FIXME: This is temporary until all platforms that support ScrollbarPainter support this part of the API.
- static bool globalSupportsExpandedScrollbars = [NSClassFromString(@"NSScrollerImp") instancesRespondToSelector:@selector(setExpanded:)];
- return globalSupportsExpandedScrollbars;
-}
-
-void ScrollbarThemeMacNonOverlayAPI::updateButtonPlacement()
-{
- NSString *buttonPlacement = [[NSUserDefaults standardUserDefaults] objectForKey:@"AppleScrollBarVariant"];
- if ([buttonPlacement isEqualToString:@"Single"])
- gButtonPlacement = ScrollbarButtonsSingle;
- else if ([buttonPlacement isEqualToString:@"DoubleMin"])
- gButtonPlacement = ScrollbarButtonsDoubleStart;
- else if ([buttonPlacement isEqualToString:@"DoubleBoth"])
- gButtonPlacement = ScrollbarButtonsDoubleBoth;
- else {
- gButtonPlacement = ScrollbarButtonsDoubleEnd;
- }
-}
-
ScrollbarTheme* ScrollbarTheme::nativeTheme()
{
if (isScrollbarOverlayAPIAvailable()) {
@@ -179,151 +138,16 @@ ScrollbarTheme* ScrollbarTheme::nativeTheme()
return NULL;
}
-static WebKit::WebThemeEngine::State scrollbarStateToThemeState(ScrollbarThemeClient* scrollbar)
-{
- if (!scrollbar->enabled())
- return WebKit::WebThemeEngine::StateDisabled;
- if (!scrollbar->isScrollableAreaActive())
- return WebKit::WebThemeEngine::StateInactive;
- if (scrollbar->pressedPart() == ThumbPart)
- return WebKit::WebThemeEngine::StatePressed;
-
- return WebKit::WebThemeEngine::StateActive;
-}
-
-void ScrollbarThemeMacOverlayAPI::registerScrollbar(ScrollbarThemeClient* scrollbar)
-{
- 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 ScrollbarThemeMacCommon::registerScrollbar(ScrollbarThemeClient* scrollbar)
{
scrollbarMap()->add(scrollbar, scrollbar);
}
-void ScrollbarThemeMacOverlayAPI::unregisterScrollbar(ScrollbarThemeClient* scrollbar)
-{
- scrollbarPainterMap()->remove(scrollbar);
-
- ScrollbarThemeMacCommon::unregisterScrollbar(scrollbar);
-}
-
void ScrollbarThemeMacCommon::unregisterScrollbar(ScrollbarThemeClient* scrollbar)
{
scrollbarMap()->remove(scrollbar);
}
-void ScrollbarThemeMacOverlayAPI::setNewPainterForScrollbar(ScrollbarThemeClient* scrollbar, ScrollbarPainter newPainter)
-{
- scrollbarPainterMap()->set(scrollbar, newPainter);
- updateEnabledState(scrollbar);
- updateScrollbarOverlayStyle(scrollbar);
-}
-
-ScrollbarPainter ScrollbarThemeMacOverlayAPI::painterForScrollbar(ScrollbarThemeClient* scrollbar)
-{
- return scrollbarPainterMap()->get(scrollbar).get();
-}
-
-// Override ScrollbarThemeMacCommon::paint() to add support for the following:
-// - drawing using WebThemeEngine functions
-// - drawing tickmarks
-// - Skia specific changes
-bool ScrollbarThemeMacNonOverlayAPI::paint(ScrollbarThemeClient* scrollbar, GraphicsContext* context, const IntRect& damageRect)
-{
- // Get the tickmarks for the frameview.
- Vector<IntRect> tickmarks;
- scrollbar->getTickmarks(tickmarks);
-
- HIThemeTrackDrawInfo trackInfo;
- trackInfo.version = 0;
- trackInfo.kind = scrollbar->controlSize() == RegularScrollbar ? kThemeMediumScrollBar : kThemeSmallScrollBar;
- trackInfo.bounds = scrollbar->frameRect();
- trackInfo.min = 0;
- trackInfo.max = scrollbar->maximum();
- trackInfo.value = scrollbar->currentPos();
- trackInfo.trackInfo.scrollbar.viewsize = scrollbar->visibleSize();
- trackInfo.attributes = 0;
- if (scrollbar->orientation() == HorizontalScrollbar)
- trackInfo.attributes |= kThemeTrackHorizontal;
-
- if (!scrollbar->enabled())
- trackInfo.enableState = kThemeTrackDisabled;
- else
- trackInfo.enableState = scrollbar->isScrollableAreaActive() ? kThemeTrackActive : kThemeTrackInactive;
-
- if (!hasButtons(scrollbar))
- trackInfo.enableState = kThemeTrackNothingToScroll;
- trackInfo.trackInfo.scrollbar.pressState = scrollbarPartToHIPressedState(scrollbar->pressedPart());
-
- SkCanvas* canvas = context->canvas();
- CGAffineTransform currentCTM = gfx::SkMatrixToCGAffineTransform(canvas->getTotalMatrix());
-
- // The Aqua scrollbar is buggy when rotated and scaled. We will just draw into a bitmap if we detect a scale or rotation.
- bool canDrawDirectly = currentCTM.a == 1.0f && currentCTM.b == 0.0f && currentCTM.c == 0.0f && (currentCTM.d == 1.0f || currentCTM.d == -1.0f);
- GraphicsContext* drawingContext = context;
- OwnPtr<ImageBuffer> imageBuffer;
- if (!canDrawDirectly) {
- trackInfo.bounds = IntRect(IntPoint(), scrollbar->frameRect().size());
-
- IntRect bufferRect(scrollbar->frameRect());
- bufferRect.intersect(damageRect);
- bufferRect.move(-scrollbar->frameRect().x(), -scrollbar->frameRect().y());
-
- imageBuffer = ImageBuffer::create(bufferRect.size());
- if (!imageBuffer)
- return true;
-
- drawingContext = imageBuffer->context();
- }
-
- // Draw thumbless.
- gfx::SkiaBitLocker bitLocker(drawingContext->canvas());
- CGContextRef cgContext = bitLocker.cgContext();
- HIThemeDrawTrack(&trackInfo, 0, cgContext, kHIThemeOrientationNormal);
-
- IntRect tickmarkTrackRect = trackRect(scrollbar, false);
- if (!canDrawDirectly) {
- tickmarkTrackRect.setX(0);
- tickmarkTrackRect.setY(0);
- }
- // The ends are rounded and the thumb doesn't go there.
- tickmarkTrackRect.inflateY(-tickmarkTrackRect.width());
- // Inset a bit.
- tickmarkTrackRect.setX(tickmarkTrackRect.x() + 2);
- tickmarkTrackRect.setWidth(tickmarkTrackRect.width() - 5);
- paintGivenTickmarks(drawingContext, scrollbar, tickmarkTrackRect, tickmarks);
-
- if (hasThumb(scrollbar)) {
- WebKit::WebThemeEngine::ScrollbarInfo scrollbarInfo;
- scrollbarInfo.orientation = scrollbar->orientation() == HorizontalScrollbar ? WebKit::WebThemeEngine::ScrollbarOrientationHorizontal : WebKit::WebThemeEngine::ScrollbarOrientationVertical;
- scrollbarInfo.parent = scrollbar->isScrollViewScrollbar() ? WebKit::WebThemeEngine::ScrollbarParentScrollView : WebKit::WebThemeEngine::ScrollbarParentRenderLayer;
- scrollbarInfo.maxValue = scrollbar->maximum();
- scrollbarInfo.currentValue = scrollbar->currentPos();
- scrollbarInfo.visibleSize = scrollbar->visibleSize();
- scrollbarInfo.totalSize = scrollbar->totalSize();
-
- WebKit::WebCanvas* webCanvas = drawingContext->canvas();
- WebKit::Platform::current()->themeEngine()->paintScrollbarThumb(
- webCanvas,
- scrollbarStateToThemeState(scrollbar),
- scrollbar->controlSize() == RegularScrollbar ? WebKit::WebThemeEngine::SizeRegular : WebKit::WebThemeEngine::SizeSmall,
- WebKit::WebRect(scrollbar->frameRect()),
- scrollbarInfo);
- }
-
- if (!canDrawDirectly)
- context->drawImageBuffer(imageBuffer.get(), scrollbar->frameRect().location());
-
- return true;
-}
-
void ScrollbarThemeMacCommon::paintGivenTickmarks(GraphicsContext* context, ScrollbarThemeClient* scrollbar, const IntRect& rect, const Vector<IntRect>& tickmarks)
{
if (scrollbar->orientation() != VerticalScrollbar)
@@ -499,43 +323,6 @@ void ScrollbarThemeMacCommon::paintTickmarks(GraphicsContext* context, Scrollbar
paintGivenTickmarks(context, scrollbar, tickmarkTrackRect, tickmarks);
}
-void ScrollbarThemeMacOverlayAPI::paintTrackBackground(GraphicsContext* context, ScrollbarThemeClient* scrollbar, const IntRect& rect) {
- ASSERT(isScrollbarOverlayAPIAvailable());
-
- GraphicsContextStateSaver stateSaver(*context);
- context->translate(rect.x(), rect.y());
- LocalCurrentGraphicsContext localContext(context);
-
- CGRect frameRect = scrollbar->frameRect();
- ScrollbarPainter scrollbarPainter = painterForScrollbar(scrollbar);
- [scrollbarPainter setEnabled:scrollbar->enabled()];
- [scrollbarPainter setBoundsSize: NSSizeFromCGSize(frameRect.size)];
-
- NSRect trackRect = NSMakeRect(0, 0, frameRect.size.width, frameRect.size.height);
- [scrollbarPainter drawKnobSlotInRect:trackRect highlight:NO];
-}
-
-void ScrollbarThemeMacOverlayAPI::paintThumb(GraphicsContext* context, ScrollbarThemeClient* scrollbar, const IntRect& rect) {
- ASSERT(isScrollbarOverlayAPIAvailable());
-
- GraphicsContextStateSaver stateSaver(*context);
- context->translate(rect.x(), rect.y());
- LocalCurrentGraphicsContext localContext(context);
-
- ScrollbarPainter scrollbarPainter = painterForScrollbar(scrollbar);
- CGRect frameRect = scrollbar->frameRect();
- [scrollbarPainter setEnabled:scrollbar->enabled()];
- [scrollbarPainter setBoundsSize:NSSizeFromCGSize(rect.size())];
- [scrollbarPainter setDoubleValue:0];
- [scrollbarPainter setKnobProportion:1];
- if (scrollbar->enabled())
- [scrollbarPainter drawKnob];
-
- // If this state is not set, then moving the cursor over the scrollbar area will only cause the
- // scrollbar to engorge when moved over the top of the scrollbar area.
- [scrollbarPainter setBoundsSize: NSSizeFromCGSize(scrollbar->frameRect().size())];
-}
-
ScrollbarThemeMacCommon::ScrollbarThemeMacCommon()
{
static bool initialized;
@@ -564,40 +351,6 @@ void ScrollbarThemeMacCommon::preferencesChanged()
gJumpOnTrackClick = [defaults boolForKey:@"AppleScrollerPagingBehavior"];
}
-int ScrollbarThemeMacOverlayAPI::scrollbarThickness(ScrollbarControlSize controlSize)
-{
- ScrollbarPainter scrollbarPainter = [NSClassFromString(@"NSScrollerImp") scrollerImpWithStyle:recommendedScrollerStyle() controlSize:controlSize horizontal:NO replacingScrollerImp:nil];
- if (supportsExpandedScrollbars())
- [scrollbarPainter setExpanded:YES];
- return [scrollbarPainter trackBoxWidth];
-}
-
-int ScrollbarThemeMacNonOverlayAPI::scrollbarThickness(ScrollbarControlSize controlSize)
-{
- return cScrollbarThickness[controlSize];
-}
-
-bool ScrollbarThemeMacOverlayAPI::usesOverlayScrollbars() const
-{
- return recommendedScrollerStyle() == NSScrollerStyleOverlay;
-}
-
-void ScrollbarThemeMacOverlayAPI::updateScrollbarOverlayStyle(ScrollbarThemeClient* scrollbar)
-{
- ScrollbarPainter painter = painterForScrollbar(scrollbar);
- switch (scrollbar->scrollbarOverlayStyle()) {
- case ScrollbarOverlayStyleDefault:
- [painter setKnobStyle:NSScrollerKnobStyleDefault];
- break;
- case ScrollbarOverlayStyleDark:
- [painter setKnobStyle:NSScrollerKnobStyleDark];
- break;
- case ScrollbarOverlayStyleLight:
- [painter setKnobStyle:NSScrollerKnobStyleLight];
- break;
- }
-}
-
double ScrollbarThemeMacCommon::initialAutoscrollTimerDelay()
{
return gInitialButtonDelay;
@@ -608,199 +361,6 @@ double ScrollbarThemeMacCommon::autoscrollTimerDelay()
return gAutoscrollButtonDelay;
}
-ScrollbarButtonsPlacement ScrollbarThemeMacOverlayAPI::buttonsPlacement() const
-{
- return ScrollbarButtonsNone;
-}
-
-ScrollbarButtonsPlacement ScrollbarThemeMacNonOverlayAPI::buttonsPlacement() const
-{
- return gButtonPlacement;
-}
-
-bool ScrollbarThemeMacNonOverlayAPI::hasButtons(ScrollbarThemeClient* scrollbar)
-{
- return scrollbar->enabled() && buttonsPlacement() != ScrollbarButtonsNone
- && (scrollbar->orientation() == HorizontalScrollbar
- ? scrollbar->width()
- : scrollbar->height()) >= 2 * (cRealButtonLength[scrollbar->controlSize()] - cButtonHitInset[scrollbar->controlSize()]);
-}
-
-bool ScrollbarThemeMacOverlayAPI::hasThumb(ScrollbarThemeClient* scrollbar)
-{
- 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;
-}
-
-bool ScrollbarThemeMacNonOverlayAPI::hasThumb(ScrollbarThemeClient* scrollbar)
-{
- int minLengthForThumb = 2 * cButtonInset[scrollbar->controlSize()] + cThumbMinLength[scrollbar->controlSize()] + 1;
- return scrollbar->enabled() && (scrollbar->orientation() == HorizontalScrollbar ?
- scrollbar->width() :
- scrollbar->height()) >= minLengthForThumb;
-}
-
-static IntRect buttonRepaintRect(const IntRect& buttonRect, ScrollbarOrientation orientation, ScrollbarControlSize controlSize, bool start)
-{
- ASSERT(gButtonPlacement != ScrollbarButtonsNone);
-
- IntRect paintRect(buttonRect);
- if (orientation == HorizontalScrollbar) {
- paintRect.setWidth(cRealButtonLength[controlSize]);
- if (!start)
- paintRect.setX(buttonRect.x() - (cRealButtonLength[controlSize] - buttonRect.width()));
- } else {
- paintRect.setHeight(cRealButtonLength[controlSize]);
- if (!start)
- paintRect.setY(buttonRect.y() - (cRealButtonLength[controlSize] - buttonRect.height()));
- }
-
- return paintRect;
-}
-
-IntRect ScrollbarThemeMacOverlayAPI::backButtonRect(ScrollbarThemeClient* scrollbar, ScrollbarPart part, bool painting)
-{
- ASSERT(buttonsPlacement() == ScrollbarButtonsNone);
- return IntRect();
-}
-
-IntRect ScrollbarThemeMacNonOverlayAPI::backButtonRect(ScrollbarThemeClient* scrollbar, ScrollbarPart part, bool painting)
-{
- IntRect result;
-
- if (part == BackButtonStartPart && (buttonsPlacement() == ScrollbarButtonsNone || buttonsPlacement() == ScrollbarButtonsDoubleEnd))
- return result;
-
- if (part == BackButtonEndPart && (buttonsPlacement() == ScrollbarButtonsNone || buttonsPlacement() == ScrollbarButtonsDoubleStart || buttonsPlacement() == ScrollbarButtonsSingle))
- return result;
-
- int thickness = scrollbarThickness(scrollbar->controlSize());
- bool outerButton = part == BackButtonStartPart && (buttonsPlacement() == ScrollbarButtonsDoubleStart || buttonsPlacement() == ScrollbarButtonsDoubleBoth);
- if (outerButton) {
- if (scrollbar->orientation() == HorizontalScrollbar)
- result = IntRect(scrollbar->x(), scrollbar->y(), cOuterButtonLength[scrollbar->controlSize()] + (painting ? cOuterButtonOverlap : 0), thickness);
- else
- result = IntRect(scrollbar->x(), scrollbar->y(), thickness, cOuterButtonLength[scrollbar->controlSize()] + (painting ? cOuterButtonOverlap : 0));
- return result;
- }
-
- // Our repaint rect is slightly larger, since we are a button that is adjacent to the track.
- if (scrollbar->orientation() == HorizontalScrollbar) {
- int start = part == BackButtonStartPart ? scrollbar->x() : scrollbar->x() + scrollbar->width() - cOuterButtonLength[scrollbar->controlSize()] - cButtonLength[scrollbar->controlSize()];
- result = IntRect(start, scrollbar->y(), cButtonLength[scrollbar->controlSize()], thickness);
- } else {
- int start = part == BackButtonStartPart ? scrollbar->y() : scrollbar->y() + scrollbar->height() - cOuterButtonLength[scrollbar->controlSize()] - cButtonLength[scrollbar->controlSize()];
- result = IntRect(scrollbar->x(), start, thickness, cButtonLength[scrollbar->controlSize()]);
- }
-
- if (painting)
- return buttonRepaintRect(result, scrollbar->orientation(), scrollbar->controlSize(), part == BackButtonStartPart);
- return result;
-}
-
-IntRect ScrollbarThemeMacOverlayAPI::forwardButtonRect(ScrollbarThemeClient* scrollbar, ScrollbarPart part, bool painting)
-{
- ASSERT(buttonsPlacement() == ScrollbarButtonsNone);
- return IntRect();
-}
-
-IntRect ScrollbarThemeMacNonOverlayAPI::forwardButtonRect(ScrollbarThemeClient* scrollbar, ScrollbarPart part, bool painting)
-{
- IntRect result;
-
- if (part == ForwardButtonEndPart && (buttonsPlacement() == ScrollbarButtonsNone || buttonsPlacement() == ScrollbarButtonsDoubleStart))
- return result;
-
- if (part == ForwardButtonStartPart && (buttonsPlacement() == ScrollbarButtonsNone || buttonsPlacement() == ScrollbarButtonsDoubleEnd || buttonsPlacement() == ScrollbarButtonsSingle))
- return result;
-
- int thickness = scrollbarThickness(scrollbar->controlSize());
- int outerButtonLength = cOuterButtonLength[scrollbar->controlSize()];
- int buttonLength = cButtonLength[scrollbar->controlSize()];
-
- bool outerButton = part == ForwardButtonEndPart && (buttonsPlacement() == ScrollbarButtonsDoubleEnd || buttonsPlacement() == ScrollbarButtonsDoubleBoth);
- if (outerButton) {
- if (scrollbar->orientation() == HorizontalScrollbar) {
- result = IntRect(scrollbar->x() + scrollbar->width() - outerButtonLength, scrollbar->y(), outerButtonLength, thickness);
- if (painting)
- result.inflateX(cOuterButtonOverlap);
- } else {
- result = IntRect(scrollbar->x(), scrollbar->y() + scrollbar->height() - outerButtonLength, thickness, outerButtonLength);
- if (painting)
- result.inflateY(cOuterButtonOverlap);
- }
- return result;
- }
-
- if (scrollbar->orientation() == HorizontalScrollbar) {
- int start = part == ForwardButtonEndPart ? scrollbar->x() + scrollbar->width() - buttonLength : scrollbar->x() + outerButtonLength;
- result = IntRect(start, scrollbar->y(), buttonLength, thickness);
- } else {
- int start = part == ForwardButtonEndPart ? scrollbar->y() + scrollbar->height() - buttonLength : scrollbar->y() + outerButtonLength;
- result = IntRect(scrollbar->x(), start, thickness, buttonLength);
- }
- if (painting)
- return buttonRepaintRect(result, scrollbar->orientation(), scrollbar->controlSize(), part == ForwardButtonStartPart);
- return result;
-}
-
-IntRect ScrollbarThemeMacOverlayAPI::trackRect(ScrollbarThemeClient* scrollbar, bool painting)
-{
- ASSERT(!hasButtons(scrollbar));
- return scrollbar->frameRect();
-}
-
-IntRect ScrollbarThemeMacNonOverlayAPI::trackRect(ScrollbarThemeClient* scrollbar, bool painting)
-{
- if (painting || !hasButtons(scrollbar))
- return scrollbar->frameRect();
-
- IntRect result;
- int thickness = scrollbarThickness(scrollbar->controlSize());
- int startWidth = 0;
- int endWidth = 0;
- int outerButtonLength = cOuterButtonLength[scrollbar->controlSize()];
- int buttonLength = cButtonLength[scrollbar->controlSize()];
- int doubleButtonLength = outerButtonLength + buttonLength;
- switch (buttonsPlacement()) {
- case ScrollbarButtonsSingle:
- startWidth = buttonLength;
- endWidth = buttonLength;
- break;
- case ScrollbarButtonsDoubleStart:
- startWidth = doubleButtonLength;
- break;
- case ScrollbarButtonsDoubleEnd:
- endWidth = doubleButtonLength;
- break;
- case ScrollbarButtonsDoubleBoth:
- startWidth = doubleButtonLength;
- endWidth = doubleButtonLength;
- break;
- default:
- break;
- }
-
- int totalWidth = startWidth + endWidth;
- if (scrollbar->orientation() == HorizontalScrollbar)
- return IntRect(scrollbar->x() + startWidth, scrollbar->y(), scrollbar->width() - totalWidth, thickness);
- return IntRect(scrollbar->x(), scrollbar->y() + startWidth, thickness, scrollbar->height() - totalWidth);
-}
-
-int ScrollbarThemeMacOverlayAPI::minimumThumbLength(ScrollbarThemeClient* scrollbar)
-{
- return [painterForScrollbar(scrollbar) knobMinLength];
-}
-
-int ScrollbarThemeMacNonOverlayAPI::minimumThumbLength(ScrollbarThemeClient* scrollbar)
-{
- return cThumbMinLength[scrollbar->controlSize()];
-}
-
bool ScrollbarThemeMacCommon::shouldCenterOnThumb(ScrollbarThemeClient*, const PlatformMouseEvent& evt)
{
if (evt.button() != LeftButton)
@@ -833,9 +393,4 @@ int ScrollbarThemeMacCommon::scrollbarPartToHIPressedState(ScrollbarPart part)
}
}
-void ScrollbarThemeMacOverlayAPI::updateEnabledState(ScrollbarThemeClient* scrollbar)
-{
- [painterForScrollbar(scrollbar) setEnabled:scrollbar->enabled()];
-}
-
} // namespace WebCore
« no previous file with comments | « Source/core/platform/mac/ScrollbarThemeMac.h ('k') | Source/core/platform/mac/ScrollbarThemeMacNonOverlayAPI.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698