| 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 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 return popup_type_ != WebKit::WebPopupTypeNone; | 810 return popup_type_ != WebKit::WebPopupTypeNone; |
| 811 } | 811 } |
| 812 | 812 |
| 813 BackingStore* RenderWidgetHostViewMac::AllocBackingStore( | 813 BackingStore* RenderWidgetHostViewMac::AllocBackingStore( |
| 814 const gfx::Size& size) { | 814 const gfx::Size& size) { |
| 815 float scale = ScaleFactor(cocoa_view_); | 815 float scale = ScaleFactor(cocoa_view_); |
| 816 return new BackingStoreMac(render_widget_host_, size, scale); | 816 return new BackingStoreMac(render_widget_host_, size, scale); |
| 817 } | 817 } |
| 818 | 818 |
| 819 void RenderWidgetHostViewMac::CopyFromCompositingSurface( | 819 void RenderWidgetHostViewMac::CopyFromCompositingSurface( |
| 820 const gfx::Size& size, | 820 const gfx::Rect& src_subrect, |
| 821 const gfx::Size& dst_size, |
| 821 const base::Callback<void(bool)>& callback, | 822 const base::Callback<void(bool)>& callback, |
| 822 skia::PlatformCanvas* output) { | 823 skia::PlatformCanvas* output) { |
| 823 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); | 824 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); |
| 825 // TODO(mazda): Support copying a partial rectangle from the compositing |
| 826 // surface with |src_subrect| (http://crbug.com/118571). |
| 827 if (!src_subrect.IsEmpty()) { |
| 828 NOTIMPLEMENTED(); |
| 829 return; |
| 830 } |
| 831 |
| 824 if (!compositing_iosurface_.get() || | 832 if (!compositing_iosurface_.get() || |
| 825 !compositing_iosurface_->HasIOSurface()) | 833 !compositing_iosurface_->HasIOSurface()) |
| 826 return; | 834 return; |
| 827 | 835 |
| 828 if (!output->initialize(size.width(), size.height(), true)) | 836 if (!output->initialize(dst_size.width(), dst_size.height(), true)) |
| 829 return; | 837 return; |
| 830 | 838 |
| 831 const bool result = compositing_iosurface_->CopyTo( | 839 const bool result = compositing_iosurface_->CopyTo( |
| 832 size, output->getTopDevice()->accessBitmap(true).getPixels()); | 840 dst_size, output->getTopDevice()->accessBitmap(true).getPixels()); |
| 833 scoped_callback_runner.Release(); | 841 scoped_callback_runner.Release(); |
| 834 callback.Run(result); | 842 callback.Run(result); |
| 835 } | 843 } |
| 836 | 844 |
| 837 // Sets whether or not to accept first responder status. | 845 // Sets whether or not to accept first responder status. |
| 838 void RenderWidgetHostViewMac::SetTakesFocusOnlyOnMouseDown(bool flag) { | 846 void RenderWidgetHostViewMac::SetTakesFocusOnlyOnMouseDown(bool flag) { |
| 839 [cocoa_view_ setTakesFocusOnlyOnMouseDown:flag]; | 847 [cocoa_view_ setTakesFocusOnlyOnMouseDown:flag]; |
| 840 } | 848 } |
| 841 | 849 |
| 842 void RenderWidgetHostViewMac::ForwardMouseEvent(const WebMouseEvent& event) { | 850 void RenderWidgetHostViewMac::ForwardMouseEvent(const WebMouseEvent& event) { |
| (...skipping 2361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3204 if (!string) return NO; | 3212 if (!string) return NO; |
| 3205 | 3213 |
| 3206 // If the user is currently using an IME, confirm the IME input, | 3214 // If the user is currently using an IME, confirm the IME input, |
| 3207 // and then insert the text from the service, the same as TextEdit and Safari. | 3215 // and then insert the text from the service, the same as TextEdit and Safari. |
| 3208 [self confirmComposition]; | 3216 [self confirmComposition]; |
| 3209 [self insertText:string]; | 3217 [self insertText:string]; |
| 3210 return YES; | 3218 return YES; |
| 3211 } | 3219 } |
| 3212 | 3220 |
| 3213 @end | 3221 @end |
| OLD | NEW |