-
timothy_horton@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=118347 <rdar://problem/14209318> Reviewed by Sam Weinig. Patch by Anders Carlsson, Antoine Quint, Sam Weinig, and myself. * CMakeLists.txt: * DerivedSources.make: * DerivedSources.pri: * GNUmakefile.am: * WebCore.exp.in: * WebCore.vcxproj/WebCore.vcxproj: * WebCore.vcxproj/WebCore.vcxproj.filters: * WebCore.xcodeproj/project.pbxproj: * css/CSSDefaultStyleSheets.cpp: * css/unavailablePlugIns.css: Added. Add new Source/WebCore/css/unavailablePlugIns.css stylesheet. * dom/EventListener.h: New event listener type to support the creation of an event listener for the label and icon for missing / blocked plug-in UI. * html/HTMLPlugInElement.cpp: (WebCore::HTMLPlugInElement::defaultEventHandler): Remove explicit event handling since we're now using a DOM event handler on the label and icon in the shadow root. * html/HTMLPlugInImageElement.cpp: (WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot): Don't populate the shadow root with plugin snapshotting elements if we're not planning on showing a snapshot, because this means that the shadow root was created for the unavailable plugin indicator instead. * page/ChromeClient.h: (WebCore::ChromeClient::shouldUnavailablePluginMessageIncludeButton): * rendering/RenderEmbeddedObject.cpp: (WebCore::RenderEmbeddedObject::RenderEmbeddedObject): (WebCore::shouldUnavailablePluginMessageIncludeButton): Rename from shouldUnavailablePluginMessageBeButton to shouldUnavailablePluginMessageIncludeButton for accuracy. (WebCore::RenderEmbeddedObject::setPluginUnavailabilityReasonDescription): Set custom text to be displayed in the unavailability indicator. (WebCore::RenderEmbeddedObject::setPluginUnavailabilityReason): (WebCore::RenderEmbeddedObject::handleUnavailablePluginButtonClickEvent): (WebCore::RenderEmbeddedObject::willBeDestroyed): (WebCore::RenderEmbeddedObject::isReplacementObscured): (WebCore::RenderEmbeddedObjectEventListener::handleEvent): (WebCore::RenderEmbeddedObjectEventListener::operator==): Remove the old code used to render the missing / blocked plug-in UI in C++ in favor of populating a shadow root in setPluginUnavailabilityReason(). We add a DOM event listener in the shadow root to eventually call into unavailablePluginButtonClicked() on the ChromeClient. (WebCore::RenderEmbeddedObject::paint): (WebCore::RenderEmbeddedObject::layout): Paint and lay out UA shadow root children. (WebCore::RenderEmbeddedObject::canHaveChildren): canHaveChildren can use the existence of a UA shadow root to decide whether a RenderEmbeddedObject can have children. * rendering/RenderEmbeddedObject.h: (WebCore::RenderEmbeddedObjectEventListener::create): (WebCore::RenderEmbeddedObjectEventListener::cast): (WebCore::RenderEmbeddedObjectEventListener::RenderEmbeddedObjectEventListener): Create the new event listener class necessary to handle events in the shadow root. (WebCore::RenderEmbeddedObject::pluginUnavailabilityReasonDescription): Added. * rendering/RenderWidget.h: Promote willBeDestroyed() to be public so we may override it in the RenderEmbeddedObject subclass. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::shouldUnavailablePluginMessageIncludeButton): Rename from shouldUnavailablePluginMessageBeButton to shouldUnavailablePluginMessageIncludeButton for accuracy. * Platform/CoreIPC/HandleMessage.h: (CoreIPC::callMemberFunction): Add a 6 argument -> 4 reply message handler. (It seems that FindPlugin is getting a little out of hand.) * Shared/APIClientTraits.cpp: * Shared/APIClientTraits.h: * UIProcess/API/C/WKPage.h: * UIProcess/WebLoaderClient.cpp: (WebKit::WebLoaderClient::pluginLoadPolicy): * UIProcess/WebLoaderClient.h: Add an unavailability description out-argument to a new version of pluginLoadPolicy, so clients can override the text of the unavailable plugin indicator. Bump the WKPageLoaderClient version and update APIClientTraits. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::findPlugin): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: Plumb the unavailability description through to the WebProcess via the FindPlugin message. * WebProcess/Plugins/PluginProcessConnection.cpp: (WebKit::PluginProcessConnection::didClose): Make a strongly referencing copy of the list of PluginProxies, so we can throw them away without the HashMap being mutated underneath us (see the comment). * WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::pluginProcessCrashed): Invalidate the plug-in's widget before setting the plugin unavailability reason, because doing so would cause the plug-in's renderer to be torn down, making invalidate() crash. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::shouldUnavailablePluginMessageIncludeButton): * WebProcess/WebCoreSupport/WebChromeClient.h: Rename from shouldUnavailablePluginMessageBeButton to shouldUnavailablePluginMessageIncludeButton for accuracy. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::createPlugin): Acquire the unavailability description from the client (via FindPlugin) and hand it to the RenderEmbeddedObject. (WebKit::WebPage::canPluginHandleResponse): Re-acquire the plugin's renderer, in case setPluginUnavailabilityReason destroyed it. * MiniBrowser/mac/WK2BrowserWindowController.m: (-[WK2BrowserWindowController awakeFromNib]): * WebKitTestRunner/TestController.cpp: (WTR::TestController::createWebViewWithOptions): Match new WKPageLoaderClient entry. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152701 268f45cc-cd09-0410-ab3c-d52691b4dbfc
7a561711