| 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 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 836 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); | 836 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); |
| 837 if (!compositing_iosurface_.get() || | 837 if (!compositing_iosurface_.get() || |
| 838 !compositing_iosurface_->HasIOSurface()) | 838 !compositing_iosurface_->HasIOSurface()) |
| 839 return; | 839 return; |
| 840 | 840 |
| 841 float scale = ScaleFactor(cocoa_view_); | 841 float scale = ScaleFactor(cocoa_view_); |
| 842 gfx::Size dst_pixel_size = dst_size.Scale(scale); | 842 gfx::Size dst_pixel_size = dst_size.Scale(scale); |
| 843 if (!output->initialize( | 843 if (!output->initialize( |
| 844 dst_pixel_size.width(), dst_pixel_size.height(), true)) | 844 dst_pixel_size.width(), dst_pixel_size.height(), true)) |
| 845 return; | 845 return; |
| 846 scoped_callback_runner.Release(); |
| 846 | 847 |
| 847 // Convert |src_subrect| from the views coordinate (upper-left origin) into | 848 // Convert |src_subrect| from the views coordinate (upper-left origin) into |
| 848 // the OpenGL coordinate (lower-left origin). | 849 // the OpenGL coordinate (lower-left origin). |
| 849 gfx::Rect src_gl_subrect = src_subrect; | 850 gfx::Rect src_gl_subrect = src_subrect; |
| 850 src_gl_subrect.set_y(GetViewBounds().height() - src_subrect.bottom()); | 851 src_gl_subrect.set_y(GetViewBounds().height() - src_subrect.bottom()); |
| 851 | 852 |
| 852 gfx::Rect src_pixel_gl_subrect = src_gl_subrect.Scale(scale); | 853 gfx::Rect src_pixel_gl_subrect = src_gl_subrect.Scale(scale); |
| 853 const bool result = compositing_iosurface_->CopyTo( | 854 compositing_iosurface_->CopyTo( |
| 854 src_pixel_gl_subrect, | 855 src_pixel_gl_subrect, |
| 855 dst_pixel_size, | 856 dst_pixel_size, |
| 856 output->getTopDevice()->accessBitmap(true).getPixels()); | 857 output->getTopDevice()->accessBitmap(true).getPixels(), |
| 857 scoped_callback_runner.Release(); | 858 callback); |
| 858 callback.Run(result); | |
| 859 } | 859 } |
| 860 | 860 |
| 861 // Sets whether or not to accept first responder status. | 861 // Sets whether or not to accept first responder status. |
| 862 void RenderWidgetHostViewMac::SetTakesFocusOnlyOnMouseDown(bool flag) { | 862 void RenderWidgetHostViewMac::SetTakesFocusOnlyOnMouseDown(bool flag) { |
| 863 [cocoa_view_ setTakesFocusOnlyOnMouseDown:flag]; | 863 [cocoa_view_ setTakesFocusOnlyOnMouseDown:flag]; |
| 864 } | 864 } |
| 865 | 865 |
| 866 void RenderWidgetHostViewMac::ForwardMouseEvent(const WebMouseEvent& event) { | 866 void RenderWidgetHostViewMac::ForwardMouseEvent(const WebMouseEvent& event) { |
| 867 if (render_widget_host_) | 867 if (render_widget_host_) |
| 868 render_widget_host_->ForwardMouseEvent(event); | 868 render_widget_host_->ForwardMouseEvent(event); |
| (...skipping 2411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3280 if (!string) return NO; | 3280 if (!string) return NO; |
| 3281 | 3281 |
| 3282 // If the user is currently using an IME, confirm the IME input, | 3282 // 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. | 3283 // and then insert the text from the service, the same as TextEdit and Safari. |
| 3284 [self confirmComposition]; | 3284 [self confirmComposition]; |
| 3285 [self insertText:string]; | 3285 [self insertText:string]; |
| 3286 return YES; | 3286 return YES; |
| 3287 } | 3287 } |
| 3288 | 3288 |
| 3289 @end | 3289 @end |
| OLD | NEW |