| Index: third_party/WebKit/Source/platform/scroll/ScrollbarThemeMacCommon.mm
|
| diff --git a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeMacCommon.mm b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeMacCommon.mm
|
| index 4ab88e4c5d03555885ac312f9d8ea33346cab3e8..1d39d75311c7075e0928096eb4e022ef01747df9 100644
|
| --- a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeMacCommon.mm
|
| +++ b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeMacCommon.mm
|
| @@ -56,7 +56,7 @@ using namespace blink;
|
|
|
| namespace blink {
|
|
|
| -typedef HashSet<ScrollbarThemeClient*> ScrollbarSet;
|
| +typedef HashSet<ScrollbarThemeClient&> ScrollbarSet;
|
|
|
| static ScrollbarSet& scrollbarSet()
|
| {
|
| @@ -71,32 +71,29 @@ static bool gScrollAnimationEnabledForSystem = false;
|
|
|
| ScrollbarTheme* ScrollbarTheme::nativeTheme()
|
| {
|
| - static ScrollbarThemeMacCommon* theme = NULL;
|
| - if (theme)
|
| - return theme;
|
| if (ScrollbarThemeMacCommon::isOverlayAPIAvailable()) {
|
| DEFINE_STATIC_LOCAL(ScrollbarThemeMacOverlayAPI, overlayTheme, ());
|
| - theme = &overlayTheme;
|
| - } else {
|
| + return overlayTheme;
|
| + }
|
| + {
|
| DEFINE_STATIC_LOCAL(ScrollbarThemeMacNonOverlayAPI, nonOverlayTheme, ());
|
| - theme = &nonOverlayTheme;
|
| + return nonOverlayTheme;
|
| }
|
| - return theme;
|
| }
|
|
|
| -void ScrollbarThemeMacCommon::registerScrollbar(ScrollbarThemeClient* scrollbar)
|
| +void ScrollbarThemeMacCommon::registerScrollbar(ScrollbarThemeClient& scrollbar)
|
| {
|
| scrollbarSet().add(scrollbar);
|
| }
|
|
|
| -void ScrollbarThemeMacCommon::unregisterScrollbar(ScrollbarThemeClient* scrollbar)
|
| +void ScrollbarThemeMacCommon::unregisterScrollbar(ScrollbarThemeClient& scrollbar)
|
| {
|
| scrollbarSet().remove(scrollbar);
|
| }
|
|
|
| -void ScrollbarThemeMacCommon::paintGivenTickmarks(SkCanvas* canvas, const ScrollbarThemeClient* scrollbar, const IntRect& rect, const Vector<IntRect>& tickmarks)
|
| +void ScrollbarThemeMacCommon::paintGivenTickmarks(SkCanvas* canvas, const ScrollbarThemeClient& scrollbar, const IntRect& rect, const Vector<IntRect>& tickmarks)
|
| {
|
| - if (scrollbar->orientation() != VerticalScrollbar)
|
| + if (scrollbar.orientation() != VerticalScrollbar)
|
| return;
|
|
|
| if (rect.height() <= 0 || rect.width() <= 0)
|
| @@ -119,7 +116,7 @@ void ScrollbarThemeMacCommon::paintGivenTickmarks(SkCanvas* canvas, const Scroll
|
|
|
| for (Vector<IntRect>::const_iterator i = tickmarks.begin(); i != tickmarks.end(); ++i) {
|
| // Calculate how far down (in %) the tick-mark should appear.
|
| - const float percent = static_cast<float>(i->y()) / scrollbar->totalSize();
|
| + const float percent = static_cast<float>(i->y()) / scrollbar.totalSize();
|
| if (percent < 0.0 || percent > 1.0)
|
| continue;
|
|
|
| @@ -133,17 +130,17 @@ void ScrollbarThemeMacCommon::paintGivenTickmarks(SkCanvas* canvas, const Scroll
|
| }
|
| }
|
|
|
| -void ScrollbarThemeMacCommon::paintTickmarks(GraphicsContext* context, const ScrollbarThemeClient* scrollbar, const IntRect& rect)
|
| +void ScrollbarThemeMacCommon::paintTickmarks(GraphicsContext& context, const ScrollbarThemeClient& scrollbar, const IntRect& rect)
|
| {
|
| // Note: This is only used for css-styled scrollbars on mac.
|
| - if (scrollbar->orientation() != VerticalScrollbar)
|
| + if (scrollbar.orientation() != VerticalScrollbar)
|
| return;
|
|
|
| if (rect.height() <= 0 || rect.width() <= 0)
|
| return;
|
|
|
| Vector<IntRect> tickmarks;
|
| - scrollbar->getTickmarks(tickmarks);
|
| + scrollbar.getTickmarks(tickmarks);
|
| if (!tickmarks.size())
|
| return;
|
|
|
| @@ -201,7 +198,7 @@ double ScrollbarThemeMacCommon::autoscrollTimerDelay()
|
| return gAutoscrollButtonDelay;
|
| }
|
|
|
| -bool ScrollbarThemeMacCommon::shouldDragDocumentInsteadOfThumb(const ScrollbarThemeClient*, const PlatformMouseEvent& event)
|
| +bool ScrollbarThemeMacCommon::shouldDragDocumentInsteadOfThumb(const ScrollbarThemeClient&, const PlatformMouseEvent& event)
|
| {
|
| return event.altKey();
|
| }
|
|
|