Index: Source/core/html/shadow/PluginPlaceholderElement.cpp |
diff --git a/Source/core/html/shadow/PluginPlaceholderElement.cpp b/Source/core/html/shadow/PluginPlaceholderElement.cpp |
index aeb6d7b90f3b5865b394ccc1d1fa918a34475c08..825fd56868fb9baccfab5a98b3d0802c8ebeb088 100644 |
--- a/Source/core/html/shadow/PluginPlaceholderElement.cpp |
+++ b/Source/core/html/shadow/PluginPlaceholderElement.cpp |
@@ -6,8 +6,14 @@ |
#include "core/html/shadow/PluginPlaceholderElement.h" |
#include "bindings/core/v8/ExceptionState.h" |
+#include "bindings/core/v8/ScriptController.h" |
#include "core/CSSPropertyNames.h" |
#include "core/CSSValueKeywords.h" |
+#include "core/UserAgentStyleSheets.h" |
+#include "core/dom/Document.h" |
+#include "core/frame/LocalFrame.h" |
+#include "core/html/HTMLStyleElement.h" |
+#include "platform/ScriptForbiddenScope.h" |
#include "wtf/StdLibExtras.h" |
#include "wtf/text/AtomicString.h" |
@@ -49,25 +55,26 @@ bool PluginPlaceholderElement::initializePlaceholderElements() |
// </div> |
// </div> |
- // FIXME: Move style out of C++ and into CSS. |
+ if (!document().frame()) |
+ return false; |
+ ScriptForbiddenScope forbidScript; |
+ ScriptController::BypassMainWorldCSP bypassCSP(document().frame()->script()); |
TrackExceptionState exceptionState; |
DEFINE_STATIC_LOCAL(AtomicString, id, ("plugin-placeholder")); |
setIdAttribute(id); |
- setInlineStyleProperty(CSSPropertyWidth, 100, CSSPrimitiveValue::CSS_PERCENTAGE); |
- setInlineStyleProperty(CSSPropertyHeight, 100, CSSPrimitiveValue::CSS_PERCENTAGE); |
- setInlineStyleProperty(CSSPropertyOverflow, CSSValueHidden); |
- setInlineStyleProperty(CSSPropertyDisplay, CSSValueFlex); |
- setInlineStyleProperty(CSSPropertyAlignItems, CSSValueCenter); |
- setInlineStyleProperty(CSSPropertyBackgroundColor, CSSValueGray); |
- setInlineStyleProperty(CSSPropertyFont, "12px -webkit-control"); |
+ |
+ // FIXME: Need to force CSP to permit this element. |
+ RefPtrWillBeRawPtr<HTMLStyleElement> styleElement = HTMLStyleElement::create(document(), false); |
+ styleElement->setTextContent(String(pluginPlaceholderCss, sizeof(pluginPlaceholderCss))); |
+ appendChild(styleElement.release(), exceptionState); |
+ if (exceptionState.hadException()) |
+ return false; |
DEFINE_STATIC_LOCAL(AtomicString, contentId, ("plugin-placeholder-content")); |
RefPtrWillBeRawPtr<HTMLDivElement> contentElement = HTMLDivElement::create(document()); |
contentElement->setIdAttribute(contentId); |
- contentElement->setInlineStyleProperty(CSSPropertyTextAlign, CSSValueCenter); |
- contentElement->setInlineStyleProperty(CSSPropertyMargin, CSSValueAuto); |
DEFINE_STATIC_LOCAL(AtomicString, messageId, ("plugin-placeholder-message")); |
RefPtrWillBeRawPtr<HTMLDivElement> messageElement = HTMLDivElement::create(document()); |