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

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: rebase 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
« no previous file with comments | « Source/core/testing/Internals.h ('k') | Source/core/testing/Internals.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 #include "core/frame/Settings.h" 77 #include "core/frame/Settings.h"
78 #include "core/html/HTMLContentElement.h" 78 #include "core/html/HTMLContentElement.h"
79 #include "core/html/HTMLIFrameElement.h" 79 #include "core/html/HTMLIFrameElement.h"
80 #include "core/html/HTMLInputElement.h" 80 #include "core/html/HTMLInputElement.h"
81 #include "core/html/HTMLMediaElement.h" 81 #include "core/html/HTMLMediaElement.h"
82 #include "core/html/HTMLPlugInElement.h" 82 #include "core/html/HTMLPlugInElement.h"
83 #include "core/html/HTMLSelectElement.h" 83 #include "core/html/HTMLSelectElement.h"
84 #include "core/html/HTMLTextAreaElement.h" 84 #include "core/html/HTMLTextAreaElement.h"
85 #include "core/html/canvas/CanvasRenderingContext2D.h" 85 #include "core/html/canvas/CanvasRenderingContext2D.h"
86 #include "core/html/forms/FormController.h" 86 #include "core/html/forms/FormController.h"
87 #include "core/html/shadow/PluginPlaceholderElement.h"
87 #include "core/html/shadow/ShadowElementNames.h" 88 #include "core/html/shadow/ShadowElementNames.h"
88 #include "core/html/shadow/TextControlInnerElements.h" 89 #include "core/html/shadow/TextControlInnerElements.h"
89 #include "core/inspector/ConsoleMessageStorage.h" 90 #include "core/inspector/ConsoleMessageStorage.h"
90 #include "core/inspector/InspectorClient.h" 91 #include "core/inspector/InspectorClient.h"
91 #include "core/inspector/InspectorConsoleAgent.h" 92 #include "core/inspector/InspectorConsoleAgent.h"
92 #include "core/inspector/InspectorController.h" 93 #include "core/inspector/InspectorController.h"
93 #include "core/inspector/InspectorCounters.h" 94 #include "core/inspector/InspectorCounters.h"
94 #include "core/inspector/InspectorFrontendChannel.h" 95 #include "core/inspector/InspectorFrontendChannel.h"
95 #include "core/inspector/InspectorInstrumentation.h" 96 #include "core/inspector/InspectorInstrumentation.h"
96 #include "core/inspector/InspectorOverlay.h" 97 #include "core/inspector/InspectorOverlay.h"
(...skipping 2143 matching lines...) Expand 10 before | Expand all | Expand 10 after
2240 Vector<Document::TransitionElementData> elementData; 2241 Vector<Document::TransitionElementData> elementData;
2241 frame()->document()->getTransitionElementData(elementData); 2242 frame()->document()->getTransitionElementData(elementData);
2242 2243
2243 Vector<Document::TransitionElementData>::iterator iter = elementData.begin() ; 2244 Vector<Document::TransitionElementData>::iterator iter = elementData.begin() ;
2244 for (; iter != elementData.end(); ++iter) 2245 for (; iter != elementData.end(); ++iter)
2245 frame()->document()->hideTransitionElements(AtomicString(iter->selector) ); 2246 frame()->document()->hideTransitionElements(AtomicString(iter->selector) );
2246 } 2247 }
2247 2248
2248 void Internals::forcePluginPlaceholder(HTMLElement* element, const String& htmlS ource, ExceptionState& exceptionState) 2249 void Internals::forcePluginPlaceholder(HTMLElement* element, const String& htmlS ource, ExceptionState& exceptionState)
2249 { 2250 {
2250 if (!element) {
2251 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages:: argumentNullOrIncorrectType(1, "HTMLElement"));
2252 return;
2253 }
2254 if (!element->isPluginElement()) { 2251 if (!element->isPluginElement()) {
2255 exceptionState.throwDOMException(InvalidNodeTypeError, "The element prov ided is not a plugin."); 2252 exceptionState.throwDOMException(InvalidNodeTypeError, "The element prov ided is not a plugin.");
2256 return; 2253 return;
2257 } 2254 }
2255
2258 element->ensureUserAgentShadowRoot().setInnerHTML(htmlSource, exceptionState ); 2256 element->ensureUserAgentShadowRoot().setInnerHTML(htmlSource, exceptionState );
2257 if (exceptionState.hadException())
2258 return;
2259
2259 toHTMLPlugInElement(element)->setUsePlaceholderContent(true); 2260 toHTMLPlugInElement(element)->setUsePlaceholderContent(true);
2260 } 2261 }
2261 2262
2263 void Internals::forcePluginPlaceholder(HTMLElement* element, const Dictionary& o ptions, ExceptionState& exceptionState)
2264 {
2265 if (!element->isPluginElement()) {
2266 exceptionState.throwDOMException(InvalidNodeTypeError, "The element prov ided is not a plugin.");
2267 return;
2268 }
2269
2270 RefPtrWillBeRawPtr<PluginPlaceholderElement> placeholder = PluginPlaceholder Element::create(element->document());
2271 String stringValue;
2272 if (DictionaryHelper::get(options, "message", stringValue))
2273 placeholder->setMessage(stringValue);
2274
2275 ShadowRoot& shadowRoot = element->ensureUserAgentShadowRoot();
2276 shadowRoot.removeChildren();
2277 shadowRoot.appendChild(placeholder.release(), exceptionState);
2278 if (exceptionState.hadException())
2279 return;
2280
2281 toHTMLPlugInElement(element)->setUsePlaceholderContent(true);
2282 }
2283
2262 Iterator* Internals::iterator(ScriptState* scriptState, ExceptionState& exceptio nState) 2284 Iterator* Internals::iterator(ScriptState* scriptState, ExceptionState& exceptio nState)
2263 { 2285 {
2264 return new InternalsIterator; 2286 return new InternalsIterator;
2265 } 2287 }
2266 2288
2267 } // namespace blink 2289 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/testing/Internals.h ('k') | Source/core/testing/Internals.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698