Widget* FrameLoaderClient::createPlugin(const IntSize& pluginSize, HTMLPlugInElement* element, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually) { /* Check if we want to embed a GtkWidget, fallback to plugins later */ CString urlString = url.string().utf8(); CString mimeTypeString = mimeType.utf8(); ASSERT(paramNames.size() == paramValues.size()); GOwnPtr<GHashTable> hash(g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free)); for (unsigned i = 0; i < paramNames.size(); ++i) { g_hash_table_insert(hash.get(), g_strdup(paramNames[i].utf8().data()), g_strdup(paramValues[i].utf8().data())); } GtkWidget* gtkWidget = 0; g_signal_emit_by_name(getViewFromFrame(m_frame), "create-plugin-widget", mimeTypeString.data(), urlString.data(), hash.get(), >kWidget); if (gtkWidget) return new GtkPluginWidget(gtkWidget); PluginView* pluginView = PluginView::create(core(m_frame), pluginSize, element, url, paramNames, paramValues, mimeType, loadManually); if (pluginView->status() == PluginStatusLoadedSuccessfully) return pluginView; return 0; }
const char* NPN_UserAgent(NPP instance) { PluginView* view = pluginViewForInstance(instance); if (!view) return PluginView::userAgentStatic(); return view->userAgent(); }
PluginView * Plugin::createView( QWidget * parent ) { PluginView * pv = instantiateView( parent ); if( pv != NULL ) { pv->setModel( this ); } return pv; }
bool WebFrame::handlesPageScaleGesture() const { if (!m_coreFrame->document()->isPluginDocument()) return 0; PluginDocument* pluginDocument = static_cast<PluginDocument*>(m_coreFrame->document()); PluginView* pluginView = static_cast<PluginView*>(pluginDocument->pluginWidget()); return pluginView && pluginView->handlesPageScaleFactor(); }
bool WebFrame::requiresUnifiedScaleFactor() const { if (!m_coreFrame->document()->isPluginDocument()) return 0; PluginDocument* pluginDocument = static_cast<PluginDocument*>(m_coreFrame->document()); PluginView* pluginView = static_cast<PluginView*>(pluginDocument->pluginWidget()); return pluginView && pluginView->requiresUnifiedScaleFactor(); }
Widget* WebFrame::createJavaAppletWidget(const IntSize& pluginSize, Element* element, const KURL& /*baseURL*/, const Vector<String>& paramNames, const Vector<String>& paramValues) { PluginView* pluginView = PluginView::create(core(this), pluginSize, element, KURL(), paramNames, paramValues, "application/x-java-applet", false); // Check if the plugin can be loaded successfully if (pluginView->plugin() && pluginView->plugin()->load()) return pluginView; return pluginView; }
void NPN_InvalidateRect(NPP instance, NPRect* invalidRect) { PluginView* view = pluginViewForInstance(instance); #if defined(XP_UNIX) // NSPluginWrapper, a plugin wrapper binary that allows running 32-bit plugins // on 64-bit architectures typically used in X11, will sometimes give us a null NPP here. if (!view) return; #endif view->invalidateRect(invalidRect); }
uint32 NPN_ScheduleTimer(NPP instance, uint32 interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32 timerID)) { //SAMSUNG FIX >> Crash in channel.pandora.tv PluginView* view = pluginViewForInstance(instance); if (!view) return 0 ; return view->scheduleTimer(instance, interval, repeat != 0, timerFunc); //SAMSUNG FIX << }
NPObject* PlatformBridge::pluginScriptableObject(Widget* widget) { #if USE(V8) if (!widget->isPluginView()) return 0; PluginView* pluginView = static_cast<PluginView*>(widget); return pluginView->getNPObject(); #else return 0; #endif }
PassScriptInstance ScriptController::createScriptInstanceForWidget(Widget* widget) { ASSERT(widget); #if PLATFORM(CHROMIUM) if (widget->isFrameView()) return 0; NPObject* npObject = ChromiumBridge::pluginScriptableObject(widget); if (!npObject) return 0; #elif PLATFORM(ANDROID) if (!widget->isPluginView()) return 0; PluginView* pluginView = static_cast<PluginView*>(widget); NPObject* npObject = pluginView->getNPObject(); if (!npObject) return 0; #endif // Frame Memory Management for NPObjects // ------------------------------------- // NPObjects are treated differently than other objects wrapped by JS. // NPObjects can be created either by the browser (e.g. the main // window object) or by the plugin (the main plugin object // for a HTMLEmbedElement). Further, unlike most DOM Objects, the frame // is especially careful to ensure NPObjects terminate at frame teardown because // if a plugin leaks a reference, it could leak its objects (or the browser's objects). // // The Frame maintains a list of plugin objects (m_pluginObjects) // which it can use to quickly find the wrapped embed object. // // Inside the NPRuntime, we've added a few methods for registering // wrapped NPObjects. The purpose of the registration is because // javascript garbage collection is non-deterministic, yet we need to // be able to tear down the plugin objects immediately. When an object // is registered, javascript can use it. When the object is destroyed, // or when the object's "owning" object is destroyed, the object will // be un-registered, and the javascript engine must not use it. // // Inside the javascript engine, the engine can keep a reference to the // NPObject as part of its wrapper. However, before accessing the object // it must consult the _NPN_Registry. v8::Local<v8::Object> wrapper = createV8ObjectForNPObject(npObject, 0); // Track the plugin object. We've been given a reference to the object. m_pluginObjects.set(widget, npObject); return V8ScriptInstance::create(wrapper); }
PassRefPtr<JSC::Bindings::Instance> ScriptController::createScriptInstanceForWidget(WebCore::Widget* widget) { if (widget->isPluginView()) { PluginView* pluginView = static_cast<PluginView*>(widget); return pluginView->bindingInstance(); } QWidget* platformWidget = widget->platformWidget(); if (!platformWidget) return 0; return JSC::Bindings::QtInstance::getQtInstance(platformWidget, bindingRootObject(), QScriptEngine::QtOwnership); }
void FindController::findString(const String& string, FindOptions options, unsigned maxMatchCount) { PluginView* pluginView = pluginViewForFrame(m_webPage->mainFrame()); bool found; if (pluginView) found = pluginView->findString(string, core(options), maxMatchCount); else found = m_webPage->corePage()->findString(string, core(options)); m_webPage->drawingArea()->dispatchAfterEnsuringUpdatedScrollPosition(WTF::bind(&FindController::updateFindUIAfterPageScroll, this, found, string, options, maxMatchCount)); }
void FindController::findString(const String& string, FindOptions options, unsigned maxMatchCount) { PluginView* pluginView = pluginViewForFrame(m_webPage->mainFrame()); WebCore::FindOptions coreOptions = core(options); // iOS will reveal the selection through a different mechanism, and // we need to avoid sending the non-painted selection change to the UI process // so that it does not clear the selection out from under us. #if PLATFORM(IOS) coreOptions = static_cast<FindOptions>(coreOptions | DoNotRevealSelection); #endif willFindString(); bool foundStringStartsAfterSelection = false; if (!pluginView) { if (Frame* selectedFrame = frameWithSelection(m_webPage->corePage())) { FrameSelection& fs = selectedFrame->selection(); if (fs.selectionBounds().isEmpty()) { m_findMatches.clear(); int indexForSelection; m_webPage->corePage()->findStringMatchingRanges(string, core(options), maxMatchCount, m_findMatches, indexForSelection); m_foundStringMatchIndex = indexForSelection; foundStringStartsAfterSelection = true; } } } bool found; if (pluginView) found = pluginView->findString(string, coreOptions, maxMatchCount); else found = m_webPage->corePage()->findString(string, coreOptions); if (found) { didFindString(); if (!foundStringStartsAfterSelection) { if (options & FindOptionsBackwards) m_foundStringMatchIndex--; else m_foundStringMatchIndex++; } } RefPtr<WebPage> protectedWebPage = m_webPage; m_webPage->drawingArea()->dispatchAfterEnsuringUpdatedScrollPosition([protectedWebPage, found, string, options, maxMatchCount] () { protectedWebPage->findController().updateFindUIAfterPageScroll(found, string, options, maxMatchCount); }); }
void PluginKateHtmlTools::addView(Kate::MainWindow *win) { // TODO: doesn't this have to be deleted? PluginView *view = new PluginView (); (void) new KAction ( i18n("HT&ML Tag..."), /*"edit_HTML_tag",*/ ALT + Key_Minus, this, SLOT( slotEditHTMLtag() ), view->actionCollection(), "edit_HTML_tag" ); view->setInstance (new KInstance("kate")); view->setXMLFile( "plugins/katehtmltools/ui.rc" ); win->guiFactory()->addClient (view); view->win = win; m_views.append (view); }
void FindController::hideFindUI() { m_findMatches.clear(); if (m_findPageOverlay) m_webPage->uninstallPageOverlay(m_findPageOverlay, true); PluginView* pluginView = pluginViewForFrame(m_webPage->mainFrame()); if (pluginView) pluginView->findString(emptyString(), 0, 0); else m_webPage->corePage()->unmarkAllTextMatches(); hideFindIndicator(); }
void KatePluginHelloWorld::addView(Kate::MainWindow *win) { // TODO: doesn't this have to be deleted? PluginView *view = new PluginView (); (void) new KAction ( i18n("Insert Hello World"), 0, this, SLOT( slotInsertHello() ), view->actionCollection(), "edit_insert_helloworld" ); view->setInstance (new KInstance("kate")); view->setXMLFile("plugins/katehelloworld/ui.rc"); win->guiFactory()->addClient (view); view->win = win; m_views.append (view); }
static void anp_postEvent(NPP instance, const ANPEvent* event) { if (instance && instance->ndata && event) { PluginView* pluginView = static_cast<PluginView*>(instance->ndata); PluginWidgetAndroid* pluginWidget = pluginView->platformPluginWidget(); WebViewCore* wvc = pluginWidget->webViewCore(); WrappedANPEvent* wrapper = new WrappedANPEvent; // recored these, and recheck that they are valid before delivery // in send_anpevent wrapper->fWVC = pluginWidget->webViewCore(); wrapper->fPWA = pluginWidget; // make a copy of the event wrapper->fEvent = *event; JavaSharedClient::EnqueueFunctionPtr(send_anpevent, wrapper); } }
PassRefPtr<JSC::Bindings::Instance> ScriptController::createScriptInstanceForWidget(Widget* widget) { if (widget->isPluginView()) { PluginView* pluginView = static_cast<PluginView*>(widget); return pluginView->bindingInstance(); } #if ENABLE(CEHTML) if (widget->isEmbeddedWidget()) { EmbeddedWidget* embeddedWidget = static_cast<EmbeddedWidget*>(widget); Frame* frame= globalObject(mainThreadNormalWorld())->impl()->frame(); return JSC::Bindings::BalInstance::getBalInstance(embeddedWidget, createRootObject(frame).get()); } #endif return 0; }
void FindController::countStringMatches(const String& string, FindOptions options, unsigned maxMatchCount) { if (maxMatchCount == std::numeric_limits<unsigned>::max()) --maxMatchCount; PluginView* pluginView = pluginViewForFrame(m_webPage->mainFrame()); unsigned matchCount; if (pluginView) matchCount = pluginView->countFindMatches(string, core(options), maxMatchCount + 1); else { matchCount = m_webPage->corePage()->countFindMatches(string, core(options), maxMatchCount + 1); m_webPage->corePage()->unmarkAllTextMatches(); } if (matchCount > maxMatchCount) matchCount = static_cast<unsigned>(kWKMoreThanMaximumMatchCount); m_webPage->send(Messages::WebPageProxy::DidCountStringMatches(string, matchCount)); }
Widget* WebFrameLoaderClient::createPlugin(const IntSize& pluginSize, HTMLPlugInElement* element, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually) { WebView* webView = m_webFrame->webView(); COMPtr<IWebUIDelegate> ui; if (SUCCEEDED(webView->uiDelegate(&ui)) && ui) { COMPtr<IWebUIDelegatePrivate4> uiPrivate(Query, ui); if (uiPrivate) { // Assemble the view arguments in a property bag. HashMap<String, String> viewArguments; for (unsigned i = 0; i < paramNames.size(); i++) viewArguments.set(paramNames[i], paramValues[i]); COMPtr<IPropertyBag> viewArgumentsBag(AdoptCOM, COMPropertyBag<String>::adopt(viewArguments)); COMPtr<IDOMElement> containingElement(AdoptCOM, DOMElement::createInstance(element)); HashMap<String, COMVariant> arguments; arguments.set(WebEmbeddedViewAttributesKey, viewArgumentsBag); arguments.set(WebEmbeddedViewBaseURLKey, url.string()); arguments.set(WebEmbeddedViewContainingElementKey, containingElement); arguments.set(WebEmbeddedViewMIMETypeKey, mimeType); COMPtr<IPropertyBag> argumentsBag(AdoptCOM, COMPropertyBag<COMVariant>::adopt(arguments)); COMPtr<IWebEmbeddedView> view; HRESULT result = uiPrivate->embeddedViewWithArguments(webView, m_webFrame, argumentsBag.get(), &view); if (SUCCEEDED(result)) { HWND parentWindow; HRESULT hr = webView->viewWindow((OLE_HANDLE*)&parentWindow); ASSERT(SUCCEEDED(hr)); return EmbeddedWidget::create(view.get(), element, parentWindow, pluginSize); } } } Frame* frame = core(m_webFrame); PluginView* pluginView = PluginView::create(frame, pluginSize, element, url, paramNames, paramValues, mimeType, loadManually); if (pluginView->status() == PluginStatusLoadedSuccessfully) return pluginView; COMPtr<IWebResourceLoadDelegate> resourceLoadDelegate; if (FAILED(webView->resourceLoadDelegate(&resourceLoadDelegate))) return pluginView; RetainPtr<CFMutableDictionaryRef> userInfo(AdoptCF, CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); unsigned count = (unsigned)paramNames.size(); for (unsigned i = 0; i < count; i++) { if (paramNames[i] == "pluginspage") { static CFStringRef key = MarshallingHelpers::LPCOLESTRToCFStringRef(WebKitErrorPlugInPageURLStringKey); RetainPtr<CFStringRef> str(AdoptCF, paramValues[i].createCFString()); CFDictionarySetValue(userInfo.get(), key, str.get()); break; } } if (!mimeType.isNull()) { static CFStringRef key = MarshallingHelpers::LPCOLESTRToCFStringRef(WebKitErrorMIMETypeKey); RetainPtr<CFStringRef> str(AdoptCF, mimeType.createCFString()); CFDictionarySetValue(userInfo.get(), key, str.get()); } String pluginName; if (pluginView->plugin()) pluginName = pluginView->plugin()->name(); if (!pluginName.isNull()) { static CFStringRef key = MarshallingHelpers::LPCOLESTRToCFStringRef(WebKitErrorPlugInNameKey); RetainPtr<CFStringRef> str(AdoptCF, pluginName.createCFString()); CFDictionarySetValue(userInfo.get(), key, str.get()); } COMPtr<CFDictionaryPropertyBag> userInfoBag(AdoptCOM, CFDictionaryPropertyBag::createInstance()); userInfoBag->setDictionary(userInfo.get()); int errorCode = 0; switch (pluginView->status()) { case PluginStatusCanNotFindPlugin: errorCode = WebKitErrorCannotFindPlugIn; break; case PluginStatusCanNotLoadPlugin: errorCode = WebKitErrorCannotLoadPlugIn; break; default: ASSERT_NOT_REACHED(); } ResourceError resourceError(String(WebKitErrorDomain), errorCode, url.string(), String()); COMPtr<IWebError> error(AdoptCOM, WebError::createInstance(resourceError, userInfoBag.get())); resourceLoadDelegate->plugInFailedWithError(webView, error.get(), getWebDataSource(frame->loader()->documentLoader())); return pluginView; }
Widget* WebFrameLoaderClient::createPlugin(const IntSize& pluginSize, Element* element, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually) { Frame* frame = core(m_webFrame); PluginView* pluginView = PluginView::create(frame, pluginSize, element, url, paramNames, paramValues, mimeType, loadManually); if (pluginView->status() == PluginStatusLoadedSuccessfully) return pluginView; /*COMPtr<IWebResourceLoadDelegate> resourceLoadDelegate; WebView* webView = m_webFrame->webView(); if (FAILED(webView->resourceLoadDelegate(&resourceLoadDelegate))) return pluginView; RetainPtr<CFMutableDictionaryRef> userInfo(AdoptCF, CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); unsigned count = (unsigned)paramNames.size(); for (unsigned i = 0; i < count; i++) { if (paramNames[i] == "pluginspage") { static CFStringRef key = MarshallingHelpers::LPCOLESTRToCFStringRef(WebKitErrorPlugInPageURLStringKey); RetainPtr<CFStringRef> str(AdoptCF, paramValues[i].createCFString()); CFDictionarySetValue(userInfo.get(), key, str.get()); break; } } if (!mimeType.isNull()) { static CFStringRef key = MarshallingHelpers::LPCOLESTRToCFStringRef(WebKitErrorMIMETypeKey); RetainPtr<CFStringRef> str(AdoptCF, mimeType.createCFString()); CFDictionarySetValue(userInfo.get(), key, str.get()); } String pluginName; if (pluginView->plugin()) pluginName = pluginView->plugin()->name(); if (!pluginName.isNull()) { static CFStringRef key = MarshallingHelpers::LPCOLESTRToCFStringRef(WebKitErrorPlugInNameKey); RetainPtr<CFStringRef> str(AdoptCF, pluginName.createCFString()); CFDictionarySetValue(userInfo.get(), key, str.get()); } COMPtr<CFDictionaryPropertyBag> userInfoBag(AdoptCOM, CFDictionaryPropertyBag::createInstance()); userInfoBag->setDictionary(userInfo.get()); int errorCode = 0; switch (pluginView->status()) { case PluginStatusCanNotFindPlugin: errorCode = WebKitErrorCannotFindPlugIn; break; case PluginStatusCanNotLoadPlugin: errorCode = WebKitErrorCannotLoadPlugIn; break; default: ASSERT_NOT_REACHED(); } ResourceError resourceError(String(WebKitErrorDomain), errorCode, url.string(), String()); COMPtr<IWebError> error(AdoptCOM, WebError::createInstance(resourceError, userInfoBag.get())); resourceLoadDelegate->plugInFailedWithError(webView, error.get(), getWebDataSource(frame->loader()->documentLoader()));*/ return pluginView; }
LRESULT CALLBACK PluginView::PluginViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { PluginView* pluginView = reinterpret_cast<PluginView*>(GetProp(hWnd, kWebPluginViewProperty)); return pluginView->wndProc(hWnd, message, wParam, lParam); }
void FindController::updateFindUIAfterPageScroll(bool found, const String& string, FindOptions options, unsigned maxMatchCount) { Frame* selectedFrame = frameWithSelection(m_webPage->corePage()); PluginView* pluginView = pluginViewForFrame(m_webPage->mainFrame()); bool shouldShowOverlay = false; if (!found) { if (!pluginView) m_webPage->corePage()->unmarkAllTextMatches(); if (selectedFrame) selectedFrame->selection().clear(); hideFindIndicator(); didFailToFindString(); m_webPage->send(Messages::WebPageProxy::DidFailToFindString(string)); } else { shouldShowOverlay = options & FindOptionsShowOverlay; bool shouldShowHighlight = options & FindOptionsShowHighlight; bool shouldDetermineMatchIndex = options & FindOptionsDetermineMatchIndex; unsigned matchCount = 1; if (shouldDetermineMatchIndex) { if (pluginView) matchCount = pluginView->countFindMatches(string, core(options), maxMatchCount + 1); else matchCount = m_webPage->corePage()->countFindMatches(string, core(options), maxMatchCount + 1); } if (shouldShowOverlay || shouldShowHighlight) { if (maxMatchCount == std::numeric_limits<unsigned>::max()) --maxMatchCount; if (pluginView) { if (!shouldDetermineMatchIndex) matchCount = pluginView->countFindMatches(string, core(options), maxMatchCount + 1); shouldShowOverlay = false; } else { m_webPage->corePage()->unmarkAllTextMatches(); matchCount = m_webPage->corePage()->markAllMatchesForText(string, core(options), shouldShowHighlight, maxMatchCount + 1); } // If we have a large number of matches, we don't want to take the time to paint the overlay. if (matchCount > maxMatchCount) { shouldShowOverlay = false; matchCount = static_cast<unsigned>(kWKMoreThanMaximumMatchCount); } } if (matchCount == static_cast<unsigned>(kWKMoreThanMaximumMatchCount)) m_foundStringMatchIndex = -1; else { if (m_foundStringMatchIndex < 0) m_foundStringMatchIndex += matchCount; if (m_foundStringMatchIndex >= (int) matchCount) m_foundStringMatchIndex -= matchCount; } m_webPage->send(Messages::WebPageProxy::DidFindString(string, matchCount, m_foundStringMatchIndex)); if (!(options & FindOptionsShowFindIndicator) || !selectedFrame || !updateFindIndicator(*selectedFrame, shouldShowOverlay)) hideFindIndicator(); } if (!shouldShowOverlay) { if (m_findPageOverlay) m_webPage->uninstallPageOverlay(m_findPageOverlay, PageOverlay::FadeMode::Fade); } else { if (!m_findPageOverlay) { RefPtr<PageOverlay> findPageOverlay = PageOverlay::create(this); m_findPageOverlay = findPageOverlay.get(); m_webPage->installPageOverlay(findPageOverlay.release(), PageOverlay::FadeMode::Fade); } m_findPageOverlay->setNeedsDisplay(); } }
void FindController::updateFindUIAfterPageScroll(bool found, const String& string, FindOptions options, unsigned maxMatchCount) { Frame* selectedFrame = frameWithSelection(m_webPage->corePage()); PluginView* pluginView = pluginViewForFrame(m_webPage->mainFrame()); bool shouldShowOverlay = false; if (!found) { if (!pluginView) m_webPage->corePage()->unmarkAllTextMatches(); // Clear the selection. if (selectedFrame) selectedFrame->selection()->clear(); hideFindIndicator(); m_webPage->send(Messages::WebPageProxy::DidFailToFindString(string)); } else { shouldShowOverlay = options & FindOptionsShowOverlay; bool shouldShowHighlight = options & FindOptionsShowHighlight; unsigned matchCount = 1; if (shouldShowOverlay || shouldShowHighlight) { if (maxMatchCount == numeric_limits<unsigned>::max()) --maxMatchCount; if (pluginView) { matchCount = pluginView->countFindMatches(string, core(options), maxMatchCount + 1); shouldShowOverlay = false; } else { m_webPage->corePage()->unmarkAllTextMatches(); matchCount = m_webPage->corePage()->markAllMatchesForText(string, core(options), shouldShowHighlight, maxMatchCount + 1); } // Check if we have more matches than allowed. if (matchCount > maxMatchCount) { shouldShowOverlay = false; matchCount = static_cast<unsigned>(kWKMoreThanMaximumMatchCount); } } m_webPage->send(Messages::WebPageProxy::DidFindString(string, matchCount)); if (!(options & FindOptionsShowFindIndicator) || !updateFindIndicator(selectedFrame, shouldShowOverlay)) { // Either we shouldn't show the find indicator, or we couldn't update it. hideFindIndicator(); } } if (!shouldShowOverlay) { if (m_findPageOverlay) { // Get rid of the overlay. m_webPage->uninstallPageOverlay(m_findPageOverlay, true); } } else { if (!m_findPageOverlay) { RefPtr<PageOverlay> findPageOverlay = PageOverlay::create(this); m_findPageOverlay = findPageOverlay.get(); m_webPage->installPageOverlay(findPageOverlay.release(), true); m_findPageOverlay->setNeedsDisplay(); } else m_findPageOverlay->setNeedsDisplay(); } }
void RenderWidget::destroy() { #if PLATFORM(APOLLO) && ENABLE(NETSCAPE_PLUGIN_API) // the plugin might be destroyed by the plugin itself meaning that // it is on the stack. Defer the unload until we have a safe stack. if (m_widget && m_widget->isPluginView()) { #if OS(DARWIN) if (!m_widget->isApolloPDFPluginView()) #endif { ASSERT(document()); document()->destroyWidgetSoon(m_widget.get()); PluginView* pluginView = static_cast<PluginView*>(m_widget.get()); // Remove the plugin from the update timer on WebViewImpl. // That timer is used to update all widgets when the HTMLLoader // is rotated. pluginView->removePlugin(); } } #endif // We can't call the base class's destroy because we don't // want to unconditionally delete ourselves (we're ref-counted). // So the code below includes copied and pasted contents of // both RenderBox::destroy() and RenderObject::destroy(). // Fix originally made for <rdar://problem/4228818>. animation()->cancelAnimations(this); if (RenderView* v = view()) v->removeWidget(this); if (AXObjectCache::accessibilityEnabled()) { document()->axObjectCache()->childrenChanged(this->parent()); document()->axObjectCache()->remove(this); } if (!documentBeingDestroyed() && parent()) parent()->dirtyLinesFromChangedChild(this); remove(); if (m_hasCounterNodeMap) RenderCounter::destroyCounterNodes(this); setWidget(0); // removes from override size map if (hasOverrideSize()) setOverrideSize(-1); if (style() && (style()->height().isPercent() || style()->minHeight().isPercent() || style()->maxHeight().isPercent())) RenderBlock::removePercentHeightDescendant(this); if (hasLayer()) { layer()->clearClipRects(); setHasLayer(false); destroyLayer(); } // Grab the arena from node()->document()->renderArena() before clearing the node pointer. // Clear the node before deref-ing, as this may be deleted when deref is called. RenderArena* arena = renderArena(); setNode(0); deref(arena); }