Selection color is dark when using Safari in dark mode.
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 Jun 2018 23:38:24 +0000 (23:38 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 Jun 2018 23:38:24 +0000 (23:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=186288
rdar://problem/38438625

Reviewed by Simon Fraser.

Pass StyleColor::Options to all of the selection color functions.
Removed supportsSelectionForegroundColors() from RenderThemeMac,
to get the default of true, since the forground colors in dark mode
can be different now. Use new semantic color methods on NSColor.

* rendering/RenderElement.cpp:
(WebCore::RenderElement::selectionColor const):
(WebCore::RenderElement::selectionBackgroundColor const):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::paintItemForeground):
(WebCore::RenderListBox::paintItemBackground):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::activeSelectionBackgroundColor const):
(WebCore::RenderTheme::inactiveSelectionBackgroundColor const):
(WebCore::RenderTheme::activeSelectionForegroundColor const):
(WebCore::RenderTheme::inactiveSelectionForegroundColor const):
(WebCore::RenderTheme::activeListBoxSelectionBackgroundColor const):
(WebCore::RenderTheme::activeListBoxSelectionForegroundColor const):
(WebCore::RenderTheme::inactiveListBoxSelectionForegroundColor const):
(WebCore::RenderTheme::platformActiveSelectionBackgroundColor const):
(WebCore::RenderTheme::platformActiveSelectionForegroundColor const):
(WebCore::RenderTheme::platformInactiveSelectionBackgroundColor const):
(WebCore::RenderTheme::platformInactiveSelectionForegroundColor const):
(WebCore::RenderTheme::platformActiveListBoxSelectionBackgroundColor const):
(WebCore::RenderTheme::platformActiveListBoxSelectionForegroundColor const):
(WebCore::RenderTheme::platformInactiveListBoxSelectionBackgroundColor const):
(WebCore::RenderTheme::platformInactiveListBoxSelectionForegroundColor const):
* rendering/RenderTheme.h:
* rendering/RenderThemeGtk.cpp:
(WebCore::RenderThemeGtk::platformActiveSelectionBackgroundColor const):
(WebCore::RenderThemeGtk::platformInactiveSelectionBackgroundColor const):
(WebCore::RenderThemeGtk::platformActiveSelectionForegroundColor const):
(WebCore::RenderThemeGtk::platformInactiveSelectionForegroundColor const):
(WebCore::RenderThemeGtk::platformActiveListBoxSelectionBackgroundColor const):
(WebCore::RenderThemeGtk::platformActiveListBoxSelectionForegroundColor const):
(WebCore::RenderThemeGtk::platformInactiveListBoxSelectionForegroundColor const):
* rendering/RenderThemeGtk.h:
* rendering/RenderThemeIOS.h:
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::platformActiveSelectionBackgroundColor const):
(WebCore::RenderThemeIOS::platformInactiveSelectionBackgroundColor const):
* rendering/RenderThemeMac.h:
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::platformActiveSelectionBackgroundColor const):
(WebCore::RenderThemeMac::platformInactiveSelectionBackgroundColor const):
(WebCore::RenderThemeMac::platformActiveSelectionForegroundColor const):
(WebCore::RenderThemeMac::platformInactiveSelectionForegroundColor const):
(WebCore::RenderThemeMac::platformActiveListBoxSelectionBackgroundColor const):
(WebCore::RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor const):
(WebCore::RenderThemeMac::platformActiveListBoxSelectionForegroundColor const):
(WebCore::RenderThemeMac::platformInactiveListBoxSelectionForegroundColor const):
* rendering/RenderThemeWin.cpp:
(WebCore::RenderThemeWin::platformActiveSelectionBackgroundColor const):
(WebCore::RenderThemeWin::platformInactiveSelectionBackgroundColor const):
(WebCore::RenderThemeWin::platformActiveSelectionForegroundColor const):
(WebCore::RenderThemeWin::platformInactiveSelectionForegroundColor const):
* rendering/RenderThemeWin.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232486 268f45cc-cd09-0410-ab3c-d52691b4dbfc

13 files changed:
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderElement.cpp
Source/WebCore/rendering/RenderListBox.cpp
Source/WebCore/rendering/RenderTheme.cpp
Source/WebCore/rendering/RenderTheme.h
Source/WebCore/rendering/RenderThemeGtk.cpp
Source/WebCore/rendering/RenderThemeGtk.h
Source/WebCore/rendering/RenderThemeIOS.h
Source/WebCore/rendering/RenderThemeIOS.mm
Source/WebCore/rendering/RenderThemeMac.h
Source/WebCore/rendering/RenderThemeMac.mm
Source/WebCore/rendering/RenderThemeWin.cpp
Source/WebCore/rendering/RenderThemeWin.h

