summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--webkit/port/platform/chromium/RenderThemeGtk.cpp35
-rw-r--r--webkit/port/platform/chromium/RenderThemeGtk.h2
-rw-r--r--webkit/port/rendering/RenderThemeWin.cpp5
-rw-r--r--webkit/port/rendering/RenderThemeWin.h2
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;