OLD | NEW |
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 Loading... |
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 if (!toShadowRoot(scope.rootNode()).isV1()) { |
| 231 return nullptr; |
| 232 } |
| 233 return scope.adjustedElement(*element); |
| 234 } |
| 235 |
215 Element* Fullscreen::currentFullScreenElementFrom(Document& document) { | 236 Element* Fullscreen::currentFullScreenElementFrom(Document& document) { |
216 if (Fullscreen* found = fromIfExists(document)) | 237 if (Fullscreen* found = fromIfExists(document)) |
217 return found->currentFullScreenElement(); | 238 return found->currentFullScreenElement(); |
218 return nullptr; | 239 return nullptr; |
219 } | 240 } |
220 | 241 |
| 242 Element* Fullscreen::currentFullScreenElementForBindingFrom( |
| 243 Document& document) { |
| 244 Element* element = currentFullScreenElementFrom(document); |
| 245 if (!element || !RuntimeEnabledFeatures::fullscreenUnprefixedEnabled()) |
| 246 return element; |
| 247 |
| 248 // For Shadow DOM V0 compatibility: We allow returning an element in V0 shadow |
| 249 // tree, even though it leaks the Shadow DOM. |
| 250 if (element->isInV0ShadowTree()) { |
| 251 UseCounter::count(document, |
| 252 UseCounter::DocumentFullscreenElementInV0Shadow); |
| 253 return element; |
| 254 } |
| 255 return document.adjustedElement(*element); |
| 256 } |
| 257 |
221 Fullscreen::Fullscreen(Document& document) | 258 Fullscreen::Fullscreen(Document& document) |
222 : ContextLifecycleObserver(&document), | 259 : ContextLifecycleObserver(&document), |
223 m_fullScreenLayoutObject(nullptr), | 260 m_fullScreenLayoutObject(nullptr), |
224 m_eventQueueTimer(this, &Fullscreen::eventQueueTimerFired), | 261 m_eventQueueTimer(this, &Fullscreen::eventQueueTimerFired), |
225 m_forCrossProcessDescendant(false) { | 262 m_forCrossProcessDescendant(false) { |
226 document.setHasFullscreenSupplement(); | 263 document.setHasFullscreenSupplement(); |
227 } | 264 } |
228 | 265 |
229 Fullscreen::~Fullscreen() {} | 266 Fullscreen::~Fullscreen() {} |
230 | 267 |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 | 764 |
728 DEFINE_TRACE(Fullscreen) { | 765 DEFINE_TRACE(Fullscreen) { |
729 visitor->trace(m_currentFullScreenElement); | 766 visitor->trace(m_currentFullScreenElement); |
730 visitor->trace(m_fullscreenElementStack); | 767 visitor->trace(m_fullscreenElementStack); |
731 visitor->trace(m_eventQueue); | 768 visitor->trace(m_eventQueue); |
732 Supplement<Document>::trace(visitor); | 769 Supplement<Document>::trace(visitor); |
733 ContextLifecycleObserver::trace(visitor); | 770 ContextLifecycleObserver::trace(visitor); |
734 } | 771 } |
735 | 772 |
736 } // namespace blink | 773 } // namespace blink |
OLD | NEW |