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 23 matching lines...) Expand all Loading... |
34 #include "core/dom/Element.h" | 34 #include "core/dom/Element.h" |
35 #include "platform/Supplementable.h" | 35 #include "platform/Supplementable.h" |
36 #include "platform/Timer.h" | 36 #include "platform/Timer.h" |
37 #include "platform/geometry/LayoutRect.h" | 37 #include "platform/geometry/LayoutRect.h" |
38 #include "wtf/Deque.h" | 38 #include "wtf/Deque.h" |
39 #include "wtf/RefPtr.h" | 39 #include "wtf/RefPtr.h" |
40 #include "wtf/Vector.h" | 40 #include "wtf/Vector.h" |
41 | 41 |
42 namespace blink { | 42 namespace blink { |
43 | 43 |
44 class LayoutFullScreen; | |
45 class ComputedStyle; | 44 class ComputedStyle; |
46 | 45 |
47 class CORE_EXPORT Fullscreen final | 46 class CORE_EXPORT Fullscreen final |
48 : public GarbageCollectedFinalized<Fullscreen> | 47 : public GarbageCollectedFinalized<Fullscreen> |
49 , public Supplement<Document> | 48 , public Supplement<Document> |
50 , public ContextLifecycleObserver { | 49 , public ContextLifecycleObserver { |
51 USING_GARBAGE_COLLECTED_MIXIN(Fullscreen); | 50 USING_GARBAGE_COLLECTED_MIXIN(Fullscreen); |
52 public: | 51 public: |
53 virtual ~Fullscreen(); | 52 virtual ~Fullscreen(); |
54 static const char* supplementName(); | 53 static const char* supplementName(); |
(...skipping 24 matching lines...) Expand all Loading... |
79 | 78 |
80 // |isAncestorOfFullscreenElement| is used in OOPIF scenarios and is set to | 79 // |isAncestorOfFullscreenElement| is used in OOPIF scenarios and is set to |
81 // true when these functions are called to enter/exit fullscreen for an | 80 // true when these functions are called to enter/exit fullscreen for an |
82 // out-of-process descendant element. In this case, we enter fullscreen | 81 // out-of-process descendant element. In this case, we enter fullscreen |
83 // for its (local) iframe container and make sure to also set the | 82 // for its (local) iframe container and make sure to also set the |
84 // ContainsFullScreenElement flag on it (so that it gains the | 83 // ContainsFullScreenElement flag on it (so that it gains the |
85 // -webkit-full-screen-ancestor style). | 84 // -webkit-full-screen-ancestor style). |
86 void didEnterFullScreenForElement(Element*); | 85 void didEnterFullScreenForElement(Element*); |
87 void didExitFullScreenForElement(); | 86 void didExitFullScreenForElement(); |
88 | 87 |
89 void setFullScreenLayoutObject(LayoutFullScreen*); | 88 void didUpdateSize(Element&); |
90 LayoutFullScreen* fullScreenLayoutObject() const { return m_fullScreenLayout
Object; } | |
91 void fullScreenLayoutObjectDestroyed(); | |
92 | 89 |
93 void elementRemoved(Element&); | 90 void elementRemoved(Element&); |
94 | 91 |
95 // Returns true if the current fullscreen element stack corresponds to a | 92 // Returns true if the current fullscreen element stack corresponds to a |
96 // container for an actual fullscreen element in an out-of-process iframe. | 93 // container for an actual fullscreen element in an out-of-process iframe. |
97 bool forCrossProcessAncestor() { return m_forCrossProcessAncestor; } | 94 bool forCrossProcessAncestor() { return m_forCrossProcessAncestor; } |
98 | 95 |
99 // Mozilla API | 96 // Mozilla API |
100 Element* webkitCurrentFullScreenElement() const { return m_fullScreenElement
.get(); } | 97 Element* webkitCurrentFullScreenElement() const { return m_fullScreenElement
.get(); } |
101 | 98 |
102 // ContextLifecycleObserver: | 99 // ContextLifecycleObserver: |
103 void contextDestroyed() override; | 100 void contextDestroyed() override; |
104 | 101 |
105 DECLARE_VIRTUAL_TRACE(); | 102 DECLARE_VIRTUAL_TRACE(); |
106 | 103 |
| 104 using ElementStack = HeapVector<std::pair<Member<Element>, RequestType>>; |
| 105 const ElementStack& fullScreenElementStack() const { return m_fullScreenElem
entStack; } |
| 106 |
107 private: | 107 private: |
108 static Fullscreen* fromIfExistsSlow(Document&); | 108 static Fullscreen* fromIfExistsSlow(Document&); |
109 | 109 |
110 explicit Fullscreen(Document&); | 110 explicit Fullscreen(Document&); |
111 | 111 |
112 Document* document(); | 112 Document* document(); |
113 | 113 |
114 void clearFullscreenElementStack(); | 114 void clearFullscreenElementStack(); |
115 void popFullscreenElementStack(); | 115 void popFullscreenElementStack(); |
116 void pushFullscreenElementStack(Element&, RequestType); | 116 void pushFullscreenElementStack(Element&, RequestType); |
117 | 117 |
118 void enqueueChangeEvent(Document&, RequestType); | 118 void enqueueChangeEvent(Document&, RequestType); |
119 void enqueueErrorEvent(Element&, RequestType); | 119 void enqueueErrorEvent(Element&, RequestType); |
120 void eventQueueTimerFired(Timer<Fullscreen>*); | 120 void eventQueueTimerFired(Timer<Fullscreen>*); |
121 | 121 |
122 Member<Element> m_fullScreenElement; | 122 Member<Element> m_fullScreenElement; |
123 HeapVector<std::pair<Member<Element>, RequestType>> m_fullScreenElementStack
; | 123 HeapVector<std::pair<Member<Element>, RequestType>> m_fullScreenElementStack
; |
124 LayoutFullScreen* m_fullScreenLayoutObject; | |
125 Timer<Fullscreen> m_eventQueueTimer; | 124 Timer<Fullscreen> m_eventQueueTimer; |
126 HeapDeque<Member<Event>> m_eventQueue; | 125 HeapDeque<Member<Event>> m_eventQueue; |
127 LayoutRect m_savedPlaceholderFrameRect; | 126 LayoutRect m_savedPlaceholderFrameRect; |
128 RefPtr<ComputedStyle> m_savedPlaceholderComputedStyle; | 127 RefPtr<ComputedStyle> m_savedPlaceholderComputedStyle; |
129 | 128 |
130 // TODO(alexmos, dcheng): Currently, this assumes that if fullscreen was | 129 // 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 | 130 // 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 | 131 // possible to re-enter fullscreen for a different element in this |
133 // document, since that requires a user gesture, which can't be obtained | 132 // 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 | 133 // since nothing in this document is visible, and since user gestures can't |
(...skipping 15 matching lines...) Expand all Loading... |
150 inline Fullscreen* Fullscreen::fromIfExists(Document& document) | 149 inline Fullscreen* Fullscreen::fromIfExists(Document& document) |
151 { | 150 { |
152 if (!document.hasFullscreenSupplement()) | 151 if (!document.hasFullscreenSupplement()) |
153 return 0; | 152 return 0; |
154 return fromIfExistsSlow(document); | 153 return fromIfExistsSlow(document); |
155 } | 154 } |
156 | 155 |
157 } // namespace blink | 156 } // namespace blink |
158 | 157 |
159 #endif // Fullscreen_h | 158 #endif // Fullscreen_h |
OLD | NEW |