diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-15 22:08:35 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-15 22:08:35 +0000 |
commit | 0c860d067e62556bad67620240abc9abfeb85c7d (patch) | |
tree | 6d0c6d8cc5d302a5b2fffeb4ffc6b1a160b52d59 /webkit | |
parent | 567dae2f920dbc1bdaf6d9defda0253b833f305b (diff) | |
download | chromium_src-0c860d067e62556bad67620240abc9abfeb85c7d.zip chromium_src-0c860d067e62556bad67620240abc9abfeb85c7d.tar.gz chromium_src-0c860d067e62556bad67620240abc9abfeb85c7d.tar.bz2 |
At times the Windows media player plugin would not render video. This would occur if it initially
received a geometry update of size 0. The plugin has a bug where it ignores subsequent geometry updates.
Based on the webkit plugin implementation they have a quirk which handles this case for media player and divx.
To ensure that this quirk works correctly in cases where we only receive one geometry update we send out
geometry updates during paint as well if needed.
Fix is to mimic this behavior for Chromium.
Fixes bug http://code.google.com/p/chromium/issues/detail?id=43916
Bug=43916
Review URL: http://codereview.chromium.org/2752009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49841 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl.cc | 11 | ||||
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl.h | 15 | ||||
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl_gtk.cc | 3 | ||||
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl_mac.mm | 3 | ||||
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl_win.cc | 14 | ||||
-rw-r--r-- | webkit/glue/plugins/webplugin_impl.cc | 23 |
6 files changed, 59 insertions, 10 deletions
diff --git a/webkit/glue/plugins/webplugin_delegate_impl.cc b/webkit/glue/plugins/webplugin_delegate_impl.cc index 55db8bd..b73b5ae 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl.cc +++ b/webkit/glue/plugins/webplugin_delegate_impl.cc @@ -138,6 +138,17 @@ void WebPluginDelegateImpl::DestroyInstance() { void WebPluginDelegateImpl::UpdateGeometry( const gfx::Rect& window_rect, const gfx::Rect& clip_rect) { + + if (first_set_window_call_) { + first_set_window_call_ = false; + // Plugins like media player on Windows have a bug where in they handle the + // first geometry update and ignore the rest resulting in painting issues. + // This quirk basically ignores the first set window call sequence for + // these plugins and has been tested for Windows plugins only. + if (quirks_ & PLUGIN_QUIRK_IGNORE_FIRST_SETWINDOW_CALL) + return; + } + if (windowless_) { WindowlessUpdateGeometry(window_rect, clip_rect); } else { diff --git a/webkit/glue/plugins/webplugin_delegate_impl.h b/webkit/glue/plugins/webplugin_delegate_impl.h index a173b45..ebf5d3e 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl.h +++ b/webkit/glue/plugins/webplugin_delegate_impl.h @@ -68,11 +68,12 @@ class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate { PLUGIN_QUIRK_WINDOWLESS_OFFSET_WINDOW_TO_DRAW = 256, // Linux PLUGIN_QUIRK_WINDOWLESS_INVALIDATE_AFTER_SET_WINDOW = 512, // Linux PLUGIN_QUIRK_NO_WINDOWLESS = 1024, // Windows - PLUGIN_QUIRK_PATCH_REGENUMKEYEXW = 2048, // Windows - PLUGIN_QUIRK_ALWAYS_NOTIFY_SUCCESS = 4096, // Windows - PLUGIN_QUIRK_ALLOW_FASTER_QUICKDRAW_PATH = 8192, // Mac - PLUGIN_QUIRK_HANDLE_MOUSE_CAPTURE = 16384, // Windows - PLUGIN_QUIRK_WINDOWLESS_NO_RIGHT_CLICK = 32768, // Linux + PLUGIN_QUIRK_PATCH_REGENUMKEYEXW = 2048, // Windows + PLUGIN_QUIRK_ALWAYS_NOTIFY_SUCCESS = 4096, // Windows + PLUGIN_QUIRK_ALLOW_FASTER_QUICKDRAW_PATH = 8192, // Mac + PLUGIN_QUIRK_HANDLE_MOUSE_CAPTURE = 16384, // Windows + PLUGIN_QUIRK_WINDOWLESS_NO_RIGHT_CLICK = 32768, // Linux + PLUGIN_QUIRK_IGNORE_FIRST_SETWINDOW_CALL = 65536, // Windows. }; static WebPluginDelegateImpl* Create(const FilePath& filename, @@ -479,6 +480,10 @@ class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate { // Holds the current cursor set by the windowless plugin. WebCursor current_windowless_cursor_; + // Set to true initially and indicates if this is the first npp_setwindow + // call received by the plugin. + bool first_set_window_call_; + DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateImpl); }; diff --git a/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc b/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc index 7eceb0d..71df073 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc +++ b/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc @@ -50,7 +50,8 @@ WebPluginDelegateImpl::WebPluginDelegateImpl( socket_(NULL), parent_(containing_view), quirks_(0), - handle_event_depth_(0) { + handle_event_depth_(0), + first_set_window_call_(true) { memset(&window_, 0, sizeof(window_)); if (instance_->mime_type() == "application/x-shockwave-flash") { // Flash is tied to Firefox's whacky behavior with windowless plugins. See diff --git a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm index ce09fdb..23eefda 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm +++ b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm @@ -267,7 +267,8 @@ WebPluginDelegateImpl::WebPluginDelegateImpl( container_is_visible_(false), have_called_set_window_(false), external_drag_tracker_(new ExternalDragTracker()), - handle_event_depth_(0) { + handle_event_depth_(0), + first_set_window_call_(true) { memset(&window_, 0, sizeof(window_)); #ifndef NP_NO_CARBON memset(&np_cg_context_, 0, sizeof(np_cg_context_)); diff --git a/webkit/glue/plugins/webplugin_delegate_impl_win.cc b/webkit/glue/plugins/webplugin_delegate_impl_win.cc index 965ed84..6da9333 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl_win.cc +++ b/webkit/glue/plugins/webplugin_delegate_impl_win.cc @@ -260,7 +260,8 @@ WebPluginDelegateImpl::WebPluginDelegateImpl( #pragma warning(suppress: 4355) // can use this user_gesture_msg_factory_(this), handle_event_depth_(0), - mouse_hook_(NULL) { + mouse_hook_(NULL), + first_set_window_call_(true) { memset(&window_, 0, sizeof(window_)); const WebPluginInfo& plugin_info = instance_->plugin_lib()->plugin_info(); @@ -298,6 +299,11 @@ WebPluginDelegateImpl::WebPluginDelegateImpl( // Windowless mode doesn't work in the WMP NPAPI plugin. quirks_ |= PLUGIN_QUIRK_NO_WINDOWLESS; + // The media player plugin sets its size on the first NPP_SetWindow call + // and never updates its size. We should call the underlying NPP_SetWindow + // only when we have the correct size. + quirks_ |= PLUGIN_QUIRK_IGNORE_FIRST_SETWINDOW_CALL; + if (filename == kOldWMPPlugin) { // Non-admin users on XP couldn't modify the key to force the new UI. quirks_ |= PLUGIN_QUIRK_PATCH_REGENUMKEYEXW; @@ -318,6 +324,12 @@ WebPluginDelegateImpl::WebPluginDelegateImpl( // Explanation for this quirk can be found in // WebPluginDelegateImpl::Initialize. quirks_ |= PLUGIN_QUIRK_PATCH_SETCURSOR; + } else if (plugin_info.name.find(L"DivX Web Player") != + std::wstring::npos) { + // The divx plugin sets its size on the first NPP_SetWindow call and never + // updates its size. We should call the underlying NPP_SetWindow only when + // we have the correct size. + quirks_ |= PLUGIN_QUIRK_IGNORE_FIRST_SETWINDOW_CALL; } } diff --git a/webkit/glue/plugins/webplugin_impl.cc b/webkit/glue/plugins/webplugin_impl.cc index c4b9434..a83f35c 100644 --- a/webkit/glue/plugins/webplugin_impl.cc +++ b/webkit/glue/plugins/webplugin_impl.cc @@ -240,9 +240,15 @@ NPObject* WebPluginImpl::scriptableObject() { } void WebPluginImpl::paint(WebCanvas* canvas, const WebRect& paint_rect) { - if (!delegate_) + if (!delegate_ || !container_) return; +#if defined(OS_WIN) + // Force a geometry update if needed to allow plugins like media player + // which defer the initial geometry update to work. + container_->reportGeometry(); +#endif // OS_WIN + // Note that |canvas| is only used when in windowless mode. delegate_->Paint(canvas, paint_rect); } @@ -291,8 +297,21 @@ void WebPluginImpl::updateGeometry( } } - first_geometry_update_ = false; +#if defined(OS_WIN) + // Don't cache the geometry during the first geometry update. The first + // geometry update sequence is received when Widget::setParent is called. + // For plugins like media player which have a bug where they only honor + // the first geometry update, we have a quirk which ignores the first + // geometry update. To ensure that these plugins work correctly in cases + // where we receive only one geometry update from webkit, we also force + // a geometry update during paint which should go out correctly as the + // initial geometry update was not cached. + if (!first_geometry_update_) + geometry_ = new_geometry; +#else // OS_WIN geometry_ = new_geometry; +#endif // OS_WIN + first_geometry_update_ = false; } void WebPluginImpl::updateFocus(bool focused) { |