Title: [189841] trunk
Revision
189841
Author
rn...@webkit.org
Date
2015-09-15 19:40:53 -0700 (Tue, 15 Sep 2015)

Log Message

Add ShadowRoot interface and Element.prototype.attachShadow
https://bugs.webkit.org/show_bug.cgi?id=149187

Reviewed by Antti Koivisto.

.:

* Source/cmake/OptionsGTK.cmake:

Source/_javascript_Core:

* Configurations/FeatureDefines.xcconfig:

Source/WebCore:

Add back ShadowRoot IDL interface and Element.prototype.attachShadow in accordance with
http://w3c.github.io/webcomponents/spec/shadow/ at db27e6e36eab512d86edcdabb33ed27b5751acd7 excluding getSelection(),
elementFromPoint(), elementsFromPoint(), caretPositionFromPoint(), and styleSheets attribute on ShadowRoot interface.

The feature is enabled by default on Mac and iOS ports for testing and disabled by default elsewhere.

Also added HTMLElement::canHaveUserAgentShadowRoot which returns false by default and overridden elsewhere to return true
to distinguish elements for which attachShadow is supposed to throw NotSupported.
See https://w3c.github.io/webcomponents/spec/shadow/#widl-Element-attachShadow-ShadowRoot-ShadowRootInit-shadowRootInitDict

Tests: fast/shadow-dom/Element-interface-attachShadow.html
       fast/shadow-dom/Element-interface-shadowRoot-attribute.html
       fast/shadow-dom/ShadowRoot-interface.html

* CMakeLists.txt:
* Configurations/FeatureDefines.xcconfig:
* DerivedSources.cpp:
* DerivedSources.make:
* PlatformGTK.cmake:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::matchRecursively):
* dom/Element.cpp:
(WebCore::Element::bindingsOffsetParent):
(WebCore::Element::offsetParent):
(WebCore::Element::addShadowRoot):
(WebCore::Element::createShadowRoot):
(WebCore::Element::attachShadow): Added.
(WebCore::Element::bindingShadowRoot): Added. Returns null unless the attached shadow root is in the "open" mode.
* dom/Element.h:
* dom/Element.idl: Added attachShadow and shadowRoot. We only expose these to JS for now since Dictionary argument isn't
supported by other binding code.
* dom/ShadowRoot.cpp: Removed an unused enum.
* dom/ShadowRoot.h:
(WebCore::ShadowRoot::Type): Replaced old-style enum "ShadowRootType" by an enum class named "Type". Also added two new
values Open and Closed for author shadow roots.
(WebCore::ShadowRoot::type):
* dom/ShadowRoot.idl: Added.
* html/HTMLButtonElement.h:
* html/HTMLDetailsElement.h:
(HTMLButtonElement::canHaveUserAgentShadowRoot): Ditto.
* html/HTMLElement.h:
(WebCore::HTMLElement::canHaveUserAgentShadowRoot): Added. Returns false by default.
* html/HTMLInputElement.h:
* html/HTMLKeygenElement.h:
* html/HTMLMarqueeElement.h:
* html/HTMLMediaElement.h:
* html/HTMLMeterElement.h:
* html/HTMLPlugInElement.h:
* html/HTMLProgressElement.h:
* html/HTMLSelectElement.h:
* html/HTMLSummaryElement.h:
* html/HTMLTextAreaElement.h:
* html/shadow/InsertionPoint.h:
(ShadowRootWithInsertionPoints::ShadowRootWithInsertionPoints):
* rendering/RenderElement.cpp:
(WebCore::RenderElement::selectionPseudoStyle):
* rendering/RenderLayer.cpp:
(WebCore::rendererForScrollbar):
* svg/SVGElement.cpp:
(WebCore::SVGElement::correspondingUseElement):
* testing/Internals.cpp:
(WebCore::Internals::shadowRootType):

Source/WebKit/mac:

* Configurations/FeatureDefines.xcconfig:

Source/WebKit2:

* Configurations/FeatureDefines.xcconfig:

Source/WTF:

* wtf/FeatureDefines.h:

Tools:

* Scripts/webkitperl/FeatureList.pm:

LayoutTests:

Add new tests for Shadow DOM with failing expectations on all platforms but Mac.

* TestExpectations:
* fast/shadow-dom: Added.
* fast/shadow-dom/Element-interface-attachShadow-expected.txt: Added.
* fast/shadow-dom/Element-interface-attachShadow.html: Added.
* fast/shadow-dom/Element-interface-shadowRoot-attribute-expected.txt: Added.
* fast/shadow-dom/Element-interface-shadowRoot-attribute.html: Added.
* fast/shadow-dom/ShadowRoot-interface-expected.txt: Added.
* fast/shadow-dom/ShadowRoot-interface.html: Added.
* js/dom/dom-static-property-for-in-iteration-expected.txt:
* platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt:
* platform/mac/TestExpectations:
* platform/mac/js/dom/constructor-length-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/ChangeLog (189840 => 189841)


--- trunk/ChangeLog	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/ChangeLog	2015-09-16 02:40:53 UTC (rev 189841)
@@ -1,3 +1,12 @@
+2015-09-15  Ryosuke Niwa  <rn...@webkit.org>
+
+        Add ShadowRoot interface and Element.prototype.attachShadow
+        https://bugs.webkit.org/show_bug.cgi?id=149187
+
+        Reviewed by Antti Koivisto.
+
+        * Source/cmake/OptionsGTK.cmake:
+
 2015-09-15  Csaba Osztrogonác  <o...@webkit.org>
 
         [cmake] Enable debug fission only if it is supported

Modified: trunk/LayoutTests/ChangeLog (189840 => 189841)


--- trunk/LayoutTests/ChangeLog	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/LayoutTests/ChangeLog	2015-09-16 02:40:53 UTC (rev 189841)
@@ -1,3 +1,25 @@
+2015-09-15  Ryosuke Niwa  <rn...@webkit.org>
+
+        Add ShadowRoot interface and Element.prototype.attachShadow
+        https://bugs.webkit.org/show_bug.cgi?id=149187
+
+        Reviewed by Antti Koivisto.
+
+        Add new tests for Shadow DOM with failing expectations on all platforms but Mac.
+
+        * TestExpectations:
+        * fast/shadow-dom: Added.
+        * fast/shadow-dom/Element-interface-attachShadow-expected.txt: Added.
+        * fast/shadow-dom/Element-interface-attachShadow.html: Added.
+        * fast/shadow-dom/Element-interface-shadowRoot-attribute-expected.txt: Added.
+        * fast/shadow-dom/Element-interface-shadowRoot-attribute.html: Added.
+        * fast/shadow-dom/ShadowRoot-interface-expected.txt: Added.
+        * fast/shadow-dom/ShadowRoot-interface.html: Added.
+        * js/dom/dom-static-property-for-in-iteration-expected.txt:
+        * platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt:
+        * platform/mac/TestExpectations:
+        * platform/mac/js/dom/constructor-length-expected.txt:
+
 2015-09-15  Jinyoung Hur  <hur....@navercorp.com>
 
         [WebGL] Only require that the stencil value and write masks have as many bits set as the stencil buffer is deep

Modified: trunk/LayoutTests/TestExpectations (189840 => 189841)


--- trunk/LayoutTests/TestExpectations	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/LayoutTests/TestExpectations	2015-09-16 02:40:53 UTC (rev 189841)
@@ -40,7 +40,6 @@
 # End platform-specific tests.
 #//////////////////////////////////////////////////////////////////////////////////////////
 
-
 # pending functional patch and per-port verification
 webkit.org/b/109954 css3/line-break [ Skip ]
 
@@ -677,3 +676,5 @@
 webkit.org/b/148925 svg/dom/svg-root-lengths.html [ Pass Failure ]
 
 webkit.org/b/149082 http/tests/xmlhttprequest/timeout/xmlhttprequest-timeout-overridesexpires.html [ Pass Failure ]
+
+webkit.org/b/148695 fast/shadow-dom [ Failure ]

Added: trunk/LayoutTests/fast/shadow-dom/Element-interface-attachShadow-expected.txt (0 => 189841)


--- trunk/LayoutTests/fast/shadow-dom/Element-interface-attachShadow-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/shadow-dom/Element-interface-attachShadow-expected.txt	2015-09-16 02:40:53 UTC (rev 189841)
@@ -0,0 +1,8 @@
+
+PASS Check the existence of Element.attachShadow 
+PASS Nodes other than Element should not have attachShadow 
+PASS Element.attachShadow must throw a TypeError if mode is not "open" or "closed" 
+PASS Element.attachShadow must create an instance of ShadowRoot 
+PASS Element.attachShadow must throw a InvalidStateError if the context object already hosts a shadow tree 
+PASS Element.attachShadow must throw a NotSupportedError for button, details, input, marquee, meter, progress, select, textarea, and keygen elements 
+

Added: trunk/LayoutTests/fast/shadow-dom/Element-interface-attachShadow.html (0 => 189841)


--- trunk/LayoutTests/fast/shadow-dom/Element-interface-attachShadow.html	                        (rev 0)
+++ trunk/LayoutTests/fast/shadow-dom/Element-interface-attachShadow.html	2015-09-16 02:40:53 UTC (rev 189841)
@@ -0,0 +1,95 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Shadow DOM: Attaching a ShadowRoot</title>
+<meta name="author" title="Ryosuke Niwa" href=""
+<meta name="assert" content="Element.prototype.attachShadow should create an instance of ShadowRoot">
+<link rel="help" href=""
+<script src=""
+<script src=""
+<link rel='stylesheet' href=''>
+</head>
+<body>
+<div id="log"></div>
+<script>
+
+test(function () {
+    assert_true('attachShadow' in Element.prototype, 'Element.prototype.attachShadow must exist');
+    assert_equals(typeof(document.createElement('div').attachShadow), 'function', 'An instance of div must have attachShadow which is a function');
+}, 'Check the existence of Element.attachShadow');
+
+test(function () {
+    assert_false('attachShadow' in Node.prototype, 'Node.prototype.attachShadow must not exist');
+    assert_false('attachShadow' in CharacterData.prototype, 'CharacterData.prototype.attachShadow must not exist');
+    assert_false('attachShadow' in Comment.prototype, 'Comment.prototype.attachShadow must not exist');
+    assert_equals(typeof(document.createComment('').attachShadow), 'undefined', 'An instance of comment must not have attachShadow');
+    assert_false('attachShadow' in Document.prototype, 'Document.prototype.attachShadow must not exist');
+    assert_equals(typeof(document.attachShadow), 'undefined', 'An instance of document must not have attachShadow which is a function');
+    assert_false('attachShadow' in DocumentFragment.prototype, 'DocumentFragment.prototype.attachShadow must not exist');
+    assert_equals(typeof((new DOMParser()).parseFromString('', 'text/html').attachShadow), 'undefined', 'An instance of document must not have attachShadow which is a function');
+    assert_false('attachShadow' in Text.prototype, 'Text.prototype.attachShadow must not exist');
+    assert_equals(typeof(document.createTextNode('').attachShadow), 'undefined', 'An instance of text node must not have attachShadow');
+}, 'Nodes other than Element should not have attachShadow');
+
+test(function () {
+    assert_throws({'name': 'TypeError'}, function () {
+        document.createElement('div').attachShadow({})
+    }, 'attachShadow must throw a TypeError when mode is omitted');
+
+    assert_throws({'name': 'TypeError'}, function () {
+        document.createElement('div').attachShadow({mode: true})
+    }, 'attachShadow must throw a TypeError when mode is a boolean');
+
+    assert_throws({'name': 'TypeError'}, function () {
+        document.createElement('div').attachShadow({mode: 1})
+    }, 'attachShadow must throw a TypeError when mode is 1');
+}, 'Element.attachShadow must throw a TypeError if mode is not "open" or "closed"');
+
+test(function () {
+    assert_true(document.createElement('div').attachShadow({mode: "open"}) instanceof ShadowRoot,
+        'attachShadow({mode: "open"}) should create an instance of ShadowRoot');
+    assert_true(document.createElement('div').attachShadow({mode: "closed"}) instanceof ShadowRoot,
+        'attachShadow({mode: "closed"}) should create an instance of ShadowRoot');
+}, 'Element.attachShadow must create an instance of ShadowRoot');
+
+test(function () {
+    assert_throws({'name': 'InvalidStateError'}, function () {
+        var div = document.createElement('div');
+        div.attachShadow({mode: "open"});
+        div.attachShadow({mode: "open"});
+    }, 'Calling attachShadow({mode: "open"}) twice on the same element must throw');
+
+    assert_throws({'name': 'InvalidStateError'}, function () {
+        var div = document.createElement('div');
+        div.attachShadow({mode: "closed"});
+        div.attachShadow({mode: "closed"});
+    }, 'Calling attachShadow({mode: "closed"}) twice on the same element must throw');
+
+    assert_throws({'name': 'InvalidStateError'}, function () {
+        var div = document.createElement('div');
+        div.attachShadow({mode: "open"});
+        div.attachShadow({mode: "closed"});
+    }, 'Calling attachShadow({mode: "closed"}) after attachShadow({mode: "open"}) on the same element must throw');
+
+    assert_throws({'name': 'InvalidStateError'}, function () {
+        var div = document.createElement('div');
+        div.attachShadow({mode: "closed"});
+        div.attachShadow({mode: "open"});
+    }, 'Calling attachShadow({mode: "open"}) after attachShadow({mode: "closed"}) on the same element must throw');
+}, 'Element.attachShadow must throw a InvalidStateError if the context object already hosts a shadow tree');
+
+test(function () {
+    for (var elementName of ['button', 'details', 'input', 'marquee', 'meter', 'progress', 'select', 'textarea', 'keygen']) {
+        assert_throws({'name': 'NotSupportedError'}, function () {
+            document.createElement(elementName).attachShadow({mode: "open"});
+        }, 'Calling attachShadow({mode: "open"}) on ' + elementName + ' element must throw');
+
+        assert_throws({'name': 'NotSupportedError'}, function () {
+            document.createElement(elementName).attachShadow({mode: "closed"});
+        }, 'Calling attachShadow({mode: "closed"}) on ' + elementName + ' element must throw');
+    }
+}, 'Element.attachShadow must throw a NotSupportedError for button, details, input, marquee, meter, progress, select, textarea, and keygen elements');
+
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/fast/shadow-dom/Element-interface-shadowRoot-attribute-expected.txt (0 => 189841)


