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

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

Issue 2296623002: Fix the wrong candidate window on Mac OSX. (Closed)
Patch Set: Fix the wrong candidate window on Mac OSX. Created 4 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 856 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 // like Chrome does on Windows, call |UpdateCursor()| here. 867 // like Chrome does on Windows, call |UpdateCursor()| here.
868 } 868 }
869 869
870 void RenderWidgetHostViewMac::OnUpdateTextInputStateCalled( 870 void RenderWidgetHostViewMac::OnUpdateTextInputStateCalled(
871 TextInputManager* text_input_manager, 871 TextInputManager* text_input_manager,
872 RenderWidgetHostViewBase* updated_view, 872 RenderWidgetHostViewBase* updated_view,
873 bool did_update_state) { 873 bool did_update_state) {
874 if (!did_update_state) 874 if (!did_update_state)
875 return; 875 return;
876 876
877 // Set the monitor state based on the text input focus state.
878 RenderWidgetHost* host = GetRenderWidgetHost();
Alexei Svitkine (slow) 2016/09/02 15:48:05 Nit: Remove this line and just inline render_widge
Seigo Nonaka 2016/09/07 23:53:38 Done.
879 const TextInputState* state = text_input_manager->GetTextInputState();
880 bool need_monitor_composition =
881 HasFocus() && state && state->type != ui::TEXT_INPUT_TYPE_NONE;
Alexei Svitkine (slow) 2016/09/02 15:48:05 Nit: Wrong indent, maybe just run git cl format?
Seigo Nonaka 2016/09/07 23:53:38 Ah yes, sorry I ran git cl format for the latest p
882 Send(new InputMsg_RequestCompositionUpdate(host->GetRoutingID(),
883 false /* immediate request */, need_monitor_composition));
884
877 if (HasFocus()) { 885 if (HasFocus()) {
Alexei Svitkine (slow) 2016/09/02 15:48:05 You're adding another call to HasFocus(). Please o
Seigo Nonaka 2016/09/07 23:53:38 Done.
878 SetTextInputActive(true); 886 SetTextInputActive(true);
879 887
880 // Let AppKit cache the new input context to make IMEs happy. 888 // Let AppKit cache the new input context to make IMEs happy.
881 // See http://crbug.com/73039. 889 // See http://crbug.com/73039.
882 [NSApp updateWindows]; 890 [NSApp updateWindows];
883 891
884 #ifndef __LP64__ 892 #ifndef __LP64__
885 bool can_compose_inline = 893 bool can_compose_inline =
886 !!GetTextInputManager()->GetActiveWidget() 894 !!GetTextInputManager()->GetActiveWidget()
887 ? GetTextInputManager()->GetTextInputState()->can_compose_inline 895 ? GetTextInputManager()->GetTextInputState()->can_compose_inline
888 : true; 896 : true;
889 UseInputWindow(TSMGetActiveDocument(), !can_compose_inline); 897 UseInputWindow(TSMGetActiveDocument(), !can_compose_inline);
890 #endif 898 #endif
891 } 899 }
892 } 900 }
893 901
894 void RenderWidgetHostViewMac::OnImeCancelComposition( 902 void RenderWidgetHostViewMac::OnImeCancelComposition(
895 TextInputManager* text_input_manager, 903 TextInputManager* text_input_manager,
896 RenderWidgetHostViewBase* updated_view) { 904 RenderWidgetHostViewBase* updated_view) {
897 [cocoa_view_ cancelComposition]; 905 [cocoa_view_ cancelComposition];
898 } 906 }
899 907
900 void RenderWidgetHostViewMac::OnImeCompositionRangeChanged( 908 void RenderWidgetHostViewMac::OnImeCompositionRangeChanged(
901 TextInputManager* text_input_manager, 909 TextInputManager* text_input_manager,
902 RenderWidgetHostViewBase* updated_view) { 910 RenderWidgetHostViewBase* updated_view) {
903 const TextInputManager::CompositionRangeInfo* info = 911 const TextInputManager::CompositionRangeInfo* info =
904 GetTextInputManager()->GetCompositionRangeInfo(); 912 GetTextInputManager()->GetCompositionRangeInfo();
913 if (!info)
Seigo Nonaka 2016/09/02 02:18:04 This is now necessary since GetCompositionRangeInf
914 return;
905 // The RangeChanged message is only sent with valid values. The current 915 // The RangeChanged message is only sent with valid values. The current
906 // caret position (start == end) will be sent if there is no IME range. 916 // caret position (start == end) will be sent if there is no IME range.
907 [cocoa_view_ setMarkedRange:info->range.ToNSRange()]; 917 [cocoa_view_ setMarkedRange:info->range.ToNSRange()];
908 composition_range_ = info->range; 918 composition_range_ = info->range;
909 composition_bounds_ = info->character_bounds; 919 composition_bounds_ = info->character_bounds;
910 } 920 }
911 921
912 void RenderWidgetHostViewMac::OnTextSelectionChanged( 922 void RenderWidgetHostViewMac::OnTextSelectionChanged(
913 TextInputManager* text_input_manager, 923 TextInputManager* text_input_manager,
914 RenderWidgetHostViewBase* updated_view) { 924 RenderWidgetHostViewBase* updated_view) {
(...skipping 2346 matching lines...) Expand 10 before | Expand all | Expand 10 after
3261 3271
3262 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3272 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3263 // regions that are not draggable. (See ControlRegionView in 3273 // regions that are not draggable. (See ControlRegionView in
3264 // native_app_window_cocoa.mm). This requires the render host view to be 3274 // native_app_window_cocoa.mm). This requires the render host view to be
3265 // draggable by default. 3275 // draggable by default.
3266 - (BOOL)mouseDownCanMoveWindow { 3276 - (BOOL)mouseDownCanMoveWindow {
3267 return YES; 3277 return YES;
3268 } 3278 }
3269 3279
3270 @end 3280 @end
OLDNEW
« 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