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

Unified Diff: Source/core/testing/Internals.cpp

Issue 522783002: Add a custom element to own structure of shadow DOM plugin placeholders. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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/testing/Internals.cpp
diff --git a/Source/core/testing/Internals.cpp b/Source/core/testing/Internals.cpp
index 1535c3884deff6a367f1b7635b48e694876ac89c..5b49a67265ed678645dc0cb295193a003b53aeff 100644
--- a/Source/core/testing/Internals.cpp
+++ b/Source/core/testing/Internals.cpp
@@ -83,6 +83,7 @@
#include "core/html/HTMLTextAreaElement.h"
#include "core/html/canvas/CanvasRenderingContext2D.h"
#include "core/html/forms/FormController.h"
+#include "core/html/shadow/PluginPlaceholderElement.h"
#include "core/html/shadow/ShadowElementNames.h"
#include "core/html/shadow/TextControlInnerElements.h"
#include "core/inspector/ConsoleMessageStorage.h"
@@ -2219,15 +2220,36 @@ void Internals::hideAllTransitionElements()
void Internals::forcePluginPlaceholder(HTMLElement* element, const String& htmlSource, ExceptionState& exceptionState)
{
- if (!element) {
- exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::argumentNullOrIncorrectType(1, "HTMLElement"));
+ if (!element->isPluginElement()) {
+ exceptionState.throwDOMException(InvalidNodeTypeError, "The element provided is not a plugin.");
return;
}
+
+ element->ensureUserAgentShadowRoot().setInnerHTML(htmlSource, exceptionState);
+ if (exceptionState.hadException())
+ return;
+
+ toHTMLPlugInElement(element)->setUsePlaceholderContent(true);
+}
+
+void Internals::forcePluginPlaceholder(HTMLElement* element, const Dictionary& options, ExceptionState& exceptionState)
esprehn 2014/08/29 21:13:26 HTMLObjectElement*
jbroman 2014/08/30 13:55:48 I'd expect this to work on HTMLEmbedElement and HT
+{
if (!element->isPluginElement()) {
exceptionState.throwDOMException(InvalidNodeTypeError, "The element provided is not a plugin.");
return;
}
- element->ensureUserAgentShadowRoot().setInnerHTML(htmlSource, exceptionState);
+
+ RefPtrWillBeRawPtr<PluginPlaceholderElement> placeholder = PluginPlaceholderElement::create(element->document());
+ String stringValue;
+ if (DictionaryHelper::get(options, "message", stringValue))
+ placeholder->setMessage(stringValue);
+
+ ShadowRoot& shadowRoot = element->ensureUserAgentShadowRoot();
+ shadowRoot.removeChildren();
+ shadowRoot.appendChild(placeholder.release(), exceptionState);
+ if (exceptionState.hadException())
+ return;
+
toHTMLPlugInElement(element)->setUsePlaceholderContent(true);
}

Powered by Google App Engine
This is Rietveld 408576698