Title: [135464] trunk
- Revision
- 135464
- Author
- morr...@google.com
- Date
- 2012-11-21 19:15:14 -0800 (Wed, 21 Nov 2012)
Log Message
[Shadow DOM] Implement Element::createShadowRoot()
https://bugs.webkit.org/show_bug.cgi?id=102911
Reviewed by Kentaro Hara.
Source/WebCore:
Added an API implementation and exposed it.
This is basically an alias of the ShadowRoot constructor, which
will be removed as bug 102913.
Test: fast/dom/shadow/shadow-aware-create-shdow-root.html
* dom/Element.cpp:
(WebCore::Element::createShadowRoot):
(WebCore):
* dom/Element.h:
(Element):
* dom/Element.idl:
LayoutTests:
The coverage might not seem comprehensive at a glance. However,
this is just an alias of ShadowRoot constructor and there are
bunch of test cases which cover it.
As bug 102913 will convert such callsites to use createShadowRoot(),
the API will get be covered well then.
* fast/dom/shadow/shadow-aware-create-shdow-root-expected.txt: Added.
* fast/dom/shadow/shadow-aware-create-shdow-root.html: Added.
Further ShadowAware API will come here.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (135463 => 135464)
--- trunk/LayoutTests/ChangeLog 2012-11-22 03:08:46 UTC (rev 135463)
+++ trunk/LayoutTests/ChangeLog 2012-11-22 03:15:14 UTC (rev 135464)
@@ -1,3 +1,21 @@
+2012-11-21 Hajime Morrita <morr...@google.com>
+
+ [Shadow DOM] Implement Element::createShadowRoot()
+ https://bugs.webkit.org/show_bug.cgi?id=102911
+
+ Reviewed by Kentaro Hara.
+
+ The coverage might not seem comprehensive at a glance. However,
+ this is just an alias of ShadowRoot constructor and there are
+ bunch of test cases which cover it.
+
+ As bug 102913 will convert such callsites to use createShadowRoot(),
+ the API will get be covered well then.
+
+ * fast/dom/shadow/shadow-aware-create-shdow-root-expected.txt: Added.
+ * fast/dom/shadow/shadow-aware-create-shdow-root.html: Added.
+ Further ShadowAware API will come here.
+
2012-11-21 Dana Jansens <dan...@chromium.org>
Remove crashing expectation for css3/filters/effect-reference-ordering-hw.html
Added: trunk/LayoutTests/fast/dom/shadow/shadow-aware-create-shadow-root-expected.txt (0 => 135464)
--- trunk/LayoutTests/fast/dom/shadow/shadow-aware-create-shadow-root-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/shadow-aware-create-shadow-root-expected.txt 2012-11-22 03:15:14 UTC (rev 135464)
@@ -0,0 +1,13 @@
+Tests for ShadowAware JS APIs.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS root1.constructor is window.WebKitShadowRoot
+PASS root1 is not root2
+PASS root1 is window.internals.oldestShadowRoot(host)
+PASS root2 is window.internals.youngestShadowRoot(host)
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/dom/shadow/shadow-aware-create-shadow-root.html (0 => 135464)
--- trunk/LayoutTests/fast/dom/shadow/shadow-aware-create-shadow-root.html (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/shadow-aware-create-shadow-root.html 2012-11-22 03:15:14 UTC (rev 135464)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+description("Tests for ShadowAware JS APIs.");
+
+// ShadowAware.createShadowRoot()
+var host = document.createElement('div');
+var root1 = host.createShadowRoot();
+var root2 = host.createShadowRoot();
+shouldBe("root1.constructor", "window.WebKitShadowRoot");
+shouldNotBe("root1", "root2");
+shouldBe("root1", "window.internals.oldestShadowRoot(host)");
+shouldBe("root2", "window.internals.youngestShadowRoot(host)");
+
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (135463 => 135464)
--- trunk/Source/WebCore/ChangeLog 2012-11-22 03:08:46 UTC (rev 135463)
+++ trunk/Source/WebCore/ChangeLog 2012-11-22 03:15:14 UTC (rev 135464)
@@ -1,3 +1,24 @@
+2012-11-21 Hajime Morrita <morr...@google.com>
+
+ [Shadow DOM] Implement Element::createShadowRoot()
+ https://bugs.webkit.org/show_bug.cgi?id=102911
+
+ Reviewed by Kentaro Hara.
+
+ Added an API implementation and exposed it.
+
+ This is basically an alias of the ShadowRoot constructor, which
+ will be removed as bug 102913.
+
+ Test: fast/dom/shadow/shadow-aware-create-shdow-root.html
+
+ * dom/Element.cpp:
+ (WebCore::Element::createShadowRoot):
+ (WebCore):
+ * dom/Element.h:
+ (Element):
+ * dom/Element.idl:
+
2012-11-20 James Simonsen <simon...@chromium.org>
[Resource Timing] Populate PerformanceResourceTiming structs with timing data
Modified: trunk/Source/WebCore/dom/Element.cpp (135463 => 135464)
--- trunk/Source/WebCore/dom/Element.cpp 2012-11-22 03:08:46 UTC (rev 135463)
+++ trunk/Source/WebCore/dom/Element.cpp 2012-11-22 03:15:14 UTC (rev 135464)
@@ -1429,6 +1429,11 @@
return data->m_shadow.get();
}
+PassRefPtr<ShadowRoot> Element::createShadowRoot(ExceptionCode& ec)
+{
+ return ShadowRoot::create(this, ec);
+}
+
ShadowRoot* Element::userAgentShadowRoot() const
{
if (ElementShadow* elementShadow = shadow()) {
Modified: trunk/Source/WebCore/dom/Element.h (135463 => 135464)
--- trunk/Source/WebCore/dom/Element.h 2012-11-22 03:08:46 UTC (rev 135463)
+++ trunk/Source/WebCore/dom/Element.h 2012-11-22 03:15:14 UTC (rev 135464)
@@ -274,6 +274,8 @@
ElementShadow* shadow() const;
ElementShadow* ensureShadow();
+ PassRefPtr<ShadowRoot> createShadowRoot(ExceptionCode&);
+
virtual void willAddAuthorShadowRoot() { }
virtual bool areAuthorShadowsAllowed() const { return true; }
Modified: trunk/Source/WebCore/dom/Element.idl (135463 => 135464)
--- trunk/Source/WebCore/dom/Element.idl 2012-11-22 03:08:46 UTC (rev 135463)
+++ trunk/Source/WebCore/dom/Element.idl 2012-11-22 03:15:14 UTC (rev 135464)
@@ -147,6 +147,10 @@
[V8EnabledAtRuntime] void webkitRequestFullscreen();
#endif
+#if defined(ENABLE_SHADOW_DOM) && ENABLE_SHADOW_DOM
+ [V8EnabledAtRuntime=shadowDOM] ShadowRoot createShadowRoot() raises(DOMException);
+#endif
+
[Conditional=POINTER_LOCK] void webkitRequestPointerLock();
// CSS Regions API
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes