Title: [152214] trunk/Source/WebCore
- Revision
- 152214
- Author
- [email protected]
- Date
- 2013-06-29 13:27:08 -0700 (Sat, 29 Jun 2013)
Log Message
Avoid calling into Objective-C every time we get the scrollbar width
https://bugs.webkit.org/show_bug.cgi?id=118216
Reviewed by Geoffrey Garen.
Profiling shows that calling Scrollbar::isOverlayScrollbar() is somewhat
expensive, because it calls down into Objective-C. Fix by caching in
ScrollbarThemeMac whether we're using overlay scrollbars. We update this
cache on creation, and when preferences change; ScrollAnimatorMac::updateScrollerStyle()
is the function that gets called when the user changes the setting in System Preferences.
* platform/ScrollbarTheme.h:
(WebCore::ScrollbarTheme::usesOverlayScrollbarsChanged):
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::updateScrollerStyle):
* platform/mac/ScrollbarThemeMac.h:
* platform/mac/ScrollbarThemeMac.mm:
(WebCore::ScrollbarThemeMac::preferencesChanged):
(WebCore::ScrollbarThemeMac::usesOverlayScrollbars):
(WebCore::ScrollbarThemeMac::usesOverlayScrollbarsChanged):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (152213 => 152214)
--- trunk/Source/WebCore/ChangeLog 2013-06-29 20:22:19 UTC (rev 152213)
+++ trunk/Source/WebCore/ChangeLog 2013-06-29 20:27:08 UTC (rev 152214)
@@ -1,5 +1,28 @@
2013-06-29 Simon Fraser <[email protected]>
+ Avoid calling into Objective-C every time we get the scrollbar width
+ https://bugs.webkit.org/show_bug.cgi?id=118216
+
+ Reviewed by Geoffrey Garen.
+
+ Profiling shows that calling Scrollbar::isOverlayScrollbar() is somewhat
+ expensive, because it calls down into Objective-C. Fix by caching in
+ ScrollbarThemeMac whether we're using overlay scrollbars. We update this
+ cache on creation, and when preferences change; ScrollAnimatorMac::updateScrollerStyle()
+ is the function that gets called when the user changes the setting in System Preferences.
+
+ * platform/ScrollbarTheme.h:
+ (WebCore::ScrollbarTheme::usesOverlayScrollbarsChanged):
+ * platform/mac/ScrollAnimatorMac.mm:
+ (WebCore::ScrollAnimatorMac::updateScrollerStyle):
+ * platform/mac/ScrollbarThemeMac.h:
+ * platform/mac/ScrollbarThemeMac.mm:
+ (WebCore::ScrollbarThemeMac::preferencesChanged):
+ (WebCore::ScrollbarThemeMac::usesOverlayScrollbars):
+ (WebCore::ScrollbarThemeMac::usesOverlayScrollbarsChanged):
+
+2013-06-29 Simon Fraser <[email protected]>
+
Avoid calling isSimpleContainerCompositingLayer() an extra time
https://bugs.webkit.org/show_bug.cgi?id=118218
Modified: trunk/Source/WebCore/platform/ScrollbarTheme.h (152213 => 152214)
--- trunk/Source/WebCore/platform/ScrollbarTheme.h 2013-06-29 20:22:19 UTC (rev 152213)
+++ trunk/Source/WebCore/platform/ScrollbarTheme.h 2013-06-29 20:27:08 UTC (rev 152214)
@@ -57,6 +57,7 @@
virtual bool supportsControlTints() const { return false; }
virtual bool usesOverlayScrollbars() const { return false; }
+ virtual void usesOverlayScrollbarsChanged() { }
virtual void updateScrollbarOverlayStyle(ScrollbarThemeClient*) { }
virtual void themeChanged() {}
Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (152213 => 152214)
--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm 2013-06-29 20:22:19 UTC (rev 152213)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm 2013-06-29 20:27:08 UTC (rev 152214)
@@ -1212,6 +1212,8 @@
m_needsScrollerStyleUpdate = false;
return;
}
+
+ macTheme->usesOverlayScrollbarsChanged();
NSScrollerStyle newStyle = [m_scrollbarPainterController.get() scrollerStyle];
Modified: trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.h (152213 => 152214)
--- trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.h 2013-06-29 20:22:19 UTC (rev 152213)
+++ trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.h 2013-06-29 20:27:08 UTC (rev 152214)
@@ -47,6 +47,7 @@
virtual bool supportsControlTints() const { return true; }
virtual bool usesOverlayScrollbars() const;
+ virtual void usesOverlayScrollbarsChanged() OVERRIDE;
virtual void updateScrollbarOverlayStyle(ScrollbarThemeClient*);
virtual double initialAutoscrollTimerDelay();
Modified: trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm (152213 => 152214)
--- trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm 2013-06-29 20:22:19 UTC (rev 152213)
+++ trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm 2013-06-29 20:27:08 UTC (rev 152214)
@@ -133,6 +133,7 @@
static float gInitialButtonDelay = 0.5f;
static float gAutoscrollButtonDelay = 0.05f;
static bool gJumpOnTrackClick = false;
+static bool gUsesOverlayScrollbars = false;
static ScrollbarButtonsPlacement gButtonPlacement = ScrollbarButtonsDoubleEnd;
@@ -226,6 +227,7 @@
gInitialButtonDelay = [defaults floatForKey:@"NSScrollerButtonDelay"];
gAutoscrollButtonDelay = [defaults floatForKey:@"NSScrollerButtonPeriod"];
gJumpOnTrackClick = [defaults boolForKey:@"AppleScrollerPagingBehavior"];
+ usesOverlayScrollbarsChanged();
}
int ScrollbarThemeMac::scrollbarThickness(ScrollbarControlSize controlSize)
@@ -241,10 +243,15 @@
bool ScrollbarThemeMac::usesOverlayScrollbars() const
{
+ return gUsesOverlayScrollbars;
+}
+
+void ScrollbarThemeMac::usesOverlayScrollbarsChanged()
+{
if (isScrollbarOverlayAPIAvailable())
- return recommendedScrollerStyle() == NSScrollerStyleOverlay;
+ gUsesOverlayScrollbars = recommendedScrollerStyle() == NSScrollerStyleOverlay;
else
- return false;
+ gUsesOverlayScrollbars = false;
}
void ScrollbarThemeMac::updateScrollbarOverlayStyle(ScrollbarThemeClient* scrollbar)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes