Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(396)

Unified Diff: third_party/WebKit/Source/core/dom/Fullscreen.cpp

Issue 2340263003: Move Document.fullscreenElement to DocumentOrShadowRoot (Closed)
Patch Set: Style nit Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/dom/Fullscreen.h ('k') | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..3af5bce3b328fba96c0bd0a67ceb0bf6998223a2 100644
--- a/third_party/WebKit/Source/core/dom/Fullscreen.cpp
+++ b/third_party/WebKit/Source/core/dom/Fullscreen.cpp
@@ -212,12 +212,49 @@ 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 if (!toShadowRoot(scope.rootNode()).isV1()) {
+ 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),
« no previous file with comments | « third_party/WebKit/Source/core/dom/Fullscreen.h ('k') | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698