| Index: third_party/WebKit/Source/core/dom/TreeScope.cpp
|
| diff --git a/third_party/WebKit/Source/core/dom/TreeScope.cpp b/third_party/WebKit/Source/core/dom/TreeScope.cpp
|
| index fdea83b380fc9ff57a3dc8783132d9474952136d..ff7396764d943d7314394e226cec2ecc21e08a39 100644
|
| --- a/third_party/WebKit/Source/core/dom/TreeScope.cpp
|
| +++ b/third_party/WebKit/Source/core/dom/TreeScope.cpp
|
| @@ -388,6 +388,23 @@ Element* TreeScope::adjustedFocusedElement() const
|
| return nullptr;
|
| }
|
|
|
| +Element* TreeScope::adjustedPointerLockElement(const Element& target) const
|
| +{
|
| + const Element* adjustedTarget = ⌖
|
| + // Unless the target is in the same TreeScope as |scope|, traverse up shadow trees to
|
| + // find a shadow host that is in the same TreeScope as |scope|.
|
| + for (const Element* ancestor = ⌖ ancestor; ancestor = ancestor->shadowHost()) {
|
| + // Exception is that if the host has V0 or UA shadow, skip the adjustment because
|
| + // .pointerLockElement is not available for non-V1 shadows.
|
| + // TODO(kochi): Once V0 code is removed, use the same logic as .activeElement for
|
| + // Shadow DOM V1.
|
| + if (ancestor->shadowRootIfV1())
|
| + adjustedTarget = ancestor;
|
| + if (this == ancestor->treeScope())
|
| + return const_cast<Element*>(adjustedTarget);
|
| + }
|
| + return nullptr;
|
| +}
|
| unsigned short TreeScope::comparePosition(const TreeScope& otherScope) const
|
| {
|
| if (otherScope == this)
|
|
|