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

Side by Side 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, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 #include "core/frame/WebKitPoint.h" 76 #include "core/frame/WebKitPoint.h"
77 #include "core/html/HTMLContentElement.h" 77 #include "core/html/HTMLContentElement.h"
78 #include "core/html/HTMLIFrameElement.h" 78 #include "core/html/HTMLIFrameElement.h"
79 #include "core/html/HTMLInputElement.h" 79 #include "core/html/HTMLInputElement.h"
80 #include "core/html/HTMLMediaElement.h" 80 #include "core/html/HTMLMediaElement.h"
81 #include "core/html/HTMLPlugInElement.h" 81 #include "core/html/HTMLPlugInElement.h"
82 #include "core/html/HTMLSelectElement.h" 82 #include "core/html/HTMLSelectElement.h"
83 #include "core/html/HTMLTextAreaElement.h" 83 #include "core/html/HTMLTextAreaElement.h"
84 #include "core/html/canvas/CanvasRenderingContext2D.h" 84 #include "core/html/canvas/CanvasRenderingContext2D.h"
85 #include "core/html/forms/FormController.h" 85 #include "core/html/forms/FormController.h"
86 #include "core/html/shadow/PluginPlaceholderElement.h"
86 #include "core/html/shadow/ShadowElementNames.h" 87 #include "core/html/shadow/ShadowElementNames.h"
87 #include "core/html/shadow/TextControlInnerElements.h" 88 #include "core/html/shadow/TextControlInnerElements.h"
88 #include "core/inspector/ConsoleMessageStorage.h" 89 #include "core/inspector/ConsoleMessageStorage.h"
89 #include "core/inspector/InspectorClient.h" 90 #include "core/inspector/InspectorClient.h"
90 #include "core/inspector/InspectorConsoleAgent.h" 91 #include "core/inspector/InspectorConsoleAgent.h"
91 #include "core/inspector/InspectorController.h" 92 #include "core/inspector/InspectorController.h"
92 #include "core/inspector/InspectorCounters.h" 93 #include "core/inspector/InspectorCounters.h"
93 #include "core/inspector/InspectorFrontendChannel.h" 94 #include "core/inspector/InspectorFrontendChannel.h"
94 #include "core/inspector/InspectorInstrumentation.h" 95 #include "core/inspector/InspectorInstrumentation.h"
95 #include "core/inspector/InspectorOverlay.h" 96 #include "core/inspector/InspectorOverlay.h"
(...skipping 2116 matching lines...) Expand 10 before | Expand all | Expand 10 after
2212 Vector<Document::TransitionElementData> elementData; 2213 Vector<Document::TransitionElementData> elementData;
2213 frame()->document()->getTransitionElementData(elementData); 2214 frame()->document()->getTransitionElementData(elementData);
2214 2215
2215 Vector<Document::TransitionElementData>::iterator iter = elementData.begin() ; 2216 Vector<Document::TransitionElementData>::iterator iter = elementData.begin() ;
2216 for (; iter != elementData.end(); ++iter) 2217 for (; iter != elementData.end(); ++iter)
2217 frame()->document()->hideTransitionElements(AtomicString(iter->selector) ); 2218 frame()->document()->hideTransitionElements(AtomicString(iter->selector) );
2218 } 2219 }
2219 2220
2220 void Internals::forcePluginPlaceholder(HTMLElement* element, const String& htmlS ource, ExceptionState& exceptionState) 2221 void Internals::forcePluginPlaceholder(HTMLElement* element, const String& htmlS ource, ExceptionState& exceptionState)
2221 { 2222 {
2222 if (!element) {
2223 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages:: argumentNullOrIncorrectType(1, "HTMLElement"));
2224 return;
2225 }
2226 if (!element->isPluginElement()) { 2223 if (!element->isPluginElement()) {
2227 exceptionState.throwDOMException(InvalidNodeTypeError, "The element prov ided is not a plugin."); 2224 exceptionState.throwDOMException(InvalidNodeTypeError, "The element prov ided is not a plugin.");
2228 return; 2225 return;
2229 } 2226 }
2227
2230 element->ensureUserAgentShadowRoot().setInnerHTML(htmlSource, exceptionState ); 2228 element->ensureUserAgentShadowRoot().setInnerHTML(htmlSource, exceptionState );
2229 if (exceptionState.hadException())
2230 return;
2231
2231 toHTMLPlugInElement(element)->setUsePlaceholderContent(true); 2232 toHTMLPlugInElement(element)->setUsePlaceholderContent(true);
2232 } 2233 }
2233 2234
2235 void Internals::forcePluginPlaceholder(HTMLElement* element, const Dictionary& o ptions, 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
2236 {
2237 if (!element->isPluginElement()) {
2238 exceptionState.throwDOMException(InvalidNodeTypeError, "The element prov ided is not a plugin.");
2239 return;
2240 }
2241
2242 RefPtrWillBeRawPtr<PluginPlaceholderElement> placeholder = PluginPlaceholder Element::create(element->document());
2243 String stringValue;
2244 if (DictionaryHelper::get(options, "message", stringValue))
2245 placeholder->setMessage(stringValue);
2246
2247 ShadowRoot& shadowRoot = element->ensureUserAgentShadowRoot();
2248 shadowRoot.removeChildren();
2249 shadowRoot.appendChild(placeholder.release(), exceptionState);
2250 if (exceptionState.hadException())
2251 return;
2252
2253 toHTMLPlugInElement(element)->setUsePlaceholderContent(true);
2254 }
2255
2234 } // namespace blink 2256 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698