Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Unified Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 2839813002: Only autohide the cursor when we are on a text entry field. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_view_mac.mm
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
index 37903daefeb08dc26ac166cfff2dba100c84da39..1a6f0b9e19d7548336c2f202bbd3f28fd79b054b 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -150,7 +150,7 @@ RenderWidgetHostView* GetRenderWidgetHostViewToUse(
@property(nonatomic, assign) NSRange selectedRange;
@property(nonatomic, assign) NSRange markedRange;
-+ (BOOL)shouldAutohideCursorForEvent:(NSEvent*)event;
+- (BOOL)shouldAutohideCursorForEvent:(NSEvent*)event;
- (id)initWithRenderWidgetHostViewMac:(RenderWidgetHostViewMac*)r;
- (void)processedWheelEvent:(const blink::WebMouseWheelEvent&)event
consumed:(BOOL)consumed;
@@ -2147,7 +2147,7 @@ void RenderWidgetHostViewMac::OnDisplayMetricsChanged(
widgetHost->ForwardKeyboardEvent(event);
// Possibly autohide the cursor.
- if ([RenderWidgetHostViewCocoa shouldAutohideCursorForEvent:theEvent])
+ if ([self shouldAutohideCursorForEvent:theEvent])
[NSCursor setHiddenUntilMouseMoves:YES];
return;
@@ -2313,7 +2313,7 @@ void RenderWidgetHostViewMac::OnDisplayMetricsChanged(
}
// Possibly autohide the cursor.
- if ([RenderWidgetHostViewCocoa shouldAutohideCursorForEvent:theEvent])
+ if ([self shouldAutohideCursorForEvent:theEvent])
[NSCursor setHiddenUntilMouseMoves:YES];
}
@@ -2831,9 +2831,13 @@ void RenderWidgetHostViewMac::OnDisplayMetricsChanged(
// Determine whether we should autohide the cursor (i.e., hide it until mouse
// move) for the given event. Customize here to be more selective about which
// key presses to autohide on.
-+ (BOOL)shouldAutohideCursorForEvent:(NSEvent*)event {
- return ([event type] == NSKeyDown &&
- !([event modifierFlags] & NSCommandKeyMask)) ? YES : NO;
+- (BOOL)shouldAutohideCursorForEvent:(NSEvent*)event {
+ return (renderWidgetHostView_->GetTextInputType() !=
+ ui::TEXT_INPUT_TYPE_NONE &&
+ [event type] == NSKeyDown &&
+ !([event modifierFlags] & NSCommandKeyMask))
+ ? YES
+ : NO;
}
- (NSArray *)accessibilityArrayAttributeValues:(NSString *)attribute
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698