Detecting whether or not a PDFPlugin is a full-page plugin or not is not as simple as checking isMainFrame(), because <embed> and <object> will cause PDFPlugin to live in the main frame, while still not being full-page. We also have to check that the main frame's document is a PluginDocument, and whether that PluginDocument's PluginWidget is our PDFPlugin's PluginView.
<rdar://problem/12752315>
Created attachment 176083 [details] patch
Thanks, Dan! http://trac.webkit.org/changeset/136316
Comment on attachment 176083 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=176083&action=review > Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm:664 > + Document* document = webFrame()->coreFrame()->document(); > + if (document->isPluginDocument()) > + return (static_cast<PluginDocument*>(document)->pluginWidget() == pluginView()); > + > + return false; Normally we do early return for the failure cases, not the main case, so it would be: if (!isPluginDocument) return false; return ......; Also, the patch has extra parentheses in the return statement that we don’t do. But I think this reads better with &&: return document->isPluginDocument() && static_cast<PluginDocument*>(document)->pluginWidget() == pluginView();
Created attachment 177290 [details] followup style patch Oooh, yes, much better. Posting a follow-up patch.
Followup style patch is http://trac.webkit.org/changeset/136422