Title: [244554] trunk/Source/WebCore
- Revision
- 244554
- Author
- timo...@apple.com
- Date
- 2019-04-23 12:13:48 -0700 (Tue, 23 Apr 2019)
Log Message
Speed up RenderTheme::systemColor on Speedometer2.
https://bugs.webkit.org/show_bug.cgi?id=197203
rdar://problem/50056756
Reviewed by Tim Horton.
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::systemColor const): Remove some unused code. And fetch the cache after an early return.
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::systemColor const): Avoid some allocations in LocalDefaultSystemAppearance
when a CSS color is in the system color cache.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (244553 => 244554)
--- trunk/Source/WebCore/ChangeLog 2019-04-23 18:15:39 UTC (rev 244553)
+++ trunk/Source/WebCore/ChangeLog 2019-04-23 19:13:48 UTC (rev 244554)
@@ -1,3 +1,17 @@
+2019-04-23 Timothy Hatcher <timo...@apple.com>
+
+ Speed up RenderTheme::systemColor on Speedometer2.
+ https://bugs.webkit.org/show_bug.cgi?id=197203
+ rdar://problem/50056756
+
+ Reviewed by Tim Horton.
+
+ * rendering/RenderThemeIOS.mm:
+ (WebCore::RenderThemeIOS::systemColor const): Remove some unused code. And fetch the cache after an early return.
+ * rendering/RenderThemeMac.mm:
+ (WebCore::RenderThemeMac::systemColor const): Avoid some allocations in LocalDefaultSystemAppearance
+ when a CSS color is in the system color cache.
+
2019-04-23 Ryosuke Niwa <rn...@webkit.org>
[iOS] element.focus() sometimes fails to reveal the focused element when it becomes editable dynamically
Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (244553 => 244554)
--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2019-04-23 18:15:39 UTC (rev 244553)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2019-04-23 19:13:48 UTC (rev 244554)
@@ -1418,15 +1418,8 @@
Color RenderThemeIOS::systemColor(CSSValueID cssValueID, OptionSet<StyleColor::Options> options) const
{
- const bool useSystemAppearance = options.contains(StyleColor::Options::UseSystemAppearance);
const bool forVisitedLink = options.contains(StyleColor::Options::ForVisitedLink);
- auto& cache = colorCache(options);
-
-#if USE(APPLE_INTERNAL_SDK) && __has_include(<WebKitAdditions/RenderThemeIOSSystemColorAdditions.mm>)
-#include <WebKitAdditions/RenderThemeIOSSystemColorAdditions.mm>
-#endif
-
// The system color cache below can't handle visited links. The only color value
// that cares about visited links is CSSValueWebkitLink, so handle it here by
// calling through to RenderTheme's base implementation.
@@ -1433,10 +1426,14 @@
if (forVisitedLink && cssValueID == CSSValueWebkitLink)
return RenderTheme::systemColor(cssValueID, options);
- ASSERT_UNUSED(useSystemAppearance, !useSystemAppearance);
ASSERT(!forVisitedLink);
+ auto& cache = colorCache(options);
return cache.systemStyleColors.ensure(cssValueID, [this, cssValueID, options] () -> Color {
+#if USE(APPLE_INTERNAL_SDK) && __has_include(<WebKitAdditions/RenderThemeIOSSystemColorAdditions.mm>)
+#include <WebKitAdditions/RenderThemeIOSSystemColorAdditions.mm>
+#endif
+
auto cssColorToSelector = [cssValueID] () -> SEL {
#if USE(APPLE_INTERNAL_SDK) && __has_include(<WebKitAdditions/RenderThemeIOSColorToSelectorAdditions.mm>)
#include <WebKitAdditions/RenderThemeIOSColorToSelectorAdditions.mm>
Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (244553 => 244554)
--- trunk/Source/WebCore/rendering/RenderThemeMac.mm 2019-04-23 18:15:39 UTC (rev 244553)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm 2019-04-23 19:13:48 UTC (rev 244554)
@@ -604,14 +604,13 @@
const bool useDarkAppearance = options.contains(StyleColor::Options::UseDarkAppearance);
const bool forVisitedLink = options.contains(StyleColor::Options::ForVisitedLink);
- LocalDefaultSystemAppearance localAppearance(useDarkAppearance);
-
auto& cache = colorCache(options);
if (useSystemAppearance) {
// Special handling for links and other system colors when the system appearance is desired.
- auto systemAppearanceColor = [] (Color& color, SEL selector) -> Color {
+ auto systemAppearanceColor = [useDarkAppearance] (Color& color, SEL selector) -> Color {
if (!color.isValid()) {
+ LocalDefaultSystemAppearance localAppearance(useDarkAppearance);
auto systemColor = wtfObjCMsgSend<NSColor *>([NSColor class], selector);
color = semanticColorFromNSColor(systemColor);
}
@@ -662,7 +661,9 @@
ASSERT(!forVisitedLink);
- return cache.systemStyleColors.ensure(cssValueID, [this, cssValueID, options, &localAppearance] () -> Color {
+ return cache.systemStyleColors.ensure(cssValueID, [this, cssValueID, options, useDarkAppearance] () -> Color {
+ LocalDefaultSystemAppearance localAppearance(useDarkAppearance);
+
auto selectCocoaColor = [cssValueID] () -> SEL {
switch (cssValueID) {
case CSSValueActivecaption:
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes