OLD | NEW |
---|---|
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 <QuartzCore/QuartzCore.h> | 8 #include <QuartzCore/QuartzCore.h> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 2781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2792 - (void)touchesBeganWithEvent:(NSEvent*)event { | 2792 - (void)touchesBeganWithEvent:(NSEvent*)event { |
2793 [responderDelegate_ touchesBeganWithEvent:event]; | 2793 [responderDelegate_ touchesBeganWithEvent:event]; |
2794 } | 2794 } |
2795 - (void)touchesCancelledWithEvent:(NSEvent*)event { | 2795 - (void)touchesCancelledWithEvent:(NSEvent*)event { |
2796 [responderDelegate_ touchesCancelledWithEvent:event]; | 2796 [responderDelegate_ touchesCancelledWithEvent:event]; |
2797 } | 2797 } |
2798 - (void)touchesEndedWithEvent:(NSEvent*)event { | 2798 - (void)touchesEndedWithEvent:(NSEvent*)event { |
2799 [responderDelegate_ touchesEndedWithEvent:event]; | 2799 [responderDelegate_ touchesEndedWithEvent:event]; |
2800 } | 2800 } |
2801 | 2801 |
2802 - (void)quickLookWithEvent:(NSEvent*)event { | |
Avi (use Gerrit)
2014/03/12 04:55:40
Can you note that this only will be invoked for >=
Andre
2014/03/12 16:59:26
Done.
| |
2803 NSPoint point = [self convertPoint:[event locationInWindow] fromView:nil]; | |
2804 TextInputClientMac::GetInstance()->GetStringAtPoint( | |
2805 renderWidgetHostView_->render_widget_host_, | |
2806 gfx::Point(point.x, NSHeight([self frame]) - point.y), | |
2807 ^(NSAttributedString* string, NSPoint baselinePoint) { | |
eseidel
2014/03/12 04:48:36
Woh, crazy. Maybe things have changed, but I reca
Avi (use Gerrit)
2014/03/12 04:58:20
I will be kind and attribute this to your weird hi
| |
2808 if (string && [string length] > 0) { | |
Avi (use Gerrit)
2014/03/12 04:55:40
Technically speaking you don't need to check strin
Andre
2014/03/12 16:59:26
True, but my thinking was the extra check makes it
Avi (use Gerrit)
2014/03/12 17:10:54
Please leave it alone. I don't mind redundancy in
| |
2809 dispatch_async(dispatch_get_main_queue(), ^{ | |
Avi (use Gerrit)
2014/03/12 04:55:40
Why the dispatch on the main thread? Are we really
Andre
2014/03/12 16:59:26
The callback happens on the IO/IPC thread.
I will
| |
2810 [self showDefinitionForAttributedString:string | |
2811 atPoint:baselinePoint]; | |
2812 }); | |
2813 } | |
2814 } | |
2815 ); | |
2816 } | |
2817 | |
2802 // This method handles 2 different types of hardware events. | 2818 // This method handles 2 different types of hardware events. |
2803 // (Apple does not distinguish between them). | 2819 // (Apple does not distinguish between them). |
2804 // a. Scrolling the middle wheel of a mouse. | 2820 // a. Scrolling the middle wheel of a mouse. |
2805 // b. Swiping on the track pad. | 2821 // b. Swiping on the track pad. |
2806 // | 2822 // |
2807 // This method is responsible for 2 types of behavior: | 2823 // This method is responsible for 2 types of behavior: |
2808 // a. Scrolling the content of window. | 2824 // a. Scrolling the content of window. |
2809 // b. Navigating forwards/backwards in history. | 2825 // b. Navigating forwards/backwards in history. |
2810 // | 2826 // |
2811 // This is a brief description of the logic: | 2827 // This is a brief description of the logic: |
(...skipping 1450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4262 CGColorGetConstantColor(kCGColorWhite)); | 4278 CGColorGetConstantColor(kCGColorWhite)); |
4263 CGContextFillRect(context, clipRect); | 4279 CGContextFillRect(context, clipRect); |
4264 } | 4280 } |
4265 } | 4281 } |
4266 | 4282 |
4267 - (void)disableRendering { | 4283 - (void)disableRendering { |
4268 renderWidgetHostView_ = NULL; | 4284 renderWidgetHostView_ = NULL; |
4269 } | 4285 } |
4270 | 4286 |
4271 @end // implementation SoftwareLayer | 4287 @end // implementation SoftwareLayer |
OLD | NEW |