summaryrefslogtreecommitdiffstats
path: root/webkit/glue
diff options
context:
space:
mode:
authorstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-21 21:58:12 +0000
committerstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-21 21:58:12 +0000
commitf4b743ed2ffbd9ebbbaf1fc616a402538bff28d0 (patch)
tree8e8868d04bad63d38ec03a3771aafb5e1930bebc /webkit/glue
parent28a4d4e616ab6c3010bfefa4ec56b38b25cc1b73 (diff)
downloadchromium_src-f4b743ed2ffbd9ebbbaf1fc616a402538bff28d0.zip
chromium_src-f4b743ed2ffbd9ebbbaf1fc616a402538bff28d0.tar.gz
chromium_src-f4b743ed2ffbd9ebbbaf1fc616a402538bff28d0.tar.bz2
Check for context changes during Mac plugin event handling.
Ensure that we don't use a context that's no longer valid BUG=32773 TEST=Toggle YouTube videos between normal and expanded size. Review URL: http://codereview.chromium.org/555038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36792 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r--webkit/glue/plugins/webplugin_delegate_impl_mac.mm11
1 files changed, 10 insertions, 1 deletions
diff --git a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm
index 78bf785..b79248f 100644
--- a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm
+++ b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm
@@ -857,6 +857,14 @@ bool WebPluginDelegateImpl::HandleInputEvent(const WebInputEvent& event,
ScopedActiveDelegate active_delegate(this);
+#ifndef NP_NO_CARBON
+ // cgcontext_.context can change during event handling (because of a geometry
+ // change triggered by the event); we need to know if that happens so we
+ // don't keep trying to use the context. It is not an owning ref, so shouldn't
+ // be used for anything but pointer comparison.
+ CGContextRef old_context_weak = cg_context_.context;
+#endif
+
// Create the plugin event structure, and send it to the plugin.
bool ret = false;
switch (instance()->event_model()) {
@@ -894,7 +902,8 @@ bool WebPluginDelegateImpl::HandleInputEvent(const WebInputEvent& event,
#ifndef NP_NO_CARBON
if (instance()->event_model() == NPEventModelCarbon &&
- instance()->drawing_model() == NPDrawingModelCoreGraphics)
+ instance()->drawing_model() == NPDrawingModelCoreGraphics &&
+ cg_context_.context == old_context_weak)
CGContextRestoreGState(cg_context_.context);
#endif