diff options
author | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-13 18:12:34 +0000 |
---|---|---|
committer | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-13 18:12:34 +0000 |
commit | d37fe632a386d29653f91564677186ff7403d8dc (patch) | |
tree | b0fc03b37c1f59a056ffd337e9b35057e09910f2 /webkit | |
parent | 4f6c2faf31dcfd7d76ba617930884dbcb32802ee (diff) | |
download | chromium_src-d37fe632a386d29653f91564677186ff7403d8dc.zip chromium_src-d37fe632a386d29653f91564677186ff7403d8dc.tar.gz chromium_src-d37fe632a386d29653f91564677186ff7403d8dc.tar.bz2 |
Add a Mac plugin quirk for ignoring QuickTime's negotiated drawing model
Since QuickTime sometimes asks for the wrong drawing model, and the only model we have that works for it is QD, force it to use that.
BUG=25978
TEST=Testcase from bug should play the movie, rather than crashing the plugin.
Review URL: http://codereview.chromium.org/385082
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31919 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl.h | 6 | ||||
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl_mac.mm | 26 |
2 files changed, 26 insertions, 6 deletions
diff --git a/webkit/glue/plugins/webplugin_delegate_impl.h b/webkit/glue/plugins/webplugin_delegate_impl.h index bd29279..1665a8b 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl.h +++ b/webkit/glue/plugins/webplugin_delegate_impl.h @@ -45,6 +45,7 @@ class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate { PLUGIN_QUIRK_NO_WINDOWLESS = 1024, // Windows PLUGIN_QUIRK_PATCH_REGENUMKEYEXW = 2048, // Windows PLUGIN_QUIRK_ALWAYS_NOTIFY_SUCCESS = 4096, // Windows + PLUGIN_QUIRK_IGNORE_NEGOTIATED_DRAWING_MODEL = 8192, // Mac }; static WebPluginDelegateImpl* Create(const FilePath& filename, @@ -168,6 +169,11 @@ class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate { WPARAM wParam, LPARAM lParam); #endif +#if defined(OS_MACOSX) + // Returns the drawing model to use for the plugin. + int PluginDrawingModel(); +#endif + //---------------------------- // used for windowless plugins void WindowlessUpdateGeometry(const gfx::Rect& window_rect, diff --git a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm index 737954a..262b002 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm +++ b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm @@ -97,6 +97,14 @@ WebPluginDelegateImpl::WebPluginDelegateImpl( memset(&qd_port_, 0, sizeof(qd_port_)); #endif instance->set_windowless(true); + + const WebPluginInfo& plugin_info = instance_->plugin_lib()->plugin_info(); + if (plugin_info.name.find(L"QuickTime") != std::wstring::npos) { + // In some cases, QuickTime inexpicably negotiates the CoreGraphics drawing + // model, but then proceeds as if it were using QuickDraw. Until we support + // CoreAnimation, just ignore what QuickTime asks for. + quirks_ |= PLUGIN_QUIRK_IGNORE_NEGOTIATED_DRAWING_MODEL; + } } WebPluginDelegateImpl::~WebPluginDelegateImpl() { @@ -113,7 +121,7 @@ void WebPluginDelegateImpl::PluginDestroyed() { this, reinterpret_cast<WindowRef>(cg_context_.window)); if (instance_->event_model() == NPEventModelCarbon) { - if (instance_->drawing_model() == NPDrawingModelQuickDraw) { + if (PluginDrawingModel() == NPDrawingModelQuickDraw) { // Tell the plugin it should stop drawing into the GWorld (which will go // away when the next idle event arrives). window_.x = 0; @@ -156,7 +164,7 @@ void WebPluginDelegateImpl::PlatformInitialize() { SetWindowBounds(reinterpret_cast<WindowRef>(cg_context_.window), kWindowContentRgn, &window_bounds); - switch (instance_->drawing_model()) { + switch (PluginDrawingModel()) { #ifndef NP_NO_QUICKDRAW case NPDrawingModelQuickDraw: window_.window = &qd_port_; @@ -193,7 +201,7 @@ void WebPluginDelegateImpl::UpdateContext(CGContextRef context) { if (context != cg_context_.context) { cg_context_.context = context; #ifndef NP_NO_QUICKDRAW - if (instance()->drawing_model() == NPDrawingModelQuickDraw) { + if (PluginDrawingModel() == NPDrawingModelQuickDraw) { if (qd_port_.port) { DisposeGWorld(qd_port_.port); DisposeGWorld(qd_world_); @@ -285,7 +293,7 @@ void WebPluginDelegateImpl::WindowlessPaint(gfx::NativeDrawingContext context, static StatsRate plugin_paint("Plugin.Paint"); StatsScope<StatsRate> scope(plugin_paint); - switch (instance()->drawing_model()) { + switch (PluginDrawingModel()) { #ifndef NP_NO_QUICKDRAW case NPDrawingModelQuickDraw: { // Plugins using the QuickDraw drawing model do not restrict their @@ -414,6 +422,12 @@ void WebPluginDelegateImpl::SetFocus() { } } +int WebPluginDelegateImpl::PluginDrawingModel() { + if (quirks_ & PLUGIN_QUIRK_IGNORE_NEGOTIATED_DRAWING_MODEL) + return NPDrawingModelQuickDraw; + return instance()->drawing_model(); +} + static bool WebInputEventIsWebMouseEvent(const WebInputEvent& event) { switch (event.type) { case WebInputEvent::MouseMove: @@ -689,7 +703,7 @@ bool WebPluginDelegateImpl::HandleInputEvent(const WebInputEvent& event, #endif bool ret = false; - switch (instance()->drawing_model()) { + switch (PluginDrawingModel()) { #ifndef NP_NO_QUICKDRAW case NPDrawingModelQuickDraw: SetGWorld(qd_port_.port, NULL); @@ -768,7 +782,7 @@ void WebPluginDelegateImpl::OnNullEvent() { // repaint. // TODO: only do this if the contents of the offscreen GWorld has changed, // so as not to spam the renderer with an unchanging image. - if (instance_->drawing_model() == NPDrawingModelQuickDraw) + if (PluginDrawingModel() == NPDrawingModelQuickDraw) instance()->webplugin()->Invalidate(); #endif |