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

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

Issue 2565203002: Add a requestFullscreen variant with a default (prefixed) type (Closed)
Patch Set: Created 4 years 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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 m_eventQueue.clear(); 310 m_eventQueue.clear();
311 311
312 if (m_fullScreenLayoutObject) 312 if (m_fullScreenLayoutObject)
313 m_fullScreenLayoutObject->destroy(); 313 m_fullScreenLayoutObject->destroy();
314 314
315 m_currentFullScreenElement = nullptr; 315 m_currentFullScreenElement = nullptr;
316 m_fullscreenElementStack.clear(); 316 m_fullscreenElementStack.clear();
317 } 317 }
318 318
319 // https://fullscreen.spec.whatwg.org/#dom-element-requestfullscreen 319 // https://fullscreen.spec.whatwg.org/#dom-element-requestfullscreen
320 void Fullscreen::requestFullscreen(Element& element) {
321 // TODO(foolip): Make RequestType::Unprefixed the default when the unprefixed
322 // API is enabled. https://crbug.com/383813
323 requestFullscreen(element, RequestType::Prefixed, false);
324 }
325
320 void Fullscreen::requestFullscreen(Element& element, 326 void Fullscreen::requestFullscreen(Element& element,
321 RequestType requestType, 327 RequestType requestType,
322 bool forCrossProcessDescendant) { 328 bool forCrossProcessDescendant) {
323 Document& document = element.document(); 329 Document& document = element.document();
324 330
325 // Use counters only need to be incremented in the process of the actual 331 // Use counters only need to be incremented in the process of the actual
326 // fullscreen element. 332 // fullscreen element.
327 if (!forCrossProcessDescendant) { 333 if (!forCrossProcessDescendant) {
328 if (document.isSecureContext()) { 334 if (document.isSecureContext()) {
329 UseCounter::count(document, UseCounter::FullscreenSecureOrigin); 335 UseCounter::count(document, UseCounter::FullscreenSecureOrigin);
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 m_fullScreenLayoutObject = layoutObject; 723 m_fullScreenLayoutObject = layoutObject;
718 } 724 }
719 725
720 void Fullscreen::fullScreenLayoutObjectDestroyed() { 726 void Fullscreen::fullScreenLayoutObjectDestroyed() {
721 m_fullScreenLayoutObject = nullptr; 727 m_fullScreenLayoutObject = nullptr;
722 } 728 }
723 729
724 void Fullscreen::enqueueChangeEvent(Document& document, 730 void Fullscreen::enqueueChangeEvent(Document& document,
725 RequestType requestType) { 731 RequestType requestType) {
726 Event* event; 732 Event* event;
727 if (requestType == UnprefixedRequest) { 733 if (requestType == RequestType::Unprefixed) {
728 event = createEvent(EventTypeNames::fullscreenchange, document); 734 event = createEvent(EventTypeNames::fullscreenchange, document);
729 } else { 735 } else {
730 DCHECK(document.hasFullscreenSupplement()); 736 DCHECK(document.hasFullscreenSupplement());
731 Fullscreen& fullscreen = from(document); 737 Fullscreen& fullscreen = from(document);
732 EventTarget* target = fullscreen.fullscreenElement(); 738 EventTarget* target = fullscreen.fullscreenElement();
733 if (!target) 739 if (!target)
734 target = fullscreen.currentFullScreenElement(); 740 target = fullscreen.currentFullScreenElement();
735 if (!target) 741 if (!target)
736 target = &document; 742 target = &document;
737 event = createEvent(EventTypeNames::webkitfullscreenchange, *target); 743 event = createEvent(EventTypeNames::webkitfullscreenchange, *target);
738 } 744 }
739 m_eventQueue.append(event); 745 m_eventQueue.append(event);
740 // NOTE: The timer is started in didEnterFullscreen/didExitFullscreen. 746 // NOTE: The timer is started in didEnterFullscreen/didExitFullscreen.
741 } 747 }
742 748
743 void Fullscreen::enqueueErrorEvent(Element& element, RequestType requestType) { 749 void Fullscreen::enqueueErrorEvent(Element& element, RequestType requestType) {
744 Event* event; 750 Event* event;
745 if (requestType == UnprefixedRequest) 751 if (requestType == RequestType::Unprefixed)
746 event = createEvent(EventTypeNames::fullscreenerror, element.document()); 752 event = createEvent(EventTypeNames::fullscreenerror, element.document());
747 else 753 else
748 event = createEvent(EventTypeNames::webkitfullscreenerror, element); 754 event = createEvent(EventTypeNames::webkitfullscreenerror, element);
749 m_eventQueue.append(event); 755 m_eventQueue.append(event);
750 m_eventQueueTimer.startOneShot(0, BLINK_FROM_HERE); 756 m_eventQueueTimer.startOneShot(0, BLINK_FROM_HERE);
751 } 757 }
752 758
753 void Fullscreen::eventQueueTimerFired(TimerBase*) { 759 void Fullscreen::eventQueueTimerFired(TimerBase*) {
754 HeapDeque<Member<Event>> eventQueue; 760 HeapDeque<Member<Event>> eventQueue;
755 m_eventQueue.swap(eventQueue); 761 m_eventQueue.swap(eventQueue);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 DEFINE_TRACE(Fullscreen) { 818 DEFINE_TRACE(Fullscreen) {
813 visitor->trace(m_pendingFullscreenElement); 819 visitor->trace(m_pendingFullscreenElement);
814 visitor->trace(m_fullscreenElementStack); 820 visitor->trace(m_fullscreenElementStack);
815 visitor->trace(m_currentFullScreenElement); 821 visitor->trace(m_currentFullScreenElement);
816 visitor->trace(m_eventQueue); 822 visitor->trace(m_eventQueue);
817 Supplement<Document>::trace(visitor); 823 Supplement<Document>::trace(visitor);
818 ContextLifecycleObserver::trace(visitor); 824 ContextLifecycleObserver::trace(visitor);
819 } 825 }
820 826
821 } // namespace blink 827 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Fullscreen.h ('k') | third_party/WebKit/Source/core/html/HTMLMediaElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698