Index: third_party/WebKit/Source/core/dom/Fullscreen.cpp |
diff --git a/third_party/WebKit/Source/core/dom/Fullscreen.cpp b/third_party/WebKit/Source/core/dom/Fullscreen.cpp |
index f30793ebf893232c84067a756b252a75473c91a3..1e841e08ad7f6e9102cdff281947e4f352f747c7 100644 |
--- a/third_party/WebKit/Source/core/dom/Fullscreen.cpp |
+++ b/third_party/WebKit/Source/core/dom/Fullscreen.cpp |
@@ -212,12 +212,50 @@ Element* Fullscreen::fullscreenElementFrom(Document& document) { |
return nullptr; |
} |
+Element* Fullscreen::fullscreenElementForBindingFrom(TreeScope& scope) { |
+ Element* element = fullscreenElementFrom(scope.document()); |
+ if (!element || !RuntimeEnabledFeatures::fullscreenUnprefixedEnabled()) |
+ return element; |
+ |
+ // TODO(kochi): Once V0 code is removed, we can use the same logic for |
+ // Document and ShadowRoot. |
+ if (!scope.rootNode().isShadowRoot()) { |
+ // For Shadow DOM V0 compatibility: We allow returning an element in V0 |
+ // shadow tree, even though it leaks the Shadow DOM. |
+ if (element->isInV0ShadowTree()) { |
+ UseCounter::count(scope.document(), |
+ UseCounter::DocumentFullscreenElementInV0Shadow); |
+ return element; |
+ } |
+ } else { |
hayato
2016/10/26 03:15:56
else if
kochi
2016/10/26 04:52:12
Done.
|
+ if (!toShadowRoot(scope).isV1()) |
hayato
2016/10/26 03:15:56
Could we avoid toShadowRoot(treeScope)?
I am not c
kochi
2016/10/26 04:52:12
Done.
|
+ return nullptr; |
+ } |
+ return scope.adjustedElement(*element); |
+} |
+ |
Element* Fullscreen::currentFullScreenElementFrom(Document& document) { |
if (Fullscreen* found = fromIfExists(document)) |
return found->currentFullScreenElement(); |
return nullptr; |
} |
+Element* Fullscreen::currentFullScreenElementForBindingFrom( |
+ Document& document) { |
+ Element* element = currentFullScreenElementFrom(document); |
+ if (!element || !RuntimeEnabledFeatures::fullscreenUnprefixedEnabled()) |
+ return element; |
+ |
+ // For Shadow DOM V0 compatibility: We allow returning an element in V0 shadow |
+ // tree, even though it leaks the Shadow DOM. |
+ if (element->isInV0ShadowTree()) { |
+ UseCounter::count(document, |
+ UseCounter::DocumentFullscreenElementInV0Shadow); |
+ return element; |
+ } |
+ return document.adjustedElement(*element); |
+} |
+ |
Fullscreen::Fullscreen(Document& document) |
: ContextLifecycleObserver(&document), |
m_fullScreenLayoutObject(nullptr), |