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

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

Issue 1357883002: Mac: Fix a crash in TextInputClientMac::GetFirstRectForRange() likely during tab closure (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cancelComposition, test Created 5 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 | content/browser/renderer_host/render_widget_host_view_mac_unittest.mm » ('j') | 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 10
(...skipping 2939 matching lines...) Expand 10 before | Expand all | Expand 10 after
2950 2950
2951 // The returned rectangle is in WebKit coordinates (upper left origin), so 2951 // The returned rectangle is in WebKit coordinates (upper left origin), so
2952 // flip the coordinate system. 2952 // flip the coordinate system.
2953 NSRect viewFrame = [self frame]; 2953 NSRect viewFrame = [self frame];
2954 rect.origin.y = NSHeight(viewFrame) - NSMaxY(rect); 2954 rect.origin.y = NSHeight(viewFrame) - NSMaxY(rect);
2955 return rect; 2955 return rect;
2956 } 2956 }
2957 2957
2958 - (NSRect)firstRectForCharacterRange:(NSRange)theRange 2958 - (NSRect)firstRectForCharacterRange:(NSRange)theRange
2959 actualRange:(NSRangePointer)actualRange { 2959 actualRange:(NSRangePointer)actualRange {
2960 // During tab closure, events can arrive after RenderWidgetHostViewMac::
2961 // Destroy() is called, which will have set |render_widget_host_| to null.
2962 if (!renderWidgetHostView_->render_widget_host_) {
2963 [self cancelComposition];
2964 return NSZeroRect;
2965 }
2966
2960 NSRect rect = [self firstViewRectForCharacterRange:theRange 2967 NSRect rect = [self firstViewRectForCharacterRange:theRange
2961 actualRange:actualRange]; 2968 actualRange:actualRange];
2962 2969
2963 // Convert into screen coordinates for return. 2970 // Convert into screen coordinates for return.
2964 rect = [self convertRect:rect toView:nil]; 2971 rect = [self convertRect:rect toView:nil];
2965 rect.origin = [[self window] convertBaseToScreen:rect.origin]; 2972 rect.origin = [[self window] convertBaseToScreen:rect.origin];
2966 return rect; 2973 return rect;
2967 } 2974 }
2968 2975
2969 - (NSRange)markedRange { 2976 - (NSRange)markedRange {
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
3409 3416
3410 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3417 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3411 // regions that are not draggable. (See ControlRegionView in 3418 // regions that are not draggable. (See ControlRegionView in
3412 // native_app_window_cocoa.mm). This requires the render host view to be 3419 // native_app_window_cocoa.mm). This requires the render host view to be
3413 // draggable by default. 3420 // draggable by default.
3414 - (BOOL)mouseDownCanMoveWindow { 3421 - (BOOL)mouseDownCanMoveWindow {
3415 return YES; 3422 return YES;
3416 } 3423 }
3417 3424
3418 @end 3425 @end
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698