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

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

Issue 3125033: Mac: Re-fix hidden CoreAnimation plugins. (Closed)
Patch Set: real fix Created 10 years, 4 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
OLDNEW
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/surface/io_surface_support_mac.h" 9 #include "app/surface/io_surface_support_mac.h"
10 #import "base/chrome_application_mac.h" 10 #import "base/chrome_application_mac.h"
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 } 411 }
412 412
413 gfx::NativeView RenderWidgetHostViewMac::GetNativeView() { 413 gfx::NativeView RenderWidgetHostViewMac::GetNativeView() {
414 return native_view(); 414 return native_view();
415 } 415 }
416 416
417 void RenderWidgetHostViewMac::MovePluginWindows( 417 void RenderWidgetHostViewMac::MovePluginWindows(
418 const std::vector<webkit_glue::WebPluginGeometry>& moves) { 418 const std::vector<webkit_glue::WebPluginGeometry>& moves) {
419 // Handle movement of accelerated plugins, which are the only "windowed" 419 // Handle movement of accelerated plugins, which are the only "windowed"
420 // plugins that exist on the Mac. 420 // plugins that exist on the Mac.
421 if (moves.size() > 0) { 421 for (std::vector<webkit_glue::WebPluginGeometry>::const_iterator iter =
422 for (std::vector<webkit_glue::WebPluginGeometry>::const_iterator iter = 422 moves.begin();
423 moves.begin(); 423 iter != moves.end();
424 iter != moves.end(); 424 ++iter) {
425 ++iter) { 425 webkit_glue::WebPluginGeometry geom = *iter;
426 webkit_glue::WebPluginGeometry geom = *iter; 426 // Ignore bogus moves which claim to move the plugin to (0, 0)
427 // Ignore bogus moves which claim to move the plugin to (0, 0) 427 // with width and height (0, 0)
428 // with width and height (0, 0) 428 if (geom.window_rect.x() == 0 &&
429 if (geom.window_rect.x() == 0 && 429 geom.window_rect.y() == 0 &&
430 geom.window_rect.y() == 0 && 430 geom.window_rect.IsEmpty()) {
431 geom.window_rect.IsEmpty()) { 431 continue;
432 continue; 432 }
433 }
434 433
435 gfx::Rect rect = geom.window_rect; 434 gfx::Rect rect = geom.window_rect;
436 if (geom.visible) { 435 if (geom.visible) {
437 rect.set_x(rect.x() + geom.clip_rect.x()); 436 rect.set_x(rect.x() + geom.clip_rect.x());
438 rect.set_y(rect.y() + geom.clip_rect.y()); 437 rect.set_y(rect.y() + geom.clip_rect.y());
439 rect.set_width(geom.clip_rect.width()); 438 rect.set_width(geom.clip_rect.width());
440 rect.set_height(geom.clip_rect.height()); 439 rect.set_height(geom.clip_rect.height());
441 } 440 }
442 441
443 PluginViewMap::iterator it = plugin_views_.find(geom.window); 442 PluginViewMap::iterator it = plugin_views_.find(geom.window);
444 DCHECK(plugin_views_.end() != it); 443 DCHECK(plugin_views_.end() != it);
445 if (plugin_views_.end() == it) { 444 if (plugin_views_.end() == it) {
446 continue; 445 continue;
447 } 446 }
448 NSRect new_rect([cocoa_view_ RectToNSRect:rect]); 447 NSRect new_rect([cocoa_view_ RectToNSRect:rect]);
449 [it->second setFrame:new_rect]; 448 [it->second setFrame:new_rect];
450 [it->second setNeedsDisplay:YES]; 449 [it->second setNeedsDisplay:YES];
451 450
452 plugin_container_manager_.SetPluginContainerGeometry(geom); 451 plugin_container_manager_.SetPluginContainerGeometry(geom);
453 } 452
453 BOOL visible =
454 plugin_container_manager_.SurfaceShouldBeVisible(geom.window);
455 [it->second setHidden:!visible];
454 } 456 }
455 } 457 }
456 458
457 void RenderWidgetHostViewMac::Focus() { 459 void RenderWidgetHostViewMac::Focus() {
458 [[cocoa_view_ window] makeFirstResponder:cocoa_view_]; 460 [[cocoa_view_ window] makeFirstResponder:cocoa_view_];
459 } 461 }
460 462
461 void RenderWidgetHostViewMac::Blur() { 463 void RenderWidgetHostViewMac::Blur() {
462 [[cocoa_view_ window] makeFirstResponder:nil]; 464 [[cocoa_view_ window] makeFirstResponder:nil];
463 } 465 }
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 821
820 void RenderWidgetHostViewMac::AcceleratedSurfaceBuffersSwapped( 822 void RenderWidgetHostViewMac::AcceleratedSurfaceBuffersSwapped(
821 gfx::PluginWindowHandle window) { 823 gfx::PluginWindowHandle window) {
822 PluginViewMap::iterator it = plugin_views_.find(window); 824 PluginViewMap::iterator it = plugin_views_.find(window);
823 DCHECK(plugin_views_.end() != it); 825 DCHECK(plugin_views_.end() != it);
824 if (plugin_views_.end() == it) { 826 if (plugin_views_.end() == it) {
825 return; 827 return;
826 } 828 }
827 DCHECK([it->second isKindOfClass:[AcceleratedPluginView class]]); 829 DCHECK([it->second isKindOfClass:[AcceleratedPluginView class]]);
828 830
831 plugin_container_manager_.SetSurfaceWasPaintedTo(window);
829 AcceleratedPluginView* view = 832 AcceleratedPluginView* view =
830 static_cast<AcceleratedPluginView*>(it->second); 833 static_cast<AcceleratedPluginView*>(it->second);
831 [view setHidden:NO]; 834 // The surface is hidden until its first paint, to not show gargabe.
835 if (plugin_container_manager_.SurfaceShouldBeVisible(window))
836 [view setHidden:NO];
832 [view setSurfaceWasSwapped:YES]; 837 [view setSurfaceWasSwapped:YES];
833 } 838 }
834 839
835 void RenderWidgetHostViewMac::DrawAcceleratedSurfaceInstance( 840 void RenderWidgetHostViewMac::DrawAcceleratedSurfaceInstance(
836 CGLContextObj context, gfx::PluginWindowHandle plugin_handle) { 841 CGLContextObj context, gfx::PluginWindowHandle plugin_handle) {
837 // Called on the display link thread. 842 // Called on the display link thread.
838 PluginViewMap::iterator it = plugin_views_.find(plugin_handle); 843 PluginViewMap::iterator it = plugin_views_.find(plugin_handle);
839 DCHECK(plugin_views_.end() != it); 844 DCHECK(plugin_views_.end() != it);
840 if (plugin_views_.end() == it) { 845 if (plugin_views_.end() == it) {
841 return; 846 return;
(...skipping 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after
2286 NSArray* toDeclare = [NSArray arrayWithObject:NSStringPboardType]; 2291 NSArray* toDeclare = [NSArray arrayWithObject:NSStringPboardType];
2287 [pboard declareTypes:toDeclare owner:nil]; 2292 [pboard declareTypes:toDeclare owner:nil];
2288 return [pboard setString:text forType:NSStringPboardType]; 2293 return [pboard setString:text forType:NSStringPboardType];
2289 } 2294 }
2290 2295
2291 - (BOOL)readSelectionFromPasteboard:(NSPasteboard*)pboard { 2296 - (BOOL)readSelectionFromPasteboard:(NSPasteboard*)pboard {
2292 return NO; 2297 return NO;
2293 } 2298 }
2294 2299
2295 @end 2300 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698