Add Element.attachShadow under the ShadowDOMV1 runtime flag (issue 1408443003 by hayato@chromium.org)

528 views
Skip to first unread message

hay...@chromium.org

unread,
Oct 15, 2015, 4:35:41 AM10/15/15
to ko...@chromium.org, ko...@chromium.org, chromium...@chromium.org, viv...@chromium.org, sigb...@opera.com, eae+bli...@chromium.org, blink-re...@chromium.org, dglazko...@chromium.org, vive...@samsung.com, ch.d...@samsung.com, blink-...@chromium.org, rob....@samsung.com
Reviewers: Takayoshi Kochi, kojii,

Message:
PTAL

Description:
Add Element.attachShadow under the ShadowDOMV1 runtime flag.

This is basically renaming from `createShadowRoot(ShadowRootInitDict)`,
which was already implemented.

Minimum layout tests are updated accordingly.

Other changes come after this CL

BUG=531990

Please review this at https://codereview.chromium.org/1408443003/

Base URL: https://chromium.googlesource.com/chromium/src.git@master

Affected files (+48, -47 lines):
M
third_party/WebKit/LayoutTests/fast/dom/shadow/create-shadow-root-with-parameter.html
M
third_party/WebKit/LayoutTests/fast/dom/shadow/create-shadow-root-with-parameter-expected.txt
M
third_party/WebKit/LayoutTests/fast/dom/shadow/delegatesFocus-highlight-sibling.html
M
third_party/WebKit/LayoutTests/fast/dom/shadow/focus-method-with-delegatesFocus.html
M
third_party/WebKit/LayoutTests/fast/dom/shadow/multiple-shadowroot-with-params.html
M
third_party/WebKit/LayoutTests/fast/dom/shadow/multiple-shadowroot-with-params-expected.txt
M third_party/WebKit/LayoutTests/fast/dom/shadow/resources/shadow-dom.js
M third_party/WebKit/Source/core/dom/Element.h
M third_party/WebKit/Source/core/dom/Element.cpp
M third_party/WebKit/Source/core/dom/Element.idl
M third_party/WebKit/Source/core/frame/OriginsUsingFeatures.h
M third_party/WebKit/Source/core/frame/UseCounter.h


Index:
third_party/WebKit/LayoutTests/fast/dom/shadow/create-shadow-root-with-parameter-expected.txt
diff --git
a/third_party/WebKit/LayoutTests/fast/dom/shadow/create-shadow-root-with-parameter-expected.txt
b/third_party/WebKit/LayoutTests/fast/dom/shadow/create-shadow-root-with-parameter-expected.txt
index
34de767d49817d73fdc0c43e9f4531125c967594..edbe652002e506911842bf96a09da45d329ce93f
100644
---
a/third_party/WebKit/LayoutTests/fast/dom/shadow/create-shadow-root-with-parameter-expected.txt
+++
b/third_party/WebKit/LayoutTests/fast/dom/shadow/create-shadow-root-with-parameter-expected.txt
@@ -1,15 +1,15 @@
-Create open shadow root.
+Attach open shadow root.
PASS [object ShadowRoot] is non-null.
-Create closed shadow root.
+Attach closed shadow root.
PASS host2.createShadowRoot({mode: 'closed'}) is non-null.
Create shadow root with empty parameter.
PASS [object ShadowRoot] is non-null.
-Create shadow root whose mode is neither open nor closed.
-PASS host4.createShadowRoot({mode: 'illegal'}) threw exception TypeError:
Failed to execute 'createShadowRoot' on 'Element': The provided
value 'illegal' is not a valid enum value of type ShadowRootMode..
-Create open shadow root with shadow-dom.js utility.
+Attach shadow root whose mode is neither open nor closed.
+PASS host4.attachShadow({mode: 'illegal'}) threw exception TypeError:
Failed to execute 'attachShadow' on 'Element': The provided value 'illegal'
is not a valid enum value of type ShadowRootMode..
+Attach open shadow root with shadow-dom.js utility.
PASS [object ShadowRoot] is non-null.
-Create shadow root on already shadowed host will raise InvalidStateError
exception.
-PASS host1.createShadowRoot({mode: 'open'}) threw exception
InvalidStateError: Failed to execute 'createShadowRoot' on 'Element':
Shadow root cannot be created on a host which already hosts a shadow tree..
+Attach shadow root on already shadowed host will raise InvalidStateError
exception.
+PASS host1.attachShadow({mode: 'open'}) threw exception InvalidStateError:
Failed to execute 'attachShadow' on 'Element': Shadow root cannot be
created on a host which already hosts a shadow tree..
PASS successfullyParsed is true

