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 // |forCrossProcessAncestor| is used in OOPIF scenarios and is set to true | 70 // |forCrossProcessDescendant| is used in OOPIF scenarios and is set to |
71 // when fullscreen is requested for an out-of-process descendant element. | 71 // true when fullscreen is requested for an out-of-process descendant |
72 void requestFullscreen(Element&, RequestType, bool forCrossProcessAncestor =
false); | 72 // element. |
| 73 void requestFullscreen(Element&, RequestType, bool forCrossProcessDescendant
= false); |
73 | 74 |
74 static void fullyExitFullscreen(Document&); | 75 static void fullyExitFullscreen(Document&); |
75 void exitFullscreen(); | 76 void exitFullscreen(); |
76 | 77 |
77 static bool fullscreenEnabled(Document&); | 78 static bool fullscreenEnabled(Document&); |
78 Element* fullscreenElement() const { return !m_fullScreenElementStack.isEmpt
y() ? m_fullScreenElementStack.last().first.get() : 0; } | 79 Element* fullscreenElement() const { return !m_fullScreenElementStack.isEmpt
y() ? m_fullScreenElementStack.last().first.get() : 0; } |
79 | 80 |
80 // |isAncestorOfFullscreenElement| is used in OOPIF scenarios and is set to | |
81 // true when these functions are called to enter/exit fullscreen for an | |
82 // out-of-process descendant element. In this case, we enter fullscreen | |
83 // for its (local) iframe container and make sure to also set the | |
84 // ContainsFullScreenElement flag on it (so that it gains the | |
85 // -webkit-full-screen-ancestor style). | |
86 void didEnterFullscreenForElement(Element*); | 81 void didEnterFullscreenForElement(Element*); |
87 void didExitFullscreen(); | 82 void didExitFullscreen(); |
88 | 83 |
89 void setFullScreenLayoutObject(LayoutFullScreen*); | 84 void setFullScreenLayoutObject(LayoutFullScreen*); |
90 LayoutFullScreen* fullScreenLayoutObject() const { return m_fullScreenLayout
Object; } | 85 LayoutFullScreen* fullScreenLayoutObject() const { return m_fullScreenLayout
Object; } |
91 void fullScreenLayoutObjectDestroyed(); | 86 void fullScreenLayoutObjectDestroyed(); |
92 | 87 |
93 void elementRemoved(Element&); | 88 void elementRemoved(Element&); |
94 | 89 |
95 // Returns true if the current fullscreen element stack corresponds to a | 90 // Returns true if the current fullscreen element stack corresponds to a |
96 // container for an actual fullscreen element in an out-of-process iframe. | 91 // container for an actual fullscreen element in a descendant |
97 bool forCrossProcessAncestor() { return m_forCrossProcessAncestor; } | 92 // out-of-process iframe. |
| 93 bool forCrossProcessDescendant() { return m_forCrossProcessDescendant; } |
98 | 94 |
99 // Mozilla API | 95 // Mozilla API |
100 Element* webkitCurrentFullScreenElement() const { return m_fullScreenElement
.get(); } | 96 Element* webkitCurrentFullScreenElement() const { return m_fullScreenElement
.get(); } |
101 | 97 |
102 // ContextLifecycleObserver: | 98 // ContextLifecycleObserver: |
103 void contextDestroyed() override; | 99 void contextDestroyed() override; |
104 | 100 |
105 DECLARE_VIRTUAL_TRACE(); | 101 DECLARE_VIRTUAL_TRACE(); |
106 | 102 |
107 private: | 103 private: |
(...skipping 21 matching lines...) Expand all Loading... |
129 | 125 |
130 // TODO(alexmos, dcheng): Currently, this assumes that if fullscreen was | 126 // 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 | 127 // 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 | 128 // possible to re-enter fullscreen for a different element in this |
133 // document, since that requires a user gesture, which can't be obtained | 129 // 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 | 130 // since nothing in this document is visible, and since user gestures can't |
135 // be forwarded across processes. However, the latter assumption could | 131 // be forwarded across processes. However, the latter assumption could |
136 // change if https://crbug.com/161068 is fixed so that cross-process | 132 // change if https://crbug.com/161068 is fixed so that cross-process |
137 // postMessage can carry user gestures. If that happens, this should be | 133 // postMessage can carry user gestures. If that happens, this should be |
138 // moved to be part of |m_fullScreenElementStack|. | 134 // moved to be part of |m_fullScreenElementStack|. |
139 bool m_forCrossProcessAncestor; | 135 bool m_forCrossProcessDescendant; |
140 }; | 136 }; |
141 | 137 |
142 inline bool Fullscreen::isActiveFullScreenElement(const Element& element) | 138 inline bool Fullscreen::isActiveFullScreenElement(const Element& element) |
143 { | 139 { |
144 Fullscreen* fullscreen = fromIfExists(element.document()); | 140 Fullscreen* fullscreen = fromIfExists(element.document()); |
145 if (!fullscreen) | 141 if (!fullscreen) |
146 return false; | 142 return false; |
147 return fullscreen->webkitCurrentFullScreenElement() == &element; | 143 return fullscreen->webkitCurrentFullScreenElement() == &element; |
148 } | 144 } |
149 | 145 |
150 inline Fullscreen* Fullscreen::fromIfExists(Document& document) | 146 inline Fullscreen* Fullscreen::fromIfExists(Document& document) |
151 { | 147 { |
152 if (!document.hasFullscreenSupplement()) | 148 if (!document.hasFullscreenSupplement()) |
153 return 0; | 149 return 0; |
154 return fromIfExistsSlow(document); | 150 return fromIfExistsSlow(document); |
155 } | 151 } |
156 | 152 |
157 } // namespace blink | 153 } // namespace blink |
158 | 154 |
159 #endif // Fullscreen_h | 155 #endif // Fullscreen_h |
OLD | NEW |