| 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 r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. |
| 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 9 * Copyright (C) 2013 Google Inc. All rights reserved. | 9 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 10 * | 10 * |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 static bool isActiveFullScreenElement(const Element&); | 60 static bool isActiveFullScreenElement(const Element&); |
| 61 | 61 |
| 62 enum RequestType { | 62 enum RequestType { |
| 63 // Element.requestFullscreen() | 63 // Element.requestFullscreen() |
| 64 UnprefixedRequest, | 64 UnprefixedRequest, |
| 65 // Element.webkitRequestFullscreen()/webkitRequestFullScreen() and | 65 // Element.webkitRequestFullscreen()/webkitRequestFullScreen() and |
| 66 // HTMLVideoElement.webkitEnterFullscreen()/webkitEnterFullScreen() | 66 // HTMLVideoElement.webkitEnterFullscreen()/webkitEnterFullScreen() |
| 67 PrefixedRequest, | 67 PrefixedRequest, |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 void requestFullscreen(Element&, RequestType); | 70 // |forCrossProcessAncestor| is used in OOPIF scenarios and is set to true |
| 71 // when fullscreen is requested for an out-of-process descendant element. |
| 72 void requestFullscreen(Element&, RequestType, bool forCrossProcessAncestor =
false); |
| 73 |
| 71 static void fullyExitFullscreen(Document&); | 74 static void fullyExitFullscreen(Document&); |
| 72 void exitFullscreen(); | 75 void exitFullscreen(); |
| 73 | 76 |
| 74 static bool fullscreenEnabled(Document&); | 77 static bool fullscreenEnabled(Document&); |
| 75 Element* fullscreenElement() const { return !m_fullScreenElementStack.isEmpt
y() ? m_fullScreenElementStack.last().first.get() : 0; } | 78 Element* fullscreenElement() const { return !m_fullScreenElementStack.isEmpt
y() ? m_fullScreenElementStack.last().first.get() : 0; } |
| 76 | 79 |
| 77 // |isAncestorOfFullscreenElement| is used in OOPIF scenarios and is set to | 80 // |isAncestorOfFullscreenElement| is used in OOPIF scenarios and is set to |
| 78 // true when these functions are called to enter/exit fullscreen for an | 81 // true when these functions are called to enter/exit fullscreen for an |
| 79 // out-of-process descendant element. In this case, we enter fullscreen | 82 // out-of-process descendant element. In this case, we enter fullscreen |
| 80 // for its (local) iframe container and make sure to also set the | 83 // for its (local) iframe container and make sure to also set the |
| 81 // ContainsFullScreenElement flag on it (so that it gains the | 84 // ContainsFullScreenElement flag on it (so that it gains the |
| 82 // -webkit-full-screen-ancestor style). | 85 // -webkit-full-screen-ancestor style). |
| 83 void didEnterFullScreenForElement(Element*, bool isAncestorOfFullscreenEleme
nt); | 86 void didEnterFullScreenForElement(Element*); |
| 84 void didExitFullScreenForElement(bool isAncestorOfFullscreenElement); | 87 void didExitFullScreenForElement(); |
| 85 | 88 |
| 86 void setFullScreenLayoutObject(LayoutFullScreen*); | 89 void setFullScreenLayoutObject(LayoutFullScreen*); |
| 87 LayoutFullScreen* fullScreenLayoutObject() const { return m_fullScreenLayout
Object; } | 90 LayoutFullScreen* fullScreenLayoutObject() const { return m_fullScreenLayout
Object; } |
| 88 void fullScreenLayoutObjectDestroyed(); | 91 void fullScreenLayoutObjectDestroyed(); |
| 89 | 92 |
| 90 void elementRemoved(Element&); | 93 void elementRemoved(Element&); |
| 91 | 94 |
| 95 // Returns true if the current fullscreen element stack corresponds to a |
| 96 // container for an actual fullscreen element in an out-of-process iframe. |
| 97 bool forCrossProcessAncestor() { return m_forCrossProcessAncestor; } |
| 98 |
| 92 // Mozilla API | 99 // Mozilla API |
| 93 Element* webkitCurrentFullScreenElement() const { return m_fullScreenElement
.get(); } | 100 Element* webkitCurrentFullScreenElement() const { return m_fullScreenElement
.get(); } |
| 94 | 101 |
| 95 // ContextLifecycleObserver: | 102 // ContextLifecycleObserver: |
| 96 void contextDestroyed() override; | 103 void contextDestroyed() override; |
| 97 | 104 |
| 98 DECLARE_VIRTUAL_TRACE(); | 105 DECLARE_VIRTUAL_TRACE(); |
| 99 | 106 |
| 100 private: | 107 private: |
| 101 static Fullscreen* fromIfExistsSlow(Document&); | 108 static Fullscreen* fromIfExistsSlow(Document&); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 112 void enqueueErrorEvent(Element&, RequestType); | 119 void enqueueErrorEvent(Element&, RequestType); |
| 113 void eventQueueTimerFired(Timer<Fullscreen>*); | 120 void eventQueueTimerFired(Timer<Fullscreen>*); |
| 114 | 121 |
| 115 Member<Element> m_fullScreenElement; | 122 Member<Element> m_fullScreenElement; |
| 116 HeapVector<std::pair<Member<Element>, RequestType>> m_fullScreenElementStack
; | 123 HeapVector<std::pair<Member<Element>, RequestType>> m_fullScreenElementStack
; |
| 117 LayoutFullScreen* m_fullScreenLayoutObject; | 124 LayoutFullScreen* m_fullScreenLayoutObject; |
| 118 Timer<Fullscreen> m_eventQueueTimer; | 125 Timer<Fullscreen> m_eventQueueTimer; |
| 119 HeapDeque<Member<Event>> m_eventQueue; | 126 HeapDeque<Member<Event>> m_eventQueue; |
| 120 LayoutRect m_savedPlaceholderFrameRect; | 127 LayoutRect m_savedPlaceholderFrameRect; |
| 121 RefPtr<ComputedStyle> m_savedPlaceholderComputedStyle; | 128 RefPtr<ComputedStyle> m_savedPlaceholderComputedStyle; |
| 129 |
| 130 // TODO(alexmos, dcheng): Currently, this assumes that if fullscreen was |
| 131 // entered for an element in an out-of-process iframe, then it's not |
| 132 // possible to re-enter fullscreen for a different element in this |
| 133 // document, since that requires a user gesture, which can't be obtained |
| 134 // since nothing in this document is visible, and since user gestures can't |
| 135 // be forwarded across processes. However, the latter assumption could |
| 136 // change if https://crbug.com/161068 is fixed so that cross-process |
| 137 // postMessage can carry user gestures. If that happens, this should be |
| 138 // moved to be part of |m_fullScreenElementStack|. |
| 139 bool m_forCrossProcessAncestor; |
| 122 }; | 140 }; |
| 123 | 141 |
| 124 inline bool Fullscreen::isActiveFullScreenElement(const Element& element) | 142 inline bool Fullscreen::isActiveFullScreenElement(const Element& element) |
| 125 { | 143 { |
| 126 Fullscreen* fullscreen = fromIfExists(element.document()); | 144 Fullscreen* fullscreen = fromIfExists(element.document()); |
| 127 if (!fullscreen) | 145 if (!fullscreen) |
| 128 return false; | 146 return false; |
| 129 return fullscreen->webkitCurrentFullScreenElement() == &element; | 147 return fullscreen->webkitCurrentFullScreenElement() == &element; |
| 130 } | 148 } |
| 131 | 149 |
| 132 inline Fullscreen* Fullscreen::fromIfExists(Document& document) | 150 inline Fullscreen* Fullscreen::fromIfExists(Document& document) |
| 133 { | 151 { |
| 134 if (!document.hasFullscreenSupplement()) | 152 if (!document.hasFullscreenSupplement()) |
| 135 return 0; | 153 return 0; |
| 136 return fromIfExistsSlow(document); | 154 return fromIfExistsSlow(document); |
| 137 } | 155 } |
| 138 | 156 |
| 139 } // namespace blink | 157 } // namespace blink |
| 140 | 158 |
| 141 #endif // Fullscreen_h | 159 #endif // Fullscreen_h |
| OLD | NEW |