WebKit Bugzilla
Attachment 347843 Details for
Bug 188861
: [iOS] Make color of spelling dots match UIKit
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188861-20180822135305.patch (text/plain), 7.13 KB, created by
Daniel Bates
on 2018-08-22 13:53:06 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Daniel Bates
Created:
2018-08-22 13:53:06 PDT
Size:
7.13 KB
patch
obsolete
>Subversion Revision: 235148 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index d133688e845a84006241c3ee39b637651ce9648a..0925f3f03bd636407edd63e28b6dbc6d9b584c83 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,22 @@ >+2018-08-22 Daniel Bates <dabates@apple.com> >+ >+ [iOS] Make color of spelling dots match UIKit >+ https://bugs.webkit.org/show_bug.cgi?id=188861 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * 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-22 Daniel Bates <dabates@apple.com> > > Spelling dots do not scale with page on iOS; share spelling dot painting code between Mac and iOS >diff --git a/Source/WebCore/rendering/RenderThemeCocoa.h b/Source/WebCore/rendering/RenderThemeCocoa.h >index c2830fe8adcad51e12d431bd6afe133499db333b..16de9654fb26aeaaaab1ad839383138a56bfe31c 100644 >--- a/Source/WebCore/rendering/RenderThemeCocoa.h >+++ b/Source/WebCore/rendering/RenderThemeCocoa.h >@@ -43,6 +43,8 @@ private: > 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 >diff --git a/Source/WebCore/rendering/RenderThemeCocoa.mm b/Source/WebCore/rendering/RenderThemeCocoa.mm >index 1d6ff6eb5501f7b45418f5115ba11b51d06c4376..2028a6a5dddcf90533f761dcdda7323b01d5a703 100644 >--- a/Source/WebCore/rendering/RenderThemeCocoa.mm >+++ b/Source/WebCore/rendering/RenderThemeCocoa.mm >@@ -53,29 +53,12 @@ SOFT_LINK_MAY_FAIL(PassKit, PKDrawApplePayButton, void, (CGContextRef context, C > > 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; >diff --git a/Source/WebCore/rendering/RenderThemeIOS.h b/Source/WebCore/rendering/RenderThemeIOS.h >index 9ca76314c0912eb7b9bd2283dd3e30ec071df58d..0d886bb3ae63ce526e81f16ef85cf69f466b0d89 100644 >--- a/Source/WebCore/rendering/RenderThemeIOS.h >+++ b/Source/WebCore/rendering/RenderThemeIOS.h >@@ -150,6 +150,8 @@ private: > > Color systemColor(CSSValueID, OptionSet<StyleColor::Options>) const override; > >+ CGColorRef colorForMarkerLineStyle(DocumentMarkerLineStyle, bool useDarkMode) override; >+ > String m_legacyMediaControlsScript; > String m_mediaControlsScript; > String m_legacyMediaControlsStyleSheet; >diff --git a/Source/WebCore/rendering/RenderThemeIOS.mm b/Source/WebCore/rendering/RenderThemeIOS.mm >index 0e5501dce68b474eecc818313eb67c2c5e5abe40..b862734126fbd1d53ede25f9f1381cdd62c4417a 100644 >--- a/Source/WebCore/rendering/RenderThemeIOS.mm >+++ b/Source/WebCore/rendering/RenderThemeIOS.mm >@@ -1421,6 +1421,20 @@ String RenderThemeIOS::mediaControlsBase64StringForIconNameAndType(const String& > > #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); >diff --git a/Source/WebCore/rendering/RenderThemeMac.h b/Source/WebCore/rendering/RenderThemeMac.h >index ba79bdac7297b31b46a6bf4d5d37215aa39839fb..287c2a6b1dd3ef4e21c95eb592af7f0fb0c0dc7d 100644 >--- a/Source/WebCore/rendering/RenderThemeMac.h >+++ b/Source/WebCore/rendering/RenderThemeMac.h >@@ -181,6 +181,8 @@ private: > > Color systemColor(CSSValueID, OptionSet<StyleColor::Options>) const final; > >+ CGColorRef colorForMarkerLineStyle(DocumentMarkerLineStyle, bool useDarkMode) override; >+ > ColorCache& colorCache(OptionSet<StyleColor::Options>) const final; > > void purgeCaches() final; >diff --git a/Source/WebCore/rendering/RenderThemeMac.mm b/Source/WebCore/rendering/RenderThemeMac.mm >index 05e781a23374b874a0e38895e41f79f6d0d20a73..0c04596c04ccfdcd982c6954cf52156565774a8c 100644 >--- a/Source/WebCore/rendering/RenderThemeMac.mm >+++ b/Source/WebCore/rendering/RenderThemeMac.mm >@@ -2982,6 +2982,23 @@ bool RenderThemeMac::usingDarkAppearance(const RenderObject& o) const > #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)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188861
: 347843