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

Side by Side Diff: third_party/WebKit/Source/core/dom/Fullscreen.cpp

Issue 2340263003: Move Document.fullscreenElement to DocumentOrShadowRoot (Closed)
Patch Set: rebase Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 10 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 return static_cast<Fullscreen*>( 205 return static_cast<Fullscreen*>(
206 Supplement<Document>::from(document, supplementName())); 206 Supplement<Document>::from(document, supplementName()));
207 } 207 }
208 208
209 Element* Fullscreen::fullscreenElementFrom(Document& document) { 209 Element* Fullscreen::fullscreenElementFrom(Document& document) {
210 if (Fullscreen* found = fromIfExists(document)) 210 if (Fullscreen* found = fromIfExists(document))
211 return found->fullscreenElement(); 211 return found->fullscreenElement();
212 return nullptr; 212 return nullptr;
213 } 213 }
214 214
215 Element* Fullscreen::fullscreenElementForBindingFrom(TreeScope& scope) {
216 Element* element = fullscreenElementFrom(scope.document());
217 if (!element || !RuntimeEnabledFeatures::fullscreenUnprefixedEnabled())
218 return element;
219
220 // TODO(kochi): Once V0 code is removed, we can use the same logic for
221 // Document and ShadowRoot.
222 if (!scope.rootNode().isShadowRoot()) {
223 // 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
224 // shadow tree, even though it leaks the Shadow DOM.
225 if (element->isInV0ShadowTree()) {
226 UseCounter::count(scope.document(),
227 UseCounter::DocumentFullscreenElementInV0Shadow);
228 return element;
229 }
230 } else {
231 if (!toShadowRoot(scope).isV1())
232 return nullptr;
233 }
234 return scope.adjustedElement(*element);
235 }
236
215 Element* Fullscreen::currentFullScreenElementFrom(Document& document) { 237 Element* Fullscreen::currentFullScreenElementFrom(Document& document) {
216 if (Fullscreen* found = fromIfExists(document)) 238 if (Fullscreen* found = fromIfExists(document))
217 return found->currentFullScreenElement(); 239 return found->currentFullScreenElement();
218 return nullptr; 240 return nullptr;
219 } 241 }
220 242
243 Element* Fullscreen::currentFullScreenElementForBindingFrom(
244 Document& document) {
245 Element* element = currentFullScreenElementFrom(document);
246 if (!element || !RuntimeEnabledFeatures::fullscreenUnprefixedEnabled())
247 return element;
248 return document.adjustedElement(*element);
249 }
250
221 Fullscreen::Fullscreen(Document& document) 251 Fullscreen::Fullscreen(Document& document)
222 : ContextLifecycleObserver(&document), 252 : ContextLifecycleObserver(&document),
223 m_fullScreenLayoutObject(nullptr), 253 m_fullScreenLayoutObject(nullptr),
224 m_eventQueueTimer(this, &Fullscreen::eventQueueTimerFired), 254 m_eventQueueTimer(this, &Fullscreen::eventQueueTimerFired),
225 m_forCrossProcessDescendant(false) { 255 m_forCrossProcessDescendant(false) {
226 document.setHasFullscreenSupplement(); 256 document.setHasFullscreenSupplement();
227 } 257 }
228 258
229 Fullscreen::~Fullscreen() {} 259 Fullscreen::~Fullscreen() {}
230 260
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 757
728 DEFINE_TRACE(Fullscreen) { 758 DEFINE_TRACE(Fullscreen) {
729 visitor->trace(m_currentFullScreenElement); 759 visitor->trace(m_currentFullScreenElement);
730 visitor->trace(m_fullscreenElementStack); 760 visitor->trace(m_fullscreenElementStack);
731 visitor->trace(m_eventQueue); 761 visitor->trace(m_eventQueue);
732 Supplement<Document>::trace(visitor); 762 Supplement<Document>::trace(visitor);
733 ContextLifecycleObserver::trace(visitor); 763 ContextLifecycleObserver::trace(visitor);
734 } 764 }
735 765
736 } // namespace blink 766 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698