diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-06 02:49:53 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-06 02:49:53 +0000 |
commit | f7113329e4351781927edd0e5061da0bec9723eb (patch) | |
tree | be37b8058ad3a950bb47367eb56400783fb94d73 | |
parent | baa50890a348a680b3b969320ea413a6d1f4ad9c (diff) | |
download | chromium_src-f7113329e4351781927edd0e5061da0bec9723eb.zip chromium_src-f7113329e4351781927edd0e5061da0bec9723eb.tar.gz chromium_src-f7113329e4351781927edd0e5061da0bec9723eb.tar.bz2 |
Windowless plugins would fail to paint at times. This occurs in the following sequence
of events:-
1. The windowless plugin receives a geometry update. We create a temporary HDC which is
saved in the NPWindow member.
2. The plugin issues a sync call to the renderer in the context of the Setwindow call.
3. An incoming paint message is received in the context of the above sync call where
the HDC created in step 1 is overwritten with the HDC received in the Paint call.
4. When the whole stack unwinds the HDC received in step 3 is destroyed incorrectly
thus causing subsequent paints to fail.
The Paint DC is created and owned by the WebPluginProxy.
Fix is to save away the old dc in the WindowlessPaint call and restore it back on return.
Fixes bug http://code.google.com/p/chromium/issues/detail?id=54247
Bug=54247
Test=Tricky to write a test which reproduces the sequence above predictably. Mocks may be an
option to look into.
Review URL: http://codereview.chromium.org/3563008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61601 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl_win.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/webkit/glue/plugins/webplugin_delegate_impl_win.cc b/webkit/glue/plugins/webplugin_delegate_impl_win.cc index 9cdc7db..8c88680 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl_win.cc +++ b/webkit/glue/plugins/webplugin_delegate_impl_win.cc @@ -1020,6 +1020,8 @@ void WebPluginDelegateImpl::WindowlessPaint(HDC hdc, damage_rect_win.right = damage_rect_win.left + damage_rect.width(); damage_rect_win.bottom = damage_rect_win.top + damage_rect.height(); + // Save away the old HDC as this could be a nested invocation. + void* old_dc = window_.window; window_.window = hdc; NPEvent paint_event; @@ -1030,6 +1032,7 @@ void WebPluginDelegateImpl::WindowlessPaint(HDC hdc, static StatsRate plugin_paint("Plugin.Paint"); StatsScope<StatsRate> scope(plugin_paint); instance()->NPP_HandleEvent(&paint_event); + window_.window = old_dc; } void WebPluginDelegateImpl::WindowlessSetWindow() { |