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

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

Issue 2732143002: Fixing a crash due to calling [RWHVCocoa attributedSubstringForProposedRange] when there is no focu… (Closed)
Patch Set: Created 3 years, 9 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 <Carbon/Carbon.h> 7 #import <Carbon/Carbon.h>
8 #import <objc/runtime.h> 8 #import <objc/runtime.h>
9 #include <OpenGL/gl.h> 9 #include <OpenGL/gl.h>
10 #include <QuartzCore/QuartzCore.h> 10 #include <QuartzCore/QuartzCore.h>
(...skipping 3079 matching lines...) Expand 10 before | Expand all | Expand 10 after
3090 3090
3091 gfx::Range expected_range; 3091 gfx::Range expected_range;
3092 const base::string16* expected_text; 3092 const base::string16* expected_text;
3093 const content::TextInputManager::CompositionRangeInfo* compositionInfo = 3093 const content::TextInputManager::CompositionRangeInfo* compositionInfo =
3094 renderWidgetHostView_->GetCompositionRangeInfo(); 3094 renderWidgetHostView_->GetCompositionRangeInfo();
3095 const content::TextInputManager::TextSelection* selection = 3095 const content::TextInputManager::TextSelection* selection =
3096 renderWidgetHostView_->GetTextSelection(); 3096 renderWidgetHostView_->GetTextSelection();
3097 if (!selection) 3097 if (!selection)
3098 return nil; 3098 return nil;
3099 3099
3100 if (!compositionInfo->range.is_empty()) { 3100 if (compositionInfo && !compositionInfo->range.is_empty()) {
EhsanK 2017/03/06 23:36:19 We do get here when <input> is not focused (left s
Avi (use Gerrit) 2017/03/06 23:39:10 Can you drop a note in the code explaining when th
EhsanK 2017/03/07 02:48:52 Sure. I still don't know the exact repro but I wil
3101 expected_text = &markedText_; 3101 expected_text = &markedText_;
3102 expected_range = compositionInfo->range; 3102 expected_range = compositionInfo->range;
3103 } else { 3103 } else {
3104 expected_text = &selection->text(); 3104 expected_text = &selection->text();
3105 size_t offset = selection->offset(); 3105 size_t offset = selection->offset();
3106 expected_range = gfx::Range(offset, offset + expected_text->size()); 3106 expected_range = gfx::Range(offset, offset + expected_text->size());
3107 } 3107 }
3108 3108
3109 gfx::Range actual_range = expected_range.Intersect(requested_range); 3109 gfx::Range actual_range = expected_range.Intersect(requested_range);
3110 if (!actual_range.IsValid()) 3110 if (!actual_range.IsValid())
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
3489 3489
3490 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3490 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3491 // regions that are not draggable. (See ControlRegionView in 3491 // regions that are not draggable. (See ControlRegionView in
3492 // native_app_window_cocoa.mm). This requires the render host view to be 3492 // native_app_window_cocoa.mm). This requires the render host view to be
3493 // draggable by default. 3493 // draggable by default.
3494 - (BOOL)mouseDownCanMoveWindow { 3494 - (BOOL)mouseDownCanMoveWindow {
3495 return YES; 3495 return YES;
3496 } 3496 }
3497 3497
3498 @end 3498 @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