From c9ec4b9cd7bb2025d7711abc1406459711a4b657 Mon Sep 17 00:00:00 2001 From: "kov@webkit.org" Date: Wed, 18 Feb 2009 12:17:11 +0000 Subject: [PATCH] 2009-02-18 Xan Lopez Reviewed by Mark Rowe. https://bugs.webkit.org/show_bug.cgi?id=23989 Based on a patch by Bo Yang Make the cursor cache global, that's all we really need and otherwise we can miss cursor transitions in some situations (see the bug for one testcase). Also remove some now useless code. * platform/Widget.h: * platform/gtk/WidgetGtk.cpp: (WebCore::Widget::Widget): (WebCore::Widget::~Widget): (WebCore::Widget::setCursor): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@41055 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- WebCore/ChangeLog | 18 ++++++++++++++++++ WebCore/platform/Widget.h | 3 +-- WebCore/platform/gtk/WidgetGtk.cpp | 21 +++++---------------- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index 849fb62e3a3c..da10c580ff7b 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,21 @@ +2009-02-18 Xan Lopez + + Reviewed by Mark Rowe. + + https://bugs.webkit.org/show_bug.cgi?id=23989 + + Based on a patch by Bo Yang + + Make the cursor cache global, that's all we really need and + otherwise we can miss cursor transitions in some situations (see + the bug for one testcase). Also remove some now useless code. + + * platform/Widget.h: + * platform/gtk/WidgetGtk.cpp: + (WebCore::Widget::Widget): + (WebCore::Widget::~Widget): + (WebCore::Widget::setCursor): + 2009-02-17 Adam Roben Windows build fix diff --git a/WebCore/platform/Widget.h b/WebCore/platform/Widget.h index 2f22069a1794..029cc7869ae3 100644 --- a/WebCore/platform/Widget.h +++ b/WebCore/platform/Widget.h @@ -137,7 +137,6 @@ public: virtual void setFocus(); void setCursor(const Cursor&); - Cursor cursor(); virtual void show(); virtual void hide(); @@ -193,7 +192,7 @@ private: IntRect m_frame; // Not used when a native widget exists. -#if PLATFORM(MAC) || PLATFORM(GTK) +#if PLATFORM(MAC) WidgetPrivate* m_data; #endif }; diff --git a/WebCore/platform/gtk/WidgetGtk.cpp b/WebCore/platform/gtk/WidgetGtk.cpp index 82fed74b7061..c83300dbacc0 100644 --- a/WebCore/platform/gtk/WidgetGtk.cpp +++ b/WebCore/platform/gtk/WidgetGtk.cpp @@ -41,23 +41,17 @@ namespace WebCore { -class WidgetPrivate { -public: - GdkCursor* cursor; -}; +static GdkCursor* lastSetCursor; Widget::Widget(PlatformWidget widget) - : m_data(new WidgetPrivate) { init(widget); - m_data->cursor = 0; } Widget::~Widget() { ASSERT(!parent()); releasePlatformWidget(); - delete m_data; } void Widget::setFocus() @@ -65,11 +59,6 @@ void Widget::setFocus() gtk_widget_grab_focus(platformWidget() ? platformWidget() : GTK_WIDGET(root()->hostWindow()->platformWindow())); } -Cursor Widget::cursor() -{ - return Cursor(m_data->cursor); -} - static GdkDrawable* gdkDrawable(PlatformWidget widget) { return widget ? widget->window : 0; @@ -77,7 +66,7 @@ static GdkDrawable* gdkDrawable(PlatformWidget widget) void Widget::setCursor(const Cursor& cursor) { - GdkCursor* pcur = cursor.impl(); + GdkCursor* platformCursor = cursor.impl(); // http://bugs.webkit.org/show_bug.cgi?id=16388 // [GTK] Widget::setCursor() gets called frequently @@ -85,11 +74,11 @@ void Widget::setCursor(const Cursor& cursor) // gdk_window_set_cursor() in certain GDK backends seems to be an // expensive operation, so avoid it if possible. - if (pcur == m_data->cursor) + if (platformCursor == lastSetCursor) return; - gdk_window_set_cursor(gdkDrawable(platformWidget()) ? GDK_WINDOW(gdkDrawable(platformWidget())) : GTK_WIDGET(root()->hostWindow()->platformWindow())->window, pcur); - m_data->cursor = pcur; + gdk_window_set_cursor(gdkDrawable(platformWidget()) ? GDK_WINDOW(gdkDrawable(platformWidget())) : GTK_WIDGET(root()->hostWindow()->platformWindow())->window, platformCursor); + lastSetCursor = platformCursor; } void Widget::show() -- 2.36.0