Skip to content
Permalink
Browse files
2011-04-20 Dominic Cooney <dominicc@chromium.org>
        Reviewed by Dimitri Glazkov.

        layoutTestController can create and destroy shadow DOM
        https://bugs.webkit.org/show_bug.cgi?id=59058

        Exercise the new layoutTestController methods.

        * fast/dom/shadow/layout-tests-can-access-shadow-expected.txt: Added.
        * fast/dom/shadow/layout-tests-can-access-shadow.html: Added.
2011-04-20  Dominic Cooney  <dominicc@chromium.org>

        Reviewed by Dimitri Glazkov.

        layoutTestController can create and destroy shadow DOM
        https://bugs.webkit.org/show_bug.cgi?id=59058

        Test: fast/dom/shadow/layout-tests-can-access-shadow.html

        * WebCore.exp.in: Mac DRT needs to see Element::ensure/removeShadowRoot
2011-04-20  Dominic Cooney  <dominicc@chromium.org>

        Reviewed by Dimitri Glazkov.

        layoutTestController can create and destroy shadow DOM
        https://bugs.webkit.org/show_bug.cgi?id=59058

        Chromium DRT relies on the Chromium WebKit API

        * public/WebElement.h:
        * src/WebElement.cpp:
        (WebKit::WebElement::shadowRoot): don't steal a zero refcount
        (WebKit::WebElement::ensureShadowRoot): added
        (WebKit::WebElement::removeShadowRoot): added
2011-04-20  Dominic Cooney  <dominicc@chromium.org>

        Reviewed by Dimitri Glazkov.

        layoutTestController can create and destroy shadow DOM
        https://bugs.webkit.org/show_bug.cgi?id=59058

        Support for new methods in GTK DRT.

        * WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
        (DumpRenderTreeSupportGtk::ensureShadowRoot):
        (DumpRenderTreeSupportGtk::removeShadowRoot):
        * WebCoreSupport/DumpRenderTreeSupportGtk.h:
2011-04-20  Dominic Cooney  <dominicc@chromium.org>

        Reviewed by Dimitri Glazkov.

        layoutTestController can create and destroy shadow DOM
        https://bugs.webkit.org/show_bug.cgi?id=59058

        Support for new methods in Mac DRT.

        * DOM/WebDOMOperations.mm:
        (-[DOMElement _ensureShadowRoot:]):
        (-[DOMElement _removeShadowRoot]):
        * DOM/WebDOMOperationsPrivate.h:
2011-04-20  Dominic Cooney  <dominicc@chromium.org>

        Reviewed by Dimitri Glazkov.

        layoutTestController can create and destroy shadow DOM
        https://bugs.webkit.org/show_bug.cgi?id=59058

        Support for new methods in Qt DRT.

        * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
        (DumpRenderTreeSupportQt::ensureShadowRoot):
        (DumpRenderTreeSupportQt::removeShadowRoot):
        * WebCoreSupport/DumpRenderTreeSupportQt.h:
2011-04-20  Dominic Cooney  <dominicc@chromium.org>

        Reviewed by Dimitri Glazkov.

        layoutTestController can create and destroy shadow DOM
        https://bugs.webkit.org/show_bug.cgi?id=59058

        Support for new methods in WK2 WebKitTestRunner.

        * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp:
        (WKBundleNodeHandleCopyElementEnsureShadowRoot):
        (WKBundleNodeHandleRemoveShadowRoot):
        * WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h:
        * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
        (WebKit::InjectedBundleNodeHandle::elementShadowRoot):
        (WebKit::InjectedBundleNodeHandle::elementEnsureShadowRoot):
        (WebKit::InjectedBundleNodeHandle::elementRemoveShadowRoot):
        * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h:
