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

Unified Diff: third_party/WebKit/Source/platform/scroll/ScrollbarThemeMacOverlayAPI.mm

Issue 1458703010: Mac: Don't repaint scrollbars every frame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master2
Patch Set: Rebase and resolve Created 5 years, 1 month 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: third_party/WebKit/Source/platform/scroll/ScrollbarThemeMacOverlayAPI.mm
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeMacOverlayAPI.mm b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeMacOverlayAPI.mm
index eed11375dcfe60a43303a211b821ba03238554b6..91d5131b11a9dee30de83fbc5ad6940b13562e22 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeMacOverlayAPI.mm
+++ b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeMacOverlayAPI.mm
@@ -133,7 +133,7 @@ void ScrollbarThemeMacOverlayAPI::setNewPainterForScrollbar(ScrollbarThemeClient
updateScrollbarOverlayStyle(scrollbar);
}
-ScrollbarPainter ScrollbarThemeMacOverlayAPI::painterForScrollbar(const ScrollbarThemeClient* scrollbar)
+ScrollbarPainter ScrollbarThemeMacOverlayAPI::painterForScrollbar(const ScrollbarThemeClient* scrollbar) const
{
return [scrollbarPainterMap()->get(const_cast<ScrollbarThemeClient*>(scrollbar)).get() painter];
}
@@ -154,7 +154,6 @@ void ScrollbarThemeMacOverlayAPI::paintTrackBackground(GraphicsContext* context,
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];
}
@@ -179,12 +178,17 @@ void ScrollbarThemeMacOverlayAPI::paintThumb(GraphicsContext* context, const Scr
[scrollbarPainter setBoundsSize:NSSizeFromCGSize(rect.size())];
[scrollbarPainter setDoubleValue:0];
[scrollbarPainter setKnobProportion:1];
+
+ CGFloat oldKnobAlpha = [scrollbarPainter knobAlpha];
+ [scrollbarPainter setKnobAlpha: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())];
+ [scrollbarPainter setKnobAlpha:oldKnobAlpha];
}
int ScrollbarThemeMacOverlayAPI::scrollbarThickness(ScrollbarControlSize controlSize)
@@ -266,5 +270,10 @@ void ScrollbarThemeMacOverlayAPI::updateEnabledState(const ScrollbarThemeClient*
[painterForScrollbar(scrollbar) setEnabled:scrollbar->enabled()];
}
+float ScrollbarThemeMacOverlayAPI::thumbOpacity(const ScrollbarThemeClient* scrollbar) const {
+ ScrollbarPainter scrollbarPainter = painterForScrollbar(scrollbar);
+ return [scrollbarPainter knobAlpha];
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698