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; |
44 class ComputedStyle; | 45 class ComputedStyle; |
45 | 46 |
46 class CORE_EXPORT Fullscreen final | 47 class CORE_EXPORT Fullscreen final |
47 : public NoBaseWillBeGarbageCollectedFinalized<Fullscreen> | 48 : public NoBaseWillBeGarbageCollectedFinalized<Fullscreen> |
48 , public WillBeHeapSupplement<Document> | 49 , public WillBeHeapSupplement<Document> |
49 , public DocumentLifecycleObserver { | 50 , public DocumentLifecycleObserver { |
50 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(Fullscreen); | 51 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(Fullscreen); |
51 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Fullscreen); | 52 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Fullscreen); |
52 public: | 53 public: |
53 virtual ~Fullscreen(); | 54 virtual ~Fullscreen(); |
(...skipping 16 matching lines...) Expand all Loading... |
70 void requestFullscreen(Element&, RequestType); | 71 void requestFullscreen(Element&, RequestType); |
71 static void fullyExitFullscreen(Document&); | 72 static void fullyExitFullscreen(Document&); |
72 void exitFullscreen(); | 73 void exitFullscreen(); |
73 | 74 |
74 static bool fullscreenEnabled(Document&); | 75 static bool fullscreenEnabled(Document&); |
75 Element* fullscreenElement() const { return !m_fullScreenElementStack.isEmpt
y() ? m_fullScreenElementStack.last().first.get() : 0; } | 76 Element* fullscreenElement() const { return !m_fullScreenElementStack.isEmpt
y() ? m_fullScreenElementStack.last().first.get() : 0; } |
76 | 77 |
77 void didEnterFullScreenForElement(Element*); | 78 void didEnterFullScreenForElement(Element*); |
78 void didExitFullScreenForElement(Element*); | 79 void didExitFullScreenForElement(Element*); |
79 | 80 |
80 void didUpdateSize(Element&); | 81 void setFullScreenLayoutObject(LayoutFullScreen*); |
| 82 LayoutFullScreen* fullScreenLayoutObject() const { return m_fullScreenLayout
Object; } |
| 83 void fullScreenLayoutObjectDestroyed(); |
81 | 84 |
82 void elementRemoved(Element&); | 85 void elementRemoved(Element&); |
83 | 86 |
84 // Mozilla API | 87 // Mozilla API |
85 Element* webkitCurrentFullScreenElement() const { return m_fullScreenElement
.get(); } | 88 Element* webkitCurrentFullScreenElement() const { return m_fullScreenElement
.get(); } |
86 | 89 |
87 void documentWasDetached() override; | 90 void documentWasDetached() override; |
88 #if !ENABLE(OILPAN) | 91 #if !ENABLE(OILPAN) |
89 void documentWasDisposed() override; | 92 void documentWasDisposed() override; |
90 #endif | 93 #endif |
91 | 94 |
92 DECLARE_VIRTUAL_TRACE(); | 95 DECLARE_VIRTUAL_TRACE(); |
93 | 96 |
94 using ElementStack = WillBeHeapVector<std::pair<RefPtrWillBeMember<Element>,
RequestType>>; | |
95 const ElementStack& fullScreenElementStack() const { return m_fullScreenElem
entStack; } | |
96 | |
97 private: | 97 private: |
98 static Fullscreen* fromIfExistsSlow(Document&); | 98 static Fullscreen* fromIfExistsSlow(Document&); |
99 | 99 |
100 explicit Fullscreen(Document&); | 100 explicit Fullscreen(Document&); |
101 | 101 |
102 Document* document(); | 102 Document* document(); |
103 | 103 |
104 void clearFullscreenElementStack(); | 104 void clearFullscreenElementStack(); |
105 void popFullscreenElementStack(); | 105 void popFullscreenElementStack(); |
106 void pushFullscreenElementStack(Element&, RequestType); | 106 void pushFullscreenElementStack(Element&, RequestType); |
107 | 107 |
108 void enqueueChangeEvent(Document&, RequestType); | 108 void enqueueChangeEvent(Document&, RequestType); |
109 void enqueueErrorEvent(Element&, RequestType); | 109 void enqueueErrorEvent(Element&, RequestType); |
110 void eventQueueTimerFired(Timer<Fullscreen>*); | 110 void eventQueueTimerFired(Timer<Fullscreen>*); |
111 | 111 |
112 RefPtrWillBeMember<Element> m_fullScreenElement; | 112 RefPtrWillBeMember<Element> m_fullScreenElement; |
113 ElementStack m_fullScreenElementStack; | 113 WillBeHeapVector<std::pair<RefPtrWillBeMember<Element>, RequestType>> m_full
ScreenElementStack; |
| 114 LayoutFullScreen* m_fullScreenLayoutObject; |
114 Timer<Fullscreen> m_eventQueueTimer; | 115 Timer<Fullscreen> m_eventQueueTimer; |
115 WillBeHeapDeque<RefPtrWillBeMember<Event>> m_eventQueue; | 116 WillBeHeapDeque<RefPtrWillBeMember<Event>> m_eventQueue; |
116 LayoutRect m_savedPlaceholderFrameRect; | 117 LayoutRect m_savedPlaceholderFrameRect; |
117 RefPtr<ComputedStyle> m_savedPlaceholderComputedStyle; | 118 RefPtr<ComputedStyle> m_savedPlaceholderComputedStyle; |
118 }; | 119 }; |
119 | 120 |
120 inline bool Fullscreen::isActiveFullScreenElement(const Element& element) | 121 inline bool Fullscreen::isActiveFullScreenElement(const Element& element) |
121 { | 122 { |
122 Fullscreen* fullscreen = fromIfExists(element.document()); | 123 Fullscreen* fullscreen = fromIfExists(element.document()); |
123 if (!fullscreen) | 124 if (!fullscreen) |
124 return false; | 125 return false; |
125 return fullscreen->webkitCurrentFullScreenElement() == &element; | 126 return fullscreen->webkitCurrentFullScreenElement() == &element; |
126 } | 127 } |
127 | 128 |
128 inline Fullscreen* Fullscreen::fromIfExists(Document& document) | 129 inline Fullscreen* Fullscreen::fromIfExists(Document& document) |
129 { | 130 { |
130 if (!document.hasFullscreenSupplement()) | 131 if (!document.hasFullscreenSupplement()) |
131 return 0; | 132 return 0; |
132 return fromIfExistsSlow(document); | 133 return fromIfExistsSlow(document); |
133 } | 134 } |
134 | 135 |
135 } // namespace blink | 136 } // namespace blink |
136 | 137 |
137 #endif // Fullscreen_h | 138 #endif // Fullscreen_h |
OLD | NEW |