2011-04-20  Dominic Cooney  <dominicc@chromium.org>

        Reviewed by Dimitri Glazkov.

        layoutTestController can create and destroy shadow DOM
        https://bugs.webkit.org/show_bug.cgi?id=59058

        Chromium, Mac, GTK and Qt DRT; and WK2 test runner.

        * DumpRenderTree/LayoutTestController.cpp:
        (ensureShadowRootCallback):
        (removeShadowRootCallback):
        (LayoutTestController::staticFunctions):
        * DumpRenderTree/LayoutTestController.h:
        * DumpRenderTree/chromium/LayoutTestController.cpp:
        (LayoutTestController::LayoutTestController):
        (LayoutTestController::ensureShadowRoot):
        (LayoutTestController::removeShadowRoot):
        * DumpRenderTree/chromium/LayoutTestController.h:
        * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
        (LayoutTestController::ensureShadowRoot):
        (LayoutTestController::removeShadowRoot):
        * DumpRenderTree/mac/LayoutTestControllerMac.mm:
        (LayoutTestController::shadowRoot):
        (LayoutTestController::ensureShadowRoot):
        (LayoutTestController::removeShadowRoot):
        * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
        (LayoutTestController::ensureShadowRoot):
        (LayoutTestController::removeShadowRoot):
        * DumpRenderTree/qt/LayoutTestControllerQt.h:
        * DumpRenderTree/win/LayoutTestControllerWin.cpp:
        (LayoutTestController::ensureShadowRoot):
        (LayoutTestController::removeShadowRoot):
        * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl:
        * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
        (WTR::LayoutTestController::shadowRoot):
        (WTR::LayoutTestController::ensureShadowRoot):
        (WTR::LayoutTestController::removeShadowRoot):
        * WebKitTestRunner/InjectedBundle/LayoutTestController.h:

Canonical link: https://commits.webkit.org/74211@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@84472 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
webkit-commit-queue committed Apr 21, 2011
1 parent 0523785 commit f9b01f7acf81fc3c23c17e3a37485d85047988c3
Showing 35 changed files with 449 additions and 5 deletions.
@@ -1,3 +1,15 @@
2011-04-20 Dominic Cooney <dominicc@chromium.org>

Reviewed by Dimitri Glazkov.

layoutTestController can create and destroy shadow DOM
https://bugs.webkit.org/show_bug.cgi?id=59058

Exercise the new layoutTestController methods.

* fast/dom/shadow/layout-tests-can-access-shadow-expected.txt: Added.
* fast/dom/shadow/layout-tests-can-access-shadow.html: Added.

2011-04-20 Dirk Pranke <dpranke@chromium.org>

Make video/image-zoom fail on GPU on all ports.
@@ -0,0 +1,13 @@

This tests that LayoutTestController can access shadow DOM.

PASS shadow.nodeName is "#shadow-root"
PASS layoutTestController.shadowRoot(shadow) is null
PASS layoutTestController.shadowRoot(p) is null
PASS shadow.nodeName is "#shadow-root"
PASS shadow === layoutTestController.shadowRoot(p) is true
PASS layoutTestController.shadowRoot(keygen) is null
PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,41 @@
<!DOCTYPE html>
<html>
<head>
<script src="../../js/resources/js-test-pre.js"></script>
</head>
<body>
<keygen id="keys" />
<p id="peas" />
<pre id="console">
This tests that LayoutTestController can access shadow DOM.

</pre>
<script>
if (window.layoutTestController) {
// Make assertions about a built-in shadow
var keygen = document.getElementById('keys');
var shadow = layoutTestController.shadowRoot(keygen);
shouldBe('shadow.nodeName', '"#shadow-root"');

// Shadow roots should not have shadows
shouldBe('layoutTestController.shadowRoot(shadow)', 'null');

// Ordinary element should not have shadow
var p = document.getElementById('peas');
shouldBe('layoutTestController.shadowRoot(p)', 'null');

// LayoutTestController can bless ordinary elements with shadows
shadow = layoutTestController.ensureShadowRoot(p);
shouldBe('shadow.nodeName', '"#shadow-root"');
shouldBe('shadow === layoutTestController.shadowRoot(p)', 'true');

// LayoutTestController can strip elements of shadows
layoutTestController.removeShadowRoot(keygen);
shouldBe('layoutTestController.shadowRoot(keygen)', 'null');
}

var successfullyParsed = true;
</script>
<script src="../../js/resources/js-test-post.js"></script>
</body>
</html>
@@ -1,3 +1,14 @@
2011-04-20 Dominic Cooney <dominicc@chromium.org>

Reviewed by Dimitri Glazkov.

layoutTestController can create and destroy shadow DOM
https://bugs.webkit.org/show_bug.cgi?id=59058

Test: fast/dom/shadow/layout-tests-can-access-shadow.html

* WebCore.exp.in: Mac DRT needs to see Element::ensure/removeShadowRoot

2011-04-20 Pratik Solanki <psolanki@apple.com>

Reviewed by Ryosuke Niwa.
@@ -802,6 +802,8 @@ __ZN7WebCore6WidgetD2Ev
__ZN7WebCore6toNodeEN3JSC7JSValueE
__ZN7WebCore7Console21shouldPrintExceptionsEv
__ZN7WebCore7Console24setShouldPrintExceptionsEb
__ZN7WebCore7Element16ensureShadowRootEv
__ZN7WebCore7Element16removeShadowRootEv
__ZN7WebCore7IntRect5scaleEf
__ZN7WebCore7IntRect5uniteERKS0_
__ZN7WebCore7IntRect9intersectERKS0_
@@ -1,3 +1,18 @@
2011-04-20 Dominic Cooney <dominicc@chromium.org>

Reviewed by Dimitri Glazkov.

layoutTestController can create and destroy shadow DOM
https://bugs.webkit.org/show_bug.cgi?id=59058

Chromium DRT relies on the Chromium WebKit API

* public/WebElement.h:
* src/WebElement.cpp:
(WebKit::WebElement::shadowRoot): don't steal a zero refcount
(WebKit::WebElement::ensureShadowRoot): added
(WebKit::WebElement::removeShadowRoot): added

2011-04-20 Alexey Marinichev <amarinichev@chromium.org>

Reviewed by Kenneth Russell.
@@ -58,7 +58,10 @@ class WebNamedNodeMap;
WEBKIT_API bool setAttribute(const WebString& name, const WebString& value);
WEBKIT_API WebNamedNodeMap attributes() const;
WEBKIT_API WebString innerText() const;

WEBKIT_API WebNode shadowRoot();
WEBKIT_API WebNode ensureShadowRoot();
WEBKIT_API void removeShadowRoot();

// Returns the language code specified for this element. This attribute
// is inherited, so the returned value is drawn from the closest parent
@@ -92,7 +92,17 @@ WebString WebElement::innerText() const

WebNode WebElement::shadowRoot()
{
return adoptRef(static_cast<Node*>(unwrap<Element>()->shadowRoot()));
return PassRefPtr<Node>(static_cast<Node*>(unwrap<Element>()->shadowRoot()));
}

WebNode WebElement::ensureShadowRoot()
{
return PassRefPtr<Node>(static_cast<Node*>(unwrap<Element>()->ensureShadowRoot()));
}

void WebElement::removeShadowRoot()
{
unwrap<Element>()->removeShadowRoot();
}

WebString WebElement::computeInheritedLanguage() const
@@ -1,3 +1,17 @@
2011-04-20 Dominic Cooney <dominicc@chromium.org>

Reviewed by Dimitri Glazkov.

layoutTestController can create and destroy shadow DOM
https://bugs.webkit.org/show_bug.cgi?id=59058

Support for new methods in GTK DRT.

* WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
(DumpRenderTreeSupportGtk::ensureShadowRoot):
(DumpRenderTreeSupportGtk::removeShadowRoot):
* WebCoreSupport/DumpRenderTreeSupportGtk.h:

2011-04-20 Carlos Garcia Campos <cgarcia@igalia.com>

Reviewed by Martin Robinson.
@@ -664,6 +664,28 @@ JSValueRef DumpRenderTreeSupportGtk::shadowRoot(JSContextRef context, JSValueRef
return toRef(exec, toJS(exec, element->shadowRoot()));
}

JSValueRef DumpRenderTreeSupportGtk::ensureShadowRoot(JSContextRef context, JSValueRef value)
{
JSLock lock(SilenceAssertionsOnly);
JSC::ExecState* exec = toJS(context);
Element* element = toElement(toJS(exec, value));
if (!element)
return JSValueMakeNull(context);

return toRef(exec, toJS(exec, element->ensureShadowRoot()));
}

void DumpRenderTreeSupportGtk::removeShadowRoot(JSContextRef context, JSValueRef value)
{
JSLock lock(SilenceAssertionsOnly);
JSC::ExecState* exec = toJS(context);
Element* element = toElement(toJS(exec, value));
if (!element)
return;

element->removeShadowRoot();
}

