Diff
Modified: trunk/LayoutTests/ChangeLog (241824 => 241825)
--- trunk/LayoutTests/ChangeLog 2019-02-20 19:23:28 UTC (rev 241824)
+++ trunk/LayoutTests/ChangeLog 2019-02-20 19:28:28 UTC (rev 241825)
@@ -1,3 +1,15 @@
+2019-02-20 Timothy Hatcher <[email protected]>
+
+ RenderThemeIOS should use RenderTheme's color cache instead of its own.
+ https://bugs.webkit.org/show_bug.cgi?id=194822
+ rdar://problem/48208296
+
+ Reviewed by Tim Horton.
+
+ * platform/ios/fast/css/apple-system-colors-expected.txt: Rebased for -apple-system-purple.
+ * platform/win/fast/css/apple-system-colors-expected.txt: Rebased for invalid color now
+ that -apple-system colors are macOS and iOS only.
+
2019-02-20 Loïc Yhuel <[email protected]>
Fix crash when opening Web Inspector after a WebSocket was blocked by content extensions
Modified: trunk/LayoutTests/platform/ios/fast/css/apple-system-colors-expected.txt (241824 => 241825)
--- trunk/LayoutTests/platform/ios/fast/css/apple-system-colors-expected.txt 2019-02-20 19:23:28 UTC (rev 241824)
+++ trunk/LayoutTests/platform/ios/fast/css/apple-system-colors-expected.txt 2019-02-20 19:28:28 UTC (rev 241825)
@@ -4,7 +4,7 @@
-apple-system-green : rgb(76, 217, 100)
-apple-system-orange : rgb(255, 149, 0)
-apple-system-pink : rgb(255, 45, 85)
--apple-system-purple : rgba(0, 0, 0, 0)
+-apple-system-purple : rgb(88, 86, 214)
-apple-system-red : rgb(255, 59, 48)
-apple-system-yellow : rgb(255, 204, 0)
-apple-wireless-playback-target-active : rgb(0, 122, 255)
Modified: trunk/LayoutTests/platform/win/fast/css/apple-system-colors-expected.txt (241824 => 241825)
--- trunk/LayoutTests/platform/win/fast/css/apple-system-colors-expected.txt 2019-02-20 19:23:28 UTC (rev 241824)
+++ trunk/LayoutTests/platform/win/fast/css/apple-system-colors-expected.txt 2019-02-20 19:28:28 UTC (rev 241825)
@@ -8,4 +8,4 @@
-apple-system-red : rgba(0, 0, 0, 0)
-apple-system-yellow : rgba(0, 0, 0, 0)
-apple-wireless-playback-target-active : rgba(0, 0, 0, 0)
-current-color with inherited -apple-system-blue : rgba(0, 0, 0, 0)
+current-color with inherited -apple-system-blue : rgb(0, 0, 0)
Modified: trunk/Source/WebCore/ChangeLog (241824 => 241825)
--- trunk/Source/WebCore/ChangeLog 2019-02-20 19:23:28 UTC (rev 241824)
+++ trunk/Source/WebCore/ChangeLog 2019-02-20 19:28:28 UTC (rev 241825)
@@ -1,3 +1,26 @@
+2019-02-20 Timothy Hatcher <[email protected]>
+
+ RenderThemeIOS should use RenderTheme's color cache instead of its own.
+ https://bugs.webkit.org/show_bug.cgi?id=194822
+ rdar://problem/48208296
+
+ Reviewed by Tim Horton.
+
+ Tested by fast/css/apple-system-colors.html.
+
+ * css/CSSValueKeywords.in:
+ * css/parser/CSSPropertyParser.cpp:
+ (WebCore::isAppleLegacyCssValueKeyword):
+ * platform/graphics/Color.h:
+ * platform/graphics/cg/ColorCG.cpp:
+ (WebCore::makeRGBAFromCGColor):
+ (WebCore::Color::Color):
+ * rendering/RenderThemeIOS.h:
+ * rendering/RenderThemeIOS.mm:
+ (WebCore::RenderThemeIOS::systemColor const):
+ * rendering/RenderThemeMac.mm:
+ (WebCore::RenderThemeMac::systemColor const):
+
2019-02-20 Loïc Yhuel <[email protected]>
Fix crash when opening Web Inspector after a WebSocket was blocked by content extensions
Modified: trunk/Source/WebCore/PAL/ChangeLog (241824 => 241825)
--- trunk/Source/WebCore/PAL/ChangeLog 2019-02-20 19:23:28 UTC (rev 241824)
+++ trunk/Source/WebCore/PAL/ChangeLog 2019-02-20 19:28:28 UTC (rev 241825)
@@ -1,3 +1,15 @@
+2019-02-20 Timothy Hatcher <[email protected]>
+
+ RenderThemeIOS should use RenderTheme's color cache instead of its own.
+ https://bugs.webkit.org/show_bug.cgi?id=194822
+ rdar://problem/48208296
+
+ Reviewed by Tim Horton.
+
+ * pal/ios/UIKitSoftLink.h:
+ * pal/ios/UIKitSoftLink.mm:
+ * pal/spi/ios/UIKitSPI.h:
+
2019-02-16 Darin Adler <[email protected]>
Continue reducing use of String::format, now focusing on hex: "%p", "%x", etc.
Modified: trunk/Source/WebCore/PAL/pal/ios/UIKitSoftLink.h (241824 => 241825)
--- trunk/Source/WebCore/PAL/pal/ios/UIKitSoftLink.h 2019-02-20 19:23:28 UTC (rev 241824)
+++ trunk/Source/WebCore/PAL/pal/ios/UIKitSoftLink.h 2019-02-20 19:28:28 UTC (rev 241825)
@@ -56,6 +56,7 @@
SOFT_LINK_CLASS_FOR_HEADER(PAL, UIPasteboard)
SOFT_LINK_CLASS_FOR_HEADER(PAL, UIScreen)
SOFT_LINK_CLASS_FOR_HEADER(PAL, UITapGestureRecognizer)
+SOFT_LINK_CLASS_FOR_HEADER(PAL, UITraitCollection)
SOFT_LINK_CLASS_FOR_HEADER(PAL, UIView)
SOFT_LINK_CLASS_FOR_HEADER(PAL, UIViewController)
SOFT_LINK_CLASS_FOR_HEADER(PAL, UIWindow)
Modified: trunk/Source/WebCore/PAL/pal/ios/UIKitSoftLink.mm (241824 => 241825)
--- trunk/Source/WebCore/PAL/pal/ios/UIKitSoftLink.mm 2019-02-20 19:23:28 UTC (rev 241824)
+++ trunk/Source/WebCore/PAL/pal/ios/UIKitSoftLink.mm 2019-02-20 19:28:28 UTC (rev 241825)
@@ -56,6 +56,7 @@
SOFT_LINK_CLASS_FOR_SOURCE(PAL, UIKit, UIPasteboard)
SOFT_LINK_CLASS_FOR_SOURCE(PAL, UIKit, UIScreen)
SOFT_LINK_CLASS_FOR_SOURCE(PAL, UIKit, UITapGestureRecognizer)
+SOFT_LINK_CLASS_FOR_SOURCE(PAL, UIKit, UITraitCollection)
SOFT_LINK_CLASS_FOR_SOURCE(PAL, UIKit, UIView)
SOFT_LINK_CLASS_FOR_SOURCE(PAL, UIKit, UIViewController)
SOFT_LINK_CLASS_FOR_SOURCE(PAL, UIKit, UIWindow)
Modified: trunk/Source/WebCore/PAL/pal/spi/ios/UIKitSPI.h (241824 => 241825)
--- trunk/Source/WebCore/PAL/pal/spi/ios/UIKitSPI.h 2019-02-20 19:23:28 UTC (rev 241824)
+++ trunk/Source/WebCore/PAL/pal/spi/ios/UIKitSPI.h 2019-02-20 19:28:28 UTC (rev 241825)
@@ -109,6 +109,7 @@
+ (UIColor *)systemGreenColor;
+ (UIColor *)systemOrangeColor;
+ (UIColor *)systemPinkColor;
++ (UIColor *)systemPurpleColor;
+ (UIColor *)systemRedColor;
+ (UIColor *)systemYellowColor;
Modified: trunk/Source/WebCore/css/CSSValueKeywords.in (241824 => 241825)
--- trunk/Source/WebCore/css/CSSValueKeywords.in 2019-02-20 19:23:28 UTC (rev 241824)
+++ trunk/Source/WebCore/css/CSSValueKeywords.in 2019-02-20 19:28:28 UTC (rev 241825)
@@ -222,22 +222,11 @@
window
windowframe
windowtext
-#if defined(WTF_PLATFORM_MAC) && WTF_PLATFORM_MAC
+#if (defined(WTF_PLATFORM_MAC) && WTF_PLATFORM_MAC) || (defined(WTF_PLATFORM_IOS_FAMILY) && WTF_PLATFORM_IOS_FAMILY)
-apple-system-header-text
-apple-system-text-background
-apple-system-control-background
--apple-system-alternate-selected-text
--apple-system-control-accent
--apple-system-even-alternating-content-background
--apple-system-odd-alternating-content-background
--apple-system-selected-content-background
--apple-system-unemphasized-selected-content-background
--apple-system-selected-text
--apple-system-unemphasized-selected-text
--apple-system-selected-text-background
--apple-system-unemphasized-selected-text-background
-apple-system-placeholder-text
--apple-system-find-highlight-background
-apple-system-label
-apple-system-secondary-label
-apple-system-tertiary-label
@@ -245,7 +234,14 @@
-apple-system-grid
-apple-system-separator
-apple-system-container-border
-#endif
+-apple-system-background
+-apple-system-secondary-background
+-apple-system-tertiary-background
+-apple-system-grouped-background
+-apple-system-secondary-grouped-background
+-apple-system-tertiary-grouped-background
+-apple-system-selected-content-background
+-apple-system-unemphasized-selected-content-background
-apple-wireless-playback-target-active
-apple-system-blue
-apple-system-brown
@@ -256,6 +252,22 @@
-apple-system-purple
-apple-system-red
-apple-system-yellow
+#endif
+#if defined(WTF_PLATFORM_MAC) && WTF_PLATFORM_MAC
+-apple-system-alternate-selected-text
+-apple-system-control-accent
+-apple-system-even-alternating-content-background
+-apple-system-odd-alternating-content-background
+-apple-system-selected-text
+-apple-system-unemphasized-selected-text
+-apple-system-selected-text-background
+-apple-system-unemphasized-selected-text-background
+-apple-system-find-highlight-background
+#endif
+#if defined(WTF_PLATFORM_IOS_FAMILY) && WTF_PLATFORM_IOS_FAMILY
+-apple-system-indigo
+-apple-system-teal
+#endif
-webkit-focus-ring-color
currentcolor
//
Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (241824 => 241825)
--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp 2019-02-20 19:23:28 UTC (rev 241824)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp 2019-02-20 19:28:28 UTC (rev 241825)
@@ -156,12 +156,18 @@
static const char applePrefix[] = "-apple-";
static const char appleSystemPrefix[] = "-apple-system";
static const char applePayPrefix[] = "-apple-pay";
+
+#if PLATFORM(MAC) || PLATFORM(IOS_FAMILY)
static const char* appleWirelessPlaybackTargetActive = getValueName(CSSValueAppleWirelessPlaybackTargetActive);
-
+#endif
+
return hasPrefix(valueKeyword, length, applePrefix)
&& !hasPrefix(valueKeyword, length, appleSystemPrefix)
&& !hasPrefix(valueKeyword, length, applePayPrefix)
- && !WTF::equal(reinterpret_cast<const LChar*>(valueKeyword), reinterpret_cast<const LChar*>(appleWirelessPlaybackTargetActive), length);
+#if PLATFORM(MAC) || PLATFORM(IOS_FAMILY)
+ && !WTF::equal(reinterpret_cast<const LChar*>(valueKeyword), reinterpret_cast<const LChar*>(appleWirelessPlaybackTargetActive), length)
+#endif
+ ;
}
template <typename CharacterType>
Modified: trunk/Source/WebCore/platform/graphics/Color.h (241824 => 241825)
--- trunk/Source/WebCore/platform/graphics/Color.h 2019-02-20 19:23:28 UTC (rev 241824)
+++ trunk/Source/WebCore/platform/graphics/Color.h 2019-02-20 19:28:28 UTC (rev 241825)
@@ -262,6 +262,7 @@
#if USE(CG)
WEBCORE_EXPORT Color(CGColorRef);
+ WEBCORE_EXPORT Color(CGColorRef, SemanticTag);
#endif
#if PLATFORM(WIN)
Modified: trunk/Source/WebCore/platform/graphics/cg/ColorCG.cpp (241824 => 241825)
--- trunk/Source/WebCore/platform/graphics/cg/ColorCG.cpp 2019-02-20 19:23:28 UTC (rev 241824)
+++ trunk/Source/WebCore/platform/graphics/cg/ColorCG.cpp 2019-02-20 19:28:28 UTC (rev 241825)
@@ -51,13 +51,8 @@
namespace WebCore {
-Color::Color(CGColorRef color)
+static RGBA32 makeRGBAFromCGColor(CGColorRef color)
{
- if (!color) {
- m_colorData.rgbaAndFlags = invalidRGBAColor;
- return;
- }
-
size_t numComponents = CGColorGetNumberOfComponents(color);
const CGFloat* components = CGColorGetComponents(color);
@@ -81,9 +76,31 @@
ASSERT_NOT_REACHED();
}
- setRGB(makeRGBA(r * 255, g * 255, b * 255, a * 255));
+ static const double scaleFactor = nextafter(256.0, 0.0);
+ return makeRGBA(r * scaleFactor, g * scaleFactor, b * scaleFactor, a * scaleFactor);
}
+Color::Color(CGColorRef color)
+{
+ if (!color) {
+ m_colorData.rgbaAndFlags = invalidRGBAColor;
+ return;
+ }
+
+ setRGB(makeRGBAFromCGColor(color));
+}
+
+Color::Color(CGColorRef color, SemanticTag)
+{
+ if (!color) {
+ m_colorData.rgbaAndFlags = invalidRGBAColor;
+ return;
+ }
+
+ setRGB(makeRGBAFromCGColor(color));
+ setIsSemantic();
+}
+
static CGColorRef leakCGColor(const Color& color)
{
CGFloat components[4];
Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.h (241824 => 241825)
--- trunk/Source/WebCore/rendering/RenderThemeIOS.h 2019-02-20 19:23:28 UTC (rev 241824)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.h 2019-02-20 19:28:28 UTC (rev 241825)
@@ -159,8 +159,6 @@
String m_legacyMediaControlsStyleSheet;
String m_mediaControlsStyleSheet;
- mutable HashMap<int, Color> m_systemColorCache;
-
#if USE(SYSTEM_PREVIEW)
RetainPtr<CIContext> m_ciContext;
#if HAVE(IOSURFACE)
Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (241824 => 241825)
--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2019-02-20 19:23:28 UTC (rev 241824)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2019-02-20 19:28:28 UTC (rev 241825)
@@ -75,9 +75,14 @@
#import <pal/spi/cocoa/CoreTextSPI.h>
#import <pal/spi/ios/UIKitSPI.h>
#import <wtf/NeverDestroyed.h>
+#import <wtf/ObjCRuntimeExtras.h>
#import <wtf/RefPtr.h>
#import <wtf/StdLibExtras.h>
+#if USE(APPLE_INTERNAL_SDK) && __has_include(<WebKitAdditions/RenderThemeIOSAdditions.mm>)
+#include <WebKitAdditions/RenderThemeIOSAdditions.mm>
+#endif
+
@interface WebCoreRenderThemeBundle : NSObject
@end
@@ -1413,8 +1418,15 @@
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.
@@ -1421,48 +1433,45 @@
if (forVisitedLink && cssValueID == CSSValueWebkitLink)
return RenderTheme::systemColor(cssValueID, options);
+ ASSERT_UNUSED(useSystemAppearance, !useSystemAppearance);
ASSERT(!forVisitedLink);
- auto addResult = m_systemColorCache.add(cssValueID, Color());
- if (!addResult.isNewEntry)
- return addResult.iterator->value;
+ return cache.systemStyleColors.ensure(cssValueID, [this, cssValueID, options] () -> Color {
+ auto cssColorToSelector = [cssValueID] () -> SEL {
+#if USE(APPLE_INTERNAL_SDK) && __has_include(<WebKitAdditions/RenderThemeIOSColorToSelectorAdditions.mm>)
+#include <WebKitAdditions/RenderThemeIOSColorToSelectorAdditions.mm>
+#endif
- Color color;
- switch (cssValueID) {
- case CSSValueAppleWirelessPlaybackTargetActive:
- color = [PAL::getUIColorClass() systemBlueColor].CGColor;
- break;
- case CSSValueAppleSystemBlue:
- color = [PAL::getUIColorClass() systemBlueColor].CGColor;
- break;
- case CSSValueAppleSystemGray:
- color = [PAL::getUIColorClass() systemGrayColor].CGColor;
- break;
- case CSSValueAppleSystemGreen:
- color = [PAL::getUIColorClass() systemGreenColor].CGColor;
- break;
- case CSSValueAppleSystemOrange:
- color = [PAL::getUIColorClass() systemOrangeColor].CGColor;
- break;
- case CSSValueAppleSystemPink:
- color = [PAL::getUIColorClass() systemPinkColor].CGColor;
- break;
- case CSSValueAppleSystemRed:
- color = [PAL::getUIColorClass() systemRedColor].CGColor;
- break;
- case CSSValueAppleSystemYellow:
- color = [PAL::getUIColorClass() systemYellowColor].CGColor;
- break;
- default:
- break;
- }
+ switch (cssValueID) {
+ case CSSValueAppleWirelessPlaybackTargetActive:
+ case CSSValueAppleSystemBlue:
+ return @selector(systemBlueColor);
+ case CSSValueAppleSystemGray:
+ return @selector(systemGrayColor);
+ case CSSValueAppleSystemGreen:
+ return @selector(systemGreenColor);
+ case CSSValueAppleSystemOrange:
+ return @selector(systemOrangeColor);
+ case CSSValueAppleSystemPink:
+ return @selector(systemPinkColor);
+ case CSSValueAppleSystemPurple:
+ return @selector(systemPurpleColor);
+ case CSSValueAppleSystemRed:
+ return @selector(systemRedColor);
+ case CSSValueAppleSystemYellow:
+ return @selector(systemYellowColor);
+ default:
+ return nullptr;
+ }
+ };
- if (!color.isValid())
- color = RenderTheme::systemColor(cssValueID, options);
+ if (auto selector = cssColorToSelector()) {
+ if (auto color = wtfObjCMsgSend<UIColor *>(PAL::getUIColorClass(), selector))
+ return Color(color.CGColor, Color::Semantic);
+ }
- addResult.iterator->value = color;
-
- return addResult.iterator->value;
+ return RenderTheme::systemColor(cssValueID, options);
+ }).iterator->value;
}
#if ENABLE(ATTACHMENT_ELEMENT)
Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (241824 => 241825)
--- trunk/Source/WebCore/rendering/RenderThemeMac.mm 2019-02-20 19:23:28 UTC (rev 241824)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm 2019-02-20 19:28:28 UTC (rev 241825)
@@ -776,7 +776,6 @@
return @selector(gridColor);
#endif
case CSSValueAppleWirelessPlaybackTargetActive:
- return @selector(systemBlueColor);
case CSSValueAppleSystemBlue:
return @selector(systemBlueColor);
case CSSValueAppleSystemBrown: