Reviewed by Maciej.
authoradele <adele@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Oct 2006 14:36:26 +0000 (14:36 +0000)
committeradele <adele@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Oct 2006 14:36:26 +0000 (14:36 +0000)
        - Fix for <rdar://problem/4768591> REGRESSION: List box selection color should just be a darker version of regular selection color

        * rendering/RenderListBox.cpp:
        (WebCore::RenderListBox::paintItemForeground):
        * rendering/RenderTheme.cpp:
        (WebCore::RenderTheme::activeListBoxSelectionBackgroundColor):
        (WebCore::RenderTheme::activeListBoxSelectionForegroundColor):
        (WebCore::RenderTheme::inactiveListBoxSelectionBackgroundColor):
        (WebCore::RenderTheme::inactiveListBoxSelectionForegroundColor):
        * rendering/RenderThemeMac.h:
        * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::activeListBoxSelectionBackgroundColor):

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

WebCore/ChangeLog
WebCore/rendering/RenderListBox.cpp
WebCore/rendering/RenderTheme.cpp
WebCore/rendering/RenderThemeMac.h
WebCore/rendering/RenderThemeMac.mm

index 12eb326e955875790e7bcd01fe1cfa7f78d259a8..0eb4c04d44ebb39782f948781c211fd0247a8924 100644 (file)
@@ -1,3 +1,19 @@
+2006-10-13  Adele Peterson  <adele@apple.com>
+
+        Reviewed by Maciej.
+
+        - Fix for <rdar://problem/4768591> REGRESSION: List box selection color should just be a darker version of regular selection color
+
+        * rendering/RenderListBox.cpp:
+        (WebCore::RenderListBox::paintItemForeground):
+        * rendering/RenderTheme.cpp:
+        (WebCore::RenderTheme::activeListBoxSelectionBackgroundColor):
+        (WebCore::RenderTheme::activeListBoxSelectionForegroundColor):
+        (WebCore::RenderTheme::inactiveListBoxSelectionBackgroundColor):
+        (WebCore::RenderTheme::inactiveListBoxSelectionForegroundColor):
+        * rendering/RenderThemeMac.h:
+        * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::activeListBoxSelectionBackgroundColor):
+
 2006-10-13  Rob Buis  <buis@kde.org>
 
         Reviewed by Mitz.
index d24d5253b53f25e64e44329ed6a09ea6d06c7ad0..92b43e04bec57c3a11ca75889e59c9a3aafaf099 100644 (file)
@@ -279,13 +279,9 @@ void RenderListBox::paintItemForeground(PaintInfo& i, int tx, int ty, int listIn
     if (element->hasTagName(optionTag) && static_cast<HTMLOptionElement*>(element)->selected()) {
         if (document()->frame()->isActive() && document()->focusNode() == node())
             textColor = theme()->activeListBoxSelectionForegroundColor();
- /*
-    FIXME: Decide what the desired behavior is for inactive foreground color.  
-    For example, disabled items have a dark grey foreground color defined in CSS.  
-    If we don't honor that, the selected disabled items will have a weird black-on-grey look.
-        else
+        // Honor the foreground color for disabled items
+        else if (!element->disabled())
             textColor = theme()->inactiveListBoxSelectionForegroundColor();
- */
           
     }
         
index 104b7d86baef671c5a14ed4fd89ddacc5e175ccb..2a3a2bd0227013764c481b2292c36b9948a8bc25 100644 (file)
@@ -206,21 +206,23 @@ Color RenderTheme::platformInactiveSelectionForegroundColor() const
 
 Color RenderTheme::activeListBoxSelectionBackgroundColor() const
 {
-    return Color(56, 117, 215);
+    return activeSelectionBackgroundColor();
 }
 
 Color RenderTheme::activeListBoxSelectionForegroundColor() const
 {
+    // Use a white color by default if the platform theme doesn't define anything.
     return Color(255, 255, 255);
 }
 
 Color RenderTheme::inactiveListBoxSelectionBackgroundColor() const
 {
-    return Color(212, 212, 212);
+    return inactiveSelectionBackgroundColor();
 }
 
 Color RenderTheme::inactiveListBoxSelectionForegroundColor() const
 {
+    // Use a black color by default if the platform theme doesn't define anything.
     return Color(0, 0, 0);
 }
 
index b3498f75b45969f80f23be7e1e5c72c315013235..683694c98b92b943fa4d944919f6b9c9e6e382ae 100644 (file)
@@ -55,6 +55,7 @@ public:
 
     virtual Color platformActiveSelectionBackgroundColor() const;
     virtual Color platformInactiveSelectionBackgroundColor() const;
+    virtual Color activeListBoxSelectionBackgroundColor() const;
     
     // System fonts.
     virtual void systemFont(int propId, FontDescription&) const;
index d0961454cbd11a3304b6a9dc2973440f313660ae..7a9f56ea0c2f107e1a6c4e68d803e4350dcb4068 100644 (file)
@@ -77,6 +77,12 @@ Color RenderThemeMac::platformInactiveSelectionBackgroundColor() const
     return Color((int)(255 * [color redComponent]), (int)(255 * [color greenComponent]), (int)(255 * [color blueComponent]));
 }
 
+Color RenderThemeMac::activeListBoxSelectionBackgroundColor() const
+{
+    NSColor* color = [[NSColor alternateSelectedControlColor] colorUsingColorSpaceName:NSDeviceRGBColorSpace];
+    return Color((int)(255 * [color redComponent]), (int)(255 * [color greenComponent]), (int)(255 * [color blueComponent]));
+}
+
 void RenderThemeMac::systemFont(int propId, FontDescription& fontDescription) const
 {
     static FontDescription systemFont;