| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" |
| 6 | 6 |
| 7 #import <objc/runtime.h> | 7 #import <objc/runtime.h> |
| 8 #include <OpenGL/gl.h> | 8 #include <OpenGL/gl.h> |
| 9 #include <QuartzCore/QuartzCore.h> | 9 #include <QuartzCore/QuartzCore.h> |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 872 // like Chrome does on Windows, call |UpdateCursor()| here. | 872 // like Chrome does on Windows, call |UpdateCursor()| here. |
| 873 } | 873 } |
| 874 | 874 |
| 875 void RenderWidgetHostViewMac::OnUpdateTextInputStateCalled( | 875 void RenderWidgetHostViewMac::OnUpdateTextInputStateCalled( |
| 876 TextInputManager* text_input_manager, | 876 TextInputManager* text_input_manager, |
| 877 RenderWidgetHostViewBase* updated_view, | 877 RenderWidgetHostViewBase* updated_view, |
| 878 bool did_update_state) { | 878 bool did_update_state) { |
| 879 if (!did_update_state) | 879 if (!did_update_state) |
| 880 return; | 880 return; |
| 881 | 881 |
| 882 // |updated_view| is the last view to change its TextInputState which can be |
| 883 // used to start/stop monitoring composition info when it has a focused |
| 884 // editable text input field. |
| 885 RenderWidgetHost* widgetHost = updated_view->GetRenderWidgetHost(); |
| 886 |
| 887 // We might end up here when |updated_view| has had active TextInputState and |
| 888 // then got destroyed. In that case, |updated_view->GetRenderWidgetHost()| |
| 889 // returns nullptr. |
| 890 if (!widgetHost) |
| 891 return; |
| 892 |
| 882 // Set the monitor state based on the text input focus state. | 893 // Set the monitor state based on the text input focus state. |
| 883 const bool has_focus = HasFocus(); | 894 const bool has_focus = HasFocus(); |
| 884 const TextInputState* state = text_input_manager->GetTextInputState(); | 895 const TextInputState* state = text_input_manager->GetTextInputState(); |
| 885 bool need_monitor_composition = | 896 bool need_monitor_composition = |
| 886 has_focus && state && state->type != ui::TEXT_INPUT_TYPE_NONE; | 897 has_focus && state && state->type != ui::TEXT_INPUT_TYPE_NONE; |
| 887 Send(new InputMsg_RequestCompositionUpdate( | 898 |
| 888 render_widget_host_->GetRoutingID(), false /* immediate request */, | 899 widgetHost->Send(new InputMsg_RequestCompositionUpdate( |
| 900 widgetHost->GetRoutingID(), false /* immediate request */, |
| 889 need_monitor_composition)); | 901 need_monitor_composition)); |
| 890 | 902 |
| 891 if (has_focus) { | 903 if (has_focus) { |
| 892 SetTextInputActive(true); | 904 SetTextInputActive(true); |
| 893 | 905 |
| 894 // Let AppKit cache the new input context to make IMEs happy. | 906 // Let AppKit cache the new input context to make IMEs happy. |
| 895 // See http://crbug.com/73039. | 907 // See http://crbug.com/73039. |
| 896 [NSApp updateWindows]; | 908 [NSApp updateWindows]; |
| 897 | 909 |
| 898 #ifndef __LP64__ | 910 #ifndef __LP64__ |
| (...skipping 2464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3363 | 3375 |
| 3364 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3376 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
| 3365 // regions that are not draggable. (See ControlRegionView in | 3377 // regions that are not draggable. (See ControlRegionView in |
| 3366 // native_app_window_cocoa.mm). This requires the render host view to be | 3378 // native_app_window_cocoa.mm). This requires the render host view to be |
| 3367 // draggable by default. | 3379 // draggable by default. |
| 3368 - (BOOL)mouseDownCanMoveWindow { | 3380 - (BOOL)mouseDownCanMoveWindow { |
| 3369 return YES; | 3381 return YES; |
| 3370 } | 3382 } |
| 3371 | 3383 |
| 3372 @end | 3384 @end |
| OLD | NEW |