diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/html/HTMLAppletElement.cpp | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/html/HTMLAppletElement.cpp')
-rw-r--r-- | Source/WebCore/html/HTMLAppletElement.cpp | 63 |
1 files changed, 33 insertions, 30 deletions
diff --git a/Source/WebCore/html/HTMLAppletElement.cpp b/Source/WebCore/html/HTMLAppletElement.cpp index ca6fd25ef..5f54f8f31 100644 --- a/Source/WebCore/html/HTMLAppletElement.cpp +++ b/Source/WebCore/html/HTMLAppletElement.cpp @@ -41,16 +41,16 @@ namespace WebCore { using namespace HTMLNames; HTMLAppletElement::HTMLAppletElement(const QualifiedName& tagName, Document& document, bool createdByParser) - : HTMLPlugInImageElement(tagName, document, createdByParser, ShouldNotPreferPlugInsForImages) + : HTMLPlugInImageElement(tagName, document, createdByParser) { ASSERT(hasTagName(appletTag)); m_serviceType = "application/x-java-applet"; } -PassRefPtr<HTMLAppletElement> HTMLAppletElement::create(const QualifiedName& tagName, Document& document, bool createdByParser) +Ref<HTMLAppletElement> HTMLAppletElement::create(const QualifiedName& tagName, Document& document, bool createdByParser) { - return adoptRef(new HTMLAppletElement(tagName, document, createdByParser)); + return adoptRef(*new HTMLAppletElement(tagName, document, createdByParser)); } void HTMLAppletElement::parseAttribute(const QualifiedName& name, const AtomicString& value) @@ -68,34 +68,41 @@ void HTMLAppletElement::parseAttribute(const QualifiedName& name, const AtomicSt HTMLPlugInImageElement::parseAttribute(name, value); } +bool HTMLAppletElement::isURLAttribute(const Attribute& attribute) const +{ + return attribute.name().localName() == codebaseAttr + || attribute.name().localName() == objectAttr + || HTMLPlugInImageElement::isURLAttribute(attribute); +} + bool HTMLAppletElement::rendererIsNeeded(const RenderStyle& style) { - if (!fastHasAttribute(codeAttr)) + if (!hasAttributeWithoutSynchronization(codeAttr)) return false; return HTMLPlugInImageElement::rendererIsNeeded(style); } -RenderPtr<RenderElement> HTMLAppletElement::createElementRenderer(PassRef<RenderStyle> style) +RenderPtr<RenderElement> HTMLAppletElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&) { if (!canEmbedJava()) - return RenderElement::createFor(*this, std::move(style)); + return RenderElement::createFor(*this, WTFMove(style)); - return RenderEmbeddedObject::createForApplet(*this, std::move(style)); + return RenderEmbeddedObject::createForApplet(*this, WTFMove(style)); } -RenderWidget* HTMLAppletElement::renderWidgetForJSBindings() const +RenderWidget* HTMLAppletElement::renderWidgetLoadingPlugin() const { if (!canEmbedJava()) - return 0; + return nullptr; // Needs to load the plugin immediatedly because this function is called // when JavaScript code accesses the plugin. // FIXME: <rdar://16893708> Check if dispatching events here is safe. - document().updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasksSynchronously); + document().updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasks::Synchronously); return renderWidget(); } -void HTMLAppletElement::updateWidget(PluginCreationOption pluginCreationOption) +void HTMLAppletElement::updateWidget(CreatePlugins createPlugins) { setNeedsWidgetUpdate(false); // FIXME: This should ASSERT isFinishedParsingChildren() instead. @@ -103,13 +110,13 @@ void HTMLAppletElement::updateWidget(PluginCreationOption pluginCreationOption) return; #if PLATFORM(IOS) - UNUSED_PARAM(pluginCreationOption); + UNUSED_PARAM(createPlugins); #else // FIXME: It's sadness that we have this special case here. // See http://trac.webkit.org/changeset/25128 and // plugins/netscape-plugin-setwindow-size.html - if (pluginCreationOption == CreateOnlyNonNetscapePlugins) { - // Ensure updateWidget() is called again during layout to create the Netscape plug-in. + if (createPlugins == CreatePlugins::No) { + // Ensure updateWidget() is called again during layout to create the plug-in. setNeedsWidgetUpdate(true); return; } @@ -117,19 +124,19 @@ void HTMLAppletElement::updateWidget(PluginCreationOption pluginCreationOption) RenderEmbeddedObject* renderer = renderEmbeddedObject(); LayoutUnit contentWidth = renderer->style().width().isFixed() ? LayoutUnit(renderer->style().width().value()) : - renderer->width() - renderer->borderAndPaddingWidth(); + renderer->width() - renderer->horizontalBorderAndPaddingExtent(); LayoutUnit contentHeight = renderer->style().height().isFixed() ? LayoutUnit(renderer->style().height().value()) : - renderer->height() - renderer->borderAndPaddingHeight(); + renderer->height() - renderer->verticalBorderAndPaddingExtent(); Vector<String> paramNames; Vector<String> paramValues; paramNames.append("code"); - paramValues.append(getAttribute(codeAttr).string()); + paramValues.append(attributeWithoutSynchronization(codeAttr).string()); - const AtomicString& codeBase = getAttribute(codebaseAttr); + const AtomicString& codeBase = attributeWithoutSynchronization(codebaseAttr); if (!codeBase.isNull()) { - paramNames.append("codeBase"); + paramNames.append(ASCIILiteral("codeBase")); paramValues.append(codeBase.string()); } @@ -139,18 +146,18 @@ void HTMLAppletElement::updateWidget(PluginCreationOption pluginCreationOption) paramValues.append(name.string()); } - const AtomicString& archive = getAttribute(archiveAttr); + const AtomicString& archive = attributeWithoutSynchronization(archiveAttr); if (!archive.isNull()) { - paramNames.append("archive"); + paramNames.append(ASCIILiteral("archive")); paramValues.append(archive.string()); } - paramNames.append("baseURL"); + paramNames.append(ASCIILiteral("baseURL")); paramValues.append(document().baseURL().string()); - const AtomicString& mayScript = getAttribute(mayscriptAttr); + const AtomicString& mayScript = attributeWithoutSynchronization(mayscriptAttr); if (!mayScript.isNull()) { - paramNames.append("mayScript"); + paramNames.append(ASCIILiteral("mayScript")); paramValues.append(mayScript.string()); } @@ -174,14 +181,10 @@ bool HTMLAppletElement::canEmbedJava() const if (document().isSandboxed(SandboxPlugins)) return false; - Settings* settings = document().settings(); - if (!settings) - return false; - - if (!settings->isJavaEnabled()) + if (!document().settings().isJavaEnabled()) return false; - if (document().securityOrigin()->isLocal() && !settings->isJavaEnabledForLocalFiles()) + if (document().securityOrigin().isLocal() && !document().settings().isJavaEnabledForLocalFiles()) return false; return true; |