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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 2373243005: Request composition info from the focused RenderWidget (Closed)
Patch Set: Added a unit test Created 4 years, 2 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 unified diff | Download patch
OLDNEW
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 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 // like Chrome does on Windows, call |UpdateCursor()| here. 878 // like Chrome does on Windows, call |UpdateCursor()| here.
879 } 879 }
880 880
881 void RenderWidgetHostViewMac::OnUpdateTextInputStateCalled( 881 void RenderWidgetHostViewMac::OnUpdateTextInputStateCalled(
882 TextInputManager* text_input_manager, 882 TextInputManager* text_input_manager,
883 RenderWidgetHostViewBase* updated_view, 883 RenderWidgetHostViewBase* updated_view,
884 bool did_update_state) { 884 bool did_update_state) {
885 if (!did_update_state) 885 if (!did_update_state)
886 return; 886 return;
887 887
888 // Only the widget with a focused text field should be computing composition
889 // info, i.e., if the current TextInputState is NONE, then the widget
890 // corresponding to |updated_view| should stop monitoring composition info. If
891 // state is anything other than NONE, the widget should start monitoring the
892 // composition info. TextInputManager guarantees that in two consecutive calls
893 // to this method, if |updated_view| are different, then the first call must
894 // have had a state->type of NONE and the second call must have had a
895 // none-NONE state, i.e., it is safe to set/unset monitoring based on current
896 // state and |updated_view|.
Charlie Reis 2016/09/30 22:39:16 How is this comment related to the null check belo
EhsanK 2016/10/05 16:39:02 A separate observation. I left a new comment for t
897 RenderWidgetHost* widgetHost = updated_view->GetRenderWidgetHost();
898 if (!widgetHost)
899 return;
900
888 // Set the monitor state based on the text input focus state. 901 // Set the monitor state based on the text input focus state.
889 const bool has_focus = HasFocus(); 902 const bool has_focus = HasFocus();
890 const TextInputState* state = text_input_manager->GetTextInputState(); 903 const TextInputState* state = text_input_manager->GetTextInputState();
891 bool need_monitor_composition = 904 bool need_monitor_composition =
892 has_focus && state && state->type != ui::TEXT_INPUT_TYPE_NONE; 905 has_focus && state && state->type != ui::TEXT_INPUT_TYPE_NONE;
893 Send(new InputMsg_RequestCompositionUpdate( 906
894 render_widget_host_->GetRoutingID(), false /* immediate request */, 907 widgetHost->Send(new InputMsg_RequestCompositionUpdate(
908 widgetHost->GetRoutingID(), false /* immediate request */,
895 need_monitor_composition)); 909 need_monitor_composition));
896 910
897 if (has_focus) { 911 if (has_focus) {
898 SetTextInputActive(true); 912 SetTextInputActive(true);
899 913
900 // Let AppKit cache the new input context to make IMEs happy. 914 // Let AppKit cache the new input context to make IMEs happy.
901 // See http://crbug.com/73039. 915 // See http://crbug.com/73039.
902 [NSApp updateWindows]; 916 [NSApp updateWindows];
903 917
904 #ifndef __LP64__ 918 #ifndef __LP64__
(...skipping 2484 matching lines...) Expand 10 before | Expand all | Expand 10 after
3389 3403
3390 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3404 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3391 // regions that are not draggable. (See ControlRegionView in 3405 // regions that are not draggable. (See ControlRegionView in
3392 // native_app_window_cocoa.mm). This requires the render host view to be 3406 // native_app_window_cocoa.mm). This requires the render host view to be
3393 // draggable by default. 3407 // draggable by default.
3394 - (BOOL)mouseDownCanMoveWindow { 3408 - (BOOL)mouseDownCanMoveWindow {
3395 return YES; 3409 return YES;
3396 } 3410 }
3397 3411
3398 @end 3412 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698