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 #include <QuartzCore/QuartzCore.h> | 7 #include <QuartzCore/QuartzCore.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" | 44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" |
45 #include "third_party/WebKit/Source/WebKit/chromium/public/mac/WebInputEventFact
ory.h" | 45 #include "third_party/WebKit/Source/WebKit/chromium/public/mac/WebInputEventFact
ory.h" |
46 #include "third_party/WebKit/Source/WebKit/chromium/public/mac/WebScreenInfoFact
ory.h" | 46 #include "third_party/WebKit/Source/WebKit/chromium/public/mac/WebScreenInfoFact
ory.h" |
47 #import "third_party/mozilla/ComplexTextInputPanel.h" | 47 #import "third_party/mozilla/ComplexTextInputPanel.h" |
48 #include "third_party/skia/include/core/SkColor.h" | 48 #include "third_party/skia/include/core/SkColor.h" |
49 #import "ui/base/cocoa/fullscreen_window_manager.h" | 49 #import "ui/base/cocoa/fullscreen_window_manager.h" |
50 #import "ui/base/cocoa/underlay_opengl_hosting_window.h" | 50 #import "ui/base/cocoa/underlay_opengl_hosting_window.h" |
51 #include "ui/base/layout.h" | 51 #include "ui/base/layout.h" |
52 #include "ui/gfx/point.h" | 52 #include "ui/gfx/point.h" |
| 53 #include "ui/gfx/rect_conversions.h" |
53 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" | 54 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
54 #include "ui/surface/io_surface_support_mac.h" | 55 #include "ui/surface/io_surface_support_mac.h" |
55 #include "webkit/plugins/npapi/webplugin.h" | 56 #include "webkit/plugins/npapi/webplugin.h" |
56 | 57 |
57 using content::BackingStoreMac; | 58 using content::BackingStoreMac; |
58 using content::NativeWebKeyboardEvent; | 59 using content::NativeWebKeyboardEvent; |
59 using content::RenderViewHostImpl; | 60 using content::RenderViewHostImpl; |
60 using content::RenderWidgetHostImpl; | 61 using content::RenderWidgetHostImpl; |
61 using content::RenderWidgetHostViewMac; | 62 using content::RenderWidgetHostViewMac; |
62 using content::RenderWidgetHostViewMacEditCommandHelper; | 63 using content::RenderWidgetHostViewMacEditCommandHelper; |
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 if (!output->initialize( | 844 if (!output->initialize( |
844 dst_pixel_size.width(), dst_pixel_size.height(), true)) | 845 dst_pixel_size.width(), dst_pixel_size.height(), true)) |
845 return; | 846 return; |
846 scoped_callback_runner.Release(); | 847 scoped_callback_runner.Release(); |
847 | 848 |
848 // Convert |src_subrect| from the views coordinate (upper-left origin) into | 849 // Convert |src_subrect| from the views coordinate (upper-left origin) into |
849 // the OpenGL coordinate (lower-left origin). | 850 // the OpenGL coordinate (lower-left origin). |
850 gfx::Rect src_gl_subrect = src_subrect; | 851 gfx::Rect src_gl_subrect = src_subrect; |
851 src_gl_subrect.set_y(GetViewBounds().height() - src_subrect.bottom()); | 852 src_gl_subrect.set_y(GetViewBounds().height() - src_subrect.bottom()); |
852 | 853 |
853 gfx::Rect src_pixel_gl_subrect = src_gl_subrect.Scale(scale); | 854 gfx::Rect src_pixel_gl_subrect = |
| 855 gfx::ToEnclosingRect(src_gl_subrect.Scale(scale)); |
854 compositing_iosurface_->CopyTo( | 856 compositing_iosurface_->CopyTo( |
855 src_pixel_gl_subrect, | 857 src_pixel_gl_subrect, |
856 dst_pixel_size, | 858 dst_pixel_size, |
857 output->getTopDevice()->accessBitmap(true).getPixels(), | 859 output->getTopDevice()->accessBitmap(true).getPixels(), |
858 callback); | 860 callback); |
859 } | 861 } |
860 | 862 |
861 // Sets whether or not to accept first responder status. | 863 // Sets whether or not to accept first responder status. |
862 void RenderWidgetHostViewMac::SetTakesFocusOnlyOnMouseDown(bool flag) { | 864 void RenderWidgetHostViewMac::SetTakesFocusOnlyOnMouseDown(bool flag) { |
863 [cocoa_view_ setTakesFocusOnlyOnMouseDown:flag]; | 865 [cocoa_view_ setTakesFocusOnlyOnMouseDown:flag]; |
(...skipping 2416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3280 if (!string) return NO; | 3282 if (!string) return NO; |
3281 | 3283 |
3282 // If the user is currently using an IME, confirm the IME input, | 3284 // If the user is currently using an IME, confirm the IME input, |
3283 // and then insert the text from the service, the same as TextEdit and Safari. | 3285 // and then insert the text from the service, the same as TextEdit and Safari. |
3284 [self confirmComposition]; | 3286 [self confirmComposition]; |
3285 [self insertText:string]; | 3287 [self insertText:string]; |
3286 return YES; | 3288 return YES; |
3287 } | 3289 } |
3288 | 3290 |
3289 @end | 3291 @end |
OLD | NEW |