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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/renderer_host/render_widget_host_view_mac.mm
diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.mm b/chrome/browser/renderer_host/render_widget_host_view_mac.mm
index 49d653a3ce68328a2eea9c26d49a327b3dd27503..a148f54035a97329a25c6a20f9096ad6ed647c77 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/chrome/browser/renderer_host/render_widget_host_view_mac.mm
@@ -418,39 +418,41 @@ void RenderWidgetHostViewMac::MovePluginWindows(
const std::vector<webkit_glue::WebPluginGeometry>& moves) {
// Handle movement of accelerated plugins, which are the only "windowed"
// plugins that exist on the Mac.
- if (moves.size() > 0) {
- for (std::vector<webkit_glue::WebPluginGeometry>::const_iterator iter =
- moves.begin();
- iter != moves.end();
- ++iter) {
- webkit_glue::WebPluginGeometry geom = *iter;
- // Ignore bogus moves which claim to move the plugin to (0, 0)
- // with width and height (0, 0)
- if (geom.window_rect.x() == 0 &&
- geom.window_rect.y() == 0 &&
- geom.window_rect.IsEmpty()) {
- continue;
- }
-
- gfx::Rect rect = geom.window_rect;
- if (geom.visible) {
- rect.set_x(rect.x() + geom.clip_rect.x());
- rect.set_y(rect.y() + geom.clip_rect.y());
- rect.set_width(geom.clip_rect.width());
- rect.set_height(geom.clip_rect.height());
- }
+ for (std::vector<webkit_glue::WebPluginGeometry>::const_iterator iter =
+ moves.begin();
+ iter != moves.end();
+ ++iter) {
+ webkit_glue::WebPluginGeometry geom = *iter;
+ // Ignore bogus moves which claim to move the plugin to (0, 0)
+ // with width and height (0, 0)
+ if (geom.window_rect.x() == 0 &&
+ geom.window_rect.y() == 0 &&
+ geom.window_rect.IsEmpty()) {
+ continue;
+ }
- PluginViewMap::iterator it = plugin_views_.find(geom.window);
- DCHECK(plugin_views_.end() != it);
- if (plugin_views_.end() == it) {
- continue;
- }
- NSRect new_rect([cocoa_view_ RectToNSRect:rect]);
- [it->second setFrame:new_rect];
- [it->second setNeedsDisplay:YES];
+ gfx::Rect rect = geom.window_rect;
+ if (geom.visible) {
+ rect.set_x(rect.x() + geom.clip_rect.x());
+ rect.set_y(rect.y() + geom.clip_rect.y());
+ rect.set_width(geom.clip_rect.width());
+ rect.set_height(geom.clip_rect.height());
+ }
- plugin_container_manager_.SetPluginContainerGeometry(geom);
+ PluginViewMap::iterator it = plugin_views_.find(geom.window);
+ DCHECK(plugin_views_.end() != it);
+ if (plugin_views_.end() == it) {
+ continue;
}
+ NSRect new_rect([cocoa_view_ RectToNSRect:rect]);
+ [it->second setFrame:new_rect];
+ [it->second setNeedsDisplay:YES];
+
+ plugin_container_manager_.SetPluginContainerGeometry(geom);
+
+ BOOL visible =
+ plugin_container_manager_.SurfaceShouldBeVisible(geom.window);
+ [it->second setHidden:!visible];
}
}
@@ -826,9 +828,12 @@ void RenderWidgetHostViewMac::AcceleratedSurfaceBuffersSwapped(
}
DCHECK([it->second isKindOfClass:[AcceleratedPluginView class]]);
+ plugin_container_manager_.SetSurfaceWasPaintedTo(window);
AcceleratedPluginView* view =
static_cast<AcceleratedPluginView*>(it->second);
- [view setHidden:NO];
+ // The surface is hidden until its first paint, to not show gargabe.
+ if (plugin_container_manager_.SurfaceShouldBeVisible(window))
+ [view setHidden:NO];
[view setSurfaceWasSwapped:YES];
}

Powered by Google App Engine
This is Rietveld 408576698