TEST COMPLETE
Index:
third_party/WebKit/LayoutTests/fast/dom/shadow/create-shadow-root-with-parameter.html
diff --git
a/third_party/WebKit/LayoutTests/fast/dom/shadow/create-shadow-root-with-parameter.html
b/third_party/WebKit/LayoutTests/fast/dom/shadow/create-shadow-root-with-parameter.html
index
1719162a08c23ae7266f6a96a2b4ae6611de07a7..0dedf12e50da6ab6a6a2235f82534866cb80d4b7
100644
---
a/third_party/WebKit/LayoutTests/fast/dom/shadow/create-shadow-root-with-parameter.html
+++
b/third_party/WebKit/LayoutTests/fast/dom/shadow/create-shadow-root-with-parameter.html
@@ -11,12 +11,12 @@
<div id="host4"></div>
</body>
<script>
-debug('Create open shadow root.');
+debug('Attach open shadow root.');
var host1 = document.querySelector('#host1');
-var root1 = host1.createShadowRoot({mode: 'open'});
+var root1 = host1.attachShadow({mode: 'open'});
shouldBeNonNull(root1);

-debug('Create closed shadow root.');
+debug('Attach closed shadow root.');
var host2 = document.querySelector('#host2');
shouldBeNonNull("host2.createShadowRoot({mode: 'closed'})");

@@ -25,11 +25,11 @@ var host3 = document.querySelector('#host3');
var root3 = host3.createShadowRoot({});
shouldBeNonNull(root3);

-debug('Create shadow root whose mode is neither open nor closed.');
+debug('Attach shadow root whose mode is neither open nor closed.');
var host4 = document.querySelector('#host4');
-shouldThrow("host4.createShadowRoot({mode: 'illegal'})");
+shouldThrow("host4.attachShadow({mode: 'illegal'})");

-debug('Create open shadow root with shadow-dom.js utility.');
+debug('Attach open shadow root with shadow-dom.js utility.');
document.body.appendChild(
createDOM('div', {id: 'host5'},
createShadowRoot({mode: 'open'})));
@@ -37,7 +37,7 @@ var host5 = document.querySelector('#host5');
var root5 = host5.shadowRoot;
shouldBeNonNull(root5);