--- trunk/LayoutTests/fast/shadow-dom/Element-interface-shadowRoot-attribute-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/shadow-dom/Element-interface-shadowRoot-attribute-expected.txt	2015-09-16 02:40:53 UTC (rev 189841)
@@ -0,0 +1,5 @@
+
+PASS shadowRoot must be defined on Element prototype 
+PASS shadowRoot attribute must return the open shadow root associated with the element 
+PASS shadowRoot attribute must return null if the shadow root attached to the element is closed 
+

Added: trunk/LayoutTests/fast/shadow-dom/Element-interface-shadowRoot-attribute.html (0 => 189841)


--- trunk/LayoutTests/fast/shadow-dom/Element-interface-shadowRoot-attribute.html	                        (rev 0)
+++ trunk/LayoutTests/fast/shadow-dom/Element-interface-shadowRoot-attribute.html	2015-09-16 02:40:53 UTC (rev 189841)
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Shadow DOM: Element interface shadowRoot attribute</title>
+<meta name="author" title="Ryosuke Niwa" href=""
+<meta name="assert" content="shadowRoot attribute on Element interface must return the associated open shadow tree if there is one">
+<link rel="help" href=""
+<script src=""
+<script src=""
+<link rel='stylesheet' href=''>
+</head>
+<body>
+<div id="log"></div>
+<script>
+
+test(function () {
+    assert_true('shadowRoot' in Element.prototype, 'shadowRoot must be defined on Element prototype');
+    assert_true('shadowRoot' in document.createElement('div'), 'shadowRoot must be defined on an instance of div element');
+    assert_false('shadowRoot' in Node.prototype, 'shadowRoot must not be defined on Node prototype');
+    assert_false('shadowRoot' in Text.prototype, 'shadowRoot must not be defined on Text prototype');
+    assert_false('shadowRoot' in document.createTextNode(''), 'shadowRoot must not be defined on an instance of Text node');
+    assert_false('shadowRoot' in Comment.prototype, 'shadowRoot must not be defined on Comment prototype');
+    assert_false('shadowRoot' in document.createComment(''), 'shadowRoot must not be defined on an instance of Comment node');
+    assert_false('shadowRoot' in Document.prototype, 'shadowRoot must not be defined on Document prototype');
+    assert_false('shadowRoot' in document, 'shadowRoot must not be defined on an instance of Document');
+    assert_false('shadowRoot' in DocumentFragment.prototype, 'shadowRoot must not be defined on DocumentFragment prototype');
+    assert_false('shadowRoot' in (new DOMParser).parseFromString('', 'text/html'), 'shadowRoot must not be defined on an instance of DocumentFragment node');
+}, 'shadowRoot must be defined on Element prototype');
+
+test(function () {
+    var host = document.createElement('div');
+    assert_equals(host.shadowRoot, null, 'shadowRoot must return null when the host does not have a shadow tree attached to it');
+
+    var openShadowRoot = host.attachShadow({mode: 'open'});
+    assert_equals(host.shadowRoot, openShadowRoot, 'shadowRoot must return the open shadow root attachShadow attached');
+}, 'shadowRoot attribute must return the open shadow root associated with the element');
+
+test(function () {
+    var host = document.createElement('div');
+    host.attachShadow({mode: 'closed'});
+    assert_equals(host.shadowRoot, null);
+}, 'shadowRoot attribute must return null if the shadow root attached to the element is closed');
+
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/fast/shadow-dom/ShadowRoot-interface-expected.txt (0 => 189841)


--- trunk/LayoutTests/fast/shadow-dom/ShadowRoot-interface-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/shadow-dom/ShadowRoot-interface-expected.txt	2015-09-16 02:40:53 UTC (rev 189841)
@@ -0,0 +1,15 @@
+Blocked access to external URL https://svn.webkit.org/repository/webkit/trunk/LayoutTests/resources/testharness.css
+
+PASS Check the existence of ShadowRoot interface 
+PASS ShadowRoot must inherit from DocumentFragment 
+PASS ShadowRoot must not be a constructor 
+PASS ShadowRoot.activeElement must return the focused element of the context object when shadow root is open. 
+PASS ShadowRoot.activeElement must return the focused element of the context object when shadow root is closed. 
+PASS ShadowRoot.host must return the shadow host of the context object. 
+PASS ShadowRoot.innerHTML must return the result of the HTML fragment serialization algorithm when shadow root is open. 
+PASS ShadowRoot.innerHTML must return the result of the HTML fragment serialization algorithm when shadow root is closed. 
+PASS ShadowRoot.innerHTML must replace all with the result of invoking the fragment parsing algorithm when shadow root is open. 
+PASS ShadowRoot.innerHTML must replace all with the result of invoking the fragment parsing algorithm when shadow root is closed. 
+FAIL ShadowRoot.styleSheets must return a StyleSheetList sequence containing the shadow root style sheets when shadow root is open. undefined is not an object (evaluating 'shadowRoot.styleSheets.length')
+FAIL ShadowRoot.styleSheets must return a StyleSheetList sequence containing the shadow root style sheets when shadow root is closed. undefined is not an object (evaluating 'shadowRoot.styleSheets.length')
+

Added: trunk/LayoutTests/fast/shadow-dom/ShadowRoot-interface.html (0 => 189841)


--- trunk/LayoutTests/fast/shadow-dom/ShadowRoot-interface.html	                        (rev 0)
+++ trunk/LayoutTests/fast/shadow-dom/ShadowRoot-interface.html	2015-09-16 02:40:53 UTC (rev 189841)
@@ -0,0 +1,112 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Shadow DOM: ShadowRoot interface</title>
+<meta name="author" title="Ryosuke Niwa" href=""
+<meta name="assert" content="ShadowRoot interface and its attributes must be defined">
+<link rel="help" href=""
+<script src=""
+<script src=""
+<link rel='stylesheet' href=''>
+</head>
+<body>
+<div id="log"></div>
+<script>
+
+test(function () {
+    assert_true('ShadowRoot' in window, '"ShadowRoot" exists on window');
+}, 'Check the existence of ShadowRoot interface');
+
+test(function () {
+    assert_equals(ShadowRoot.prototype.__proto__, DocumentFragment.prototype, 'ShadowRoot must inherit from DocumentFragment');
+}, 'ShadowRoot must inherit from DocumentFragment');
+
+test(function () {
+    assert_throws({'name': 'TypeError'}, function () { new ShadowRoot(); }, 'new ShadowRoot() must throw a TypeError');
+}, 'ShadowRoot must not be a constructor');
+
+function testActiveElement(mode) {
+    test(function () {
+        var host = document.createElement('div');
+        document.body.appendChild(host);
+        var shadowRoot = host.attachShadow({'mode': mode});
+        shadowRoot.appendChild(document.createElement('input'));
+        assert_equals(shadowRoot.activeElement, null, 'ShadowRoot.host must return null if an ' + mode + ' shadow tree does not have a focused element');
+        shadowRoot.firstChild.focus();
+        assert_equals(shadowRoot.activeElement, shadowRoot.firstChild, 'ShadowRoot.host must return the focused element of an ' + mode + ' shadow tree');
+        host.remove();
+        assert_equals(shadowRoot.activeElement, null, 'ShadowRoot.host must return null if an ' + mode + ' shadow tree lost focus');
+    }, 'ShadowRoot.activeElement must return the focused element of the context object when shadow root is ' + mode + '.');
+}
+
+testActiveElement('open');
+testActiveElement('closed');
+
+test(function () {
+    var host1 = document.createElement('div');
+    assert_equals(host1.attachShadow({'mode': 'open'}).host, host1, 'ShadowRoot.host must return the shadow host of an open shadow tree')
+
+    var host2 = document.createElement('div');
+    assert_equals(host2.attachShadow({'mode': 'closed'}).host, host2, 'ShadowRoot.host must return the shadow host of a closed shadow tree');
+}, 'ShadowRoot.host must return the shadow host of the context object.');
+
+function testInnerHTML(mode) {
+    test(function () {
+        var host = document.createElement('div');
+        var shadowRoot = host.attachShadow({'mode': mode});
+        assert_equals(shadowRoot.innerHTML, '', 'ShadowRoot.innerHTML must be an empty string when the shadow root does not have any children');
+
+        shadowRoot.appendChild(document.createTextNode('hello'));
+        assert_equals(shadowRoot.innerHTML, 'hello', 'ShadowRoot.innerHTML must serialize a text node child');
+
+        shadowRoot.appendChild(document.createElement('span'));
+        assert_equals(shadowRoot.innerHTML, 'hello<span></span>', 'ShadowRoot.innerHTML must serialize a HTML element child');
+    }, 'ShadowRoot.innerHTML must return the result of the HTML fragment serialization algorithm when shadow root is ' + mode + '.');
+}
+
+testInnerHTML('open');
+testInnerHTML('closed');
+
+function testSetInnerHTML(mode) {
+    test(function () {
+        var host = document.createElement('div');
+        var shadowRoot = host.attachShadow({'mode': mode});
+        shadowRoot.innerHTML = 'hello';
+        assert_equals(shadowRoot.childNodes.length, 1, 'ShadowRoot.innerHTML = "hello" must insert a single child (text node)');
+        assert_true(shadowRoot.firstChild instanceof Text, 'The first child of the shadow root after ShadowRoot.innerHTML = "hello" must be a Text node');
+        assert_equals(shadowRoot.firstChild.data, 'hello', 'The first Text node should contain the string "hello" after ShadowRoot.innerHTML = "hello"');
+
+        shadowRoot.innerHTML = '<b>hello</b>';
+        assert_equals(shadowRoot.childNodes.length, 1, 'ShadowRoot.innerHTML = "<b>hello</b>" must insert a single child (b)');
+        assert_true(shadowRoot.firstChild instanceof HTMLElement, 'The first child of the shadow root after ShadowRoot.innerHTML = "<b>hello</b>" must be a HTML element');
+        assert_equals(shadowRoot.firstChild.localName, 'b', 'The local name of the shadow root\'s first child after ShadowRoot.innerHTML = "<b>hello</b>" must be "b"');
+        assert_equals(shadowRoot.innerHTML, '<b>hello</b>', 'ShadowRoot.innerHTML must be "<b>hello</b>" after ShadowRoot.innerHTML = "<b>hello</b>"');
+
+        shadowRoot.innerHTML = '';
+        assert_equals(shadowRoot.childNodes.length, 0, 'ShadowRoot.innerHTML = "" must remove all its children');
+    }, 'ShadowRoot.innerHTML must replace all with the result of invoking the fragment parsing algorithm when shadow root is ' + mode + '.');
+}
+
+testSetInnerHTML('open');
+testSetInnerHTML('closed');
+
+function testStyleSheets(mode) {
+    test(function () {
+        var host = document.createElement('div');
+        var shadowRoot = host.attachShadow({'mode': mode});
+
+        assert_equals(shadowRoot.styleSheets.length, 0, 'shadowRoot.styleSheets must be empty when the shadow root does not contain any stylesheets');
+        shadowRoot.innerHTML = '<span></span><style> a.rule {} </style><style> b.rule {} </style>';
+        assert_equals(shadowRoot.styleSheets.length, 2, 'shadowRoot.styleSheets must contain two items when the shadow root has two style elements');
+        var styles = shadowRoot.querySelectorAll('style');
+        assert_equals(shadowRoot.styleSheets[0], styles[0].sheet, 'shadowRoot.styleSheets[0] must be the first style element in the shadow root');
+        assert_equals(shadowRoot.styleSheets[1], styles[1].sheet, 'shadowRoot.styleSheets[1] must be the second style element in the shadow root');
+    }, 'ShadowRoot.styleSheets must return a StyleSheetList sequence containing the shadow root style sheets when shadow root is ' + mode + '.');
+}
+
+testStyleSheets('open');
+testStyleSheets('closed');
+
+</script>
+</body>
+</html>

