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

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

Issue 2337783004: Fix the wrong candidate window on Mac OSX. (Closed)
Patch Set: 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 if (HasFocus()) { 877 // Set the monitor state based on the text input focus state.
878 const bool has_focus = HasFocus();
879 const TextInputState* state = text_input_manager->GetTextInputState();
880 bool need_monitor_composition =
881 has_focus && state && state->type != ui::TEXT_INPUT_TYPE_NONE;
882 Send(new InputMsg_RequestCompositionUpdate(
883 render_widget_host_->GetRoutingID(), false /* immediate request */,
884 need_monitor_composition));
885
886 if (has_focus) {
878 SetTextInputActive(true); 887 SetTextInputActive(true);
879 888
880 // Let AppKit cache the new input context to make IMEs happy. 889 // Let AppKit cache the new input context to make IMEs happy.
881 // See http://crbug.com/73039. 890 // See http://crbug.com/73039.
882 [NSApp updateWindows]; 891 [NSApp updateWindows];
883 892
884 #ifndef __LP64__ 893 #ifndef __LP64__
885 bool can_compose_inline = 894 bool can_compose_inline =
886 !!GetTextInputManager()->GetActiveWidget() 895 !!GetTextInputManager()->GetActiveWidget()
887 ? GetTextInputManager()->GetTextInputState()->can_compose_inline 896 ? GetTextInputManager()->GetTextInputState()->can_compose_inline
888 : true; 897 : true;
889 UseInputWindow(TSMGetActiveDocument(), !can_compose_inline); 898 UseInputWindow(TSMGetActiveDocument(), !can_compose_inline);
890 #endif 899 #endif
891 } 900 }
892 } 901 }
893 902
894 void RenderWidgetHostViewMac::OnImeCancelComposition( 903 void RenderWidgetHostViewMac::OnImeCancelComposition(
895 TextInputManager* text_input_manager, 904 TextInputManager* text_input_manager,
896 RenderWidgetHostViewBase* updated_view) { 905 RenderWidgetHostViewBase* updated_view) {
897 [cocoa_view_ cancelComposition]; 906 [cocoa_view_ cancelComposition];
898 } 907 }
899 908
900 void RenderWidgetHostViewMac::OnImeCompositionRangeChanged( 909 void RenderWidgetHostViewMac::OnImeCompositionRangeChanged(
901 TextInputManager* text_input_manager, 910 TextInputManager* text_input_manager,
902 RenderWidgetHostViewBase* updated_view) { 911 RenderWidgetHostViewBase* updated_view) {
903 const TextInputManager::CompositionRangeInfo* info = 912 const TextInputManager::CompositionRangeInfo* info =
904 GetTextInputManager()->GetCompositionRangeInfo(); 913 GetTextInputManager()->GetCompositionRangeInfo();
914 if (!info)
915 return;
905 // The RangeChanged message is only sent with valid values. The current 916 // 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. 917 // caret position (start == end) will be sent if there is no IME range.
907 [cocoa_view_ setMarkedRange:info->range.ToNSRange()]; 918 [cocoa_view_ setMarkedRange:info->range.ToNSRange()];
908 composition_range_ = info->range; 919 composition_range_ = info->range;
909 composition_bounds_ = info->character_bounds; 920 composition_bounds_ = info->character_bounds;
910 } 921 }
911 922
912 void RenderWidgetHostViewMac::OnTextSelectionChanged( 923 void RenderWidgetHostViewMac::OnTextSelectionChanged(
913 TextInputManager* text_input_manager, 924 TextInputManager* text_input_manager,
914 RenderWidgetHostViewBase* updated_view) { 925 RenderWidgetHostViewBase* updated_view) {
(...skipping 2350 matching lines...) Expand 10 before | Expand all | Expand 10 after
3265 3276
3266 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3277 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3267 // regions that are not draggable. (See ControlRegionView in 3278 // regions that are not draggable. (See ControlRegionView in
3268 // native_app_window_cocoa.mm). This requires the render host view to be 3279 // native_app_window_cocoa.mm). This requires the render host view to be
3269 // draggable by default. 3280 // draggable by default.
3270 - (BOOL)mouseDownCanMoveWindow { 3281 - (BOOL)mouseDownCanMoveWindow {
3271 return YES; 3282 return YES;
3272 } 3283 }
3273 3284
3274 @end 3285 @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