OLD | NEW |
1 /* | 1 /* |
2 * This file is part of the WebKit project. | 2 * This file is part of the WebKit project. |
3 * | 3 * |
4 * Copyright (C) 2006 Apple Computer, Inc. | 4 * Copyright (C) 2006 Apple Computer, Inc. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 } | 175 } |
176 | 176 |
177 static void setSizeIfAuto(RenderStyle* style, const IntSize& size) | 177 static void setSizeIfAuto(RenderStyle* style, const IntSize& size) |
178 { | 178 { |
179 if (style->width().isIntrinsicOrAuto()) | 179 if (style->width().isIntrinsicOrAuto()) |
180 style->setWidth(Length(size.width(), Fixed)); | 180 style->setWidth(Length(size.width(), Fixed)); |
181 if (style->height().isAuto()) | 181 if (style->height().isAuto()) |
182 style->setHeight(Length(size.height(), Fixed)); | 182 style->setHeight(Length(size.height(), Fixed)); |
183 } | 183 } |
184 | 184 |
| 185 static double querySystemBlinkInterval(double defaultInterval) { |
| 186 UINT blinkTime = ::GetCaretBlinkTime(); |
| 187 if (blinkTime == 0) |
| 188 return defaultInterval; |
| 189 if (blinkTime == INFINITE) |
| 190 return 0; |
| 191 return blinkTime / 1000.0; |
| 192 } |
| 193 |
185 // Implement WebCore::theme() for getting the global RenderTheme. | 194 // Implement WebCore::theme() for getting the global RenderTheme. |
186 RenderTheme* theme() | 195 RenderTheme* theme() |
187 { | 196 { |
188 static RenderThemeWin winTheme; | 197 static RenderThemeWin winTheme; |
189 return &winTheme; | 198 return &winTheme; |
190 } | 199 } |
191 | 200 |
192 bool RenderThemeWin::supportsFocusRing(const RenderStyle* style) const | 201 bool RenderThemeWin::supportsFocusRing(const RenderStyle* style) const |
193 { | 202 { |
194 // Let webkit draw one of its halo rings around any focused element, | 203 // Let webkit draw one of its halo rings around any focused element, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 return Color(255, 255, 150); | 245 return Color(255, 255, 150); |
237 } | 246 } |
238 | 247 |
239 double RenderThemeWin::caretBlinkFrequency() const | 248 double RenderThemeWin::caretBlinkFrequency() const |
240 { | 249 { |
241 // Disable the blinking caret in layout test mode, as it introduces | 250 // Disable the blinking caret in layout test mode, as it introduces |
242 // a race condition for the pixel tests. http://b/1198440 | 251 // a race condition for the pixel tests. http://b/1198440 |
243 if (ChromiumBridge::layoutTestMode()) | 252 if (ChromiumBridge::layoutTestMode()) |
244 return 0; | 253 return 0; |
245 | 254 |
246 // TODO(ericroman): this should be using the platform's blink frequency. | 255 // This involves a system call, so we cache the result. |
247 return RenderTheme::caretBlinkFrequency(); | 256 static double blinkInterval = querySystemBlinkInterval(RenderTheme::caretBli
nkFrequency()); |
| 257 return blinkInterval; |
248 } | 258 } |
249 | 259 |
250 void RenderThemeWin::systemFont(int propId, Document* document, FontDescription&
fontDescription) const | 260 void RenderThemeWin::systemFont(int propId, Document* document, FontDescription&
fontDescription) const |
251 { | 261 { |
252 // This logic owes much to RenderThemeSafari.cpp. | 262 // This logic owes much to RenderThemeSafari.cpp. |
253 FontDescription* cachedDesc = NULL; | 263 FontDescription* cachedDesc = NULL; |
254 wchar_t* faceName = 0; | 264 wchar_t* faceName = 0; |
255 float fontSize = 0; | 265 float fontSize = 0; |
256 switch (propId) { | 266 switch (propId) { |
257 case CSSValueSmallCaption: | 267 case CSSValueSmallCaption: |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 // static | 618 // static |
609 void RenderThemeWin::setFindInPageMode(bool enable) { | 619 void RenderThemeWin::setFindInPageMode(bool enable) { |
610 if (m_findInPageMode == enable) | 620 if (m_findInPageMode == enable) |
611 return; | 621 return; |
612 | 622 |
613 m_findInPageMode = enable; | 623 m_findInPageMode = enable; |
614 theme()->platformColorsDidChange(); | 624 theme()->platformColorsDidChange(); |
615 } | 625 } |
616 | 626 |
617 } // namespace WebCore | 627 } // namespace WebCore |
OLD | NEW |