| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) | 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) |
| 5 * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2012 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2012 Apple Inc. All rights reserv
ed. |
| 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 bool HTMLAppletElement::layoutObjectIsNeeded(const ComputedStyle& style) | 86 bool HTMLAppletElement::layoutObjectIsNeeded(const ComputedStyle& style) |
| 87 { | 87 { |
| 88 if (!fastHasAttribute(codeAttr) && !openShadowRoot()) | 88 if (!fastHasAttribute(codeAttr) && !openShadowRoot()) |
| 89 return false; | 89 return false; |
| 90 return HTMLPlugInElement::layoutObjectIsNeeded(style); | 90 return HTMLPlugInElement::layoutObjectIsNeeded(style); |
| 91 } | 91 } |
| 92 | 92 |
| 93 LayoutObject* HTMLAppletElement::createLayoutObject(const ComputedStyle& style) | 93 LayoutObject* HTMLAppletElement::createLayoutObject(const ComputedStyle& style) |
| 94 { | 94 { |
| 95 return LayoutObject::createObject(this, style); | 95 if (!canEmbedJava() || openShadowRoot()) |
| 96 return LayoutObject::createObject(this, style); |
| 97 |
| 98 if (usePlaceholderContent()) |
| 99 return new LayoutBlockFlow(this); |
| 100 |
| 101 return new LayoutApplet(this); |
| 96 } | 102 } |
| 97 | 103 |
| 98 LayoutPart* HTMLAppletElement::layoutPartForJSBindings() const | 104 LayoutPart* HTMLAppletElement::layoutPartForJSBindings() const |
| 99 { | 105 { |
| 100 return nullptr; | 106 if (!canEmbedJava()) |
| 107 return nullptr; |
| 108 return HTMLPlugInElement::layoutPartForJSBindings(); |
| 101 } | 109 } |
| 102 | 110 |
| 103 LayoutPart* HTMLAppletElement::existingLayoutPart() const | 111 LayoutPart* HTMLAppletElement::existingLayoutPart() const |
| 104 { | 112 { |
| 105 return layoutPart(); | 113 return layoutPart(); |
| 106 } | 114 } |
| 107 | 115 |
| 108 void HTMLAppletElement::updateWidgetInternal() | 116 void HTMLAppletElement::updateWidgetInternal() |
| 109 { | 117 { |
| 110 setNeedsWidgetUpdate(false); | 118 setNeedsWidgetUpdate(false); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 setPlaceholder(nullptr); | 202 setPlaceholder(nullptr); |
| 195 } else if (placeholder) { | 203 } else if (placeholder) { |
| 196 setPlaceholder(placeholder.release()); | 204 setPlaceholder(placeholder.release()); |
| 197 } else if (widget) { | 205 } else if (widget) { |
| 198 document().setContainsPlugins(); | 206 document().setContainsPlugins(); |
| 199 setWidget(widget); | 207 setWidget(widget); |
| 200 setPlaceholder(nullptr); | 208 setPlaceholder(nullptr); |
| 201 } | 209 } |
| 202 } | 210 } |
| 203 | 211 |
| 212 bool HTMLAppletElement::canEmbedJava() const |
| 213 { |
| 214 if (document().isSandboxed(SandboxPlugins)) |
| 215 return false; |
| 216 |
| 217 Settings* settings = document().settings(); |
| 218 if (!settings) |
| 219 return false; |
| 220 |
| 221 if (!settings->javaEnabled()) |
| 222 return false; |
| 223 |
| 224 return true; |
| 225 } |
| 226 |
| 204 bool HTMLAppletElement::canEmbedURL(const KURL& url) const | 227 bool HTMLAppletElement::canEmbedURL(const KURL& url) const |
| 205 { | 228 { |
| 206 if (!document().securityOrigin()->canDisplay(url)) { | 229 if (!document().securityOrigin()->canDisplay(url)) { |
| 207 FrameLoader::reportLocalLoadFailed(document().frame(), url.string()); | 230 FrameLoader::reportLocalLoadFailed(document().frame(), url.string()); |
| 208 return false; | 231 return false; |
| 209 } | 232 } |
| 210 | 233 |
| 211 if (!document().contentSecurityPolicy()->allowObjectFromSource(url) | 234 if (!document().contentSecurityPolicy()->allowObjectFromSource(url) |
| 212 || !document().contentSecurityPolicy()->allowPluginTypeForDocument(docum
ent(), m_serviceType, m_serviceType, url)) { | 235 || !document().contentSecurityPolicy()->allowPluginTypeForDocument(docum
ent(), m_serviceType, m_serviceType, url)) { |
| 213 layoutEmbeddedObject()->setPluginUnavailabilityReason(LayoutEmbeddedObje
ct::PluginBlockedByContentSecurityPolicy); | 236 layoutEmbeddedObject()->setPluginUnavailabilityReason(LayoutEmbeddedObje
ct::PluginBlockedByContentSecurityPolicy); |
| 214 return false; | 237 return false; |
| 215 } | 238 } |
| 216 return true; | 239 return true; |
| 217 } | 240 } |
| 218 | 241 |
| 219 } | 242 } |
| OLD | NEW |