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

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
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 {
hayato 2016/10/26 03:15:56 else if
kochi 2016/10/26 04:52:12 Done.
231 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.
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
249 // For Shadow DOM V0 compatibility: We allow returning an element in V0 shadow
250 // tree, even though it leaks the Shadow DOM.
251 if (element->isInV0ShadowTree()) {
252 UseCounter::count(document,
253 UseCounter::DocumentFullscreenElementInV0Shadow);
254 return element;
255 }
256 return document.adjustedElement(*element);
257 }
258
221 Fullscreen::Fullscreen(Document& document) 259 Fullscreen::Fullscreen(Document& document)
222 : ContextLifecycleObserver(&document), 260 : ContextLifecycleObserver(&document),
223 m_fullScreenLayoutObject(nullptr), 261 m_fullScreenLayoutObject(nullptr),
224 m_eventQueueTimer(this, &Fullscreen::eventQueueTimerFired), 262 m_eventQueueTimer(this, &Fullscreen::eventQueueTimerFired),
225 m_forCrossProcessDescendant(false) { 263 m_forCrossProcessDescendant(false) {
226 document.setHasFullscreenSupplement(); 264 document.setHasFullscreenSupplement();
227 } 265 }
228 266
229 Fullscreen::~Fullscreen() {} 267 Fullscreen::~Fullscreen() {}
230 268
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 765
728 DEFINE_TRACE(Fullscreen) { 766 DEFINE_TRACE(Fullscreen) {
729 visitor->trace(m_currentFullScreenElement); 767 visitor->trace(m_currentFullScreenElement);
730 visitor->trace(m_fullscreenElementStack); 768 visitor->trace(m_fullscreenElementStack);
731 visitor->trace(m_eventQueue); 769 visitor->trace(m_eventQueue);
732 Supplement<Document>::trace(visitor); 770 Supplement<Document>::trace(visitor);
733 ContextLifecycleObserver::trace(visitor); 771 ContextLifecycleObserver::trace(visitor);
734 } 772 }
735 773
736 } // namespace blink 774 } // namespace blink
OLDNEW
« 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