unsigned int DumpRenderTreeSupportGtk::workerThreadCount()
{
#if ENABLE(WORKERS)
@@ -60,6 +60,9 @@ class DumpRenderTreeSupportGtk {
static void clearOpener(WebKitWebFrame*);

static JSValueRef shadowRoot(JSContextRef, JSValueRef);
static JSValueRef ensureShadowRoot(JSContextRef, JSValueRef);
static void removeShadowRoot(JSContextRef, JSValueRef);

static WebKitDOMRange* jsValueToDOMRange(JSContextRef, JSValueRef);

// FIXME: Move these to webkitwebframe.h once their API has been discussed.
@@ -1,3 +1,17 @@
2011-04-20 Dominic Cooney <dominicc@chromium.org>

Reviewed by Dimitri Glazkov.

layoutTestController can create and destroy shadow DOM
https://bugs.webkit.org/show_bug.cgi?id=59058

Support for new methods in Mac DRT.

* DOM/WebDOMOperations.mm:
(-[DOMElement _ensureShadowRoot:]):
(-[DOMElement _removeShadowRoot]):
* DOM/WebDOMOperationsPrivate.h:

2011-04-20 Eric Carlson <eric.carlson@apple.com>

Reviewed by Dan Bernstein.
@@ -81,6 +81,18 @@ - (JSValueRef)_shadowRoot:(JSContextRef)context
return toRef(execState, toJS(execState, core(self)->shadowRoot()));
}

- (JSValueRef)_ensureShadowRoot:(JSContextRef)context
{
JSLock lock(SilenceAssertionsOnly);
ExecState* execState = toJS(context);
return toRef(execState, toJS(execState, core(self)->ensureShadowRoot()));
}

- (void)_removeShadowRoot
{
core(self)->removeShadowRoot();
}

@end

@implementation DOMNode (WebDOMNodeOperations)
@@ -33,6 +33,8 @@
+ (DOMElement *)_DOMElementFromJSContext:(JSContextRef)context value:(JSValueRef)value;
- (NSString *)_markerTextForListItem;
- (JSValueRef)_shadowRoot:(JSContextRef)context;
- (JSValueRef)_ensureShadowRoot:(JSContextRef)context;
- (void)_removeShadowRoot;
@end

@interface DOMDocument (WebDOMDocumentOperationsPrivate)
@@ -1,3 +1,17 @@
2011-04-20 Dominic Cooney <dominicc@chromium.org>

Reviewed by Dimitri Glazkov.

layoutTestController can create and destroy shadow DOM
https://bugs.webkit.org/show_bug.cgi?id=59058

Support for new methods in Qt DRT.

* WebCoreSupport/DumpRenderTreeSupportQt.cpp:
(DumpRenderTreeSupportQt::ensureShadowRoot):
(DumpRenderTreeSupportQt::removeShadowRoot):
* WebCoreSupport/DumpRenderTreeSupportQt.h:

2011-04-20 Balazs Kelemen <kbalazs@webkit.org>

Reviewed by Csaba Osztrogonác.
@@ -1077,6 +1077,23 @@ QVariant DumpRenderTreeSupportQt::shadowRoot(const QWebElement& element)
return QVariant::fromValue(QDRTNode(webShadowRoot));
}

QVariant DumpRenderTreeSupportQt::ensureShadowRoot(const QWebElement& element)
{
WebCore::Element* webElement = element.m_element;
if (!webElement)
return QVariant();

return QVariant::fromValue(QDRTNode(webElement->ensureShadowRoot()));
}

void DumpRenderTreeSupportQt::removeShadowRoot(const QWebElement& element)
{
WebCore::Element* webElement = element.m_element;
if (!webElement)
return;
webElement->removeShadowRoot();
}

// Provide a backward compatibility with previously exported private symbols as of QtWebKit 4.6 release

void QWEBKIT_EXPORT qt_resumeActiveDOMObjects(QWebFrame* frame)
@@ -202,6 +202,8 @@ class QWEBKIT_EXPORT DumpRenderTreeSupportQt {
static void setAlternateHtml(QWebFrame*, const QString& html, const QUrl& baseUrl, const QUrl& failingUrl);

static QVariant shadowRoot(const QWebElement&);
static QVariant ensureShadowRoot(const QWebElement&);
static void removeShadowRoot(const QWebElement&);
};

