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

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

Issue 2340263003: Move Document.fullscreenElement to DocumentOrShadowRoot (Closed)
Patch Set: rebase 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
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..1fc1a22d476a98d86066752028cbe2bb69a1b918 100644
--- a/third_party/WebKit/Source/core/dom/Fullscreen.cpp
+++ b/third_party/WebKit/Source/core/dom/Fullscreen.cpp
@@ -212,12 +212,42 @@ 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
foolip 2016/10/24 15:30:12 Do you want to attempt all of these changes at onc
kochi 2016/10/25 10:08:04 Ah good catch! I forgot to add this logic to Fulls
+ // shadow tree, even though it leaks the Shadow DOM.
+ if (element->isInV0ShadowTree()) {
+ UseCounter::count(scope.document(),
+ UseCounter::DocumentFullscreenElementInV0Shadow);
+ return element;
+ }
+ } else {
+ if (!toShadowRoot(scope).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;
+ return document.adjustedElement(*element);
+}
+
Fullscreen::Fullscreen(Document& document)
: ContextLifecycleObserver(&document),
m_fullScreenLayoutObject(nullptr),

Powered by Google App Engine
This is Rietveld 408576698