1 /* 2 * Copyright (C) 2007 Apple Inc. 3 * Copyright (C) 2007 Alp Toker <alp (at) atoker.com> 4 * Copyright (C) 2008 Collabora Ltd. 5 * Copyright (C) 2008, 2009 Google Inc. 6 * Copyright (C) 2009 Kenneth Rohde Christiansen 7 * 8 * This library is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU Library General Public 10 * License as published by the Free Software Foundation; either 11 * version 2 of the License, or (at your option) any later version. 12 * 13 * This library is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * Library General Public License for more details. 17 * 18 * You should have received a copy of the GNU Library General Public License 19 * along with this library; see the file COPYING.LIB. If not, write to 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 21 * Boston, MA 02110-1301, USA. 22 * 23 */ 24 25 #include "config.h" 26 #include "RenderThemeChromiumLinux.h" 27 28 #include "CSSValueKeywords.h" 29 #include "Color.h" 30 #include "RenderObject.h" 31 #include "UserAgentStyleSheets.h" 32 33 namespace WebCore { 34 35 unsigned RenderThemeChromiumLinux::m_thumbInactiveColor = 0xf0ebe5; 36 unsigned RenderThemeChromiumLinux::m_thumbActiveColor = 0xfaf8f5; 37 unsigned RenderThemeChromiumLinux::m_trackColor = 0xe3ddd8; 38 unsigned RenderThemeChromiumLinux::m_activeSelectionBackgroundColor = 39 0xff1e90ff; 40 unsigned RenderThemeChromiumLinux::m_activeSelectionForegroundColor = 41 Color::black; 42 unsigned RenderThemeChromiumLinux::m_inactiveSelectionBackgroundColor = 43 0xffc8c8c8; 44 unsigned RenderThemeChromiumLinux::m_inactiveSelectionForegroundColor = 45 0xff323232; 46 47 double RenderThemeChromiumLinux::m_caretBlinkInterval; 48 49 PassRefPtr<RenderTheme> RenderThemeChromiumLinux::create() 50 { 51 return adoptRef(new RenderThemeChromiumLinux()); 52 } 53 54 PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page* page) 55 { 56 static RenderTheme* rt = RenderThemeChromiumLinux::create().releaseRef(); 57 return rt; 58 } 59 60 RenderThemeChromiumLinux::RenderThemeChromiumLinux() 61 { 62 m_caretBlinkInterval = RenderTheme::caretBlinkInterval(); 63 } 64 65 RenderThemeChromiumLinux::~RenderThemeChromiumLinux() 66 { 67 } 68 69 Color RenderThemeChromiumLinux::systemColor(int cssValueId) const 70 { 71 static const Color linuxButtonGrayColor(0xffdddddd); 72 73 if (cssValueId == CSSValueButtonface) 74 return linuxButtonGrayColor; 75 return RenderTheme::systemColor(cssValueId); 76 } 77 78 String RenderThemeChromiumLinux::extraDefaultStyleSheet() 79 { 80 return RenderThemeChromiumSkia::extraDefaultStyleSheet() + 81 String(themeChromiumLinuxUserAgentStyleSheet, sizeof(themeChromiumLinuxUserAgentStyleSheet)); 82 } 83 84 bool RenderThemeChromiumLinux::controlSupportsTints(const RenderObject* o) const 85 { 86 return isEnabled(o); 87 } 88 89 Color RenderThemeChromiumLinux::activeListBoxSelectionBackgroundColor() const 90 { 91 return Color(0x28, 0x28, 0x28); 92 } 93 94 Color RenderThemeChromiumLinux::activeListBoxSelectionForegroundColor() const 95 { 96 return Color::black; 97 } 98 99 Color RenderThemeChromiumLinux::inactiveListBoxSelectionBackgroundColor() const 100 { 101 return Color(0xc8, 0xc8, 0xc8); 102 } 103 104 Color RenderThemeChromiumLinux::inactiveListBoxSelectionForegroundColor() const 105 { 106 return Color(0x32, 0x32, 0x32); 107 } 108 109 Color RenderThemeChromiumLinux::platformActiveSelectionBackgroundColor() const 110 { 111 return m_activeSelectionBackgroundColor; 112 } 113 114 Color RenderThemeChromiumLinux::platformInactiveSelectionBackgroundColor() const 115 { 116 return m_inactiveSelectionBackgroundColor; 117 } 118 119 Color RenderThemeChromiumLinux::platformActiveSelectionForegroundColor() const 120 { 121 return m_activeSelectionForegroundColor; 122 } 123 124 Color RenderThemeChromiumLinux::platformInactiveSelectionForegroundColor() const 125 { 126 return m_inactiveSelectionForegroundColor; 127 } 128 129 void RenderThemeChromiumLinux::adjustSliderThumbSize(RenderObject* o) const 130 { 131 // These sizes match the sizes in Chromium Win. 132 const int sliderThumbAlongAxis = 11; 133 const int sliderThumbAcrossAxis = 21; 134 if (o->style()->appearance() == SliderThumbHorizontalPart) { 135 o->style()->setWidth(Length(sliderThumbAlongAxis, Fixed)); 136 o->style()->setHeight(Length(sliderThumbAcrossAxis, Fixed)); 137 } else if (o->style()->appearance() == SliderThumbVerticalPart) { 138 o->style()->setWidth(Length(sliderThumbAcrossAxis, Fixed)); 139 o->style()->setHeight(Length(sliderThumbAlongAxis, Fixed)); 140 } else 141 RenderThemeChromiumSkia::adjustSliderThumbSize(o); 142 } 143 144 bool RenderThemeChromiumLinux::supportsControlTints() const 145 { 146 return true; 147 } 148 149 void RenderThemeChromiumLinux::setCaretBlinkInterval(double interval) 150 { 151 m_caretBlinkInterval = interval; 152 } 153 154 double RenderThemeChromiumLinux::caretBlinkIntervalInternal() const 155 { 156 return m_caretBlinkInterval; 157 } 158 159 void RenderThemeChromiumLinux::setSelectionColors( 160 unsigned activeBackgroundColor, 161 unsigned activeForegroundColor, 162 unsigned inactiveBackgroundColor, 163 unsigned inactiveForegroundColor) 164 { 165 m_activeSelectionBackgroundColor = activeBackgroundColor; 166 m_activeSelectionForegroundColor = activeForegroundColor; 167 m_inactiveSelectionBackgroundColor = inactiveBackgroundColor; 168 m_inactiveSelectionForegroundColor = inactiveForegroundColor; 169 } 170 171 void RenderThemeChromiumLinux::setScrollbarColors( 172 SkColor inactiveColor, SkColor activeColor, SkColor trackColor) 173 { 174 m_thumbInactiveColor = inactiveColor; 175 m_thumbActiveColor = activeColor; 176 m_trackColor = trackColor; 177 } 178 179 } // namespace WebCore 180