#endif
@@ -1,3 +1,22 @@
2011-04-20 Dominic Cooney <dominicc@chromium.org>

Reviewed by Dimitri Glazkov.

layoutTestController can create and destroy shadow DOM
https://bugs.webkit.org/show_bug.cgi?id=59058

Support for new methods in WK2 WebKitTestRunner.

* WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp:
(WKBundleNodeHandleCopyElementEnsureShadowRoot):
(WKBundleNodeHandleRemoveShadowRoot):
* WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h:
* WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
(WebKit::InjectedBundleNodeHandle::elementShadowRoot):
(WebKit::InjectedBundleNodeHandle::elementEnsureShadowRoot):
(WebKit::InjectedBundleNodeHandle::elementRemoveShadowRoot):
* WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h:

2011-04-20 Anders Carlsson <andersca@apple.com>

Reviewed by Sam Weinig.
@@ -67,6 +67,17 @@ WKBundleNodeHandleRef WKBundleNodeHandleCopyElementShadowRoot(WKBundleNodeHandle
return toAPI(nodeHandle.release().releaseRef());
}

WKBundleNodeHandleRef WKBundleNodeHandleCopyElementEnsureShadowRoot(WKBundleNodeHandleRef elementHandleRef)
{
RefPtr<InjectedBundleNodeHandle> nodeHandle = toImpl(elementHandleRef)->elementEnsureShadowRoot();
return toAPI(nodeHandle.release().releaseRef());
}

void WKBundleNodeHandleRemoveShadowRoot(WKBundleNodeHandleRef elementHandleRef)
{
toImpl(elementHandleRef)->elementRemoveShadowRoot();
}

void WKBundleNodeHandleSetHTMLInputElementValueForUser(WKBundleNodeHandleRef htmlInputElementHandleRef, WKStringRef valueRef)
{
toImpl(htmlInputElementHandleRef)->setHTMLInputElementValueForUser(toWTFString(valueRef));
@@ -47,6 +47,8 @@ WK_EXPORT WKRect WKBundleNodeHandleGetRenderRect(WKBundleNodeHandleRef nodeHandl
/* Element Specific Operations */
WK_EXPORT WKRect WKBundleNodeHandleGetElementBounds(WKBundleNodeHandleRef elementHandle);
WK_EXPORT WKBundleNodeHandleRef WKBundleNodeHandleCopyElementShadowRoot(WKBundleNodeHandleRef elementHandle);
WK_EXPORT WKBundleNodeHandleRef WKBundleNodeHandleCopyElementEnsureShadowRoot(WKBundleNodeHandleRef elementHandle);
WK_EXPORT void WKBundleNodeHandleRemoveShadowRoot(WKBundleNodeHandleRef elementHandle);

/* HTMLInputElement Specific Operations */
WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementValueForUser(WKBundleNodeHandleRef htmlInputElementHandle, WKStringRef value);
@@ -173,6 +173,22 @@ PassRefPtr<InjectedBundleNodeHandle> InjectedBundleNodeHandle::elementShadowRoot
return getOrCreate(static_cast<Element*>(m_node.get())->shadowRoot());
}

PassRefPtr<InjectedBundleNodeHandle> InjectedBundleNodeHandle::elementEnsureShadowRoot()
{
if (!m_node->isElementNode())
return 0;

return getOrCreate(static_cast<Element*>(m_node.get())->ensureShadowRoot());
}

void InjectedBundleNodeHandle::elementRemoveShadowRoot()
{
if (!m_node->isElementNode())
return;

static_cast<Element*>(m_node.get())->removeShadowRoot();
}

PassRefPtr<WebFrame> InjectedBundleNodeHandle::documentFrame()
{
if (!m_node->isDocumentNode())
@@ -69,6 +69,8 @@ class InjectedBundleNodeHandle : public APIObject {
PassRefPtr<InjectedBundleNodeHandle> htmlTableCellElementCellAbove();

PassRefPtr<InjectedBundleNodeHandle> elementShadowRoot();
PassRefPtr<InjectedBundleNodeHandle> elementEnsureShadowRoot();
void elementRemoveShadowRoot();

PassRefPtr<WebFrame> documentFrame();
PassRefPtr<WebFrame> htmlFrameElementContentFrame();

0 comments on commit f9b01f7

Please sign in to comment.