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

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

Issue 2340263003: Move Document.fullscreenElement to DocumentOrShadowRoot (Closed)
Patch Set: Fix for comments 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..e75d853d744c37555a2ba3a42a12fd70c8c74e20 100644
--- a/third_party/WebKit/Source/core/dom/Fullscreen.cpp
+++ b/third_party/WebKit/Source/core/dom/Fullscreen.cpp
@@ -218,6 +218,39 @@ Element* Fullscreen::currentFullScreenElementFrom(Document& document) {
return nullptr;
}
+Element* Fullscreen::fullscreenElementForBindingFrom(Document& document) {
+ Element* element = nullptr;
+ if (Fullscreen* found = fromIfExists(document))
+ element = found->fullscreenElement();
+ if (!element)
+ return nullptr;
+
+ // For Shadow DOM V0 compatibility: We allow returning an element in V0
+ // shadow tree, even though it leaks the Shadow DOM.
+ // TODO(kochi): Once V0 code is removed, the following V0 check is
+ // unnecessary.
+ if (element->isInV0ShadowTree()) {
+ UseCounter::count(document,
+ UseCounter::DocumentFullscreenElementInV0Shadow);
+ return element;
+ }
+ return document.adjustedElement(*element);
+}
+
+Element* Fullscreen::fullscreenElementForBindingFrom(ShadowRoot& shadowRoot) {
+ // TODO(kochi): Once V0 code is removed, the following non-V1 check is
+ // unnecessary. After V0 code is removed, we can use the same logic for
+ // Document and ShadowRoot.
+ if (!shadowRoot.isV1())
+ return nullptr;
+
+ if (Fullscreen* found = fromIfExists(shadowRoot.document())) {
+ if (Element* element = found->fullscreenElement())
+ return shadowRoot.adjustedElement(*element);
+ }
+ return nullptr;
+}
+
Fullscreen::Fullscreen(Document& document)
: ContextLifecycleObserver(&document),
m_fullScreenLayoutObject(nullptr),

Powered by Google App Engine
This is Rietveld 408576698