Chromium Code Reviews| Index: Source/core/dom/ContainerNode.cpp |
| diff --git a/Source/core/dom/ContainerNode.cpp b/Source/core/dom/ContainerNode.cpp |
| index f399213a53970bcd7f8a6b467d8ce43cac065ba5..efb14bfc14aaf4f9c1af11b9c1137f850642c6b9 100644 |
| --- a/Source/core/dom/ContainerNode.cpp |
| +++ b/Source/core/dom/ContainerNode.cpp |
| @@ -1084,6 +1084,20 @@ void ContainerNode::focusStateChanged() |
| void ContainerNode::setFocus(bool received) |
| { |
| + // Recurse up the shadow trees to mark shadow hosts if it matches :focus. |
|
hayato
2015/06/12 04:37:57
Could you add a layout test which involves a dom m
kochi
2015/06/12 07:34:17
Added 'focus-with-dom-mutation.html' layout test w
|
| + if (isInShadowTree() && shadowHost()->shadowRoot()) |
|
hayato
2015/06/12 04:37:57
Not intuitive to me. Is this checking that `this`
kochi
2015/06/12 07:34:17
Yes, it's author shadow only.
Updated the comment
|
| + shadowHost()->setFocus(received); |
| + |
| + // If this is an author shadow host and indirectly focused (has focused element within |
| + // its shadow root), update focus. |
| + // TODO(kochi): Handle UA shadow which marks multiple nodes as focused such as |
| + // <input type="date"> the same way as author shadow. |
| + if (document().focusedElement() && document().focusedElement() != this) { |
| + Element* host = toElement(this); |
|
hayato
2015/06/12 04:37:57
1. Looks isElementNode() is used in L1112.
`this`
kochi
2015/06/12 07:34:17
1. Good catch. I guess no one is calling setFocus
|
| + if (host->shadowRoot()) |
| + received = received && host->shadowRoot()->delegatesFocus(); |
| + } |
| + |
| if (focused() == received) |
| return; |