Chromium Code Reviews| 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 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 809 bool RenderWidgetHostViewMac::IsPopup() const { | 809 bool RenderWidgetHostViewMac::IsPopup() const { |
| 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 // TODO(mazda): Support copying a partial rectangle from the compositing surface | |
| 820 // with |src_subrect| (http://crbug.com/118571). | |
| 819 void RenderWidgetHostViewMac::CopyFromCompositingSurface( | 821 void RenderWidgetHostViewMac::CopyFromCompositingSurface( |
| 820 const gfx::Size& size, | 822 const gfx::Rect& /* src_subrect */, |
| 823 const gfx::Size& dst_size, | |
| 821 const base::Callback<void(bool)>& callback, | 824 const base::Callback<void(bool)>& callback, |
| 822 skia::PlatformCanvas* output) { | 825 skia::PlatformCanvas* output) { |
|
piman
2012/07/26 00:04:51
For mac and windows, where subrects are not suppor
mazda
2012/07/26 02:20:04
Done.
| |
| 823 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); | 826 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); |
| 824 if (!compositing_iosurface_.get() || | 827 if (!compositing_iosurface_.get() || |
| 825 !compositing_iosurface_->HasIOSurface()) | 828 !compositing_iosurface_->HasIOSurface()) |
| 826 return; | 829 return; |
| 827 | 830 |
| 828 if (!output->initialize(size.width(), size.height(), true)) | 831 if (!output->initialize(dst_size.width(), dst_size.height(), true)) |
| 829 return; | 832 return; |
| 830 | 833 |
| 831 const bool result = compositing_iosurface_->CopyTo( | 834 const bool result = compositing_iosurface_->CopyTo( |
| 832 size, output->getTopDevice()->accessBitmap(true).getPixels()); | 835 dst_size, output->getTopDevice()->accessBitmap(true).getPixels()); |
| 833 scoped_callback_runner.Release(); | 836 scoped_callback_runner.Release(); |
| 834 callback.Run(result); | 837 callback.Run(result); |
| 835 } | 838 } |
| 836 | 839 |
| 837 // Sets whether or not to accept first responder status. | 840 // Sets whether or not to accept first responder status. |
| 838 void RenderWidgetHostViewMac::SetTakesFocusOnlyOnMouseDown(bool flag) { | 841 void RenderWidgetHostViewMac::SetTakesFocusOnlyOnMouseDown(bool flag) { |
| 839 [cocoa_view_ setTakesFocusOnlyOnMouseDown:flag]; | 842 [cocoa_view_ setTakesFocusOnlyOnMouseDown:flag]; |
| 840 } | 843 } |
| 841 | 844 |
| 842 void RenderWidgetHostViewMac::ForwardMouseEvent(const WebMouseEvent& event) { | 845 void RenderWidgetHostViewMac::ForwardMouseEvent(const WebMouseEvent& event) { |
| (...skipping 2359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3202 if (!string) return NO; | 3205 if (!string) return NO; |
| 3203 | 3206 |
| 3204 // If the user is currently using an IME, confirm the IME input, | 3207 // If the user is currently using an IME, confirm the IME input, |
| 3205 // and then insert the text from the service, the same as TextEdit and Safari. | 3208 // and then insert the text from the service, the same as TextEdit and Safari. |
| 3206 [self confirmComposition]; | 3209 [self confirmComposition]; |
| 3207 [self insertText:string]; | 3210 [self insertText:string]; |
| 3208 return YES; | 3211 return YES; |
| 3209 } | 3212 } |
| 3210 | 3213 |
| 3211 @end | 3214 @end |
| OLD | NEW |