void RenderApplet::createWidgetIfNecessary() { HTMLAppletElement* element = static_cast<HTMLAppletElement*>(node()); if (widget() || !element->isFinishedParsingChildren()) return; // FIXME: Java applets can't be resized (this is a bug in Apple's Java implementation). // In order to work around this problem and have a correct size from the start, we will // use fixed widths/heights from the style system when we can, since the widget might // not have an accurate m_width/m_height. int contentWidth = style()->width().isFixed() ? style()->width().value() : width() - borderAndPaddingWidth(); int contentHeight = style()->height().isFixed() ? style()->height().value() : height() - borderAndPaddingHeight(); for (Node* child = element->firstChild(); child; child = child->nextSibling()) { if (child->hasTagName(paramTag)) { HTMLParamElement* p = static_cast<HTMLParamElement*>(child); if (!p->name().isEmpty()) m_args.set(p->name(), p->value()); } } Frame* frame = document()->frame(); ASSERT(frame); setWidget(frame->loader()->createJavaAppletWidget(IntSize(contentWidth, contentHeight), element, m_args)); }
JSValue jsHTMLAppletElementWidth(ExecState* exec, JSValue slotBase, const Identifier&) { JSHTMLAppletElement* castedThis = static_cast<JSHTMLAppletElement*>(asObject(slotBase)); UNUSED_PARAM(exec); HTMLAppletElement* imp = static_cast<HTMLAppletElement*>(castedThis->impl()); JSValue result = jsString(exec, imp->getAttribute(WebCore::HTMLNames::widthAttr)); return result; }
PassRefPtr<Widget> SubframeLoader::createJavaAppletWidget(const IntSize& size, HTMLAppletElement& element, const Vector<String>& paramNames, const Vector<String>& paramValues) { String baseURLString; String codeBaseURLString; for (size_t i = 0; i < paramNames.size(); ++i) { if (equalIgnoringCase(paramNames[i], "baseurl")) baseURLString = paramValues[i]; else if (equalIgnoringCase(paramNames[i], "codebase")) codeBaseURLString = paramValues[i]; } if (!codeBaseURLString.isEmpty()) { URL codeBaseURL = completeURL(codeBaseURLString); if (!element.document().securityOrigin()->canDisplay(codeBaseURL)) { FrameLoader::reportLocalLoadFailed(&m_frame, codeBaseURL.string()); return nullptr; } const char javaAppletMimeType[] = "application/x-java-applet"; if (!element.document().contentSecurityPolicy()->allowObjectFromSource(codeBaseURL) || !element.document().contentSecurityPolicy()->allowPluginType(javaAppletMimeType, javaAppletMimeType, codeBaseURL)) return nullptr; } if (baseURLString.isEmpty()) baseURLString = m_frame.document()->baseURL().string(); URL baseURL = completeURL(baseURLString); RefPtr<Widget> widget; if (allowPlugins(AboutToInstantiatePlugin)) widget = m_frame.loader().client().createJavaAppletWidget(size, &element, baseURL, paramNames, paramValues); logPluginRequest(document()->page(), element.serviceType(), String(), widget); if (!widget) { RenderEmbeddedObject* renderer = element.renderEmbeddedObject(); if (!renderer->isPluginUnavailable()) renderer->setPluginUnavailabilityReason(RenderEmbeddedObject::PluginMissing); return nullptr; } m_containsPlugins = true; return widget; }
void setJSHTMLAppletElementWidth(ExecState* exec, JSObject* thisObject, JSValue value) { JSHTMLAppletElement* castedThis = static_cast<JSHTMLAppletElement*>(thisObject); HTMLAppletElement* imp = static_cast<HTMLAppletElement*>(castedThis->impl()); imp->setAttribute(WebCore::HTMLNames::widthAttr, valueToStringWithNullCheck(exec, value)); }
void setJSHTMLAppletElementVspace(ExecState* exec, JSObject* thisObject, JSValue value) { JSHTMLAppletElement* castedThisObj = static_cast<JSHTMLAppletElement*>(thisObject); HTMLAppletElement* imp = static_cast<HTMLAppletElement*>(castedThisObj->impl()); imp->setAttribute(HTMLNames::vspaceAttr, valueToStringWithNullCheck(exec, value)); }