Modified: trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt (189840 => 189841)


--- trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt	2015-09-16 02:40:53 UTC (rev 189841)
@@ -66,6 +66,7 @@
 PASS a["dataset"] is [object DOMStringMap]
 PASS a["uiactions"] is 
 PASS a["webkitRegionOverset"] is undefined
+PASS a["shadowRoot"] is null
 PASS a["previousElementSibling"] is [object HTMLDivElement]
 PASS a["nextElementSibling"] is [object HTMLScriptElement]
 PASS a["children"] is [object HTMLCollection]

Modified: trunk/LayoutTests/platform/mac/TestExpectations (189840 => 189841)


--- trunk/LayoutTests/platform/mac/TestExpectations	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2015-09-16 02:40:53 UTC (rev 189841)
@@ -1291,3 +1291,5 @@
 [ Mavericks Yosemite ] fast/text/international/system-language/han-quotes.html [ ImageOnlyFailure ]
 
 webkit.org/b/149128 fast/text/control-characters [ ImageOnlyFailure ]
+
+webkit.org/b/148695 fast/shadow-dom [ Pass ]

Modified: trunk/LayoutTests/platform/mac/js/dom/constructor-length-expected.txt (189840 => 189841)


--- trunk/LayoutTests/platform/mac/js/dom/constructor-length-expected.txt	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/LayoutTests/platform/mac/js/dom/constructor-length-expected.txt	2015-09-16 02:40:53 UTC (rev 189841)
@@ -35,7 +35,7 @@
 FAIL PeerConnection.length should be 2. Threw exception ReferenceError: Can't find variable: PeerConnection
 PASS PopStateEvent.length is 1
 PASS ProgressEvent.length is 1
-FAIL ShadowRoot.length should be 1. Threw exception ReferenceError: Can't find variable: ShadowRoot
+FAIL ShadowRoot.length should be 1. Was 0.
 PASS StorageEvent.length is 1
 PASS TextTrackCue.length is 3
 PASS TrackEvent.length is 1

Modified: trunk/LayoutTests/platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt (189840 => 189841)


--- trunk/LayoutTests/platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/LayoutTests/platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt	2015-09-16 02:40:53 UTC (rev 189841)
@@ -1753,6 +1753,11 @@
 PASS Object.getOwnPropertyDescriptor(global, 'Selection').hasOwnProperty('set') is false
 PASS Object.getOwnPropertyDescriptor(global, 'Selection').enumerable is false
 PASS Object.getOwnPropertyDescriptor(global, 'Selection').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'ShadowRoot').value is ShadowRoot
+PASS Object.getOwnPropertyDescriptor(global, 'ShadowRoot').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ShadowRoot').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ShadowRoot').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'ShadowRoot').configurable is true
 PASS Object.getOwnPropertyDescriptor(global, 'SpeechSynthesisEvent').value is SpeechSynthesisEvent
 PASS Object.getOwnPropertyDescriptor(global, 'SpeechSynthesisEvent').hasOwnProperty('get') is false
 PASS Object.getOwnPropertyDescriptor(global, 'SpeechSynthesisEvent').hasOwnProperty('set') is false

Modified: trunk/Source/_javascript_Core/ChangeLog (189840 => 189841)


--- trunk/Source/_javascript_Core/ChangeLog	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-09-16 02:40:53 UTC (rev 189841)
@@ -1,3 +1,12 @@
+2015-09-15  Ryosuke Niwa  <rn...@webkit.org>
+
+        Add ShadowRoot interface and Element.prototype.attachShadow
+        https://bugs.webkit.org/show_bug.cgi?id=149187
+
+        Reviewed by Antti Koivisto.
+
+        * Configurations/FeatureDefines.xcconfig:
+
 2015-09-15  Joseph Pecoraro  <pecor...@apple.com>
 
         Web Inspector: Paused Debugger prevents page reload

Modified: trunk/Source/_javascript_Core/Configurations/FeatureDefines.xcconfig (189840 => 189841)


--- trunk/Source/_javascript_Core/Configurations/FeatureDefines.xcconfig	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/_javascript_Core/Configurations/FeatureDefines.xcconfig	2015-09-16 02:40:53 UTC (rev 189841)
@@ -228,4 +228,6 @@
 
 ENABLE_SATURATED_LAYOUT_ARITHMETIC = ENABLE_SATURATED_LAYOUT_ARITHMETIC;
 
-FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCELERATED_OVERFLOW_SCROLLING) $(ENABLE_AVF_CAPTIONS) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CANVAS_PATH) $(ENABLE_CANVAS_PROXY) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_ES6_ARROWFUNCTION_SYNTAX) $(ENABLE_ES6_CLASS_SYNTAX) $(ENABLE_ES6_MODULES) $(ENABLE_ES6_TEMPLATE_LITERAL_SYNTAX) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_ANIMATIONS_LEVEL_2) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_SHAPES) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS3_TEXT_LINE_BREAK) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION)
  $(ENABLE_DOM4_EVENTS_CONSTRUCTOR) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_ENCRYPTED_MEDIA_V2) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FONT_LOAD_EVENTS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GAMEPAD_DEPRECATED) $(ENABLE_GEOLOCATION) $(ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING) $(ENABLE_ICONDATABASE) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INDIE_UI) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_COLOR_POPOVER) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_INTL) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TEXT_AUTOSIZING) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LEGACY_VENDOR_PREFIXES) $(ENABLE_LEGACY_WEB_AUDIO) $(ENABLE_LETTERPRESS) $(ENABLE_LINK_PREFETCH) $(ENABLE_MATHML) $(ENA
 BLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NAVIGATOR_HWCONCURRENCY) $(ENABLE_NOTIFICATIONS) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_PICTURE_SIZES) $(ENABLE_POINTER_LOCK) $(ENABLE_PROXIMITY_EVENTS) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_REQUEST_AUTOCOMPLETE) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RUBBER_BANDING) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SUBTLE_CRYPTO) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_OTF_CONVERTER) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEMPLATE_ELEMENT) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_USERSELECT_ALL) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_DATACUE_VALUE) $(ENABL
 E_VIEW_MODE_CSS_MEDIA) $(ENABLE_WEBASSEMBLY) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_REPLAY) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_XHR_TIMEOUT) $(ENABLE_XSLT) $(ENABLE_FTL_JIT) $(ENABLE_JIT) $(ENABLE_SATURATED_LAYOUT_ARITHMETIC) $(ENABLE_VIDEO_PRESENTATION_MODE);
+ENABLE_SHADOW_DOM = ENABLE_SHADOW_DOM;
+
+FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCELERATED_OVERFLOW_SCROLLING) $(ENABLE_AVF_CAPTIONS) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CANVAS_PATH) $(ENABLE_CANVAS_PROXY) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_ES6_ARROWFUNCTION_SYNTAX) $(ENABLE_ES6_CLASS_SYNTAX) $(ENABLE_ES6_MODULES) $(ENABLE_ES6_TEMPLATE_LITERAL_SYNTAX) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_ANIMATIONS_LEVEL_2) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_SHAPES) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS3_TEXT_LINE_BREAK) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DO
 M4_EVENTS_CONSTRUCTOR) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_ENCRYPTED_MEDIA_V2) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FONT_LOAD_EVENTS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GAMEPAD_DEPRECATED) $(ENABLE_GEOLOCATION) $(ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING) $(ENABLE_ICONDATABASE) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INDIE_UI) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_COLOR_POPOVER) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_INTL) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TEXT_AUTOSIZING) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LEGACY_VENDOR_PREFIXES) $(ENABLE_LEGACY_WEB_AUDIO) $(ENABLE_LETTERPRESS) $(ENABLE_LINK_PREFETCH) $(ENABLE_MATHML) $(ENABLE_MEDIA_CO
 NTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NAVIGATOR_HWCONCURRENCY) $(ENABLE_NOTIFICATIONS) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_PICTURE_SIZES) $(ENABLE_POINTER_LOCK) $(ENABLE_PROXIMITY_EVENTS) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_REQUEST_AUTOCOMPLETE) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RUBBER_BANDING) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SUBTLE_CRYPTO) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_OTF_CONVERTER) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEMPLATE_ELEMENT) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_USERSELECT_ALL) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_DATACUE_VALUE) $(ENABLE_VIEW_MODE_
 CSS_MEDIA) $(ENABLE_WEBASSEMBLY) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_REPLAY) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_XHR_TIMEOUT) $(ENABLE_XSLT) $(ENABLE_FTL_JIT) $(ENABLE_JIT) $(ENABLE_SATURATED_LAYOUT_ARITHMETIC) $(ENABLE_SHADOW_DOM) $(ENABLE_VIDEO_PRESENTATION_MODE);

Modified: trunk/Source/WTF/ChangeLog (189840 => 189841)


--- trunk/Source/WTF/ChangeLog	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WTF/ChangeLog	2015-09-16 02:40:53 UTC (rev 189841)
@@ -1,4 +1,13 @@
+2015-09-15  Ryosuke Niwa  <rn...@webkit.org>
 
+        Add ShadowRoot interface and Element.prototype.attachShadow
+        https://bugs.webkit.org/show_bug.cgi?id=149187
+
+        Reviewed by Antti Koivisto.
+
+        * wtf/FeatureDefines.h:
+
+
 2015-09-11  Keith Miller  <keith_mil...@apple.com>
 
         cryptographicallyRandomValuesFromOS should use CCRandomCopyBytes when available.

Modified: trunk/Source/WTF/wtf/FeatureDefines.h (189840 => 189841)


--- trunk/Source/WTF/wtf/FeatureDefines.h	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WTF/wtf/FeatureDefines.h	2015-09-16 02:40:53 UTC (rev 189841)
@@ -134,6 +134,10 @@
 #define ENABLE_RESPECT_EXIF_ORIENTATION 1
 #endif
 
+#if !defined(ENABLE_SHADOW_DOM)
+#define ENABLE_SHADOW_DOM 1
+#endif
+
 #if !defined(ENABLE_TEXT_CARET)
 #define ENABLE_TEXT_CARET 0
 #endif
@@ -258,6 +262,10 @@
 #define ENABLE_PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC 1
 #endif
 
+#if !defined(ENABLE_SHADOW_DOM)
+#define ENABLE_SHADOW_DOM 1
+#endif
+
 #endif /* PLATFORM(MAC) */
 
 /* --------- Apple Windows port --------- */
@@ -679,6 +687,10 @@
 #define ENABLE_SATURATED_LAYOUT_ARITHMETIC 1
 #endif
 
+#if !defined(ENABLE_SHADOW_DOM)
+#define ENABLE_SHADOW_DOM 0
+#endif
+
 #if !defined(ENABLE_SMOOTH_SCROLLING)
 #define ENABLE_SMOOTH_SCROLLING 0
 #endif

Modified: trunk/Source/WebCore/CMakeLists.txt (189840 => 189841)


--- trunk/Source/WebCore/CMakeLists.txt	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/CMakeLists.txt	2015-09-16 02:40:53 UTC (rev 189841)
@@ -424,6 +424,7 @@
     dom/Range.idl
     dom/RequestAnimationFrameCallback.idl
     dom/SecurityPolicyViolationEvent.idl
+    dom/ShadowRoot.idl
     dom/StringCallback.idl
     dom/Text.idl
     dom/TextEvent.idl

Modified: trunk/Source/WebCore/ChangeLog (189840 => 189841)


--- trunk/Source/WebCore/ChangeLog	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/ChangeLog	2015-09-16 02:40:53 UTC (rev 189841)
@@ -1,3 +1,76 @@
+2015-09-15  Ryosuke Niwa  <rn...@webkit.org>
+
+        Add ShadowRoot interface and Element.prototype.attachShadow
+        https://bugs.webkit.org/show_bug.cgi?id=149187
+
+        Reviewed by Antti Koivisto.
+
+        Add back ShadowRoot IDL interface and Element.prototype.attachShadow in accordance with
+        http://w3c.github.io/webcomponents/spec/shadow/ at db27e6e36eab512d86edcdabb33ed27b5751acd7 excluding getSelection(),
+        elementFromPoint(), elementsFromPoint(), caretPositionFromPoint(), and styleSheets attribute on ShadowRoot interface.
+
+        The feature is enabled by default on Mac and iOS ports for testing and disabled by default elsewhere.
+
+        Also added HTMLElement::canHaveUserAgentShadowRoot which returns false by default and overridden elsewhere to return true
+        to distinguish elements for which attachShadow is supposed to throw NotSupported.
+        See https://w3c.github.io/webcomponents/spec/shadow/#widl-Element-attachShadow-ShadowRoot-ShadowRootInit-shadowRootInitDict
+
+        Tests: fast/shadow-dom/Element-interface-attachShadow.html
+               fast/shadow-dom/Element-interface-shadowRoot-attribute.html
+               fast/shadow-dom/ShadowRoot-interface.html
+
+        * CMakeLists.txt:
+        * Configurations/FeatureDefines.xcconfig:
+        * DerivedSources.cpp:
+        * DerivedSources.make:
+        * PlatformGTK.cmake:
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.vcxproj/WebCore.vcxproj.filters:
+        * WebCore.xcodeproj/project.pbxproj:
+        * css/SelectorChecker.cpp:
+        (WebCore::SelectorChecker::matchRecursively):
+        * dom/Element.cpp:
+        (WebCore::Element::bindingsOffsetParent):
+        (WebCore::Element::offsetParent):
+        (WebCore::Element::addShadowRoot):
+        (WebCore::Element::createShadowRoot):
+        (WebCore::Element::attachShadow): Added.
+        (WebCore::Element::bindingShadowRoot): Added. Returns null unless the attached shadow root is in the "open" mode.
+        * dom/Element.h:
+        * dom/Element.idl: Added attachShadow and shadowRoot. We only expose these to JS for now since Dictionary argument isn't
+        supported by other binding code.
+        * dom/ShadowRoot.cpp: Removed an unused enum.
+        * dom/ShadowRoot.h:
+        (WebCore::ShadowRoot::Type): Replaced old-style enum "ShadowRootType" by an enum class named "Type". Also added two new
+        values Open and Closed for author shadow roots.
+        (WebCore::ShadowRoot::type):
+        * dom/ShadowRoot.idl: Added.
+        * html/HTMLButtonElement.h:
+        * html/HTMLDetailsElement.h:
+        (HTMLButtonElement::canHaveUserAgentShadowRoot): Ditto.
+        * html/HTMLElement.h:
+        (WebCore::HTMLElement::canHaveUserAgentShadowRoot): Added. Returns false by default.
+        * html/HTMLInputElement.h:
+        * html/HTMLKeygenElement.h:
+        * html/HTMLMarqueeElement.h:
+        * html/HTMLMediaElement.h:
+        * html/HTMLMeterElement.h:
+        * html/HTMLPlugInElement.h:
+        * html/HTMLProgressElement.h:
+        * html/HTMLSelectElement.h:
+        * html/HTMLSummaryElement.h:
+        * html/HTMLTextAreaElement.h:
+        * html/shadow/InsertionPoint.h:
+        (ShadowRootWithInsertionPoints::ShadowRootWithInsertionPoints):
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::selectionPseudoStyle):
+        * rendering/RenderLayer.cpp:
+        (WebCore::rendererForScrollbar):
+        * svg/SVGElement.cpp:
+        (WebCore::SVGElement::correspondingUseElement):
+        * testing/Internals.cpp:
+        (WebCore::Internals::shadowRootType):
+
 2015-09-15  Brent Fulgham  <bfulg...@apple.com>
 
         [Win] Unreviewed release fix after r189832

Modified: trunk/Source/WebCore/Configurations/FeatureDefines.xcconfig (189840 => 189841)


--- trunk/Source/WebCore/Configurations/FeatureDefines.xcconfig	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/Configurations/FeatureDefines.xcconfig	2015-09-16 02:40:53 UTC (rev 189841)
@@ -228,4 +228,6 @@
 
 ENABLE_SATURATED_LAYOUT_ARITHMETIC = ENABLE_SATURATED_LAYOUT_ARITHMETIC;
 
-FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCELERATED_OVERFLOW_SCROLLING) $(ENABLE_AVF_CAPTIONS) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CANVAS_PATH) $(ENABLE_CANVAS_PROXY) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_ES6_ARROWFUNCTION_SYNTAX) $(ENABLE_ES6_CLASS_SYNTAX) $(ENABLE_ES6_MODULES) $(ENABLE_ES6_TEMPLATE_LITERAL_SYNTAX) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_ANIMATIONS_LEVEL_2) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_SHAPES) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS3_TEXT_LINE_BREAK) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION)
  $(ENABLE_DOM4_EVENTS_CONSTRUCTOR) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_ENCRYPTED_MEDIA_V2) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FONT_LOAD_EVENTS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GAMEPAD_DEPRECATED) $(ENABLE_GEOLOCATION) $(ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING) $(ENABLE_ICONDATABASE) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INDIE_UI) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_COLOR_POPOVER) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_INTL) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TEXT_AUTOSIZING) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LEGACY_VENDOR_PREFIXES) $(ENABLE_LEGACY_WEB_AUDIO) $(ENABLE_LETTERPRESS) $(ENABLE_LINK_PREFETCH) $(ENABLE_MATHML) $(ENA
 BLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NAVIGATOR_HWCONCURRENCY) $(ENABLE_NOTIFICATIONS) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_PICTURE_SIZES) $(ENABLE_POINTER_LOCK) $(ENABLE_PROXIMITY_EVENTS) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_REQUEST_AUTOCOMPLETE) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RUBBER_BANDING) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SUBTLE_CRYPTO) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_OTF_CONVERTER) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEMPLATE_ELEMENT) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_USERSELECT_ALL) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_DATACUE_VALUE) $(ENABL
 E_VIEW_MODE_CSS_MEDIA) $(ENABLE_WEBASSEMBLY) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_REPLAY) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_XHR_TIMEOUT) $(ENABLE_XSLT) $(ENABLE_FTL_JIT) $(ENABLE_JIT) $(ENABLE_SATURATED_LAYOUT_ARITHMETIC) $(ENABLE_VIDEO_PRESENTATION_MODE);
+ENABLE_SHADOW_DOM = ENABLE_SHADOW_DOM;
+
+FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCELERATED_OVERFLOW_SCROLLING) $(ENABLE_AVF_CAPTIONS) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CANVAS_PATH) $(ENABLE_CANVAS_PROXY) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_ES6_ARROWFUNCTION_SYNTAX) $(ENABLE_ES6_CLASS_SYNTAX) $(ENABLE_ES6_MODULES) $(ENABLE_ES6_TEMPLATE_LITERAL_SYNTAX) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_ANIMATIONS_LEVEL_2) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_SHAPES) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS3_TEXT_LINE_BREAK) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DO
 M4_EVENTS_CONSTRUCTOR) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_ENCRYPTED_MEDIA_V2) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FONT_LOAD_EVENTS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GAMEPAD_DEPRECATED) $(ENABLE_GEOLOCATION) $(ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING) $(ENABLE_ICONDATABASE) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INDIE_UI) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_COLOR_POPOVER) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_INTL) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TEXT_AUTOSIZING) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LEGACY_VENDOR_PREFIXES) $(ENABLE_LEGACY_WEB_AUDIO) $(ENABLE_LETTERPRESS) $(ENABLE_LINK_PREFETCH) $(ENABLE_MATHML) $(ENABLE_MEDIA_CO
 NTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NAVIGATOR_HWCONCURRENCY) $(ENABLE_NOTIFICATIONS) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_PICTURE_SIZES) $(ENABLE_POINTER_LOCK) $(ENABLE_PROXIMITY_EVENTS) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_REQUEST_AUTOCOMPLETE) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RUBBER_BANDING) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SUBTLE_CRYPTO) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_OTF_CONVERTER) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEMPLATE_ELEMENT) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_USERSELECT_ALL) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_DATACUE_VALUE) $(ENABLE_VIEW_MODE_
 CSS_MEDIA) $(ENABLE_WEBASSEMBLY) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_REPLAY) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_XHR_TIMEOUT) $(ENABLE_XSLT) $(ENABLE_FTL_JIT) $(ENABLE_JIT) $(ENABLE_SATURATED_LAYOUT_ARITHMETIC) $(ENABLE_SHADOW_DOM) $(ENABLE_VIDEO_PRESENTATION_MODE);

Modified: trunk/Source/WebCore/DerivedSources.cpp (189840 => 189841)


--- trunk/Source/WebCore/DerivedSources.cpp	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/DerivedSources.cpp	2015-09-16 02:40:53 UTC (rev 189841)
@@ -329,17 +329,6 @@
 #include "JSSQLTransactionCallback.cpp"
 #include "JSSQLTransactionErrorCallback.cpp"
 #include "JSSVGAElement.cpp"
-#include "JSStorage.cpp"
-#include "JSStorageErrorCallback.cpp"
-#include "JSStorageEvent.cpp"
-#include "JSStorageInfo.cpp"
-#include "JSStorageQuota.cpp"
-#include "JSStorageQuotaCallback.cpp"
-#include "JSStorageUsageCallback.cpp"
-#include "JSStringCallback.cpp"
-#include "JSStyleMedia.cpp"
-#include "JSStyleSheet.cpp"
-#include "JSStyleSheetList.cpp"
 #include "JSSVGAltGlyphDefElement.cpp"
 #include "JSSVGAltGlyphElement.cpp"
 #include "JSSVGAltGlyphItemElement.cpp"
@@ -481,6 +470,18 @@
 #include "JSSVGViewSpec.cpp"
 #include "JSSVGZoomAndPan.cpp"
 #include "JSSVGZoomEvent.cpp"
+#include "JSShadowRoot.cpp"
+#include "JSStorage.cpp"
+#include "JSStorageErrorCallback.cpp"
+#include "JSStorageEvent.cpp"
+#include "JSStorageInfo.cpp"
+#include "JSStorageQuota.cpp"
+#include "JSStorageQuotaCallback.cpp"
+#include "JSStorageUsageCallback.cpp"
+#include "JSStringCallback.cpp"
+#include "JSStyleMedia.cpp"
+#include "JSStyleSheet.cpp"
+#include "JSStyleSheetList.cpp"
 #include "JSText.cpp"
 #include "JSTextEvent.cpp"
 #include "JSTextMetrics.cpp"

Modified: trunk/Source/WebCore/DerivedSources.make (189840 => 189841)


--- trunk/Source/WebCore/DerivedSources.make	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/DerivedSources.make	2015-09-16 02:40:53 UTC (rev 189841)
@@ -319,6 +319,7 @@
     $(WebCore)/dom/Range.idl \
     $(WebCore)/dom/RequestAnimationFrameCallback.idl \
     $(WebCore)/dom/SecurityPolicyViolationEvent.idl \
+    $(WebCore)/dom/ShadowRoot.idl \
     $(WebCore)/dom/StringCallback.idl \
     $(WebCore)/dom/Text.idl \
     $(WebCore)/dom/TextEvent.idl \
@@ -1055,6 +1056,10 @@
     HTML_FLAGS := $(HTML_FLAGS) ENABLE_MEDIA_STREAM=1
 endif
 
+ifeq ($(findstring ENABLE_SHADOW_DOM,$(FEATURE_DEFINES)), ENABLE_SHADOW_DOM)
+    HTML_FLAGS := $(HTML_FLAGS) ENABLE_SHADOW_DOM=1
+endif
+
 JSHTMLElementWrapperFactory.cpp JSHTMLElementWrapperFactory.h HTMLElementFactory.cpp HTMLElementFactory.h HTMLElementTypeHelpers.h HTMLNames.cpp HTMLNames.h : htmlMakeNames.intermediate
 .INTERMEDIATE : htmlMakeNames.intermediate
 

Modified: trunk/Source/WebCore/PlatformGTK.cmake (189840 => 189841)


--- trunk/Source/WebCore/PlatformGTK.cmake	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/PlatformGTK.cmake	2015-09-16 02:40:53 UTC (rev 189841)
@@ -593,6 +593,7 @@
     dom/NodeList.idl
     dom/ProcessingInstruction.idl
     dom/Range.idl
+    dom/ShadowRoot.idl
     dom/Text.idl
     dom/TreeWalker.idl
     dom/UIEvent.idl

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (189840 => 189841)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2015-09-16 02:40:53 UTC (rev 189841)
@@ -4044,6 +4044,20 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
     </ClCompile>
+    <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSShadowRoot.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
+    </ClCompile>
     <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSSQLError.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@@ -20014,6 +20028,7 @@
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSRequestAnimationFrameCallback.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSRGBColor.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSScreen.h" />
+    <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSShadowRoot.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSSQLError.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSSQLResultSet.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSSQLResultSetRowList.h" />

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (189840 => 189841)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2015-09-16 02:40:53 UTC (rev 189841)
@@ -5707,6 +5707,9 @@
     <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSSecurityPolicyViolationEvent.cpp">
       <Filter>DerivedSources</Filter>
     </ClCompile>
+    <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSShadowRoot.cpp">
+      <Filter>DerivedSources</Filter>
+    </ClCompile>
     <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSSQLError.cpp">
       <Filter>DerivedSources</Filter>
     </ClCompile>
@@ -13072,6 +13075,9 @@
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSScreen.h">
       <Filter>DerivedSources</Filter>
     </ClInclude>
+    <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSShadowRoot.h">
+      <Filter>DerivedSources</Filter>
+    </ClInclude>
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSSQLError.h">
       <Filter>DerivedSources</Filter>
     </ClInclude>

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (189840 => 189841)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-09-16 02:40:53 UTC (rev 189841)
@@ -3856,6 +3856,8 @@
 		9BD0BF9312A42BF50072FD43 /* ScopedEventQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BD0BF9112A42BF50072FD43 /* ScopedEventQueue.h */; };
 		9BD0BF9412A42BF50072FD43 /* ScopedEventQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9BD0BF9212A42BF50072FD43 /* ScopedEventQueue.cpp */; };
 		9BD8A95A18BEFC7600987E9A /* CollectionIndexCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9BD8A95918BEFC7600987E9A /* CollectionIndexCache.cpp */; };
+		9BDA64D71B975CE5009C4387 /* JSShadowRoot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B6BC9601B975966005AE1F0 /* JSShadowRoot.cpp */; };
+		9BDA64D81B975CF2009C4387 /* JSShadowRoot.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B6BC9611B975966005AE1F0 /* JSShadowRoot.h */; };
 		9BF9A8801648DD2F001C6B23 /* JSHTMLFormControlsCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9BF9A87E1648DD2F001C6B23 /* JSHTMLFormControlsCollection.cpp */; };
 		9BF9A8811648DD2F001C6B23 /* JSHTMLFormControlsCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BF9A87F1648DD2F001C6B23 /* JSHTMLFormControlsCollection.h */; };
 		9D6380101AF173220031A15C /* StyleSelfAlignmentData.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D63800F1AF16E160031A15C /* StyleSelfAlignmentData.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -11228,6 +11230,7 @@
 		9A528E8217D7F52F00AA9518 /* FloatingObjects.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FloatingObjects.h; sourceTree = "<group>"; };
 		9AB1F37E18E2489A00534743 /* CSSToLengthConversionData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSToLengthConversionData.h; sourceTree = "<group>"; };
 		9AB1F37F18E2489A00534743 /* CSSToLengthConversionData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSToLengthConversionData.cpp; sourceTree = "<group>"; };
+		9B19B67E1B964E5200348745 /* ShadowRoot.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ShadowRoot.idl; sourceTree = "<group>"; };
 		9B1AB0791648C69D0051F3F2 /* HTMLFormControlsCollection.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = HTMLFormControlsCollection.idl; sourceTree = "<group>"; };
 		9B1AB07B1648C7C40051F3F2 /* JSHTMLFormControlsCollectionCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLFormControlsCollectionCustom.cpp; sourceTree = "<group>"; };
 		9B24DE8C15194B9500C59C27 /* HTMLBDIElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLBDIElement.h; sourceTree = "<group>"; };
@@ -11240,6 +11243,8 @@
 		9B50B1DC17CD4C0F0087F63C /* FormNamedItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormNamedItem.h; sourceTree = "<group>"; };
 		9B55EEE81B3E8898005342BC /* EditorCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = EditorCocoa.mm; sourceTree = "<group>"; };
 		9B55EEEA1B3F3FEF005342BC /* EditorCocoa.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EditorCocoa.h; sourceTree = "<group>"; };
+		9B6BC9601B975966005AE1F0 /* JSShadowRoot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSShadowRoot.cpp; sourceTree = "<group>"; };
+		9B6BC9611B975966005AE1F0 /* JSShadowRoot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSShadowRoot.h; sourceTree = "<group>"; };
 		9B6C41521344949000085B62 /* StringWithDirection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringWithDirection.h; sourceTree = "<group>"; };
 		9BA273F3172206BB0097CE47 /* LogicalSelectionOffsetCaches.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LogicalSelectionOffsetCaches.h; sourceTree = "<group>"; };
 		9BAB6C6A12550631001626D4 /* EditingStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditingStyle.h; sourceTree = "<group>"; };
@@ -20042,6 +20047,8 @@
 				E4B423860CBFB73C00AF2ECE /* JSProgressEvent.h */,
 				4998AECB13F9D6C90090B1AA /* JSRequestAnimationFrameCallback.cpp */,
 				4998AECC13F9D6C90090B1AA /* JSRequestAnimationFrameCallback.h */,
+				9B6BC9601B975966005AE1F0 /* JSShadowRoot.cpp */,
+				9B6BC9611B975966005AE1F0 /* JSShadowRoot.h */,
 				65DF31EF09D1CC60000BE325 /* JSText.cpp */,
 				65DF31F009D1CC60000BE325 /* JSText.h */,
 				D7613AC214753E5600DB8606 /* JSWebKitNamedFlow.cpp */,
@@ -23556,6 +23563,7 @@
 				E45322AA140CE267005A0F92 /* SelectorQuery.h */,
 				A6D169611346B49B000EB770 /* ShadowRoot.cpp */,
 				A6D169631346B4C1000EB770 /* ShadowRoot.h */,
+				9B19B67E1B964E5200348745 /* ShadowRoot.idl */,
 				31741AAB16635E45008A5B7E /* SimulatedClickOptions.h */,
 				D01A27AB10C9BFD800026A42 /* SpaceSplitString.cpp */,
 				D01A27AC10C9BFD800026A42 /* SpaceSplitString.h */,
@@ -26467,6 +26475,7 @@
 				93309E01099E64920056E581 /* RemoveCSSPropertyCommand.h in Headers */,
 				D06C0D8F0CFD11460065F43F /* RemoveFormatCommand.h in Headers */,
 				93309E05099E64920056E581 /* RemoveNodeCommand.h in Headers */,
+				9BDA64D81B975CF2009C4387 /* JSShadowRoot.h in Headers */,
 				93309E07099E64920056E581 /* RemoveNodePreservingChildrenCommand.h in Headers */,
 				B59ED23B18272679006D564C /* RenderAncestorIterator.h in Headers */,
 				7CD494CD1A86EB1D000A87EC /* RenderAttachment.h in Headers */,
@@ -28981,6 +28990,7 @@
 				2E2D99CD10E2BBDA00496337 /* JSBlob.cpp in Sources */,
 				8931DE5B14C44C44000DC9D2 /* JSBlobCustom.cpp in Sources */,
 				1449E287107D4DB400B5793F /* JSCallbackData.cpp in Sources */,
+				9BDA64D71B975CE5009C4387 /* JSShadowRoot.cpp in Sources */,
 				65DF323909D1DE65000BE325 /* JSCanvasGradient.cpp in Sources */,
 				65DF323B09D1DE65000BE325 /* JSCanvasPattern.cpp in Sources */,
 				49EED1421051969400099FAB /* JSCanvasRenderingContext.cpp in Sources */,