index b1bb905..26c545e 100644 (file)
@@ -1,3 +1,70 @@
+2018-06-04  Timothy Hatcher  <timothy@apple.com>
+
+        Selection color is dark when using Safari in dark mode.
+
+        https://bugs.webkit.org/show_bug.cgi?id=186288
+        rdar://problem/38438625
+
+        Reviewed by Simon Fraser.
+
+        Pass StyleColor::Options to all of the selection color functions.
+        Removed supportsSelectionForegroundColors() from RenderThemeMac,
+        to get the default of true, since the forground colors in dark mode
+        can be different now. Use new semantic color methods on NSColor.
+
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::selectionColor const):
+        (WebCore::RenderElement::selectionBackgroundColor const):
+        * rendering/RenderListBox.cpp:
+        (WebCore::RenderListBox::paintItemForeground):
+        (WebCore::RenderListBox::paintItemBackground):
+        * rendering/RenderTheme.cpp:
+        (WebCore::RenderTheme::activeSelectionBackgroundColor const):
+        (WebCore::RenderTheme::inactiveSelectionBackgroundColor const):
+        (WebCore::RenderTheme::activeSelectionForegroundColor const):
+        (WebCore::RenderTheme::inactiveSelectionForegroundColor const):
+        (WebCore::RenderTheme::activeListBoxSelectionBackgroundColor const):
+        (WebCore::RenderTheme::activeListBoxSelectionForegroundColor const):
+        (WebCore::RenderTheme::inactiveListBoxSelectionForegroundColor const):
+        (WebCore::RenderTheme::platformActiveSelectionBackgroundColor const):
+        (WebCore::RenderTheme::platformActiveSelectionForegroundColor const):
+        (WebCore::RenderTheme::platformInactiveSelectionBackgroundColor const):
+        (WebCore::RenderTheme::platformInactiveSelectionForegroundColor const):
+        (WebCore::RenderTheme::platformActiveListBoxSelectionBackgroundColor const):
+        (WebCore::RenderTheme::platformActiveListBoxSelectionForegroundColor const):
+        (WebCore::RenderTheme::platformInactiveListBoxSelectionBackgroundColor const):
+        (WebCore::RenderTheme::platformInactiveListBoxSelectionForegroundColor const):
+        * rendering/RenderTheme.h:
+        * rendering/RenderThemeGtk.cpp:
+        (WebCore::RenderThemeGtk::platformActiveSelectionBackgroundColor const):
+        (WebCore::RenderThemeGtk::platformInactiveSelectionBackgroundColor const):
+        (WebCore::RenderThemeGtk::platformActiveSelectionForegroundColor const):
+        (WebCore::RenderThemeGtk::platformInactiveSelectionForegroundColor const):
+        (WebCore::RenderThemeGtk::platformActiveListBoxSelectionBackgroundColor const):
+        (WebCore::RenderThemeGtk::platformActiveListBoxSelectionForegroundColor const):
+        (WebCore::RenderThemeGtk::platformInactiveListBoxSelectionForegroundColor const):
+        * rendering/RenderThemeGtk.h:
+        * rendering/RenderThemeIOS.h:
+        * rendering/RenderThemeIOS.mm:
+        (WebCore::RenderThemeIOS::platformActiveSelectionBackgroundColor const):
+        (WebCore::RenderThemeIOS::platformInactiveSelectionBackgroundColor const):
+        * rendering/RenderThemeMac.h:
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderThemeMac::platformActiveSelectionBackgroundColor const):
+        (WebCore::RenderThemeMac::platformInactiveSelectionBackgroundColor const):
+        (WebCore::RenderThemeMac::platformActiveSelectionForegroundColor const):
+        (WebCore::RenderThemeMac::platformInactiveSelectionForegroundColor const):
+        (WebCore::RenderThemeMac::platformActiveListBoxSelectionBackgroundColor const):
+        (WebCore::RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor const):
+        (WebCore::RenderThemeMac::platformActiveListBoxSelectionForegroundColor const):
+        (WebCore::RenderThemeMac::platformInactiveListBoxSelectionForegroundColor const):
+        * rendering/RenderThemeWin.cpp:
+        (WebCore::RenderThemeWin::platformActiveSelectionBackgroundColor const):
+        (WebCore::RenderThemeWin::platformInactiveSelectionBackgroundColor const):
+        (WebCore::RenderThemeWin::platformActiveSelectionForegroundColor const):
+        (WebCore::RenderThemeWin::platformInactiveSelectionForegroundColor const):
+        * rendering/RenderThemeWin.h:
+
 2018-06-04  Chris Dumez  <cdumez@apple.com>
 
         Update Fetch code to provide more useful exception messages
index 3133ca6..5983b0d 100644 (file)
@@ -1372,8 +1372,8 @@ Color RenderElement::selectionColor(CSSPropertyID colorProperty) const
     }
 
     if (frame().selection().isFocusedAndActive())
-        return theme().activeSelectionForegroundColor();
-    return theme().inactiveSelectionForegroundColor();
+        return theme().activeSelectionForegroundColor(document().styleColorOptions());
+    return theme().inactiveSelectionForegroundColor(document().styleColorOptions());
 }
 
 std::unique_ptr<RenderStyle> RenderElement::selectionPseudoStyle() const
@@ -1414,8 +1414,8 @@ Color RenderElement::selectionBackgroundColor() const
         return pseudoStyle->visitedDependentColorWithColorFilter(CSSPropertyBackgroundColor).blendWithWhite();
 
     if (frame().selection().isFocusedAndActive())
-        return theme().activeSelectionBackgroundColor();
-    return theme().inactiveSelectionBackgroundColor();
+        return theme().activeSelectionBackgroundColor(document().styleColorOptions());
+    return theme().inactiveSelectionBackgroundColor(document().styleColorOptions());
 }
 
 bool RenderElement::getLeadingCorner(FloatPoint& point, bool& insideFixed) const
index bb01d6b..4a31202 100644 (file)
@@ -425,10 +425,10 @@ void RenderListBox::paintItemForeground(PaintInfo& paintInfo, const LayoutPoint&
     Color textColor = itemStyle.visitedDependentColorWithColorFilter(CSSPropertyColor);
     if (isOptionElement && downcast<HTMLOptionElement>(*listItemElement).selected()) {
         if (frame().selection().isFocusedAndActive() && document().focusedElement() == &selectElement())
-            textColor = theme().activeListBoxSelectionForegroundColor();
+            textColor = theme().activeListBoxSelectionForegroundColor(document().styleColorOptions());
         // Honor the foreground color for disabled items
         else if (!listItemElement->isDisabledFormControl() && !selectElement().isDisabledFormControl())
-            textColor = theme().inactiveListBoxSelectionForegroundColor();
+            textColor = theme().inactiveListBoxSelectionForegroundColor(document().styleColorOptions());
     }
 
     paintInfo.context().setFillColor(textColor);
@@ -458,7 +458,7 @@ void RenderListBox::paintItemBackground(PaintInfo& paintInfo, const LayoutPoint&
     Color backColor;
     if (is<HTMLOptionElement>(*listItemElement) && downcast<HTMLOptionElement>(*listItemElement).selected()) {
         if (frame().selection().isFocusedAndActive() && document().focusedElement() == &selectElement())
-            backColor = theme().activeListBoxSelectionBackgroundColor();
+            backColor = theme().activeListBoxSelectionBackgroundColor(document().styleColorOptions());
         else
             backColor = theme().inactiveListBoxSelectionBackgroundColor(document().styleColorOptions());
     } else
index d67e27a..0988abb 100644 (file)
@@ -579,38 +579,38 @@ LayoutPoint RenderTheme::volumeSliderOffsetFromMuteButton(const RenderBox& muteB
 
 #endif
 
-Color RenderTheme::activeSelectionBackgroundColor() const
+Color RenderTheme::activeSelectionBackgroundColor(OptionSet<StyleColor::Options> options) const
 {
     if (!m_activeSelectionBackgroundColor.isValid())
-        m_activeSelectionBackgroundColor = platformActiveSelectionBackgroundColor().blendWithWhite();
+        m_activeSelectionBackgroundColor = platformActiveSelectionBackgroundColor(options).blendWithWhite();
     return m_activeSelectionBackgroundColor;
 }
 
-Color RenderTheme::inactiveSelectionBackgroundColor() const
+Color RenderTheme::inactiveSelectionBackgroundColor(OptionSet<StyleColor::Options> options) const
 {
     if (!m_inactiveSelectionBackgroundColor.isValid())
-        m_inactiveSelectionBackgroundColor = platformInactiveSelectionBackgroundColor().blendWithWhite();
+        m_inactiveSelectionBackgroundColor = platformInactiveSelectionBackgroundColor(options).blendWithWhite();
     return m_inactiveSelectionBackgroundColor;
 }
 
-Color RenderTheme::activeSelectionForegroundColor() const
+Color RenderTheme::activeSelectionForegroundColor(OptionSet<StyleColor::Options> options) const
 {
     if (!m_activeSelectionForegroundColor.isValid() && supportsSelectionForegroundColors())
-        m_activeSelectionForegroundColor = platformActiveSelectionForegroundColor();
+        m_activeSelectionForegroundColor = platformActiveSelectionForegroundColor(options);
     return m_activeSelectionForegroundColor;
 }
 
-Color RenderTheme::inactiveSelectionForegroundColor() const
+Color RenderTheme::inactiveSelectionForegroundColor(OptionSet<StyleColor::Options> options) const
 {
     if (!m_inactiveSelectionForegroundColor.isValid() && supportsSelectionForegroundColors())
-        m_inactiveSelectionForegroundColor = platformInactiveSelectionForegroundColor();
+        m_inactiveSelectionForegroundColor = platformInactiveSelectionForegroundColor(options);
     return m_inactiveSelectionForegroundColor;
 }
 
-Color RenderTheme::activeListBoxSelectionBackgroundColor() const
+Color RenderTheme::activeListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options> options) const
 {
     if (!m_activeListBoxSelectionBackgroundColor.isValid())
-        m_activeListBoxSelectionBackgroundColor = platformActiveListBoxSelectionBackgroundColor();
+        m_activeListBoxSelectionBackgroundColor = platformActiveListBoxSelectionBackgroundColor(options);
     return m_activeListBoxSelectionBackgroundColor;
 }
 
@@ -621,63 +621,63 @@ Color RenderTheme::inactiveListBoxSelectionBackgroundColor(OptionSet<StyleColor:
     return m_inactiveListBoxSelectionBackgroundColor;
 }
 
-Color RenderTheme::activeListBoxSelectionForegroundColor() const
+Color RenderTheme::activeListBoxSelectionForegroundColor(OptionSet<StyleColor::Options> options) const
 {
     if (!m_activeListBoxSelectionForegroundColor.isValid() && supportsListBoxSelectionForegroundColors())
-        m_activeListBoxSelectionForegroundColor = platformActiveListBoxSelectionForegroundColor();
+        m_activeListBoxSelectionForegroundColor = platformActiveListBoxSelectionForegroundColor(options);
     return m_activeListBoxSelectionForegroundColor;
 }
 
-Color RenderTheme::inactiveListBoxSelectionForegroundColor() const
+Color RenderTheme::inactiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options> options) const
 {
     if (!m_inactiveListBoxSelectionForegroundColor.isValid() && supportsListBoxSelectionForegroundColors())
-        m_inactiveListBoxSelectionForegroundColor = platformInactiveListBoxSelectionForegroundColor();
+        m_inactiveListBoxSelectionForegroundColor = platformInactiveListBoxSelectionForegroundColor(options);
     return m_inactiveListBoxSelectionForegroundColor;
 }
 
-Color RenderTheme::platformActiveSelectionBackgroundColor() const
+Color RenderTheme::platformActiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const
 {
     // Use a blue color by default if the platform theme doesn't define anything.
     return Color(0, 0, 255);
 }
 
-Color RenderTheme::platformActiveSelectionForegroundColor() const
+Color RenderTheme::platformActiveSelectionForegroundColor(OptionSet<StyleColor::Options>) const
 {
     // Use a white color by default if the platform theme doesn't define anything.
     return Color::white;
 }
 
-Color RenderTheme::platformInactiveSelectionBackgroundColor() const
+Color RenderTheme::platformInactiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const
 {
     // Use a grey color by default if the platform theme doesn't define anything.
     // This color matches Firefox's inactive color.
     return Color(176, 176, 176);
 }
 
-Color RenderTheme::platformInactiveSelectionForegroundColor() const
+Color RenderTheme::platformInactiveSelectionForegroundColor(OptionSet<StyleColor::Options>) const
 {
     // Use a black color by default.
     return Color::black;
 }
 
-Color RenderTheme::platformActiveListBoxSelectionBackgroundColor() const
+Color RenderTheme::platformActiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options> options) const
 {
-    return platformActiveSelectionBackgroundColor();
+    return platformActiveSelectionBackgroundColor(options);
 }
 
-Color RenderTheme::platformActiveListBoxSelectionForegroundColor() const
+Color RenderTheme::platformActiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options> options) const
 {
-    return platformActiveSelectionForegroundColor();
+    return platformActiveSelectionForegroundColor(options);
 }
 
-Color RenderTheme::platformInactiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options>) const
+Color RenderTheme::platformInactiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options> options) const
 {
-    return platformInactiveSelectionBackgroundColor();
+    return platformInactiveSelectionBackgroundColor(options);
 }
 
-Color RenderTheme::platformInactiveListBoxSelectionForegroundColor() const
+Color RenderTheme::platformInactiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options> options) const
 {
-    return platformInactiveSelectionForegroundColor();
+    return platformInactiveSelectionForegroundColor(options);
 }
 
 int RenderTheme::baselinePosition(const RenderBox& box) const
index 7daaecc..4ad3b59 100644 (file)
@@ -133,16 +133,16 @@ public:
     virtual bool supportsDataListUI(const AtomicString&) const { return false; }
 
     // Text selection colors.
-    Color activeSelectionBackgroundColor() const;
-    Color inactiveSelectionBackgroundColor() const;
-    Color activeSelectionForegroundColor() const;
-    Color inactiveSelectionForegroundColor() const;
+    Color activeSelectionBackgroundColor(OptionSet<StyleColor::Options>) const;
+    Color inactiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const;
+    Color activeSelectionForegroundColor(OptionSet<StyleColor::Options>) const;
+    Color inactiveSelectionForegroundColor(OptionSet<StyleColor::Options>) const;
 
     // List box selection colors
-    Color activeListBoxSelectionBackgroundColor() const;
-    Color activeListBoxSelectionForegroundColor() const;
+    Color activeListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options>) const;
+    Color activeListBoxSelectionForegroundColor(OptionSet<StyleColor::Options>) const;
     Color inactiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options>) const;
-    Color inactiveListBoxSelectionForegroundColor() const;
+    Color inactiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options>) const;
 
     // Highlighting colors for TextMatches.
     virtual Color platformActiveTextSearchHighlightColor() const;
@@ -255,15 +255,15 @@ protected:
     virtual void updateCachedSystemFontDescription(CSSValueID systemFontID, FontCascadeDescription&) const = 0;
 
     // The platform selection color.
-    virtual Color platformActiveSelectionBackgroundColor() const;
-    virtual Color platformInactiveSelectionBackgroundColor() const;
-    virtual Color platformActiveSelectionForegroundColor() const;
-    virtual Color platformInactiveSelectionForegroundColor() const;
+    virtual Color platformActiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const;
+    virtual Color platformInactiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const;
+    virtual Color platformActiveSelectionForegroundColor(OptionSet<StyleColor::Options>) const;
+    virtual Color platformInactiveSelectionForegroundColor(OptionSet<StyleColor::Options>) const;
 
-    virtual Color platformActiveListBoxSelectionBackgroundColor() const;
+    virtual Color platformActiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options>) const;
     virtual Color platformInactiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options>) const;
-    virtual Color platformActiveListBoxSelectionForegroundColor() const;
-    virtual Color platformInactiveListBoxSelectionForegroundColor() const;
+    virtual Color platformActiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options>) const;
+    virtual Color platformInactiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options>) const;
 
     virtual bool supportsSelectionForegroundColors() const { return true; }
     virtual bool supportsListBoxSelectionForegroundColors() const { return true; }
index 96584aa..f549471 100644 (file)
@@ -1716,27 +1716,27 @@ static Color styleColor(RenderThemePart themePart, GtkStateFlags state, StyleCol
 }
 #endif // GTK_CHECK_VERSION(3, 20, 0)
 
-Color RenderThemeGtk::platformActiveSelectionBackgroundColor() const
+Color RenderThemeGtk::platformActiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const
 {
     return styleColor(EntrySelection, static_cast<GtkStateFlags>(GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_FOCUSED), StyleColorBackground);
 }
 
-Color RenderThemeGtk::platformInactiveSelectionBackgroundColor() const
+Color RenderThemeGtk::platformInactiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const
 {
     return styleColor(EntrySelection, GTK_STATE_FLAG_SELECTED, StyleColorBackground);
 }
 
-Color RenderThemeGtk::platformActiveSelectionForegroundColor() const
+Color RenderThemeGtk::platformActiveSelectionForegroundColor(OptionSet<StyleColor::Options>) const
 {
     return styleColor(EntrySelection, static_cast<GtkStateFlags>(GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_FOCUSED), StyleColorForeground);
 }
 
-Color RenderThemeGtk::platformInactiveSelectionForegroundColor() const
+Color RenderThemeGtk::platformInactiveSelectionForegroundColor(OptionSet<StyleColor::Options>) const
 {
     return styleColor(EntrySelection, GTK_STATE_FLAG_SELECTED, StyleColorForeground);
 }
 
-Color RenderThemeGtk::platformActiveListBoxSelectionBackgroundColor() const
+Color RenderThemeGtk::platformActiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options>) const
 {
     return styleColor(ListBox, static_cast<GtkStateFlags>(GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_FOCUSED), StyleColorBackground);
 }
@@ -1746,12 +1746,12 @@ Color RenderThemeGtk::platformInactiveListBoxSelectionBackgroundColor(OptionSet<
     return styleColor(ListBox, GTK_STATE_FLAG_SELECTED, StyleColorBackground);
 }
 
-Color RenderThemeGtk::platformActiveListBoxSelectionForegroundColor() const
+Color RenderThemeGtk::platformActiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options>) const
 {
     return styleColor(ListBox, static_cast<GtkStateFlags>(GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_FOCUSED), StyleColorForeground);
 }
 
-Color RenderThemeGtk::platformInactiveListBoxSelectionForegroundColor() const
+Color RenderThemeGtk::platformInactiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options>) const
 {
     return styleColor(ListBox, GTK_STATE_FLAG_SELECTED, StyleColorForeground);
 }
index 81033e7..31ee7b7 100644 (file)
@@ -70,16 +70,16 @@ public:
     int baselinePosition(const RenderBox&) const override;
 
     // The platform selection color.
-    Color platformActiveSelectionBackgroundColor() const override;
-    Color platformInactiveSelectionBackgroundColor() const override;
-    Color platformActiveSelectionForegroundColor() const override;
-    Color platformInactiveSelectionForegroundColor() const override;
+    Color platformActiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const override;
+    Color platformInactiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const override;
+    Color platformActiveSelectionForegroundColor(OptionSet<StyleColor::Options>) const override;
+    Color platformInactiveSelectionForegroundColor(OptionSet<StyleColor::Options>) const override;
 
     // List Box selection color
-    Color platformActiveListBoxSelectionBackgroundColor() const override;
-    Color platformActiveListBoxSelectionForegroundColor() const override;
+    Color platformActiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options>) const override;
+    Color platformActiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options>) const override;
     Color platformInactiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options>) const override;
-    Color platformInactiveListBoxSelectionForegroundColor() const override;
+    Color platformInactiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options>) const override;
 
     Seconds caretBlinkInterval() const override;
 
index 1b43277..9ca7631 100644 (file)
@@ -109,8 +109,8 @@ protected:
     void adjustSearchFieldStyle(StyleResolver&, RenderStyle&, const Element*) const override;
     bool paintSearchFieldDecorations(const RenderObject&, const PaintInfo&, const IntRect&) override;
 
-    Color platformActiveSelectionBackgroundColor() const override;
-    Color platformInactiveSelectionBackgroundColor() const override;
+    Color platformActiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const override;
+    Color platformInactiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const override;
 
 #if ENABLE(TOUCH_EVENTS)
     Color platformTapHighlightColor() const override { return 0x4D1A1A1A; }
index d420a00..bc82cf1 100644 (file)
@@ -1101,12 +1101,12 @@ bool RenderThemeIOS::paintFileUploadIconDecorations(const RenderObject&, const R
     return false;
 }
 
-Color RenderThemeIOS::platformActiveSelectionBackgroundColor() const
+Color RenderThemeIOS::platformActiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const
 {
     return Color::transparent;
 }
 
-Color RenderThemeIOS::platformInactiveSelectionBackgroundColor() const
+Color RenderThemeIOS::platformInactiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const
 {
     return Color::transparent;
 }
index 51fcdc2..05759b3 100644 (file)
@@ -53,12 +53,14 @@ public:
 
     bool isControlStyled(const RenderStyle&, const BorderData&, const FillLayer&, const Color& backgroundColor) const final;
 
-    Color platformActiveSelectionBackgroundColor() const final;
-    Color platformInactiveSelectionBackgroundColor() const final;
-    Color platformActiveListBoxSelectionBackgroundColor() const final;
-    Color platformActiveListBoxSelectionForegroundColor() const final;
+    Color platformActiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const final;
+    Color platformActiveSelectionForegroundColor(OptionSet<StyleColor::Options>) const final;
+    Color platformInactiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const final;
+    Color platformInactiveSelectionForegroundColor(OptionSet<StyleColor::Options>) const final;
+    Color platformActiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options>) const final;
+    Color platformActiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options>) const final;
     Color platformInactiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options>) const final;
-    Color platformInactiveListBoxSelectionForegroundColor() const final;
+    Color platformInactiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options>) const final;
     Color platformFocusRingColor(OptionSet<StyleColor::Options>) const final;
 
     ScrollbarControlSize scrollbarControlSizeForPart(ControlPart) final { return SmallScrollbar; }
@@ -114,8 +116,6 @@ private:
     String imageControlsStyleSheet() const final;
 #endif
 
-    bool supportsSelectionForegroundColors() const final { return false; }
-
     bool paintTextField(const RenderObject&, const PaintInfo&, const FloatRect&) final;
     void adjustTextFieldStyle(StyleResolver&, RenderStyle&, const Element*) const final;
 
index 7b8a79f..4a3dd46 100644 (file)
@@ -291,29 +291,77 @@ String RenderThemeMac::imageControlsStyleSheet() const
 
 #endif
 
-Color RenderThemeMac::platformActiveSelectionBackgroundColor() const
+Color RenderThemeMac::platformActiveSelectionBackgroundColor(OptionSet<StyleColor::Options> options) const
 {
+    LocalDefaultSystemAppearance localAppearance(options.contains(StyleColor::Options::UseSystemAppearance), options.contains(StyleColor::Options::UseDefaultAppearance));
     return colorFromNSColor([NSColor selectedTextBackgroundColor]);
 }
 
-Color RenderThemeMac::platformInactiveSelectionBackgroundColor() const
+Color RenderThemeMac::platformInactiveSelectionBackgroundColor(OptionSet<StyleColor::Options> options) const
 {
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+    LocalDefaultSystemAppearance localAppearance(options.contains(StyleColor::Options::UseSystemAppearance), options.contains(StyleColor::Options::UseDefaultAppearance));
+    return colorFromNSColor([NSColor unemphasizedSelectedTextBackgroundColor]);
+#else
+    UNUSED_PARAM(options);
     return colorFromNSColor([NSColor secondarySelectedControlColor]);
+#endif
+}
+
+Color RenderThemeMac::platformActiveSelectionForegroundColor(OptionSet<StyleColor::Options> options) const
+{
+    LocalDefaultSystemAppearance localAppearance(options.contains(StyleColor::Options::UseSystemAppearance), options.contains(StyleColor::Options::UseDefaultAppearance));
+    return colorFromNSColor([NSColor selectedTextColor]);
+}
+
+Color RenderThemeMac::platformInactiveSelectionForegroundColor(OptionSet<StyleColor::Options> options) const
+{
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+    LocalDefaultSystemAppearance localAppearance(options.contains(StyleColor::Options::UseSystemAppearance), options.contains(StyleColor::Options::UseDefaultAppearance));
+    return colorFromNSColor([NSColor unemphasizedSelectedTextColor]);
+#else
+    UNUSED_PARAM(options);
+    return colorFromNSColor([NSColor textColor]);
+#endif
 }
 
-Color RenderThemeMac::platformActiveListBoxSelectionBackgroundColor() const
+Color RenderThemeMac::platformActiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options> options) const
 {
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+    LocalDefaultSystemAppearance localAppearance(options.contains(StyleColor::Options::UseSystemAppearance), options.contains(StyleColor::Options::UseDefaultAppearance));
+    return colorFromNSColor([NSColor selectedContentBackgroundColor]);
+#else
+    UNUSED_PARAM(options);
     return colorFromNSColor([NSColor alternateSelectedControlColor]);
+#endif
+}
+
+Color RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options> options) const
+{
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+    LocalDefaultSystemAppearance localAppearance(options.contains(StyleColor::Options::UseSystemAppearance), options.contains(StyleColor::Options::UseDefaultAppearance));
+    return colorFromNSColor([NSColor unemphasizedSelectedContentBackgroundColor]);
+#else
+    UNUSED_PARAM(options);
+    return colorFromNSColor([NSColor secondarySelectedControlColor]);
+#endif
 }
 
-Color RenderThemeMac::platformActiveListBoxSelectionForegroundColor() const
+Color RenderThemeMac::platformActiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options> options) const
 {
-    return Color::white;
+    LocalDefaultSystemAppearance localAppearance(options.contains(StyleColor::Options::UseSystemAppearance), options.contains(StyleColor::Options::UseDefaultAppearance));
+    return colorFromNSColor([NSColor alternateSelectedControlTextColor]);
 }
 
-Color RenderThemeMac::platformInactiveListBoxSelectionForegroundColor() const
+Color RenderThemeMac::platformInactiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options> options) const
 {
-    return Color::black;
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+    LocalDefaultSystemAppearance localAppearance(options.contains(StyleColor::Options::UseSystemAppearance), options.contains(StyleColor::Options::UseDefaultAppearance));
+    return colorFromNSColor([NSColor unemphasizedSelectedTextColor]);
+#else
+    UNUSED_PARAM(options);
+    return colorFromNSColor([NSColor selectedControlTextColor]);
+#endif
 }
 
 Color RenderThemeMac::platformFocusRingColor(OptionSet<StyleColor::Options> options) const
@@ -323,14 +371,6 @@ Color RenderThemeMac::platformFocusRingColor(OptionSet<StyleColor::Options> opti
     return systemColor(CSSValueWebkitFocusRingColor, options);
 }
 
-Color RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options> options) const
-{
-    const bool useSystemAppearance = options.contains(StyleColor::Options::UseSystemAppearance);
-    const bool useDefaultAppearance = options.contains(StyleColor::Options::UseDefaultAppearance);
-    LocalDefaultSystemAppearance localAppearance(useSystemAppearance, useDefaultAppearance);
-    return platformInactiveSelectionBackgroundColor();
-}
-
 static FontSelectionValue toFontWeight(NSInteger appKitFontWeight)
 {
     ASSERT(appKitFontWeight > 0 && appKitFontWeight < 15);
index e144480..f14a38e 100644 (file)
@@ -293,25 +293,25 @@ bool RenderThemeWin::supportsHover(const RenderStyle&) const
     return haveTheme;
 }
 
-Color RenderThemeWin::platformActiveSelectionBackgroundColor() const
+Color RenderThemeWin::platformActiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const
 {
     COLORREF color = GetSysColor(COLOR_HIGHLIGHT);
     return Color(GetRValue(color), GetGValue(color), GetBValue(color));
 }
 
-Color RenderThemeWin::platformInactiveSelectionBackgroundColor() const
+Color RenderThemeWin::platformInactiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const
 {
     // This color matches Firefox.
     return Color(176, 176, 176);
 }
 
-Color RenderThemeWin::platformActiveSelectionForegroundColor() const
+Color RenderThemeWin::platformActiveSelectionForegroundColor(OptionSet<StyleColor::Options>) const
 {
     COLORREF color = GetSysColor(COLOR_HIGHLIGHTTEXT);
     return Color(GetRValue(color), GetGValue(color), GetBValue(color));
 }
 
-Color RenderThemeWin::platformInactiveSelectionForegroundColor() const
+Color RenderThemeWin::platformInactiveSelectionForegroundColor(OptionSet<StyleColor::Options>) const
 {
     return platformActiveSelectionForegroundColor();
 }
index d3f1be1..fee24b6 100644 (file)
@@ -54,10 +54,10 @@ public:
     // A method asking if the theme's controls actually care about redrawing when hovered.
     bool supportsHover(const RenderStyle&) const override;
 
-    Color platformActiveSelectionBackgroundColor() const override;
-    Color platformInactiveSelectionBackgroundColor() const override;
-    Color platformActiveSelectionForegroundColor() const override;
-    Color platformInactiveSelectionForegroundColor() const override;
+    Color platformActiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const override;
+    Color platformInactiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const override;
+    Color platformActiveSelectionForegroundColor(OptionSet<StyleColor::Options>) const override;
+    Color platformInactiveSelectionForegroundColor(OptionSet<StyleColor::Options>) const override;
 
     Color systemColor(CSSValueID, OptionSet<StyleColor::Options>) const override;