diff options
author | deanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-07 17:01:39 +0000 |
---|---|---|
committer | deanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-07 17:01:39 +0000 |
commit | 3d2b7b5f90e42a435b1ef1f55c39e60c3a846485 (patch) | |
tree | 06cb8d466f083da98e1b4086c9ab7f66590fc401 | |
parent | 169627b81ce036a7014476c366b060e050b5ff70 (diff) | |
download | chromium_src-3d2b7b5f90e42a435b1ef1f55c39e60c3a846485.zip chromium_src-3d2b7b5f90e42a435b1ef1f55c39e60c3a846485.tar.gz chromium_src-3d2b7b5f90e42a435b1ef1f55c39e60c3a846485.tar.bz2 |
Update themes since we merged webkit r38911.
- A blink value of 0 should no longer paint storm. Return
a non-blinking caret in linux layout test mode again.
- Update a mismerge from Chromium r6487. The virtual method
was renamed to creatBlinkInterval, so now we are created an
additional virtual method instead of overriding the theme's.
Review URL: http://codereview.chromium.org/13611
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6494 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | webkit/port/platform/chromium/RenderThemeGtk.cpp | 35 | ||||
-rw-r--r-- | webkit/port/platform/chromium/RenderThemeGtk.h | 2 | ||||
-rw-r--r-- | webkit/port/rendering/RenderThemeWin.cpp | 5 | ||||
-rw-r--r-- | webkit/port/rendering/RenderThemeWin.h | 2 |
4 files changed, 24 insertions, 20 deletions
diff --git a/webkit/port/platform/chromium/RenderThemeGtk.cpp b/webkit/port/platform/chromium/RenderThemeGtk.cpp index 17f0734..4e74de9 100644 --- a/webkit/port/platform/chromium/RenderThemeGtk.cpp +++ b/webkit/port/platform/chromium/RenderThemeGtk.cpp @@ -205,6 +205,20 @@ static void gtkStyleSetCallback(GtkWidget* widget, GtkStyle* previous, RenderThe renderTheme->platformColorsDidChange(); } +static double querySystemBlinkInterval(double defaultInterval) +{ + GtkSettings* settings = gtk_settings_get_default(); + + gboolean shouldBlink; + gint time; + + g_object_get(settings, "gtk-cursor-blink", &shouldBlink, "gtk-cursor-blink-time", &time, NULL); + + if (!shouldBlink) + return 0; + + return time / 1000.0; +} // Implement WebCore::theme() for getting the global RenderTheme. RenderTheme* theme() @@ -261,27 +275,16 @@ Color RenderThemeGtk::platformInactiveSelectionForegroundColor() const return makeColor(widget->style->text[GTK_STATE_ACTIVE]); } -double RenderThemeGtk::caretBlinkFrequency() const +double RenderThemeGtk::caretBlinkInterval() const { // Disable the blinking caret in layout test mode, as it introduces // a race condition for the pixel tests. http://b/1198440 - if (ChromiumBridge::layoutTestMode()) { - // TODO(port): We need to disable this under linux, but returning 0 - // (like Windows does) sends gtk into an infinite expose loop. Do - // something about this later. - } - - GtkSettings* settings = gtk_settings_get_default(); - - gboolean shouldBlink; - gint time; - - g_object_get(settings, "gtk-cursor-blink", &shouldBlink, "gtk-cursor-blink-time", &time, NULL); - - if (!shouldBlink) + if (ChromiumBridge::layoutTestMode()) return 0; - return time / 2000.; + // We cache the interval so we don't have to repeatedly request it from gtk. + static double blinkInterval = querySystemBlinkInterval(RenderTheme::caretBlinkInterval()); + return blinkInterval; } void RenderThemeGtk::systemFont(int propId, Document* document, FontDescription& fontDescription) const diff --git a/webkit/port/platform/chromium/RenderThemeGtk.h b/webkit/port/platform/chromium/RenderThemeGtk.h index c4bfd32..48932d2 100644 --- a/webkit/port/platform/chromium/RenderThemeGtk.h +++ b/webkit/port/platform/chromium/RenderThemeGtk.h @@ -54,7 +54,7 @@ public: virtual Color platformActiveSelectionForegroundColor() const; virtual Color platformInactiveSelectionForegroundColor() const; - virtual double caretBlinkFrequency() const; + virtual double caretBlinkInterval() const; // System fonts. virtual void systemFont(int propId, Document*, FontDescription&) const; diff --git a/webkit/port/rendering/RenderThemeWin.cpp b/webkit/port/rendering/RenderThemeWin.cpp index cb474c3..4377107 100644 --- a/webkit/port/rendering/RenderThemeWin.cpp +++ b/webkit/port/rendering/RenderThemeWin.cpp @@ -185,7 +185,8 @@ static void setSizeIfAuto(RenderStyle* style, const IntSize& size) style->setHeight(Length(size.height(), Fixed)); } -static double querySystemBlinkInterval(double defaultInterval) { +static double querySystemBlinkInterval(double defaultInterval) +{ UINT blinkTime = ::GetCaretBlinkTime(); if (blinkTime == 0) return defaultInterval; @@ -258,7 +259,7 @@ Color RenderThemeWin::platformTextSearchHighlightColor() const return Color(255, 255, 150); } -double RenderThemeWin::caretBlinkFrequency() const +double RenderThemeWin::caretBlinkInterval() const { // Disable the blinking caret in layout test mode, as it introduces // a race condition for the pixel tests. http://b/1198440 diff --git a/webkit/port/rendering/RenderThemeWin.h b/webkit/port/rendering/RenderThemeWin.h index cd9cb4c..0dd3494 100644 --- a/webkit/port/rendering/RenderThemeWin.h +++ b/webkit/port/rendering/RenderThemeWin.h @@ -62,7 +62,7 @@ public: virtual Color platformInactiveSelectionForegroundColor() const; virtual Color platformTextSearchHighlightColor() const; - virtual double caretBlinkFrequency() const; + virtual double caretBlinkInterval() const; // System fonts. virtual void systemFont(int propId, Document*, FontDescription&) const; |