Modified: trunk/Source/WebCore/css/SelectorChecker.cpp (189840 => 189841)


--- trunk/Source/WebCore/css/SelectorChecker.cpp	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/css/SelectorChecker.cpp	2015-09-16 02:40:53 UTC (rev 189841)
@@ -240,7 +240,7 @@
                 if (context.element->shadowPseudoId() != context.selector->value())
                     return MatchResult::fails(Match::SelectorFailsLocally);
 
-                if (context.selector->pseudoElementType() == CSSSelector::PseudoElementWebKitCustom && root->type() != ShadowRoot::UserAgentShadowRoot)
+                if (context.selector->pseudoElementType() == CSSSelector::PseudoElementWebKitCustom && root->type() != ShadowRoot::Type::UserAgent)
                     return MatchResult::fails(Match::SelectorFailsLocally);
             } else
                 return MatchResult::fails(Match::SelectorFailsLocally);

Modified: trunk/Source/WebCore/dom/Element.cpp (189840 => 189841)


--- trunk/Source/WebCore/dom/Element.cpp	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/dom/Element.cpp	2015-09-16 02:40:53 UTC (rev 189841)
@@ -35,6 +35,7 @@
 #include "ClientRectList.h"
 #include "ContainerNodeAlgorithms.h"
 #include "DOMTokenList.h"
+#include "Dictionary.h"
 #include "DocumentSharedObjectPool.h"
 #include "ElementIterator.h"
 #include "ElementRareData.h"
@@ -760,7 +761,7 @@
     Element* element = offsetParent();
     if (!element || !element->isInShadowTree())
         return element;
-    return element->containingShadowRoot()->type() == ShadowRoot::UserAgentShadowRoot ? 0 : element;
+    return element->containingShadowRoot()->type() == ShadowRoot::Type::UserAgent ? nullptr : element;
 }
 
 Element* Element::offsetParent()
@@ -1626,7 +1627,7 @@
 
     InspectorInstrumentation::didPushShadowRoot(*this, shadowRoot);
 
-    if (shadowRoot.type() == ShadowRoot::UserAgentShadowRoot)
+    if (shadowRoot.type() == ShadowRoot::Type::UserAgent)
         didAddUserAgentShadowRoot(&shadowRoot);
 }
 
@@ -1657,10 +1658,49 @@
     return nullptr;
 }
 
