OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <QuartzCore/QuartzCore.h> | 5 #include <QuartzCore/QuartzCore.h> |
6 | 6 |
7 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" | 7 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" |
8 | 8 |
9 #include "app/app_switches.h" | 9 #include "app/app_switches.h" |
10 #include "app/surface/io_surface_support_mac.h" | 10 #include "app/surface/io_surface_support_mac.h" |
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 void RenderWidgetHostViewMac::ImeCancelComposition() { | 738 void RenderWidgetHostViewMac::ImeCancelComposition() { |
739 [cocoa_view_ cancelComposition]; | 739 [cocoa_view_ cancelComposition]; |
740 } | 740 } |
741 | 741 |
742 void RenderWidgetHostViewMac::DidUpdateBackingStore( | 742 void RenderWidgetHostViewMac::DidUpdateBackingStore( |
743 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, | 743 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, |
744 const std::vector<gfx::Rect>& copy_rects) { | 744 const std::vector<gfx::Rect>& copy_rects) { |
745 if (!is_hidden_) { | 745 if (!is_hidden_) { |
746 std::vector<gfx::Rect> rects(copy_rects); | 746 std::vector<gfx::Rect> rects(copy_rects); |
747 | 747 |
748 // Because the findbar might be open, we cannot use scrollRect:by: here. Fo
r | 748 // Because the findbar might be open, we cannot use scrollRect:by: here. For |
749 // now, simply mark all of scroll rect as dirty. | 749 // now, simply mark all of scroll rect as dirty. |
750 if (!scroll_rect.IsEmpty()) | 750 if (!scroll_rect.IsEmpty()) |
751 rects.push_back(scroll_rect); | 751 rects.push_back(scroll_rect); |
752 | 752 |
753 for (size_t i = 0; i < rects.size(); ++i) { | 753 for (size_t i = 0; i < rects.size(); ++i) { |
754 NSRect ns_rect = [cocoa_view_ flipRectToNSRect:rects[i]]; | 754 NSRect ns_rect = [cocoa_view_ flipRectToNSRect:rects[i]]; |
755 | 755 |
756 if (about_to_validate_and_paint_) { | 756 if (about_to_validate_and_paint_) { |
757 // As much as we'd like to use -setNeedsDisplayInRect: here, we can't. | 757 // As much as we'd like to use -setNeedsDisplayInRect: here, we can't. |
758 // We're in the middle of executing a -drawRect:, and as soon as it | 758 // We're in the middle of executing a -drawRect:, and as soon as it |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 [view updateSwapBuffersCount:swap_buffers_count | 1012 [view updateSwapBuffersCount:swap_buffers_count |
1013 fromRenderer:renderer_id | 1013 fromRenderer:renderer_id |
1014 routeId:route_id]; | 1014 routeId:route_id]; |
1015 } | 1015 } |
1016 | 1016 |
1017 void RenderWidgetHostViewMac::UpdateRootGpuViewVisibility( | 1017 void RenderWidgetHostViewMac::UpdateRootGpuViewVisibility( |
1018 bool show_gpu_widget) { | 1018 bool show_gpu_widget) { |
1019 // Plugins are destroyed on page navigate. The compositor layer on the other | 1019 // Plugins are destroyed on page navigate. The compositor layer on the other |
1020 // hand is created on demand and then stays alive until its renderer process | 1020 // hand is created on demand and then stays alive until its renderer process |
1021 // dies (usually on cross-domain navigation). Instead, only a flag | 1021 // dies (usually on cross-domain navigation). Instead, only a flag |
1022 // |is_gpu_rendering_active()| is flipped when the compositor output should be | 1022 // |is_accelerated_compositing_active()| is flipped when the compositor output |
1023 // shown/hidden. | 1023 // should be shown/hidden. |
1024 // Show/hide the view belonging to the compositor here. | 1024 // Show/hide the view belonging to the compositor here. |
1025 plugin_container_manager_.set_gpu_rendering_active(show_gpu_widget); | 1025 plugin_container_manager_.set_gpu_rendering_active(show_gpu_widget); |
1026 | 1026 |
1027 gfx::PluginWindowHandle root_handle = | 1027 gfx::PluginWindowHandle root_handle = |
1028 plugin_container_manager_.root_container_handle(); | 1028 plugin_container_manager_.root_container_handle(); |
1029 if (root_handle != gfx::kNullPluginWindow) { | 1029 if (root_handle != gfx::kNullPluginWindow) { |
1030 PluginViewMap::iterator it = plugin_views_.find(root_handle); | 1030 PluginViewMap::iterator it = plugin_views_.find(root_handle); |
1031 DCHECK(plugin_views_.end() != it); | 1031 DCHECK(plugin_views_.end() != it); |
1032 if (plugin_views_.end() == it) { | 1032 if (plugin_views_.end() == it) { |
1033 return; | 1033 return; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 int32 route_id, | 1078 int32 route_id, |
1079 uint64 swap_buffers_count) { | 1079 uint64 swap_buffers_count) { |
1080 BrowserThread::PostTask( | 1080 BrowserThread::PostTask( |
1081 BrowserThread::IO, FROM_HERE, | 1081 BrowserThread::IO, FROM_HERE, |
1082 new BuffersSwappedAcknowledger( | 1082 new BuffersSwappedAcknowledger( |
1083 renderer_id, route_id, swap_buffers_count)); | 1083 renderer_id, route_id, swap_buffers_count)); |
1084 } | 1084 } |
1085 | 1085 |
1086 void RenderWidgetHostViewMac::GpuRenderingStateDidChange() { | 1086 void RenderWidgetHostViewMac::GpuRenderingStateDidChange() { |
1087 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1087 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1088 if (GetRenderWidgetHost()->is_gpu_rendering_active()) { | 1088 if (GetRenderWidgetHost()->is_accelerated_compositing_active()) { |
1089 UpdateRootGpuViewVisibility( | 1089 UpdateRootGpuViewVisibility( |
1090 GetRenderWidgetHost()->is_gpu_rendering_active()); | 1090 GetRenderWidgetHost()->is_accelerated_compositing_active()); |
1091 } else { | 1091 } else { |
1092 needs_gpu_visibility_update_after_repaint_ = true; | 1092 needs_gpu_visibility_update_after_repaint_ = true; |
1093 } | 1093 } |
1094 } | 1094 } |
1095 | 1095 |
1096 void RenderWidgetHostViewMac::DrawAcceleratedSurfaceInstance( | 1096 void RenderWidgetHostViewMac::DrawAcceleratedSurfaceInstance( |
1097 CGLContextObj context, | 1097 CGLContextObj context, |
1098 gfx::PluginWindowHandle plugin_handle, | 1098 gfx::PluginWindowHandle plugin_handle, |
1099 NSSize size) { | 1099 NSSize size) { |
1100 // Called on the display link thread. | 1100 // Called on the display link thread. |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1678 - (void)drawRect:(NSRect)dirtyRect { | 1678 - (void)drawRect:(NSRect)dirtyRect { |
1679 if (!renderWidgetHostView_->render_widget_host_) { | 1679 if (!renderWidgetHostView_->render_widget_host_) { |
1680 // TODO(shess): Consider using something more noticable? | 1680 // TODO(shess): Consider using something more noticable? |
1681 [[NSColor whiteColor] set]; | 1681 [[NSColor whiteColor] set]; |
1682 NSRectFill(dirtyRect); | 1682 NSRectFill(dirtyRect); |
1683 return; | 1683 return; |
1684 } | 1684 } |
1685 | 1685 |
1686 const gfx::Rect damagedRect([self flipNSRectToRect:dirtyRect]); | 1686 const gfx::Rect damagedRect([self flipNSRectToRect:dirtyRect]); |
1687 | 1687 |
1688 if (renderWidgetHostView_->render_widget_host_->is_gpu_rendering_active()) { | 1688 if (renderWidgetHostView_->render_widget_host_-> |
| 1689 is_accelerated_compositing_active()) { |
1689 gfx::Rect gpuRect; | 1690 gfx::Rect gpuRect; |
1690 | 1691 |
1691 gfx::PluginWindowHandle root_handle = | 1692 gfx::PluginWindowHandle root_handle = |
1692 renderWidgetHostView_->plugin_container_manager_.root_container_handle(); | 1693 renderWidgetHostView_->plugin_container_manager_.root_container_handle(); |
1693 if (root_handle != gfx::kNullPluginWindow) { | 1694 if (root_handle != gfx::kNullPluginWindow) { |
1694 RenderWidgetHostViewMac::PluginViewMap::iterator it = | 1695 RenderWidgetHostViewMac::PluginViewMap::iterator it = |
1695 renderWidgetHostView_->plugin_views_.find(root_handle); | 1696 renderWidgetHostView_->plugin_views_.find(root_handle); |
1696 DCHECK(it != renderWidgetHostView_->plugin_views_.end()); | 1697 DCHECK(it != renderWidgetHostView_->plugin_views_.end()); |
1697 if (it != renderWidgetHostView_->plugin_views_.end() && | 1698 if (it != renderWidgetHostView_->plugin_views_.end() && |
1698 ![it->second isHidden]) { | 1699 ![it->second isHidden]) { |
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2674 if (!string) return NO; | 2675 if (!string) return NO; |
2675 | 2676 |
2676 // If the user is currently using an IME, confirm the IME input, | 2677 // If the user is currently using an IME, confirm the IME input, |
2677 // and then insert the text from the service, the same as TextEdit and Safari. | 2678 // and then insert the text from the service, the same as TextEdit and Safari. |
2678 [self confirmComposition]; | 2679 [self confirmComposition]; |
2679 [self insertText:string]; | 2680 [self insertText:string]; |
2680 return YES; | 2681 return YES; |
2681 } | 2682 } |
2682 | 2683 |
2683 @end | 2684 @end |
OLD | NEW |