Source/WebKit/chromium/ChangeLog

 12011-03-30 MORITA Hajime <morrita@google.com>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 [Chromium] Expose the shadow DOM to DumpRenderTree JS tests.
 6 https://bugs.webkit.org/show_bug.cgi?id=56573
 7
 8 Added:
 9 - WebBingins::makeNode() to convert WebNode to a JS object, and
 10 - WebElement::shadowRoot().
 11
 12 * public/WebBindings.h:
 13 * public/WebElement.h:
 14 * src/WebBindings.cpp:
 15 (WebKit::makeNodeImpl):
 16 (WebKit::WebBindings::makeNode):
 17 * src/WebElement.cpp:
 18 (WebKit::WebElement::shadowRoot):
 19
1202011-03-30 Mario Sanchez Prada <msanchez@igalia.com>
221
322 Reviewed by Chris Fleizach.

Source/WebKit/chromium/public/WebBindings.h

@@namespace WebKit {
4040
4141class WebDragData;
4242class WebElement;
 43class WebNode;
4344class WebRange;
4445
4546// A haphazard collection of functions for dealing with plugins.

@@public:
137138
138139 WEBKIT_API static NPObject* makeIntArray(const WebVector<int>&);
139140 WEBKIT_API static NPObject* makeStringArray(const WebVector<WebString>&);
 141 WEBKIT_API static NPObject* makeNode(const WebNode&);
140142
141143 // Exceptions -------------------------------------------------------------
142144

Source/WebKit/chromium/public/WebElement.h

@@class WebNamedNodeMap;
5858 WEBKIT_API bool setAttribute(const WebString& name, const WebString& value);
5959 WEBKIT_API WebNamedNodeMap attributes() const;
6060 WEBKIT_API WebString innerText() const;
 61 WEBKIT_API WebNode shadowRoot();
6162
6263 // Returns the language code specified for this element. This attribute
6364 // is inherited, so the returned value is drawn from the closest parent

Source/WebKit/chromium/src/WebBindings.cpp

4141#include "V8DOMWrapper.h"
4242#include "V8Element.h"
4343#include "V8NPUtils.h"
 44#include "V8Node.h"
4445#include "V8Proxy.h"
4546#include "V8Range.h"
4647#elif USE(JSC)

@@static NPObject* makeStringArrayImpl(const WebVector<WebString>& data)
256257 return npCreateV8ScriptObject(0, result, window);
257258}
258259
 260static NPObject* makeNodeImpl(WebNode data)
 261{
 262 v8::HandleScope handleScope;
 263 if (data.isNull())
 264 return 0;
 265 v8::Handle<v8::Object> result = V8Node::wrap(data.unwrap<Node>());
 266 WebCore::DOMWindow* window = WebCore::V8Proxy::retrieveWindow(WebCore::V8Proxy::currentContext());
 267 return npCreateV8ScriptObject(0, result, window);
 268}
 269
259270#endif
260271
261272bool WebBindings::getRange(NPObject* range, WebRange* webRange)

@@NPObject* WebBindings::makeStringArray(const WebVector<WebString>& data)
298309#endif
299310}
300311
 312NPObject* WebBindings::makeNode(const WebNode& data)
 313{
 314#if USE(V8)
 315 return makeNodeImpl(data);
 316#else
 317 // Not supported on other ports (JSC, etc.).
 318 return 0;
 319#endif
 320}
 321
301322void WebBindings::pushExceptionHandler(ExceptionHandler handler, void* data)
302323{
303324 WebCore::pushExceptionHandler(handler, data);

Source/WebKit/chromium/src/WebElement.cpp

@@WebString WebElement::innerText() const
9090 return constUnwrap<Element>()->innerText();
9191}
9292
 93WebNode WebElement::shadowRoot()
 94{
 95 return adoptRef(unwrap<Element>()->shadowRoot());
 96}
 97
9398WebString WebElement::computeInheritedLanguage() const
9499{
95100 return WebString(constUnwrap<Element>()->computeInheritedLanguage());

Tools/ChangeLog

 12011-03-30 MORITA Hajime <morrita@google.com>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 [Chromium] Expose the shadow DOM to DumpRenderTree JS tests.
 6 https://bugs.webkit.org/show_bug.cgi?id=56573
 7
 8 Added LayoutTestController.shadowRoot() to Chromium DRT.
 9
 10 * DumpRenderTree/chromium/LayoutTestController.cpp:
 11 (LayoutTestController::LayoutTestController):
 12 (LayoutTestController::shadowRoot):
 13 * DumpRenderTree/chromium/LayoutTestController.h:
 14
1152011-03-30 Yuta Kitamura <yutak@chromium.org>
216
317 Reviewed by Kent Tamura.

Tools/DumpRenderTree/chromium/LayoutTestController.cpp

@@LayoutTestController::LayoutTestController(TestShell* shell)
173173 bindMethod("setWindowIsKey", &LayoutTestController::setWindowIsKey);
174174 bindMethod("setXSSAuditorEnabled", &LayoutTestController::setXSSAuditorEnabled);
175175 bindMethod("setAsynchronousSpellCheckingEnabled", &LayoutTestController::setAsynchronousSpellCheckingEnabled);
 176 bindMethod("shadowRoot", &LayoutTestController::shadowRoot);
176177 bindMethod("showWebInspector", &LayoutTestController::showWebInspector);
177178 bindMethod("simulateDesktopNotificationClick", &LayoutTestController::simulateDesktopNotificationClick);
178179 bindMethod("suspendAnimations", &LayoutTestController::suspendAnimations);

@@void LayoutTestController::setAsynchronousSpellCheckingEnabled(const CppArgument
647648 result->setNull();
648649}
649650
 651void LayoutTestController::shadowRoot(const CppArgumentList& arguments, CppVariant* result)
 652{
 653 if (arguments.size() != 1 || !arguments[0].isObject()) {
 654 result->setNull();
 655 return;
 656 }
 657
 658 WebElement element;
 659 if (!WebBindings::getElement(arguments[0].value.objectValue, &element)) {
 660 result->setNull();
 661 return;
 662 }
 663
 664 WebNode shadowRoot = element.shadowRoot();
 665 if (shadowRoot.isNull()) {
 666 result->setNull();
 667 return;
 668 }
 669
 670 result->set(WebBindings::makeNode(shadowRoot));
 671}
 672
650673void LayoutTestController::showWebInspector(const CppArgumentList&, CppVariant* result)
651674{
652675 m_shell->showDevTools();

Tools/DumpRenderTree/chromium/LayoutTestController.h

@@public:
270270 void setAllowUniversalAccessFromFileURLs(const CppArgumentList&, CppVariant*);
271271 void setAllowFileAccessFromFileURLs(const CppArgumentList&, CppVariant*);
272272
 273 void shadowRoot(const CppArgumentList&, CppVariant*);
273274
274275 // The fallback method is called when a nonexistent method is called on
275276 // the layout test controller object.