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

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
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 2147 matching lines...) Expand 10 before | Expand all | Expand 10 after
2244 Vector<Document::TransitionElementData> elementData; 2245 Vector<Document::TransitionElementData> elementData;
2245 frame()->document()->getTransitionElementData(elementData); 2246 frame()->document()->getTransitionElementData(elementData);
2246 2247
2247 Vector<Document::TransitionElementData>::iterator iter = elementData.begin() ; 2248 Vector<Document::TransitionElementData>::iterator iter = elementData.begin() ;
2248 for (; iter != elementData.end(); ++iter) 2249 for (; iter != elementData.end(); ++iter)
2249 frame()->document()->hideTransitionElements(AtomicString(iter->selector) ); 2250 frame()->document()->hideTransitionElements(AtomicString(iter->selector) );
2250 } 2251 }
2251 2252
2252 void Internals::forcePluginPlaceholder(HTMLElement* element, const String& htmlS ource, ExceptionState& exceptionState) 2253 void Internals::forcePluginPlaceholder(HTMLElement* element, const String& htmlS ource, ExceptionState& exceptionState)
2253 { 2254 {
2254 if (!element) {
2255 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages:: argumentNullOrIncorrectType(1, "HTMLElement"));
2256 return;
2257 }
2258 if (!element->isPluginElement()) { 2255 if (!element->isPluginElement()) {
2259 exceptionState.throwDOMException(InvalidNodeTypeError, "The element prov ided is not a plugin."); 2256 exceptionState.throwDOMException(InvalidNodeTypeError, "The element prov ided is not a plugin.");
2260 return; 2257 return;
2261 } 2258 }
2259
2262 element->ensureUserAgentShadowRoot().setInnerHTML(htmlSource, exceptionState ); 2260 element->ensureUserAgentShadowRoot().setInnerHTML(htmlSource, exceptionState );
2261 if (exceptionState.hadException())
2262 return;
2263
2263 toHTMLPlugInElement(element)->setUsePlaceholderContent(true); 2264 toHTMLPlugInElement(element)->setUsePlaceholderContent(true);
2264 } 2265 }
2265 2266
2267 void Internals::forcePluginPlaceholder(HTMLElement* element, const Dictionary& o ptions, ExceptionState& exceptionState)
2268 {
2269 if (!element->isPluginElement()) {
2270 exceptionState.throwDOMException(InvalidNodeTypeError, "The element prov ided is not a plugin.");
2271 return;
2272 }
2273
2274 RefPtrWillBeRawPtr<PluginPlaceholderElement> placeholder = PluginPlaceholder Element::create(element->document());
2275 String stringValue;
2276 if (DictionaryHelper::get(options, "message", stringValue))
2277 placeholder->setMessage(stringValue);
2278
2279 ShadowRoot& shadowRoot = element->ensureUserAgentShadowRoot();
2280 shadowRoot.removeChildren();
2281 shadowRoot.appendChild(placeholder.release(), exceptionState);
2282 if (exceptionState.hadException())
2283 return;
2284
2285 toHTMLPlugInElement(element)->setUsePlaceholderContent(true);
2286 }
2287
2266 Iterator* Internals::iterator(ScriptState* scriptState, ExceptionState& exceptio nState) 2288 Iterator* Internals::iterator(ScriptState* scriptState, ExceptionState& exceptio nState)
2267 { 2289 {
2268 return new InternalsIterator; 2290 return new InternalsIterator;
2269 } 2291 }
2270 2292
2271 } // namespace blink 2293 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698