Changeset 244554 in webkit


Ignore:
Timestamp:
Apr 23, 2019 12:13:48 PM (5 years ago)
Author:
timothy@apple.com
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.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r244546 r244554  
     12019-04-23  Timothy Hatcher  <timothy@apple.com>
     2
     3        Speed up RenderTheme::systemColor on Speedometer2.
     4        https://bugs.webkit.org/show_bug.cgi?id=197203
     5        rdar://problem/50056756
     6
     7        Reviewed by Tim Horton.
     8
     9        * rendering/RenderThemeIOS.mm:
     10        (WebCore::RenderThemeIOS::systemColor const): Remove some unused code. And fetch the cache after an early return.
     11        * rendering/RenderThemeMac.mm:
     12        (WebCore::RenderThemeMac::systemColor const): Avoid some allocations in LocalDefaultSystemAppearance
     13        when a CSS color is in the system color cache.
     14
    1152019-04-23  Ryosuke Niwa  <rniwa@webkit.org>
    216
  • trunk/Source/WebCore/rendering/RenderThemeIOS.mm

    r241825 r244554  
    14191419Color RenderThemeIOS::systemColor(CSSValueID cssValueID, OptionSet<StyleColor::Options> options) const
    14201420{
    1421     const bool useSystemAppearance = options.contains(StyleColor::Options::UseSystemAppearance);
    14221421    const bool forVisitedLink = options.contains(StyleColor::Options::ForVisitedLink);
    1423 
    1424     auto& cache = colorCache(options);
    1425 
    1426 #if USE(APPLE_INTERNAL_SDK) && __has_include(<WebKitAdditions/RenderThemeIOSSystemColorAdditions.mm>)
    1427 #include <WebKitAdditions/RenderThemeIOSSystemColorAdditions.mm>
    1428 #endif
    14291422
    14301423    // The system color cache below can't handle visited links. The only color value
     
    14341427        return RenderTheme::systemColor(cssValueID, options);
    14351428
    1436     ASSERT_UNUSED(useSystemAppearance, !useSystemAppearance);
    14371429    ASSERT(!forVisitedLink);
    14381430
     1431    auto& cache = colorCache(options);
    14391432    return cache.systemStyleColors.ensure(cssValueID, [this, cssValueID, options] () -> Color {
     1433#if USE(APPLE_INTERNAL_SDK) && __has_include(<WebKitAdditions/RenderThemeIOSSystemColorAdditions.mm>)
     1434#include <WebKitAdditions/RenderThemeIOSSystemColorAdditions.mm>
     1435#endif
     1436
    14401437        auto cssColorToSelector = [cssValueID] () -> SEL {
    14411438#if USE(APPLE_INTERNAL_SDK) && __has_include(<WebKitAdditions/RenderThemeIOSColorToSelectorAdditions.mm>)
  • trunk/Source/WebCore/rendering/RenderThemeMac.mm

    r242325 r244554  
    605605    const bool forVisitedLink = options.contains(StyleColor::Options::ForVisitedLink);
    606606
    607     LocalDefaultSystemAppearance localAppearance(useDarkAppearance);
    608 
    609607    auto& cache = colorCache(options);
    610608
    611609    if (useSystemAppearance) {
    612610        // Special handling for links and other system colors when the system appearance is desired.
    613         auto systemAppearanceColor = [] (Color& color, SEL selector) -> Color {
     611        auto systemAppearanceColor = [useDarkAppearance] (Color& color, SEL selector) -> Color {
    614612            if (!color.isValid()) {
     613                LocalDefaultSystemAppearance localAppearance(useDarkAppearance);
    615614                auto systemColor = wtfObjCMsgSend<NSColor *>([NSColor class], selector);
    616615                color = semanticColorFromNSColor(systemColor);
     
    663662    ASSERT(!forVisitedLink);
    664663
    665     return cache.systemStyleColors.ensure(cssValueID, [this, cssValueID, options, &localAppearance] () -> Color {
     664    return cache.systemStyleColors.ensure(cssValueID, [this, cssValueID, options, useDarkAppearance] () -> Color {
     665        LocalDefaultSystemAppearance localAppearance(useDarkAppearance);
     666
    666667        auto selectCocoaColor = [cssValueID] () -> SEL {
    667668            switch (cssValueID) {
Note: See TracChangeset for help on using the changeset viewer.