Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 10037008: Fix window shadows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase only Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.h ('k') | content/content_tests.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 width, 948 width,
949 height, 949 height,
950 transport_dib); 950 transport_dib);
951 } 951 }
952 952
953 void RenderWidgetHostViewMac::CompositorSwapBuffers(uint64 surface_handle, 953 void RenderWidgetHostViewMac::CompositorSwapBuffers(uint64 surface_handle,
954 int32 route_id, 954 int32 route_id,
955 int32 gpu_host_id) { 955 int32 gpu_host_id) {
956 pending_swap_buffers_acks_.push_back(std::make_pair(route_id, gpu_host_id)); 956 pending_swap_buffers_acks_.push_back(std::make_pair(route_id, gpu_host_id));
957 if (!compositing_iosurface_.get() && !is_hidden_) { 957 if (!compositing_iosurface_.get() && !is_hidden_) {
958 [cocoa_view_ addedGLContext];
959 compositing_iosurface_.reset(CompositingIOSurfaceMac::Create()); 958 compositing_iosurface_.reset(CompositingIOSurfaceMac::Create());
960 } 959 }
961 960
962 if (compositing_iosurface_.get() && !is_hidden_) { 961 if (compositing_iosurface_.get() && !is_hidden_) {
963 last_frame_was_accelerated_ = true; 962 last_frame_was_accelerated_ = true;
964 compositing_iosurface_->SetIOSurface(surface_handle); 963 compositing_iosurface_->SetIOSurface(surface_handle);
965 [cocoa_view_ setNeedsDisplay:YES]; 964 [cocoa_view_ setNeedsDisplay:YES];
966 } else { 965 } else {
967 AckPendingCompositorSwapBuffers(); 966 AckPendingCompositorSwapBuffers();
968 } 967 }
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 if (self) { 1219 if (self) {
1221 editCommand_helper_.reset(new RenderWidgetHostViewMacEditCommandHelper); 1220 editCommand_helper_.reset(new RenderWidgetHostViewMacEditCommandHelper);
1222 editCommand_helper_->AddEditingSelectorsToClass([self class]); 1221 editCommand_helper_->AddEditingSelectorsToClass([self class]);
1223 1222
1224 renderWidgetHostView_.reset(r); 1223 renderWidgetHostView_.reset(r);
1225 canBeKeyView_ = YES; 1224 canBeKeyView_ = YES;
1226 focusedPluginIdentifier_ = -1; 1225 focusedPluginIdentifier_ = -1;
1227 1226
1228 // OpenGL support: 1227 // OpenGL support:
1229 handlingGlobalFrameDidChange_ = NO; 1228 handlingGlobalFrameDidChange_ = NO;
1230 hasGLContext_ = NO;
1231 [[NSNotificationCenter defaultCenter] 1229 [[NSNotificationCenter defaultCenter]
1232 addObserver:self 1230 addObserver:self
1233 selector:@selector(globalFrameDidChange:) 1231 selector:@selector(globalFrameDidChange:)
1234 name:NSViewGlobalFrameDidChangeNotification 1232 name:NSViewGlobalFrameDidChangeNotification
1235 object:self]; 1233 object:self];
1236 } 1234 }
1237 return self; 1235 return self;
1238 } 1236 }
1239 1237
1240 - (void)dealloc { 1238 - (void)dealloc {
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 for (NSView* subview in [self subviews]) { 1755 for (NSView* subview in [self subviews]) {
1758 if (![subview isKindOfClass:[RenderWidgetHostViewCocoa class]]) 1756 if (![subview isKindOfClass:[RenderWidgetHostViewCocoa class]])
1759 continue; // Skip plugin views. 1757 continue; // Skip plugin views.
1760 1758
1761 [static_cast<RenderWidgetHostViewCocoa*>(subview) 1759 [static_cast<RenderWidgetHostViewCocoa*>(subview)
1762 renderWidgetHostViewMac]->KillSelf(); 1760 renderWidgetHostViewMac]->KillSelf();
1763 } 1761 }
1764 } 1762 }
1765 } 1763 }
1766 1764
1767 // OpenGL support
1768 - (void)addedGLContext {
1769 hasGLContext_ = YES;
1770 if (![self isHiddenOrHasHiddenAncestor]) {
1771 // Intentionally leak underlaySurface count so that the window never changes
1772 // back to opaque. This is to prevent black/transparent flashing that
1773 // appears during tab switching otherwise.
1774 // TODO(jbates) Remove the underlaySurfaceAdded feature completely from
1775 // ChromeBrowserWindow when the subtle gray line corner bug is fixed. Then
1776 // the window can be permanently set to non-opaque. crbug.com/56154
1777 if ([[self window] respondsToSelector:@selector(underlaySurfaceAdded)])
1778 [static_cast<id>([self window]) underlaySurfaceAdded];
1779 }
1780 }
1781
1782 - (void)viewWillMoveToWindow:(NSWindow*)newWindow { 1765 - (void)viewWillMoveToWindow:(NSWindow*)newWindow {
1783 if (![self isHiddenOrHasHiddenAncestor]) {
1784 // Intentionally leak underlaySurface count (see comment in addedGLContext).
1785 if (hasGLContext_ &&
1786 [newWindow respondsToSelector:@selector(underlaySurfaceAdded)])
1787 [static_cast<id>(newWindow) underlaySurfaceAdded];
1788 }
1789
1790 // We're messing with the window, so do this to ensure no flashes. This one 1766 // We're messing with the window, so do this to ensure no flashes. This one
1791 // prevents a flash when the current tab is closed. 1767 // prevents a flash when the current tab is closed.
1792 [[self window] disableScreenUpdatesUntilFlush]; 1768 [[self window] disableScreenUpdatesUntilFlush];
1793 } 1769 }
1794 1770
1795 - (void) globalFrameDidChange:(NSNotification*)notification { 1771 - (void)globalFrameDidChange:(NSNotification*)notification {
1796 if (handlingGlobalFrameDidChange_) 1772 if (handlingGlobalFrameDidChange_)
1797 return; 1773 return;
1798 1774
1799 handlingGlobalFrameDidChange_ = YES; 1775 handlingGlobalFrameDidChange_ = YES;
1800 if (renderWidgetHostView_->compositing_iosurface_.get()) 1776 if (renderWidgetHostView_->compositing_iosurface_.get())
1801 renderWidgetHostView_->compositing_iosurface_->GlobalFrameDidChange(); 1777 renderWidgetHostView_->compositing_iosurface_->GlobalFrameDidChange();
1802 handlingGlobalFrameDidChange_ = NO; 1778 handlingGlobalFrameDidChange_ = NO;
1803 } 1779 }
1804 1780
1805 - (void)setFrameSize:(NSSize)newSize { 1781 - (void)setFrameSize:(NSSize)newSize {
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after
2878 if (!string) return NO; 2854 if (!string) return NO;
2879 2855
2880 // If the user is currently using an IME, confirm the IME input, 2856 // If the user is currently using an IME, confirm the IME input,
2881 // and then insert the text from the service, the same as TextEdit and Safari. 2857 // and then insert the text from the service, the same as TextEdit and Safari.
2882 [self confirmComposition]; 2858 [self confirmComposition];
2883 [self insertText:string]; 2859 [self insertText:string];
2884 return YES; 2860 return YES;
2885 } 2861 }
2886 2862
2887 @end 2863 @end
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.h ('k') | content/content_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698