Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1222)

Unified Diff: Source/core/html/shadow/PluginPlaceholderElement.cpp

Issue 516273002: Move plugin placeholder style to CSS, and allow it to bypass main world CSP. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add the actual .css file Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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());
« Source/core/css/pluginPlaceholder.css ('K') | « Source/core/css/pluginPlaceholder.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698