ScriptInstance WebMediaPlayerProxy::pluginInstance() { if (!m_instance) { RenderObject* r = element()->renderer(); if (!r || !r->isWidget()) return 0; Frame* frame = element()->document()->frame(); RenderWidget* renderWidget = static_cast<RenderWidget*>(element()->renderer()); if (renderWidget && renderWidget->widget()) m_instance = frame->script()->createScriptInstanceForWidget(renderWidget->widget()); } return m_instance; }
PassScriptInstance HTMLPlugInElement::getInstance() const { Frame* frame = document()->frame(); if (!frame) return 0; // If the host dynamically turns off JavaScript (or Java) we will still return // the cached allocated Bindings::Instance. Not supporting this edge-case is OK. if (m_instance) return m_instance; RenderWidget* renderWidget = renderWidgetForJSBindings(); if (renderWidget && renderWidget->widget()) m_instance = frame->script()->createScriptInstanceForWidget(renderWidget->widget()); return m_instance; }
Widget* HTMLPlugInElement::pluginWidget() const { RenderWidget* renderWidget = renderWidgetForJSBindings(); if (!renderWidget) return 0; return renderWidget->widget(); }
RenderWidget* HTMLObjectElement::renderWidgetForJSBindings() const { RenderWidget* renderWidget = (renderer() && renderer()->isWidget()) ? static_cast<RenderWidget*>(renderer()) : 0; if (renderWidget && !renderWidget->widget()) { document()->updateLayoutIgnorePendingStylesheets(); renderWidget = (renderer() && renderer()->isWidget()) ? static_cast<RenderWidget*>(renderer()) : 0; } return renderWidget; }
RenderWidget* HTMLEmbedElement::renderWidgetForJSBindings() const { RenderWidget* renderWidget = findWidgetRenderer(this); if (renderWidget && !renderWidget->widget()) { document()->updateLayoutIgnorePendingStylesheets(); renderWidget = findWidgetRenderer(this); } return renderWidget; }
KJS::Bindings::Instance *HTMLObjectElement::getInstance() const { Frame* frame = document()->frame(); if (!frame) return 0; if (m_instance) return m_instance.get(); RenderWidget* renderWidget = (renderer() && renderer()->isWidget()) ? static_cast<RenderWidget*>(renderer()) : 0; if (renderWidget && !renderWidget->widget()) { document()->updateLayoutIgnorePendingStylesheets(); renderWidget = (renderer() && renderer()->isWidget()) ? static_cast<RenderWidget*>(renderer()) : 0; } if (renderWidget && renderWidget->widget()) m_instance = frame->createScriptInstanceForWidget(renderWidget->widget()); return m_instance.get(); }
KJS::Bindings::Instance* HTMLEmbedElement::getInstance() const { Frame* frame = document()->frame(); if (!frame) return 0; if (m_instance) return m_instance.get(); RenderWidget* renderWidget = findWidgetRenderer(this); if (renderWidget && !renderWidget->widget()) { document()->updateLayoutIgnorePendingStylesheets(); renderWidget = findWidgetRenderer(this); } if (renderWidget && renderWidget->widget()) m_instance = frame->createScriptInstanceForWidget(renderWidget->widget()); return m_instance.get(); }
Widget* HTMLPlugInElement::pluginWidget() const { if (m_inBeforeLoadEventHandler) { // The plug-in hasn't loaded yet, and it makes no sense to try to load if beforeload handler happened to touch the plug-in element. // That would recursively call beforeload for the same element. return 0; } RenderWidget* renderWidget = renderWidgetForJSBindings(); if (!renderWidget) return 0; return renderWidget->widget(); }
Widget* HTMLPlugInElement::pluginWidget(PluginLoadingPolicy loadPolicy) const { if (m_inBeforeLoadEventHandler) { // The plug-in hasn't loaded yet, and it makes no sense to try to load if beforeload handler happened to touch the plug-in element. // That would recursively call beforeload for the same element. return nullptr; } RenderWidget* renderWidget = loadPolicy == PluginLoadingPolicy::Load ? renderWidgetLoadingPlugin() : this->renderWidget(); if (!renderWidget) return nullptr; return renderWidget->widget(); }
PassScriptInstance HTMLPlugInElement::getInstance() const { Frame* frame = document()->frame(); if (!frame) return 0; // If the host dynamically turns off JavaScript (or Java) we will still return // the cached allocated Bindings::Instance. Not supporting this edge-case is OK. if (m_instance) return m_instance; if (m_inBeforeLoadEventHandler) { // The plug-in hasn't loaded yet, and it makes no sense to try to load if beforeload handler happened to touch the plug-in element. // That would recursively call beforeload for the same element. return 0; } RenderWidget* renderWidget = renderWidgetForJSBindings(); if (renderWidget && renderWidget->widget()) m_instance = frame->script()->createScriptInstanceForWidget(renderWidget->widget()); return m_instance; }