+RefPtr<ShadowRoot> Element::attachShadow(const Dictionary& dictionary, ExceptionCode& ec)
+{
+    String mode;
+    dictionary.get("mode", mode);
+
+    auto type = ShadowRoot::Type::Closed;
+    if (mode == "open")
+        type = ShadowRoot::Type::Open;
+    else if (mode != "closed") {
+        ec = TypeError;
+        return nullptr;
+    }
+
+    // FIXME: The current spec allows attachShadow on non-HTML elements.
+    if (!is<HTMLElement>(this) || downcast<HTMLElement>(this)->canHaveUserAgentShadowRoot()) {
+        ec = NOT_SUPPORTED_ERR;
+        return nullptr;
+    }
+
+    if (shadowRoot()) {
+        ec = INVALID_STATE_ERR;
+        return nullptr;
+    }
+
+    addShadowRoot(ShadowRoot::create(document(), type));
+
+    return shadowRoot();
+}
+
+ShadowRoot* Element::bindingShadowRoot() const
+{
+    ShadowRoot* root = shadowRoot();
+    if (!root)
+        return nullptr;
+    if (root->type() != ShadowRoot::Type::Open)
+        return nullptr;
+    return root;
+}
+
 ShadowRoot* Element::userAgentShadowRoot() const
 {
     if (ShadowRoot* shadowRoot = this->shadowRoot()) {
-        ASSERT(shadowRoot->type() == ShadowRoot::UserAgentShadowRoot);
+        ASSERT(shadowRoot->type() == ShadowRoot::Type::UserAgent);
         return shadowRoot;
     }
     return nullptr;
@@ -1670,7 +1710,7 @@
 {
     ShadowRoot* shadowRoot = userAgentShadowRoot();
     if (!shadowRoot) {
-        addShadowRoot(ShadowRoot::create(document(), ShadowRoot::UserAgentShadowRoot));
+        addShadowRoot(ShadowRoot::create(document(), ShadowRoot::Type::UserAgent));
         shadowRoot = userAgentShadowRoot();
     }
     return *shadowRoot;

Modified: trunk/Source/WebCore/dom/Element.h (189840 => 189841)


--- trunk/Source/WebCore/dom/Element.h	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/dom/Element.h	2015-09-16 02:40:53 UTC (rev 189841)
@@ -39,6 +39,7 @@
 class ClientRect;
 class ClientRectList;
 class DatasetDOMStringMap;
+class Dictionary;
 class DOMTokenList;
 class ElementRareData;
 class HTMLDocument;
@@ -247,6 +248,9 @@
     WEBCORE_EXPORT ShadowRoot* shadowRoot() const;
     WEBCORE_EXPORT RefPtr<ShadowRoot> createShadowRoot(ExceptionCode&);
 
+    ShadowRoot* bindingShadowRoot() const;
+    RefPtr<ShadowRoot> attachShadow(const Dictionary&, ExceptionCode&);
+
     ShadowRoot* userAgentShadowRoot() const;
     WEBCORE_EXPORT ShadowRoot& ensureUserAgentShadowRoot();
 

Modified: trunk/Source/WebCore/dom/Element.idl (189840 => 189841)


--- trunk/Source/WebCore/dom/Element.idl	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/dom/Element.idl	2015-09-16 02:40:53 UTC (rev 189841)
@@ -166,6 +166,11 @@
     [Conditional=CSS_REGIONS] readonly attribute DOMString webkitRegionOverset;
     [Conditional=CSS_REGIONS] sequence<Range> webkitGetRegionFlowRanges();
 
+    // Shadow DOM API
+#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
+    [Conditional=SHADOW_DOM, RaisesException] ShadowRoot attachShadow(Dictionary options);
+    [Conditional=SHADOW_DOM, ImplementedAs=bindingShadowRoot] readonly attribute ShadowRoot shadowRoot;
+#endif
 
     // Event Handlers
 

Modified: trunk/Source/WebCore/dom/Node.cpp (189840 => 189841)


--- trunk/Source/WebCore/dom/Node.cpp	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/dom/Node.cpp	2015-09-16 02:40:53 UTC (rev 189841)
@@ -1074,7 +1074,7 @@
 bool Node::isInUserAgentShadowTree() const
 {
     auto* shadowRoot = containingShadowRoot();
-    return shadowRoot && shadowRoot->type() == ShadowRoot::UserAgentShadowRoot;
+    return shadowRoot && shadowRoot->type() == ShadowRoot::Type::UserAgent;
 }
 
 Node* Node::nonBoundaryShadowTreeRootNode()

Modified: trunk/Source/WebCore/dom/ShadowRoot.cpp (189840 => 189841)


--- trunk/Source/WebCore/dom/ShadowRoot.cpp	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/dom/ShadowRoot.cpp	2015-09-16 02:40:53 UTC (rev 189841)
@@ -43,18 +43,12 @@
 
 COMPILE_ASSERT(sizeof(ShadowRoot) == sizeof(SameSizeAsShadowRoot), shadowroot_should_stay_small);
 
-enum ShadowRootUsageOriginType {
-    ShadowRootUsageOriginWeb = 0,
-    ShadowRootUsageOriginNotWeb,
-    ShadowRootUsageOriginMax
-};
-
-ShadowRoot::ShadowRoot(Document& document, ShadowRootType type)
+ShadowRoot::ShadowRoot(Document& document, Type type)
     : DocumentFragment(document, CreateShadowRoot)
     , TreeScope(*this, document)
     , m_resetStyleInheritance(false)
     , m_type(type)
-    , m_host(0)
+    , m_host(nullptr)
 {
 }
 

Modified: trunk/Source/WebCore/dom/ShadowRoot.h (189840 => 189841)


--- trunk/Source/WebCore/dom/ShadowRoot.h	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/dom/ShadowRoot.h	2015-09-16 02:40:53 UTC (rev 189841)
@@ -40,11 +40,13 @@
 
 class ShadowRoot : public DocumentFragment, public TreeScope {
 public:
-    enum ShadowRootType {
-        UserAgentShadowRoot = 0,
+    enum class Type : uint8_t {
+        UserAgent = 0,
+        Closed,
+        Open,
     };
 
-    static Ref<ShadowRoot> create(Document& document, ShadowRootType type)
+    static Ref<ShadowRoot> create(Document& document, Type type)
     {
         return adoptRef(*new ShadowRoot(document, type));
     }
@@ -62,7 +64,7 @@
 
     Element* activeElement() const;
 
-    ShadowRootType type() const { return static_cast<ShadowRootType>(m_type); }
+    Type type() const { return m_type; }
 
     PassRefPtr<Node> cloneNode(bool, ExceptionCode&);
 
@@ -71,7 +73,7 @@
     virtual ContentDistributor* distributor() { return nullptr; }
 
 protected:
-    ShadowRoot(Document&, ShadowRootType);
+    ShadowRoot(Document&, Type);
 
     // FIXME: This shouldn't happen. https://bugs.webkit.org/show_bug.cgi?id=88834
     bool isOrphan() const { return !m_host; }
@@ -81,8 +83,8 @@
 
     virtual Ref<Node> cloneNodeInternal(Document&, CloningOperation) override;
 
-    unsigned m_resetStyleInheritance : 1;
-    unsigned m_type : 1;
+    bool m_resetStyleInheritance : 1;
+    Type m_type;
 
     Element* m_host;
 };

Added: trunk/Source/WebCore/dom/ShadowRoot.idl (0 => 189841)


--- trunk/Source/WebCore/dom/ShadowRoot.idl	                        (rev 0)
+++ trunk/Source/WebCore/dom/ShadowRoot.idl	2015-09-16 02:40:53 UTC (rev 189841)
@@ -0,0 +1,35 @@
+/*
+* Copyright (C) 2015 Apple Inc. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+* 1. Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+* PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+[
+    Conditional=SHADOW_DOM,
+    JSGenerateToJSObject
+] interface ShadowRoot : DocumentFragment {
+    readonly attribute Element          activeElement;
+    readonly attribute Element          host;
+
+    [TreatNullAs=NullString, SetterRaisesException]
+    attribute DOMString                 innerHTML;
+};

Modified: trunk/Source/WebCore/html/HTMLButtonElement.h (189840 => 189841)


--- trunk/Source/WebCore/html/HTMLButtonElement.h	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/html/HTMLButtonElement.h	2015-09-16 02:40:53 UTC (rev 189841)
@@ -49,6 +49,7 @@
 
     // HTMLFormControlElement always creates one, but buttons don't need it.
     virtual bool alwaysCreateUserAgentShadowRoot() const override { return false; }
+    virtual bool canHaveUserAgentShadowRoot() const override final { return true; }
 
     virtual void parseAttribute(const QualifiedName&, const AtomicString&) override;
     virtual bool isPresentationAttribute(const QualifiedName&) const override;

Modified: trunk/Source/WebCore/html/HTMLDetailsElement.h (189840 => 189841)


--- trunk/Source/WebCore/html/HTMLDetailsElement.h	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/html/HTMLDetailsElement.h	2015-09-16 02:40:53 UTC (rev 189841)
@@ -41,6 +41,7 @@
     virtual void parseAttribute(const QualifiedName&, const AtomicString&) override;
 
     virtual void didAddUserAgentShadowRoot(ShadowRoot*) override;
+    virtual bool canHaveUserAgentShadowRoot() const override final { return true; }
 
     bool m_isOpen;
 };

Modified: trunk/Source/WebCore/html/HTMLElement.h (189840 => 189841)


--- trunk/Source/WebCore/html/HTMLElement.h	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/html/HTMLElement.h	2015-09-16 02:40:53 UTC (rev 189841)
@@ -89,6 +89,7 @@
 
     virtual bool isHTMLUnknownElement() const { return false; }
     virtual bool isTextControlInnerTextElement() const { return false; }
+    virtual bool canHaveUserAgentShadowRoot() const { return false; }
 
     virtual bool willRespondToMouseMoveEvents() override;
     virtual bool willRespondToMouseWheelEvents() override;

Modified: trunk/Source/WebCore/html/HTMLInputElement.h (189840 => 189841)


--- trunk/Source/WebCore/html/HTMLInputElement.h	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/html/HTMLInputElement.h	2015-09-16 02:40:53 UTC (rev 189841)
@@ -331,6 +331,7 @@
     enum AutoCompleteSetting { Uninitialized, On, Off };
 
     virtual void didAddUserAgentShadowRoot(ShadowRoot*) override final;
+    virtual bool canHaveUserAgentShadowRoot() const override final { return true; }
 
     virtual void willChangeForm() override final;
     virtual void didChangeForm() override final;

Modified: trunk/Source/WebCore/html/HTMLKeygenElement.h (189840 => 189841)


--- trunk/Source/WebCore/html/HTMLKeygenElement.h	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/html/HTMLKeygenElement.h	2015-09-16 02:40:53 UTC (rev 189841)
@@ -52,6 +52,8 @@
     virtual void reset() override;
     virtual bool shouldSaveAndRestoreFormControlState() const override;
 
+    virtual bool canHaveUserAgentShadowRoot() const override final { return true; }
+
     HTMLSelectElement* shadowSelect() const;
 };
 

Modified: trunk/Source/WebCore/html/HTMLMarqueeElement.h (189840 => 189841)


--- trunk/Source/WebCore/html/HTMLMarqueeElement.h	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/html/HTMLMarqueeElement.h	2015-09-16 02:40:53 UTC (rev 189841)
@@ -62,6 +62,8 @@
     virtual void resume() override;
     virtual const char* activeDOMObjectName() const override { return "HTMLMarqueeElement"; }
 
+    virtual bool canHaveUserAgentShadowRoot() const override final { return true; }
+
     RenderMarquee* renderMarquee() const;
 };
 

Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (189840 => 189841)


--- trunk/Source/WebCore/html/HTMLMediaElement.h	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h	2015-09-16 02:40:53 UTC (rev 189841)
@@ -487,6 +487,9 @@
 
     virtual bool alwaysCreateUserAgentShadowRoot() const override { return true; }
 
+    // FIXME: Shadow DOM spec says we should be able to create shadow root on audio and video elements
+    virtual bool canHaveUserAgentShadowRoot() const override final { return true; }
+
     virtual bool hasCustomFocusLogic() const override;
     virtual bool supportsFocus() const override;
     virtual bool isMouseFocusable() const override;

Modified: trunk/Source/WebCore/html/HTMLMeterElement.h (189840 => 189841)


--- trunk/Source/WebCore/html/HTMLMeterElement.h	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/html/HTMLMeterElement.h	2015-09-16 02:40:53 UTC (rev 189841)
@@ -76,6 +76,7 @@
 
     void didElementStateChange();
     virtual void didAddUserAgentShadowRoot(ShadowRoot*) override;
+    virtual bool canHaveUserAgentShadowRoot() const override final { return true; }
 
     RefPtr<MeterValueElement> m_value;
 };

Modified: trunk/Source/WebCore/html/HTMLPlugInElement.h (189840 => 189841)


--- trunk/Source/WebCore/html/HTMLPlugInElement.h	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/html/HTMLPlugInElement.h	2015-09-16 02:40:53 UTC (rev 189841)
@@ -117,6 +117,9 @@
 
     bool dispatchBeforeLoadEvent(const String& sourceURL); // Not implemented, generates a compile error if subclasses call this by mistake.
 
+    // FIXME: Shadow DOM spec says we should be able to create shadow root on applet, embed, and object.
+    virtual bool canHaveUserAgentShadowRoot() const override final { return true; }
+
     // This will load the plugin if necessary.
     virtual RenderWidget* renderWidgetLoadingPlugin() const = 0;
 

Modified: trunk/Source/WebCore/html/HTMLProgressElement.h (189840 => 189841)


--- trunk/Source/WebCore/html/HTMLProgressElement.h	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/html/HTMLProgressElement.h	2015-09-16 02:40:53 UTC (rev 189841)
@@ -62,6 +62,7 @@
 
     void didElementStateChange();
     virtual void didAddUserAgentShadowRoot(ShadowRoot*) override;
+    virtual bool canHaveUserAgentShadowRoot() const override final { return true; }
     bool isDeterminate() const;
 
     ProgressValueElement* m_value;

Modified: trunk/Source/WebCore/html/HTMLSelectElement.h (189840 => 189841)


--- trunk/Source/WebCore/html/HTMLSelectElement.h	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/html/HTMLSelectElement.h	2015-09-16 02:40:53 UTC (rev 189841)
@@ -128,6 +128,8 @@
     
     virtual bool canStartSelection() const override { return false; }
 
+    virtual bool canHaveUserAgentShadowRoot() const override final { return true; }
+
     virtual bool isEnumeratable() const override { return true; }
     virtual bool supportLabels() const override { return true; }
 

Modified: trunk/Source/WebCore/html/HTMLSummaryElement.h (189840 => 189841)


--- trunk/Source/WebCore/html/HTMLSummaryElement.h	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/html/HTMLSummaryElement.h	2015-09-16 02:40:53 UTC (rev 189841)
@@ -42,6 +42,10 @@
     virtual void defaultEventHandler(Event*) override;
 
     virtual void didAddUserAgentShadowRoot(ShadowRoot*) override;
+
+    // FIXME: Shadow DOM spec says we should be able to create shadow root on this element
+    virtual bool canHaveUserAgentShadowRoot() const override final { return true; }
+
     HTMLDetailsElement* detailsElement() const;
 
     virtual bool supportsFocus() const override;

Modified: trunk/Source/WebCore/html/HTMLTextAreaElement.h (189840 => 189841)


--- trunk/Source/WebCore/html/HTMLTextAreaElement.h	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/html/HTMLTextAreaElement.h	2015-09-16 02:40:53 UTC (rev 189841)
@@ -68,6 +68,7 @@
     enum WrapMethod { NoWrap, SoftWrap, HardWrap };
 
     virtual void didAddUserAgentShadowRoot(ShadowRoot*) override;
+    virtual bool canHaveUserAgentShadowRoot() const override final { return true; }
 
     void handleBeforeTextInsertedEvent(BeforeTextInsertedEvent*) const;
     static String sanitizeUserInputValue(const String&, unsigned maxLength);

Modified: trunk/Source/WebCore/html/shadow/InsertionPoint.h (189840 => 189841)


--- trunk/Source/WebCore/html/shadow/InsertionPoint.h	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/html/shadow/InsertionPoint.h	2015-09-16 02:40:53 UTC (rev 189841)
@@ -87,7 +87,7 @@
     
 private:
     ShadowRootWithInsertionPoints(Document& document)
-        : ShadowRoot(document, UserAgentShadowRoot)
+        : ShadowRoot(document, Type::UserAgent)
     { }
 
     virtual void childrenChanged(const ChildChange&) override;

Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (189840 => 189841)


--- trunk/Source/WebCore/rendering/RenderElement.cpp	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp	2015-09-16 02:40:53 UTC (rev 189841)
@@ -1614,7 +1614,7 @@
         return nullptr;
 
     if (ShadowRoot* root = element()->containingShadowRoot()) {
-        if (root->type() == ShadowRoot::UserAgentShadowRoot) {
+        if (root->type() == ShadowRoot::Type::UserAgent) {
             if (Element* shadowHost = element()->shadowHost())
                 return shadowHost->renderer()->getUncachedPseudoStyle(PseudoStyleRequest(SELECTION));
         }

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (189840 => 189841)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2015-09-16 02:40:53 UTC (rev 189841)
@@ -3062,7 +3062,7 @@
 {
     if (Element* element = renderer.element()) {
         if (ShadowRoot* shadowRoot = element->containingShadowRoot()) {
-            if (shadowRoot->type() == ShadowRoot::UserAgentShadowRoot)
+            if (shadowRoot->type() == ShadowRoot::Type::UserAgent)
                 return shadowRoot->host()->renderer();
         }
     }

Modified: trunk/Source/WebCore/svg/SVGElement.cpp (189840 => 189841)


--- trunk/Source/WebCore/svg/SVGElement.cpp	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/svg/SVGElement.cpp	2015-09-16 02:40:53 UTC (rev 189841)
@@ -488,7 +488,7 @@
     auto* root = containingShadowRoot();
     if (!root)
         return nullptr;
-    if (root->type() != ShadowRoot::UserAgentShadowRoot)
+    if (root->type() != ShadowRoot::Type::UserAgent)
         return nullptr;
     auto* host = root->host();
     if (!is<SVGUseElement>(host))

Modified: trunk/Source/WebCore/testing/Internals.cpp (189840 => 189841)


--- trunk/Source/WebCore/testing/Internals.cpp	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebCore/testing/Internals.cpp	2015-09-16 02:40:53 UTC (rev 189841)
@@ -770,8 +770,12 @@
     }
 
     switch (downcast<ShadowRoot>(*root).type()) {
-    case ShadowRoot::UserAgentShadowRoot:
+    case ShadowRoot::Type::UserAgent:
         return String("UserAgentShadowRoot");
+    case ShadowRoot::Type::Closed:
+        return String("ClosedShadowRoot");
+    case ShadowRoot::Type::Open:
+        return String("OpenShadowRoot");
     default:
         ASSERT_NOT_REACHED();
         return String("Unknown");

Modified: trunk/Source/WebKit/mac/ChangeLog (189840 => 189841)


--- trunk/Source/WebKit/mac/ChangeLog	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebKit/mac/ChangeLog	2015-09-16 02:40:53 UTC (rev 189841)
@@ -1,3 +1,12 @@
+2015-09-15  Ryosuke Niwa  <rn...@webkit.org>
+
+        Add ShadowRoot interface and Element.prototype.attachShadow
+        https://bugs.webkit.org/show_bug.cgi?id=149187
+
+        Reviewed by Antti Koivisto.
+
+        * Configurations/FeatureDefines.xcconfig:
+
 2015-09-14  Alex Christensen  <achristen...@webkit.org>
 
         Progress towards CMake on Mac.

Modified: trunk/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig (189840 => 189841)


--- trunk/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig	2015-09-16 02:40:53 UTC (rev 189841)
@@ -228,4 +228,6 @@
 
 ENABLE_SATURATED_LAYOUT_ARITHMETIC = ENABLE_SATURATED_LAYOUT_ARITHMETIC;
 
-FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCELERATED_OVERFLOW_SCROLLING) $(ENABLE_AVF_CAPTIONS) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CANVAS_PATH) $(ENABLE_CANVAS_PROXY) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_ES6_ARROWFUNCTION_SYNTAX) $(ENABLE_ES6_CLASS_SYNTAX) $(ENABLE_ES6_MODULES) $(ENABLE_ES6_TEMPLATE_LITERAL_SYNTAX) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_ANIMATIONS_LEVEL_2) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_SHAPES) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS3_TEXT_LINE_BREAK) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION)
  $(ENABLE_DOM4_EVENTS_CONSTRUCTOR) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_ENCRYPTED_MEDIA_V2) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FONT_LOAD_EVENTS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GAMEPAD_DEPRECATED) $(ENABLE_GEOLOCATION) $(ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING) $(ENABLE_ICONDATABASE) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INDIE_UI) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_COLOR_POPOVER) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_INTL) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TEXT_AUTOSIZING) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LEGACY_VENDOR_PREFIXES) $(ENABLE_LEGACY_WEB_AUDIO) $(ENABLE_LETTERPRESS) $(ENABLE_LINK_PREFETCH) $(ENABLE_MATHML) $(ENA
 BLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NAVIGATOR_HWCONCURRENCY) $(ENABLE_NOTIFICATIONS) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_PICTURE_SIZES) $(ENABLE_POINTER_LOCK) $(ENABLE_PROXIMITY_EVENTS) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_REQUEST_AUTOCOMPLETE) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RUBBER_BANDING) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SUBTLE_CRYPTO) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_OTF_CONVERTER) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEMPLATE_ELEMENT) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_USERSELECT_ALL) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_DATACUE_VALUE) $(ENABL
 E_VIEW_MODE_CSS_MEDIA) $(ENABLE_WEBASSEMBLY) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_REPLAY) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_XHR_TIMEOUT) $(ENABLE_XSLT) $(ENABLE_FTL_JIT) $(ENABLE_JIT) $(ENABLE_SATURATED_LAYOUT_ARITHMETIC) $(ENABLE_VIDEO_PRESENTATION_MODE);
+ENABLE_SHADOW_DOM = ENABLE_SHADOW_DOM;
+
+FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCELERATED_OVERFLOW_SCROLLING) $(ENABLE_AVF_CAPTIONS) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CANVAS_PATH) $(ENABLE_CANVAS_PROXY) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_ES6_ARROWFUNCTION_SYNTAX) $(ENABLE_ES6_CLASS_SYNTAX) $(ENABLE_ES6_MODULES) $(ENABLE_ES6_TEMPLATE_LITERAL_SYNTAX) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_ANIMATIONS_LEVEL_2) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_SHAPES) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS3_TEXT_LINE_BREAK) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DO
 M4_EVENTS_CONSTRUCTOR) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_ENCRYPTED_MEDIA_V2) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FONT_LOAD_EVENTS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GAMEPAD_DEPRECATED) $(ENABLE_GEOLOCATION) $(ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING) $(ENABLE_ICONDATABASE) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INDIE_UI) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_COLOR_POPOVER) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_INTL) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TEXT_AUTOSIZING) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LEGACY_VENDOR_PREFIXES) $(ENABLE_LEGACY_WEB_AUDIO) $(ENABLE_LETTERPRESS) $(ENABLE_LINK_PREFETCH) $(ENABLE_MATHML) $(ENABLE_MEDIA_CO
 NTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NAVIGATOR_HWCONCURRENCY) $(ENABLE_NOTIFICATIONS) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_PICTURE_SIZES) $(ENABLE_POINTER_LOCK) $(ENABLE_PROXIMITY_EVENTS) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_REQUEST_AUTOCOMPLETE) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RUBBER_BANDING) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SUBTLE_CRYPTO) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_OTF_CONVERTER) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEMPLATE_ELEMENT) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_USERSELECT_ALL) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_DATACUE_VALUE) $(ENABLE_VIEW_MODE_
 CSS_MEDIA) $(ENABLE_WEBASSEMBLY) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_REPLAY) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_XHR_TIMEOUT) $(ENABLE_XSLT) $(ENABLE_FTL_JIT) $(ENABLE_JIT) $(ENABLE_SATURATED_LAYOUT_ARITHMETIC) $(ENABLE_SHADOW_DOM) $(ENABLE_VIDEO_PRESENTATION_MODE);

Modified: trunk/Source/WebKit2/ChangeLog (189840 => 189841)


--- trunk/Source/WebKit2/ChangeLog	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebKit2/ChangeLog	2015-09-16 02:40:53 UTC (rev 189841)
@@ -1,3 +1,12 @@
+2015-09-15  Ryosuke Niwa  <rn...@webkit.org>
+
+        Add ShadowRoot interface and Element.prototype.attachShadow
+        https://bugs.webkit.org/show_bug.cgi?id=149187
+
+        Reviewed by Antti Koivisto.
+
+        * Configurations/FeatureDefines.xcconfig:
+
 2015-09-15  Brady Eidson  <beid...@apple.com>
 
         Add empty IDBFactory implementation for Modern IDB.

Modified: trunk/Source/WebKit2/Configurations/FeatureDefines.xcconfig (189840 => 189841)


--- trunk/Source/WebKit2/Configurations/FeatureDefines.xcconfig	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/WebKit2/Configurations/FeatureDefines.xcconfig	2015-09-16 02:40:53 UTC (rev 189841)
@@ -228,4 +228,6 @@
 
 ENABLE_SATURATED_LAYOUT_ARITHMETIC = ENABLE_SATURATED_LAYOUT_ARITHMETIC;
 
-FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCELERATED_OVERFLOW_SCROLLING) $(ENABLE_AVF_CAPTIONS) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CANVAS_PATH) $(ENABLE_CANVAS_PROXY) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_ES6_ARROWFUNCTION_SYNTAX) $(ENABLE_ES6_CLASS_SYNTAX) $(ENABLE_ES6_MODULES) $(ENABLE_ES6_TEMPLATE_LITERAL_SYNTAX) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_ANIMATIONS_LEVEL_2) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_SHAPES) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS3_TEXT_LINE_BREAK) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION)
  $(ENABLE_DOM4_EVENTS_CONSTRUCTOR) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_ENCRYPTED_MEDIA_V2) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FONT_LOAD_EVENTS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GAMEPAD_DEPRECATED) $(ENABLE_GEOLOCATION) $(ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING) $(ENABLE_ICONDATABASE) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INDIE_UI) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_COLOR_POPOVER) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_INTL) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TEXT_AUTOSIZING) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LEGACY_VENDOR_PREFIXES) $(ENABLE_LEGACY_WEB_AUDIO) $(ENABLE_LETTERPRESS) $(ENABLE_LINK_PREFETCH) $(ENABLE_MATHML) $(ENA
 BLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NAVIGATOR_HWCONCURRENCY) $(ENABLE_NOTIFICATIONS) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_PICTURE_SIZES) $(ENABLE_POINTER_LOCK) $(ENABLE_PROXIMITY_EVENTS) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_REQUEST_AUTOCOMPLETE) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RUBBER_BANDING) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SUBTLE_CRYPTO) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_OTF_CONVERTER) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEMPLATE_ELEMENT) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_USERSELECT_ALL) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_DATACUE_VALUE) $(ENABL
 E_VIEW_MODE_CSS_MEDIA) $(ENABLE_WEBASSEMBLY) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_REPLAY) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_XHR_TIMEOUT) $(ENABLE_XSLT) $(ENABLE_FTL_JIT) $(ENABLE_JIT) $(ENABLE_SATURATED_LAYOUT_ARITHMETIC) $(ENABLE_VIDEO_PRESENTATION_MODE);
+ENABLE_SHADOW_DOM = ENABLE_SHADOW_DOM;
+
+FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCELERATED_OVERFLOW_SCROLLING) $(ENABLE_AVF_CAPTIONS) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CANVAS_PATH) $(ENABLE_CANVAS_PROXY) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_ES6_ARROWFUNCTION_SYNTAX) $(ENABLE_ES6_CLASS_SYNTAX) $(ENABLE_ES6_MODULES) $(ENABLE_ES6_TEMPLATE_LITERAL_SYNTAX) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_ANIMATIONS_LEVEL_2) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_SHAPES) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS3_TEXT_LINE_BREAK) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DO
 M4_EVENTS_CONSTRUCTOR) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_ENCRYPTED_MEDIA_V2) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FONT_LOAD_EVENTS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GAMEPAD_DEPRECATED) $(ENABLE_GEOLOCATION) $(ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING) $(ENABLE_ICONDATABASE) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INDIE_UI) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_COLOR_POPOVER) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_INTL) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TEXT_AUTOSIZING) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LEGACY_VENDOR_PREFIXES) $(ENABLE_LEGACY_WEB_AUDIO) $(ENABLE_LETTERPRESS) $(ENABLE_LINK_PREFETCH) $(ENABLE_MATHML) $(ENABLE_MEDIA_CO
 NTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NAVIGATOR_HWCONCURRENCY) $(ENABLE_NOTIFICATIONS) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_PICTURE_SIZES) $(ENABLE_POINTER_LOCK) $(ENABLE_PROXIMITY_EVENTS) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_REQUEST_AUTOCOMPLETE) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RUBBER_BANDING) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SUBTLE_CRYPTO) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_OTF_CONVERTER) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEMPLATE_ELEMENT) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_USERSELECT_ALL) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_DATACUE_VALUE) $(ENABLE_VIEW_MODE_
 CSS_MEDIA) $(ENABLE_WEBASSEMBLY) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_REPLAY) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_XHR_TIMEOUT) $(ENABLE_XSLT) $(ENABLE_FTL_JIT) $(ENABLE_JIT) $(ENABLE_SATURATED_LAYOUT_ARITHMETIC) $(ENABLE_SHADOW_DOM) $(ENABLE_VIDEO_PRESENTATION_MODE);

Modified: trunk/Source/cmake/OptionsGTK.cmake (189840 => 189841)


--- trunk/Source/cmake/OptionsGTK.cmake	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Source/cmake/OptionsGTK.cmake	2015-09-16 02:40:53 UTC (rev 189841)
@@ -178,6 +178,7 @@
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_XHR_TIMEOUT PRIVATE ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NETWORK_PROCESS PRIVATE ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_THREADED_COMPOSITOR PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SHADOW_DOM PRIVATE OFF)
 
 # Finalize the value for all options. Do not attempt to use an option before
 # this point, and do not attempt to change any option after this point.

Modified: trunk/Tools/ChangeLog (189840 => 189841)


--- trunk/Tools/ChangeLog	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Tools/ChangeLog	2015-09-16 02:40:53 UTC (rev 189841)
@@ -1,3 +1,12 @@
+2015-09-15  Ryosuke Niwa  <rn...@webkit.org>
+
+        Add ShadowRoot interface and Element.prototype.attachShadow
+        https://bugs.webkit.org/show_bug.cgi?id=149187
+
+        Reviewed by Antti Koivisto.
+
+        * Scripts/webkitperl/FeatureList.pm:
+
 2015-09-15  Aakash Jain  <aakash_j...@apple.com>
 
         Appscale queue status json output lacks bots

Modified: trunk/Tools/Scripts/webkitperl/FeatureList.pm (189840 => 189841)


--- trunk/Tools/Scripts/webkitperl/FeatureList.pm	2015-09-16 02:10:46 UTC (rev 189840)
+++ trunk/Tools/Scripts/webkitperl/FeatureList.pm	2015-09-16 02:40:53 UTC (rev 189841)
@@ -123,6 +123,7 @@
     $resourceTimingSupport,
     $scriptedSpeechSupport,
     $seccompFiltersSupport,
+    $shadowDOMSupport,
     $streamsAPISupport,
     $styleScopedSupport,
     $subtleCrypto,
@@ -384,6 +385,9 @@
     { option => "scripted-speech", desc => "Toggle Scripted Speech support",
       define => "ENABLE_SCRIPTED_SPEECH", default => 0, value => \$scriptedSpeechSupport },
 
+    { option => "shadow-dom", desc => "Toggle Shadow DOM support",
+      define => "ENABLE_SHADOW_DOM", default => (isAppleMacWebKit() || isIOSWebKit()), value => \$shadowDOMSupport },
+
     { option => "streams-api", desc => "Toggle Streams API support",
       define => "ENABLE_STREAMS_API", default => 1, value => \$streamsAPISupport },
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to