Diff
Modified: trunk/Source/WebCore/ChangeLog (235379 => 235380)
--- trunk/Source/WebCore/ChangeLog 2018-08-27 17:09:20 UTC (rev 235379)
+++ trunk/Source/WebCore/ChangeLog 2018-08-27 17:10:55 UTC (rev 235380)
@@ -1,5 +1,24 @@
2018-08-27 Daniel Bates <daba...@apple.com>
+ [iOS] Make color of spelling dots match UIKit
+ https://bugs.webkit.org/show_bug.cgi?id=188861
+
+ Reviewed by Simon Fraser.
+
+ * rendering/RenderThemeCocoa.h:
+ * rendering/RenderThemeCocoa.mm:
+ (WebCore::RenderThemeCocoa::drawLineForDocumentMarker): Modified to call colorForMarkerLineStyle()
+ for the color to use for the line style.
+ (WebCore::colorForStyle): Deleted.
+ * rendering/RenderThemeIOS.h:
+ * rendering/RenderThemeIOS.mm:
+ (WebCore::RenderThemeIOS::colorForMarkerLineStyle): Added.
+ * rendering/RenderThemeMac.h:
+ * rendering/RenderThemeMac.mm:
+ (WebCore::RenderThemeMac::colorForMarkerLineStyle): Added.
+
+2018-08-27 Daniel Bates <daba...@apple.com>
+
Spelling dots do not scale with page on iOS; share spelling dot painting code between Mac and iOS
https://bugs.webkit.org/show_bug.cgi?id=188828
<rdar://problem/15966403>
Modified: trunk/Source/WebCore/rendering/RenderThemeCocoa.h (235379 => 235380)
--- trunk/Source/WebCore/rendering/RenderThemeCocoa.h 2018-08-27 17:09:20 UTC (rev 235379)
+++ trunk/Source/WebCore/rendering/RenderThemeCocoa.h 2018-08-27 17:10:55 UTC (rev 235380)
@@ -43,6 +43,8 @@
bool paintApplePayButton(const RenderObject&, const PaintInfo&, const IntRect&) override;
#endif
protected:
+ virtual CGColorRef colorForMarkerLineStyle(DocumentMarkerLineStyle, bool useDarkMode) = 0;
+
#if ENABLE(VIDEO)
String mediaControlsFormattedStringForDuration(double) override;
#endif
Modified: trunk/Source/WebCore/rendering/RenderThemeCocoa.mm (235379 => 235380)
--- trunk/Source/WebCore/rendering/RenderThemeCocoa.mm 2018-08-27 17:09:20 UTC (rev 235379)
+++ trunk/Source/WebCore/rendering/RenderThemeCocoa.mm 2018-08-27 17:10:55 UTC (rev 235380)
@@ -51,29 +51,12 @@
namespace WebCore {
-static CGColorRef colorForStyle(DocumentMarkerLineStyle style, bool useDarkMode)
-{
- switch (style) {
- // Red
- case DocumentMarkerLineStyle::Spelling:
- return cachedCGColor(useDarkMode ? Color { 255, 140, 140, 217 } : Color { 255, 59, 48, 191 });
- // Blue
- case DocumentMarkerLineStyle::DictationAlternatives:
- case DocumentMarkerLineStyle::TextCheckingDictationPhraseWithAlternatives:
- case DocumentMarkerLineStyle::AutocorrectionReplacement:
- return cachedCGColor(useDarkMode ? Color { 40, 145, 255, 217 } : Color { 0, 122, 255, 191 });
- // Green
- case DocumentMarkerLineStyle::Grammar:
- return cachedCGColor(useDarkMode ? Color { 50, 215, 75, 217 } : Color { 25, 175, 50, 191 });
- }
-}
-
void RenderThemeCocoa::drawLineForDocumentMarker(const RenderText& renderer, GraphicsContext& context, const FloatPoint& origin, float width, DocumentMarkerLineStyle style)
{
if (context.paintingDisabled())
return;
- auto circleColor = colorForStyle(style, renderer.page().useSystemAppearance() && renderer.page().useDarkAppearance());
+ auto circleColor = colorForMarkerLineStyle(style, renderer.page().useSystemAppearance() && renderer.page().useDarkAppearance());
// Center the underline and ensure we only draw entire dots.
FloatPoint offsetPoint = origin;
Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.h (235379 => 235380)
--- trunk/Source/WebCore/rendering/RenderThemeIOS.h 2018-08-27 17:09:20 UTC (rev 235379)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.h 2018-08-27 17:10:55 UTC (rev 235380)
@@ -150,6 +150,8 @@
Color systemColor(CSSValueID, OptionSet<StyleColor::Options>) const override;
+ CGColorRef colorForMarkerLineStyle(DocumentMarkerLineStyle, bool useDarkMode) override;
+
String m_legacyMediaControlsScript;
String m_mediaControlsScript;
String m_legacyMediaControlsStyleSheet;
Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (235379 => 235380)
--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2018-08-27 17:09:20 UTC (rev 235379)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2018-08-27 17:10:55 UTC (rev 235380)
@@ -1421,6 +1421,20 @@
#endif // ENABLE(VIDEO)
+CGColorRef RenderThemeIOS::colorForMarkerLineStyle(DocumentMarkerLineStyle style, bool)
+{
+ switch (style) {
+ case DocumentMarkerLineStyle::Spelling:
+ return [getUIColorClass() systemRedColor].CGColor;
+ case DocumentMarkerLineStyle::DictationAlternatives:
+ case DocumentMarkerLineStyle::TextCheckingDictationPhraseWithAlternatives:
+ case DocumentMarkerLineStyle::AutocorrectionReplacement:
+ return [getUIColorClass() systemBlueColor].CGColor;
+ case DocumentMarkerLineStyle::Grammar:
+ return [getUIColorClass() systemGreenColor].CGColor;
+ }
+}
+
Color RenderThemeIOS::systemColor(CSSValueID cssValueID, OptionSet<StyleColor::Options> options) const
{
const bool forVisitedLink = options.contains(StyleColor::Options::ForVisitedLink);
Modified: trunk/Source/WebCore/rendering/RenderThemeMac.h (235379 => 235380)
--- trunk/Source/WebCore/rendering/RenderThemeMac.h 2018-08-27 17:09:20 UTC (rev 235379)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.h 2018-08-27 17:10:55 UTC (rev 235380)
@@ -181,6 +181,8 @@
Color systemColor(CSSValueID, OptionSet<StyleColor::Options>) const final;
+ CGColorRef colorForMarkerLineStyle(DocumentMarkerLineStyle, bool useDarkMode) override;
+
ColorCache& colorCache(OptionSet<StyleColor::Options>) const final;
void purgeCaches() final;
Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (235379 => 235380)
--- trunk/Source/WebCore/rendering/RenderThemeMac.mm 2018-08-27 17:09:20 UTC (rev 235379)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm 2018-08-27 17:10:55 UTC (rev 235380)
@@ -2993,6 +2993,23 @@
#endif
}
+CGColorRef RenderThemeMac::colorForMarkerLineStyle(DocumentMarkerLineStyle style, bool useDarkMode)
+{
+ switch (style) {
+ // Red
+ case DocumentMarkerLineStyle::Spelling:
+ return cachedCGColor(useDarkMode ? Color { 255, 140, 140, 217 } : Color { 255, 59, 48, 191 });
+ // Blue
+ case DocumentMarkerLineStyle::DictationAlternatives:
+ case DocumentMarkerLineStyle::TextCheckingDictationPhraseWithAlternatives:
+ case DocumentMarkerLineStyle::AutocorrectionReplacement:
+ return cachedCGColor(useDarkMode ? Color { 40, 145, 255, 217 } : Color { 0, 122, 255, 191 });
+ // Green
+ case DocumentMarkerLineStyle::Grammar:
+ return cachedCGColor(useDarkMode ? Color { 50, 215, 75, 217 } : Color { 25, 175, 50, 191 });
+ }
+}
+
} // namespace WebCore
#endif // PLATFORM(MAC)