summaryrefslogtreecommitdiffstats
path: root/chrome/browser/renderer_host
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-10 22:35:30 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-10 22:35:30 +0000
commit6ee524b8b8f376b02f598e6ba44813c6386e0692 (patch)
tree99cabda9ff796400d914f96d3715dfb49e718ce3 /chrome/browser/renderer_host
parent1b33a4a1aa0c9c1282b36fd0e64fc2cb1cf537e6 (diff)
downloadchromium_src-6ee524b8b8f376b02f598e6ba44813c6386e0692.zip
chromium_src-6ee524b8b8f376b02f598e6ba44813c6386e0692.tar.gz
chromium_src-6ee524b8b8f376b02f598e6ba44813c6386e0692.tar.bz2
Turn on Mac cursor support now that we're already linking in the world.
Review URL: http://codereview.chromium.org/21227 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9522 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host')
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_mac.h3
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_mac.mm24
2 files changed, 19 insertions, 8 deletions
diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.h b/chrome/browser/renderer_host/render_widget_host_view_mac.h
index 1ca398c..398c411 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_mac.h
+++ b/chrome/browser/renderer_host/render_widget_host_view_mac.h
@@ -9,6 +9,7 @@
#include "base/time.h"
#include "chrome/browser/renderer_host/render_widget_host_view.h"
+#include "webkit/glue/webcursor.h"
class RenderWidgetHostViewMac;
@@ -92,7 +93,7 @@ class RenderWidgetHostViewMac : public RenderWidgetHostView {
RenderWidgetHost* render_widget_host_;
// The cursor for the page. This is passed up from the renderer.
-// WebCursor current_cursor_; // temporarily commented for link issues
+ WebCursor current_cursor_;
// Indicates if the page is loading.
bool is_loading_;
diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.mm b/chrome/browser/renderer_host/render_widget_host_view_mac.mm
index dfb290e..dd2066a 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/chrome/browser/renderer_host/render_widget_host_view_mac.mm
@@ -124,17 +124,27 @@ gfx::Rect RenderWidgetHostViewMac::GetViewBounds() const {
}
void RenderWidgetHostViewMac::UpdateCursor(const WebCursor& cursor) {
-// current_cursor_ = cursor; // temporarily commented for link issues
+ current_cursor_ = cursor;
UpdateCursorIfOverSelf();
}
void RenderWidgetHostViewMac::UpdateCursorIfOverSelf() {
- // Do something special (as Windows does) for arrow cursor while loading a
- // page? TODO(avi): decide
- // TODO(avi): check to see if mouse pointer is within our bounds
- // Disabled so we don't have to link in glue... yet
-// NSCursor* ns_cursor = current_cursor_.GetCursor();
-// [ns_cursor set];
+ // Do something special (as Win Chromium does) for arrow cursor while loading
+ // a page? TODO(avi): decide
+ // Can we synchronize to the event stream? Switch to -[NSWindow
+ // mouseLocationOutsideOfEventStream] if we cannot. TODO(avi): test and see
+ NSEvent* event = [[cocoa_view_ window] currentEvent];
+ if ([event window] != [cocoa_view_ window])
+ return;
+
+ NSPoint event_location = [event locationInWindow];
+ NSPoint local_point = [cocoa_view_ convertPoint:event_location fromView:nil];
+
+ if (!NSPointInRect(local_point, [cocoa_view_ bounds]))
+ return;
+
+ NSCursor* ns_cursor = current_cursor_.GetCursor();
+ [ns_cursor set];
}
void RenderWidgetHostViewMac::SetIsLoading(bool is_loading) {