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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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/rect_conversions.h" |
| 54 #include "ui/gfx/size_conversions.h" |
54 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" | 55 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
55 #include "ui/surface/io_surface_support_mac.h" | 56 #include "ui/surface/io_surface_support_mac.h" |
56 #include "webkit/plugins/npapi/webplugin.h" | 57 #include "webkit/plugins/npapi/webplugin.h" |
57 | 58 |
58 using content::BackingStoreMac; | 59 using content::BackingStoreMac; |
59 using content::NativeWebKeyboardEvent; | 60 using content::NativeWebKeyboardEvent; |
60 using content::RenderViewHostImpl; | 61 using content::RenderViewHostImpl; |
61 using content::RenderWidgetHostImpl; | 62 using content::RenderWidgetHostImpl; |
62 using content::RenderWidgetHostViewMac; | 63 using content::RenderWidgetHostViewMac; |
63 using content::RenderWidgetHostViewMacEditCommandHelper; | 64 using content::RenderWidgetHostViewMacEditCommandHelper; |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 const gfx::Rect& src_subrect, | 834 const gfx::Rect& src_subrect, |
834 const gfx::Size& dst_size, | 835 const gfx::Size& dst_size, |
835 const base::Callback<void(bool)>& callback, | 836 const base::Callback<void(bool)>& callback, |
836 skia::PlatformCanvas* output) { | 837 skia::PlatformCanvas* output) { |
837 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); | 838 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); |
838 if (!compositing_iosurface_.get() || | 839 if (!compositing_iosurface_.get() || |
839 !compositing_iosurface_->HasIOSurface()) | 840 !compositing_iosurface_->HasIOSurface()) |
840 return; | 841 return; |
841 | 842 |
842 float scale = ScaleFactor(cocoa_view_); | 843 float scale = ScaleFactor(cocoa_view_); |
843 gfx::Size dst_pixel_size = dst_size.Scale(scale); | 844 gfx::Size dst_pixel_size = gfx::ToFlooredSize(dst_size.Scale(scale)); |
844 if (!output->initialize( | 845 if (!output->initialize( |
845 dst_pixel_size.width(), dst_pixel_size.height(), true)) | 846 dst_pixel_size.width(), dst_pixel_size.height(), true)) |
846 return; | 847 return; |
847 scoped_callback_runner.Release(); | 848 scoped_callback_runner.Release(); |
848 | 849 |
849 // Convert |src_subrect| from the views coordinate (upper-left origin) into | 850 // Convert |src_subrect| from the views coordinate (upper-left origin) into |
850 // the OpenGL coordinate (lower-left origin). | 851 // the OpenGL coordinate (lower-left origin). |
851 gfx::Rect src_gl_subrect = src_subrect; | 852 gfx::Rect src_gl_subrect = src_subrect; |
852 src_gl_subrect.set_y(GetViewBounds().height() - src_subrect.bottom()); | 853 src_gl_subrect.set_y(GetViewBounds().height() - src_subrect.bottom()); |
853 | 854 |
(...skipping 2445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3299 if (!string) return NO; | 3300 if (!string) return NO; |
3300 | 3301 |
3301 // If the user is currently using an IME, confirm the IME input, | 3302 // If the user is currently using an IME, confirm the IME input, |
3302 // and then insert the text from the service, the same as TextEdit and Safari. | 3303 // and then insert the text from the service, the same as TextEdit and Safari. |
3303 [self confirmComposition]; | 3304 [self confirmComposition]; |
3304 [self insertText:string]; | 3305 [self insertText:string]; |
3305 return YES; | 3306 return YES; |
3306 } | 3307 } |
3307 | 3308 |
3308 @end | 3309 @end |
OLD | NEW |