diff options
author | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-04 15:48:33 +0000 |
---|---|---|
committer | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-04 15:48:33 +0000 |
commit | 372a33ac2ccb4150776ffcd766b6408fd644efaf (patch) | |
tree | 1e71b76e15055e1ce3f6690e26b85788cd87a66d /webkit | |
parent | 4e4e65fdf52efa29f7168f72a2bc898e19d8c81c (diff) | |
download | chromium_src-372a33ac2ccb4150776ffcd766b6408fd644efaf.zip chromium_src-372a33ac2ccb4150776ffcd766b6408fd644efaf.tar.gz chromium_src-372a33ac2ccb4150776ffcd766b6408fd644efaf.tar.bz2 |
Fix a crash when scrolling a fast-path QuickDraw plugin
Two changes
- Only throw away QuickDraw plugin GWorlds when the size changes, so we don't get into this case in the first place
- Add a safety check so that if anything else like this happens, it will call SetWindow instead of crashing.
BUG=43007
TEST=Scroll a page with a QuickTime movie on 10.5; it shouldn't crash.
Review URL: http://codereview.chromium.org/1937004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46351 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/plugins/quickdraw_drawing_manager_mac.cc | 14 | ||||
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl_mac.mm | 15 |
2 files changed, 22 insertions, 7 deletions
diff --git a/webkit/glue/plugins/quickdraw_drawing_manager_mac.cc b/webkit/glue/plugins/quickdraw_drawing_manager_mac.cc index 185d4db..424cc1e 100644 --- a/webkit/glue/plugins/quickdraw_drawing_manager_mac.cc +++ b/webkit/glue/plugins/quickdraw_drawing_manager_mac.cc @@ -41,11 +41,13 @@ void QuickDrawDrawingManager::SetFastPathEnabled(bool enabled) { void QuickDrawDrawingManager::SetTargetContext(CGContextRef context, const gfx::Size& plugin_size) { target_context_ = context; - plugin_size_ = plugin_size; - // Pitch the old GWorlds, since they are the wrong size now. - DestroyGWorlds(); - if (fast_path_enabled_) - UpdateGWorlds(); + if (plugin_size != plugin_size_) { + plugin_size_ = plugin_size; + // Pitch the old GWorlds, since they are the wrong size now. + DestroyGWorlds(); + if (fast_path_enabled_) + UpdateGWorlds(); + } } void QuickDrawDrawingManager::SetPluginWindow(WindowRef window) { @@ -103,6 +105,8 @@ void QuickDrawDrawingManager::UpdateGWorlds() { // directly into the shared memory. NewGWorld(&plugin_world_, k32ARGBPixelFormat, &window_bounds, NULL, NULL, kNativeEndianPixMap); + if (fast_path_enabled_) + current_port_ = plugin_world_; } void QuickDrawDrawingManager::ScrapeWindow(WindowRef window, diff --git a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm index c61ed22..c5ec61d 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm +++ b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm @@ -660,7 +660,18 @@ void WebPluginDelegateImpl::WindowlessUpdateGeometry( bool clip_rect_changed = (clip_rect_ != old_clip_rect); bool window_size_changed = (window_rect.size() != window_rect_.size()); - if (window_rect == window_rect_ && !clip_rect_changed) + bool force_set_window = false; +#ifndef NP_NO_QUICKDRAW + // In a QuickDraw plugin, a geometry update might have caused a port change; + // if so, we need to call SetWindow even if nothing else changed. + if (qd_manager_.get() && (qd_port_.port != qd_manager_->port())) { + LOG(ERROR) << "Saving the day"; + qd_port_.port = qd_manager_->port(); + force_set_window = true; + } +#endif + + if (window_rect == window_rect_ && !clip_rect_changed && !force_set_window) return; if (old_clip_rect.IsEmpty() != clip_rect_.IsEmpty()) { @@ -679,7 +690,7 @@ void WebPluginDelegateImpl::WindowlessUpdateGeometry( } #endif - if (window_size_changed || clip_rect_changed) + if (window_size_changed || clip_rect_changed || force_set_window) WindowlessSetWindow(); } |