summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-18 17:30:52 +0000
committerstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-18 17:30:52 +0000
commitee48d179fbf2376a62ff4d6b928f2725c088bf10 (patch)
tree3babdc2c85799f61753573c1196153cbcbfa647b
parent38364fd79c17db99541a7ed5fab9e8c253e76949 (diff)
downloadchromium_src-ee48d179fbf2376a62ff4d6b928f2725c088bf10.zip
chromium_src-ee48d179fbf2376a62ff4d6b928f2725c088bf10.tar.gz
chromium_src-ee48d179fbf2376a62ff4d6b928f2725c088bf10.tar.bz2
Fix the initial draw handing of Core Animation plugins
Removes the call to SetWindow(NULL) in the Core Animation case, since that causes the delegate to enable the TransportDIB drawing mode. Removes the early return in Paint, since now we don't call it (and if we do later, it'll be to get snapshots using the existing Cocoa event model path, per the ammended CA drawing model spec). Also renames windowless_ in WebPluginDelegateProxy to make it clear that it's just about drawing. BUG=37974 TEST=In a build with Core Animation plugin enabled, there should be no flash of black when the plugin is first drawn. Review URL: http://codereview.chromium.org/982010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41961 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/renderer/webplugin_delegate_proxy.cc15
-rw-r--r--chrome/renderer/webplugin_delegate_proxy.h2
-rw-r--r--webkit/glue/plugins/webplugin_delegate_impl_mac.mm13
3 files changed, 17 insertions, 13 deletions
diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc
index a400d39..daf58b5 100644
--- a/chrome/renderer/webplugin_delegate_proxy.cc
+++ b/chrome/renderer/webplugin_delegate_proxy.cc
@@ -157,7 +157,7 @@ WebPluginDelegateProxy::WebPluginDelegateProxy(
const base::WeakPtr<RenderView>& render_view)
: render_view_(render_view),
plugin_(NULL),
- windowless_(false),
+ uses_shared_bitmaps_(false),
window_(gfx::kNullPluginWindow),
mime_type_(mime_type),
instance_id_(MSG_ROUTING_NONE),
@@ -457,7 +457,7 @@ void WebPluginDelegateProxy::UpdateGeometry(const gfx::Rect& window_rect,
param.ack_key = -1;
#endif
- if (windowless_) {
+ if (uses_shared_bitmaps_) {
if (!backing_store_canvas_.get() ||
(window_rect.width() != backing_store_canvas_->getDevice()->width() ||
window_rect.height() != backing_store_canvas_->getDevice()->height()))
@@ -623,8 +623,7 @@ void WebPluginDelegateProxy::Paint(WebKit::WebCanvas* canvas,
return;
}
- // No paint events for windowed plugins.
- if (!windowless_)
+ if (!uses_shared_bitmaps_)
return;
// We got a paint before the plugin's coordinates, so there's no buffer to
@@ -929,7 +928,7 @@ void WebPluginDelegateProxy::WindowFrameChanged(gfx::Rect window_frame,
#endif // OS_MACOSX
void WebPluginDelegateProxy::OnSetWindow(gfx::PluginWindowHandle window) {
- windowless_ = !window;
+ uses_shared_bitmaps_ = !window;
window_ = window;
if (plugin_)
plugin_->SetWindow(window);
@@ -1290,6 +1289,12 @@ bool WebPluginDelegateProxy::BindFakePluginWindowHandle() {
geom.rects_valid = true;
geom.visible = true;
render_view_->DidMovePlugin(geom);
+ // Invalidate the plugin region to ensure that the move event actually gets
+ // dispatched (for a plugin on an otherwise static page).
+ render_view_->didInvalidateRect(WebKit::WebRect(plugin_rect_.x(),
+ plugin_rect_.y(),
+ plugin_rect_.width(),
+ plugin_rect_.height()));
return true;
}
diff --git a/chrome/renderer/webplugin_delegate_proxy.h b/chrome/renderer/webplugin_delegate_proxy.h
index fbc7779..72e36bc 100644
--- a/chrome/renderer/webplugin_delegate_proxy.h
+++ b/chrome/renderer/webplugin_delegate_proxy.h
@@ -215,7 +215,7 @@ class WebPluginDelegateProxy
base::WeakPtr<RenderView> render_view_;
webkit_glue::WebPlugin* plugin_;
- bool windowless_;
+ bool uses_shared_bitmaps_;
gfx::PluginWindowHandle window_;
scoped_refptr<PluginChannelHost> channel_host_;
std::string mime_type_;
diff --git a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm
index 19815b9..08995ee 100644
--- a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm
+++ b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm
@@ -301,12 +301,17 @@ void WebPluginDelegateImpl::PlatformInitialize() {
// point, so we just set the initial state directly.
container_is_visible_ = true;
+ // Let the WebPlugin know that we are windowless (unless this is a
+ // Core Animation plugin, in which case BindFakePluginWindowHandle will take
+ // care of setting up the appropriate window handle).
+ if (instance()->drawing_model() != NPDrawingModelCoreAnimation)
+ plugin_->SetWindow(NULL);
+
#ifndef NP_NO_CARBON
// If the plugin wants Carbon events, hook up to the source of idle events.
if (instance()->event_model() == NPEventModelCarbon)
UpdateIdleEventRate();
#endif
- plugin_->SetWindow(NULL);
// QuickTime can crash if it gets other calls (e.g., NPP_Write) before it
// gets a SetWindow call, so call SetWindow (with a 0x0 rect) immediately.
@@ -443,12 +448,6 @@ void WebPluginDelegateImpl::DrawLayerInSurface() {
void WebPluginDelegateImpl::WindowlessPaint(gfx::NativeDrawingContext context,
const gfx::Rect& damage_rect) {
- // There is currently nothing to do for the Core Animation drawing model,
- // but there have been discussions on the plugin-futures mailing list that
- // might require future work.
- if (instance()->drawing_model() == NPDrawingModelCoreAnimation)
- return;
-
// If we somehow get a paint before we've set up the plugin buffer, bail.
if (!buffer_context_)
return;