-debug('Create shadow root on already shadowed host will raise
InvalidStateError exception.');
-shouldThrow("host1.createShadowRoot({mode: 'open'})");
+debug('Attach shadow root on already shadowed host will raise
InvalidStateError exception.');
+shouldThrow("host1.attachShadow({mode: 'open'})");
</script>
</html>
Index:
third_party/WebKit/LayoutTests/fast/dom/shadow/delegatesFocus-highlight-sibling.html
diff --git
a/third_party/WebKit/LayoutTests/fast/dom/shadow/delegatesFocus-highlight-sibling.html
b/third_party/WebKit/LayoutTests/fast/dom/shadow/delegatesFocus-highlight-sibling.html
index
e3132637c81ecd8344303c44babefd91a79e5e0d..704553ea35be33e4cd4a105668cf65bf15bcf769
100644
---
a/third_party/WebKit/LayoutTests/fast/dom/shadow/delegatesFocus-highlight-sibling.html
+++
b/third_party/WebKit/LayoutTests/fast/dom/shadow/delegatesFocus-highlight-sibling.html
@@ -45,7 +45,7 @@ function RegisterXMenu() {
var xMenuProto = Object.create(HTMLElement.prototype);
xMenuProto.createdCallback = function() {
var delegatesFocus = this.hasAttribute('delegatesFocus');
- this.createShadowRoot({ 'delegatesFocus': delegatesFocus })
+ this.attachShadow({ 'delegatesFocus': delegatesFocus })
.appendChild(
document.importNode(template.content, true)
);
Index:
third_party/WebKit/LayoutTests/fast/dom/shadow/focus-method-with-delegatesFocus.html
diff --git
a/third_party/WebKit/LayoutTests/fast/dom/shadow/focus-method-with-delegatesFocus.html
b/third_party/WebKit/LayoutTests/fast/dom/shadow/focus-method-with-delegatesFocus.html
index
a4674ab45c226cf8d0ee70077a1d24fa7ff82e97..8efe7163a9b1b401f1fdb0badd1241098c58d451
100644
---
a/third_party/WebKit/LayoutTests/fast/dom/shadow/focus-method-with-delegatesFocus.html
+++
b/third_party/WebKit/LayoutTests/fast/dom/shadow/focus-method-with-delegatesFocus.html
@@ -29,7 +29,7 @@ function registerShadow(templateId, tagName) {
var proto = Object.create(HTMLElement.prototype);
proto.createdCallback = function() {
var delegatesFocus = this.hasAttribute('delegatesFocus');
- this.createShadowRoot({'delegatesFocus':
delegatesFocus}).appendChild(
+ this.attachShadow({'delegatesFocus': delegatesFocus}).appendChild(
document.importNode(template.content, true));
};
document.registerElement(tagName, { prototype: proto });
Index:
third_party/WebKit/LayoutTests/fast/dom/shadow/multiple-shadowroot-with-params-expected.txt
diff --git
a/third_party/WebKit/LayoutTests/fast/dom/shadow/multiple-shadowroot-with-params-expected.txt
b/third_party/WebKit/LayoutTests/fast/dom/shadow/multiple-shadowroot-with-params-expected.txt
index
9f8785f8a685bb17ed6aa390eeaa33d8b8486c8c..377fb288c1baf859418f7c5070a4168b817ac1ba
100644
---
a/third_party/WebKit/LayoutTests/fast/dom/shadow/multiple-shadowroot-with-params-expected.txt
+++
b/third_party/WebKit/LayoutTests/fast/dom/shadow/multiple-shadowroot-with-params-expected.txt
@@ -10,9 +10,9 @@ PASS internals.shadowRootType(shadow1)
is "OpenByDefaultShadowRoot"
PASS internals.shadowRootType(shadow2) is "OpenByDefaultShadowRoot"
PASS internals.youngestShadowRoot(div) is shadow2
PASS shadow2.olderShadowRoot is shadow1
-(2/2) createShadowRoot({mode:"open"}) cannot create multiple shadow roots
+(2/2) attachShadow({mode:"open"}) cannot create multiple shadow roots
PASS internals.shadowRootType(shadow1) is "OpenByDefaultShadowRoot"
-PASS div.createShadowRoot({mode: "open"}) threw exception
InvalidStateError: Failed to execute 'createShadowRoot' on 'Element':
Shadow root cannot be created on a host which already hosts a shadow tree..
+PASS div.attachShadow({mode: "open"}) threw exception InvalidStateError:
Failed to execute 'attachShadow' on 'Element': Shadow root cannot be
created on a host which already hosts a shadow tree..
PASS internals.youngestShadowRoot(div) is shadow1
(3/3) createShadowRoot() cannot create multiple shadow roots on shadow
root with explicit open parameter.
PASS internals.shadowRootType(shadow1) is "OpenShadowRoot"
@@ -20,22 +20,22 @@ PASS div.createShadowRoot() threw exception
InvalidStateError: Failed to execute
PASS internals.youngestShadowRoot(div) is shadow1
(4/4) closed shadow root cannot be created on any open shadow roots
PASS internals.shadowRootType(shadow1) is "OpenByDefaultShadowRoot"
-PASS div.createShadowRoot({mode: "closed"}) threw exception
InvalidStateError: Failed to execute 'createShadowRoot' on 'Element':
Shadow root cannot be created on a host which already hosts a shadow tree..
+PASS div.attachShadow({mode: "closed"}) threw exception InvalidStateError:
Failed to execute 'attachShadow' on 'Element': Shadow root cannot be
created on a host which already hosts a shadow tree..
PASS internals.youngestShadowRoot(div) is shadow1
PASS internals.shadowRootType(shadow1) is "OpenShadowRoot"
-PASS div.createShadowRoot({mode: "closed"}) threw exception
InvalidStateError: Failed to execute 'createShadowRoot' on 'Element':
Shadow root cannot be created on a host which already hosts a shadow tree..
+PASS div.attachShadow({mode: "closed"}) threw exception InvalidStateError:
Failed to execute 'attachShadow' on 'Element': Shadow root cannot be
created on a host which already hosts a shadow tree..
PASS internals.youngestShadowRoot(div) is shadow1
(5/5) any shadow root cannot be created on closed shadow root
PASS internals.shadowRootType(shadow1) is "ClosedShadowRoot"
PASS div.createShadowRoot() threw exception InvalidStateError: Failed to
execute 'createShadowRoot' on 'Element': Shadow root cannot be created on a
host which already hosts this type of shadow tree..
-PASS div.createShadowRoot({mode: "open"}) threw exception
InvalidStateError: Failed to execute 'createShadowRoot' on 'Element':
Shadow root cannot be created on a host which already hosts a shadow tree..
-PASS div.createShadowRoot({mode: "closed"}) threw exception
InvalidStateError: Failed to execute 'createShadowRoot' on 'Element':
Shadow root cannot be created on a host which already hosts a shadow tree..
+PASS div.attachShadow({mode: "open"}) threw exception InvalidStateError:
Failed to execute 'attachShadow' on 'Element': Shadow root cannot be
created on a host which already hosts a shadow tree..
+PASS div.attachShadow({mode: "closed"}) threw exception InvalidStateError:
Failed to execute 'attachShadow' on 'Element': Shadow root cannot be
created on a host which already hosts a shadow tree..
(6/6) explicitly open/closed shadow root cannot be created on UA shadow
root
PASS internals.shadowRootType(internals.shadowRoot(input))
is "UserAgentShadowRoot"
PASS internals.youngestShadowRoot(input) is shadow1
PASS internals.shadowRootType(shadow1) is "OpenByDefaultShadowRoot"
-PASS input.createShadowRoot({mode: "open"}) threw exception
InvalidStateError: Failed to execute 'createShadowRoot' on 'Element':
Shadow root cannot be created on a host which already hosts a shadow tree..
-PASS input.createShadowRoot({mode: "closed"}) threw exception
InvalidStateError: Failed to execute 'createShadowRoot' on 'Element':
Shadow root cannot be created on a host which already hosts a shadow tree..
+PASS input.attachShadow({mode: "open"}) threw exception InvalidStateError:
Failed to execute 'attachShadow' on 'Element': Shadow root cannot be
created on a host which already hosts a shadow tree..
+PASS input.attachShadow({mode: "closed"}) threw exception
InvalidStateError: Failed to execute 'attachShadow' on 'Element': Shadow
root cannot be created on a host which already hosts a shadow tree..
PASS successfullyParsed is true

TEST COMPLETE
Index:
third_party/WebKit/LayoutTests/fast/dom/shadow/multiple-shadowroot-with-params.html
diff --git
a/third_party/WebKit/LayoutTests/fast/dom/shadow/multiple-shadowroot-with-params.html
b/third_party/WebKit/LayoutTests/fast/dom/shadow/multiple-shadowroot-with-params.html
index
4f1e3ccf98e40084db35b9b472b876668e1ad987..77fb3e74d31b10aad7e291a8296bbce9aed7a847
100644
---
a/third_party/WebKit/LayoutTests/fast/dom/shadow/multiple-shadowroot-with-params.html
+++
b/third_party/WebKit/LayoutTests/fast/dom/shadow/multiple-shadowroot-with-params.html
@@ -35,18 +35,18 @@ youngestShadowRootShouldBe('div', 'shadow2');
shouldBe('shadow2.olderShadowRoot', 'shadow1');


-debug('(2/2) createShadowRoot({mode:"open"}) cannot create multiple shadow
roots');
+debug('(2/2) attachShadow({mode:"open"}) cannot create multiple shadow
roots');
div = document.createElement('div');
shadow1 = div.createShadowRoot();
shouldBeOpenByDefaultShadowRoot('shadow1');

-shouldThrow('div.createShadowRoot({mode: "open"})');
+shouldThrow('div.attachShadow({mode: "open"})');
youngestShadowRootShouldBe('div', 'shadow1');


debug('(3/3) createShadowRoot() cannot create multiple shadow roots on
shadow root with explicit open parameter.');
div = document.createElement('div');
-shadow1 = div.createShadowRoot({mode: 'open'});
+shadow1 = div.attachShadow({mode: 'open'});
shouldBeOpenShadowRoot('shadow1');

shouldThrow('div.createShadowRoot()');
@@ -58,25 +58,25 @@ div = document.createElement('div');
shadow1 = div.createShadowRoot();
shouldBeOpenByDefaultShadowRoot('shadow1');

-shouldThrow('div.createShadowRoot({mode: "closed"})');
+shouldThrow('div.attachShadow({mode: "closed"})');
youngestShadowRootShouldBe('div', 'shadow1');

div = document.createElement('div');
-shadow1 = div.createShadowRoot({mode: 'open'});
+shadow1 = div.attachShadow({mode: 'open'});
shouldBeOpenShadowRoot('shadow1');

-shouldThrow('div.createShadowRoot({mode: "closed"})');
+shouldThrow('div.attachShadow({mode: "closed"})');
youngestShadowRootShouldBe('div', 'shadow1');


debug('(5/5) any shadow root cannot be created on closed shadow root');
div = document.createElement('div');
-shadow1 = div.createShadowRoot({mode: 'closed'});
+shadow1 = div.attachShadow({mode: 'closed'});
shouldBeClosedShadowRoot('shadow1');

shouldThrow('div.createShadowRoot()');
-shouldThrow('div.createShadowRoot({mode: "open"})');
-shouldThrow('div.createShadowRoot({mode: "closed"})');
+shouldThrow('div.attachShadow({mode: "open"})');
+shouldThrow('div.attachShadow({mode: "closed"})');


debug('(6/6) explicitly open/closed shadow root cannot be created on UA
shadow root');
@@ -87,8 +87,8 @@ youngestShadowRootShouldBe('input', 'shadow1');
shouldBeOpenByDefaultShadowRoot('shadow1');

input = document.createElement('input');
-shouldThrow('input.createShadowRoot({mode: "open"})');
+shouldThrow('input.attachShadow({mode: "open"})');

input = document.createElement('input');
-shouldThrow('input.createShadowRoot({mode: "closed"})');
+shouldThrow('input.attachShadow({mode: "closed"})');
</script>
Index:
third_party/WebKit/LayoutTests/fast/dom/shadow/resources/shadow-dom.js
diff --git
a/third_party/WebKit/LayoutTests/fast/dom/shadow/resources/shadow-dom.js
b/third_party/WebKit/LayoutTests/fast/dom/shadow/resources/shadow-dom.js
index
19ba8e4e9d6fc2626e786b53b8024ff07c61da4d..651084c92aa36c214b0cb3c5ebadf8364a5633bb
100644
--- a/third_party/WebKit/LayoutTests/fast/dom/shadow/resources/shadow-dom.js
+++ b/third_party/WebKit/LayoutTests/fast/dom/shadow/resources/shadow-dom.js
@@ -1,3 +1,4 @@
+// TODO(hayato): Have both createShadowRoot and attachShadow.
function createShadowRoot()
{
var children = Array.prototype.slice.call(arguments);
@@ -41,7 +42,7 @@ function createDOM(tagName, attributes)
shadowRoot =
window.internals.createUserAgentShadowRoot(element);
} else {
if (child.parameter && Object.keys(child.parameter).length
> 0)
- shadowRoot = element.createShadowRoot(child.parameter);
+ shadowRoot = element.attachShadow(child.parameter);
else
shadowRoot = element.createShadowRoot();
}
Index: third_party/WebKit/Source/core/dom/Element.cpp
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp
b/third_party/WebKit/Source/core/dom/Element.cpp
index
68af23e2104623ab7161b1d3d3d92e123197ecf8..210306d7686e42846e3dcf10033eee127f2baccd
100644
--- a/third_party/WebKit/Source/core/dom/Element.cpp
+++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -1918,12 +1918,11 @@ PassRefPtrWillBeRawPtr<ShadowRoot>
Element::createShadowRoot(const ScriptState*
return createShadowRootInternal(ShadowRootType::OpenByDefault,
exceptionState);
}

-PassRefPtrWillBeRawPtr<ShadowRoot> Element::createShadowRoot(const
ScriptState* scriptState, const ShadowRootInit& shadowRootInitDict,
ExceptionState& exceptionState)
+PassRefPtrWillBeRawPtr<ShadowRoot> Element::attachShadow(const
ScriptState* scriptState, const ShadowRootInit& shadowRootInitDict,
ExceptionState& exceptionState)
{
ASSERT(RuntimeEnabledFeatures::shadowDOMV1Enabled());
- UseCounter::count(document(),
UseCounter::ElementCreateShadowRootWithParameter);

- OriginsUsingFeatures::countMainWorldOnly(scriptState, document(),
OriginsUsingFeatures::Feature::ElementCreateShadowRoot);
+ OriginsUsingFeatures::countMainWorldOnly(scriptState, document(),
OriginsUsingFeatures::Feature::ElementAttachShadow);

if (shadowRootInitDict.hasMode() && shadowRoot()) {
exceptionState.throwDOMException(InvalidStateError, "Shadow root
cannot be created on a host which already hosts a shadow tree.");
@@ -1939,9 +1938,9 @@ PassRefPtrWillBeRawPtr<ShadowRoot>
Element::createShadowRoot(const ScriptState*
exceptionState.throwDOMException(NotSupportedError, "Closed
shadow root is not supported yet.");
return nullptr;
}
- UseCounter::count(document(),
UseCounter::ElementCreateShadowRootClosed);
+ UseCounter::count(document(),
UseCounter::ElementAttachShadowClosed);
} else if (type == ShadowRootType::Open) {
- UseCounter::count(document(),
UseCounter::ElementCreateShadowRootOpen);
+ UseCounter::count(document(), UseCounter::ElementAttachShadowOpen);
}

RefPtrWillBeRawPtr<ShadowRoot> shadowRoot =
createShadowRootInternal(type, exceptionState);
Index: third_party/WebKit/Source/core/dom/Element.h
diff --git a/third_party/WebKit/Source/core/dom/Element.h
b/third_party/WebKit/Source/core/dom/Element.h
index
61a4cc34516c49638284624cbcbd5ef8473c5483..213c3ae385d8661c44184f48775d02cdb8a4503a
100644
--- a/third_party/WebKit/Source/core/dom/Element.h
+++ b/third_party/WebKit/Source/core/dom/Element.h
@@ -329,7 +329,7 @@ public:
// shadow roots is prohibited in any combination and throws an
exception. Multiple shadow roots
// are allowed only when createShadowRoot() is used without any
parameters from JavaScript.
PassRefPtrWillBeRawPtr<ShadowRoot> createShadowRoot(const
ScriptState*, ExceptionState&);
- PassRefPtrWillBeRawPtr<ShadowRoot> createShadowRoot(const
ScriptState*, const ShadowRootInit&, ExceptionState&);
+ PassRefPtrWillBeRawPtr<ShadowRoot> attachShadow(const ScriptState*,
const ShadowRootInit&, ExceptionState&);
PassRefPtrWillBeRawPtr<ShadowRoot>
createShadowRootInternal(ShadowRootType, ExceptionState&);

ShadowRoot* openShadowRoot() const;
Index: third_party/WebKit/Source/core/dom/Element.idl
diff --git a/third_party/WebKit/Source/core/dom/Element.idl
b/third_party/WebKit/Source/core/dom/Element.idl
index
f83577ecf1c5c0e53929345d60fa9468fb5e333e..f2f6cd531ad7d8afca8db8ee4b875eb55f117676
100644
--- a/third_party/WebKit/Source/core/dom/Element.idl
+++ b/third_party/WebKit/Source/core/dom/Element.idl
@@ -70,7 +70,7 @@ enum NativeScrollBehavior
{ "disable-native-scroll", "perform-before-native-scro
// Shadow DOM
//
http://w3c.github.io/webcomponents/spec/shadow/#extensions-to-element-interface
[RaisesException, CallWith=ScriptState,
MeasureAs=ElementCreateShadowRoot] ShadowRoot createShadowRoot();
- [RuntimeEnabled=ShadowDOMV1, RaisesException, CallWith=ScriptState,
MeasureAs=ElementCreateShadowRoot] ShadowRoot
createShadowRoot(ShadowRootInit shadowRootInitDict);
+ [RuntimeEnabled=ShadowDOMV1, RaisesException, CallWith=ScriptState,
MeasureAs=ElementAttachShadow] ShadowRoot attachShadow(ShadowRootInit
shadowRootInitDict);
NodeList getDestinationInsertionPoints();
[PerWorldBindings, ImplementedAs=openShadowRoot] readonly attribute
ShadowRoot? shadowRoot;

Index: third_party/WebKit/Source/core/frame/OriginsUsingFeatures.h
diff --git a/third_party/WebKit/Source/core/frame/OriginsUsingFeatures.h
b/third_party/WebKit/Source/core/frame/OriginsUsingFeatures.h
index
185c4099bb781c808f67340b490c879b3c2c0257..e289738242918db7926c075689dd952933697abf
100644
--- a/third_party/WebKit/Source/core/frame/OriginsUsingFeatures.h
+++ b/third_party/WebKit/Source/core/frame/OriginsUsingFeatures.h
@@ -34,6 +34,7 @@ public:
GeolocationInsecureOrigin,
GetUserMediaInsecureOrigin,
GetUserMediaSecureOrigin,
+ ElementAttachShadow,

NumberOfFeatures // This must be the last item.
};
Index: third_party/WebKit/Source/core/frame/UseCounter.h
diff --git a/third_party/WebKit/Source/core/frame/UseCounter.h
b/third_party/WebKit/Source/core/frame/UseCounter.h
index
ccaf40425f9836d962293db62aee3c7a39079458..5dd36039fcc32ca43d2711d67eef61829735351f
100644
--- a/third_party/WebKit/Source/core/frame/UseCounter.h
+++ b/third_party/WebKit/Source/core/frame/UseCounter.h
@@ -676,7 +676,7 @@ public:
ElementCreateShadowRootMultipleWithUserAgentShadowRoot = 800,
InputTypeFileSecureOrigin = 801,
InputTypeFileInsecureOrigin = 802,
- ElementCreateShadowRootWithParameter = 804,
+ ElementAttachShadow = 804,
V8KeyboardEvent_KeyIdentifier_AttributeGetter = 805,
V8SecurityPolicyViolationEvent_DocumentURI_AttributeGetter = 806,
V8SecurityPolicyViolationEvent_BlockedURI_AttributeGetter = 807,
@@ -780,8 +780,8 @@ public:
ClientHintsMetaAcceptCH = 904,
HTMLElementDeprecatedWidth = 905,
ClientHintsContentDPR = 906,
- ElementCreateShadowRootOpen = 907,
- ElementCreateShadowRootClosed = 908,
+ ElementAttachShadowOpen = 907,
+ ElementAttachShadowClosed = 908,
AudioParamSetValueAtTime = 909,
AudioParamLinearRampToValueAtTime = 910,
AudioParamExponentialRampToValueAtTime = 911,


hay...@chromium.org

unread,
Oct 15, 2015, 4:43:04 AM10/15/15
to ko...@chromium.org, ko...@chromium.org, chromium...@chromium.org, viv...@chromium.org, sigb...@opera.com, eae+bli...@chromium.org, blink-re...@chromium.org, dglazko...@chromium.org, vive...@samsung.com, ch.d...@samsung.com, blink-...@chromium.org, rob....@samsung.com

https://codereview.chromium.org/1408443003/diff/1/third_party/WebKit/Source/core/frame/OriginsUsingFeatures.h
File third_party/WebKit/Source/core/frame/OriginsUsingFeatures.h
(right):

https://codereview.chromium.org/1408443003/diff/1/third_party/WebKit/Source/core/frame/OriginsUsingFeatures.h#newcode37
third_party/WebKit/Source/core/frame/OriginsUsingFeatures.h:37:
ElementAttachShadow,
kojii@
I guess this is for RAPPOR. Is this change enough to make RAPPOR work?

https://codereview.chromium.org/1408443003/

ko...@chromium.org

unread,
Oct 15, 2015, 4:57:00 AM10/15/15
to hay...@chromium.org, ko...@chromium.org, chromium...@chromium.org, viv...@chromium.org, sigb...@opera.com, eae+bli...@chromium.org, blink-re...@chromium.org, dglazko...@chromium.org, vive...@samsung.com, ch.d...@samsung.com, blink-...@chromium.org, rob....@samsung.com
this looks good for the first step.

Could you also look at the layout test failures and
fix them in this CL?

https://codereview.chromium.org/1408443003/

hay...@chromium.org

unread,
Oct 15, 2015, 7:43:57 AM10/15/15
to ko...@chromium.org, ko...@chromium.org, chromium...@chromium.org, viv...@chromium.org, sigb...@opera.com, eae+bli...@chromium.org, blink-re...@chromium.org, dglazko...@chromium.org, vive...@samsung.com, ch.d...@samsung.com, blink-...@chromium.org, rob....@samsung.com
On 2015/10/15 08:57:00, Takayoshi Kochi wrote:
> this looks good for the first step.

> Could you also look at the layout test failures and
> fix them in this CL?

Thanks. I've fixed them.

https://codereview.chromium.org/1408443003/

ko...@chromium.org

unread,
Oct 15, 2015, 8:16:18 AM10/15/15
to hay...@chromium.org, ko...@chromium.org, chromium...@chromium.org, viv...@chromium.org, sigb...@opera.com, eae+bli...@chromium.org, blink-re...@chromium.org, dglazko...@chromium.org, vive...@samsung.com, ch.d...@samsung.com, blink-...@chromium.org, rob....@samsung.com

https://codereview.chromium.org/1408443003/diff/40001/third_party/WebKit/LayoutTests/fast/dom/shadow/create-shadow-root-with-parameter.html
File
third_party/WebKit/LayoutTests/fast/dom/shadow/create-shadow-root-with-parameter.html
(right):

https://codereview.chromium.org/1408443003/diff/40001/third_party/WebKit/LayoutTests/fast/dom/shadow/create-shadow-root-with-parameter.html#newcode21
third_party/WebKit/LayoutTests/fast/dom/shadow/create-shadow-root-with-parameter.html:21:
shouldBeNonNull("host2.createShadowRoot({mode: 'closed'})");
Forgot to change here?

https://codereview.chromium.org/1408443003/diff/40001/third_party/WebKit/LayoutTests/fast/dom/shadow/create-shadow-root-with-parameter.html#newcode25
third_party/WebKit/LayoutTests/fast/dom/shadow/create-shadow-root-with-parameter.html:25:
var root3 = host3.createShadowRoot({});
Ditto.

https://codereview.chromium.org/1408443003/diff/40001/third_party/WebKit/LayoutTests/fast/dom/shadow/create-shadow-root-with-parameter.html#newcode35
third_party/WebKit/LayoutTests/fast/dom/shadow/create-shadow-root-with-parameter.html:35:
createShadowRoot({mode: 'open'})));
Do you plan to add attachShadow() in shadow-dom.js?

This looks confusing.
(edit: I found your TODO in shadow-dom.js).

https://codereview.chromium.org/1408443003/diff/40001/third_party/WebKit/LayoutTests/fast/dom/shadow/resources/shadow-dom.js
File
third_party/WebKit/LayoutTests/fast/dom/shadow/resources/shadow-dom.js
(right):

https://codereview.chromium.org/1408443003/diff/40001/third_party/WebKit/LayoutTests/fast/dom/shadow/resources/shadow-dom.js#newcode1
third_party/WebKit/LayoutTests/fast/dom/shadow/resources/shadow-dom.js:1:
// TODO(hayato): Have both createShadowRoot and attachShadow.
Yes!!

https://codereview.chromium.org/1408443003/

hay...@chromium.org

unread,
Oct 15, 2015, 11:47:29 PM10/15/15
to ko...@chromium.org, ko...@chromium.org, chromium...@chromium.org, viv...@chromium.org, sigb...@opera.com, eae+bli...@chromium.org, blink-re...@chromium.org, dglazko...@chromium.org, vive...@samsung.com, ch.d...@samsung.com, blink-...@chromium.org, rob....@samsung.com

https://codereview.chromium.org/1408443003/diff/40001/third_party/WebKit/LayoutTests/fast/dom/shadow/create-shadow-root-with-parameter.html
File
third_party/WebKit/LayoutTests/fast/dom/shadow/create-shadow-root-with-parameter.html
(right):

https://codereview.chromium.org/1408443003/diff/40001/third_party/WebKit/LayoutTests/fast/dom/shadow/create-shadow-root-with-parameter.html#newcode21
third_party/WebKit/LayoutTests/fast/dom/shadow/create-shadow-root-with-parameter.html:21:
shouldBeNonNull("host2.createShadowRoot({mode: 'closed'})");
On 2015/10/15 12:16:18, Takayoshi Kochi wrote:
> Forgot to change here?

I've rewritten this test.

https://codereview.chromium.org/1408443003/

ko...@chromium.org

unread,
Oct 16, 2015, 12:27:46 AM10/16/15
to hay...@chromium.org, ko...@chromium.org, chromium...@chromium.org, viv...@chromium.org, sigb...@opera.com, eae+bli...@chromium.org, blink-re...@chromium.org, dglazko...@chromium.org, vive...@samsung.com, ch.d...@samsung.com, blink-...@chromium.org, rob....@samsung.com

hay...@chromium.org

unread,
Oct 16, 2015, 12:34:13 AM10/16/15
to ko...@chromium.org, ko...@chromium.org, chromium...@chromium.org, viv...@chromium.org, sigb...@opera.com, eae+bli...@chromium.org, blink-re...@chromium.org, dglazko...@chromium.org, vive...@samsung.com, ch.d...@samsung.com, blink-...@chromium.org, rob....@samsung.com
Thanks. Let me land this CL.

It looks we need another change to make RAPPOR work, but I can do it later.



https://codereview.chromium.org/1408443003/

commit-bot@chromium.org via codereview.chromium.org

unread,
Oct 16, 2015, 12:34:58 AM10/16/15
to hay...@chromium.org, ko...@chromium.org, ko...@chromium.org, commi...@chromium.org, chromium...@chromium.org, viv...@chromium.org, sigb...@opera.com, eae+bli...@chromium.org, blink-re...@chromium.org, dglazko...@chromium.org, vive...@samsung.com, ch.d...@samsung.com, blink-...@chromium.org, rob....@samsung.com

commit-bot@chromium.org via codereview.chromium.org

unread,
Oct 16, 2015, 1:16:27 AM10/16/15
to hay...@chromium.org, ko...@chromium.org, ko...@chromium.org, commi...@chromium.org, chromium...@chromium.org, viv...@chromium.org, sigb...@opera.com, eae+bli...@chromium.org, blink-re...@chromium.org, dglazko...@chromium.org, vive...@samsung.com, ch.d...@samsung.com, blink-...@chromium.org, rob....@samsung.com
Committed patchset #4 (id:60001)

https://codereview.chromium.org/1408443003/

commit-bot@chromium.org via codereview.chromium.org

unread,
Oct 16, 2015, 1:17:23 AM10/16/15
to hay...@chromium.org, ko...@chromium.org, ko...@chromium.org, commi...@chromium.org, chromium...@chromium.org, viv...@chromium.org, sigb...@opera.com, eae+bli...@chromium.org, blink-re...@chromium.org, dglazko...@chromium.org, vive...@samsung.com, ch.d...@samsung.com, blink-...@chromium.org, rob....@samsung.com
Patchset 4 (id:??) landed as
https://crrev.com/c50b98bea4c7bd611fefe7ade6d9bd52fa9af101
Cr-Commit-Position: refs/heads/master@{#354452}

https://codereview.chromium.org/1408443003/
Reply all
Reply to author
Forward
0 new messages