| 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 GarbageCollectedFinalized<Fullscreen> | 48 : public GarbageCollectedFinalized<Fullscreen> |
| 48 , public Supplement<Document> | 49 , public Supplement<Document> |
| 49 , public ContextLifecycleObserver { | 50 , public ContextLifecycleObserver { |
| 50 USING_GARBAGE_COLLECTED_MIXIN(Fullscreen); | 51 USING_GARBAGE_COLLECTED_MIXIN(Fullscreen); |
| 51 public: | 52 public: |
| 52 virtual ~Fullscreen(); | 53 virtual ~Fullscreen(); |
| 53 static const char* supplementName(); | 54 static const char* supplementName(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 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 void didEnterFullscreenForElement(Element*); | 81 void didEnterFullscreenForElement(Element*); |
| 81 void didExitFullscreen(); | 82 void didExitFullscreen(); |
| 82 | 83 |
| 83 void didUpdateSize(Element&); | 84 void setFullScreenLayoutObject(LayoutFullScreen*); |
| 85 LayoutFullScreen* fullScreenLayoutObject() const { return m_fullScreenLayout
Object; } |
| 86 void fullScreenLayoutObjectDestroyed(); |
| 84 | 87 |
| 85 void elementRemoved(Element&); | 88 void elementRemoved(Element&); |
| 86 | 89 |
| 87 // Returns true if the current fullscreen element stack corresponds to a | 90 // Returns true if the current fullscreen element stack corresponds to a |
| 88 // container for an actual fullscreen element in a descendant | 91 // container for an actual fullscreen element in a descendant |
| 89 // out-of-process iframe. | 92 // out-of-process iframe. |
| 90 bool forCrossProcessDescendant() { return m_forCrossProcessDescendant; } | 93 bool forCrossProcessDescendant() { return m_forCrossProcessDescendant; } |
| 91 | 94 |
| 92 // Mozilla API | 95 // Mozilla API |
| 93 Element* webkitCurrentFullScreenElement() const { return m_fullScreenElement
.get(); } | 96 Element* webkitCurrentFullScreenElement() const { return m_fullScreenElement
.get(); } |
| 94 | 97 |
| 95 // ContextLifecycleObserver: | 98 // ContextLifecycleObserver: |
| 96 void contextDestroyed() override; | 99 void contextDestroyed() override; |
| 97 | 100 |
| 98 DECLARE_VIRTUAL_TRACE(); | 101 DECLARE_VIRTUAL_TRACE(); |
| 99 | 102 |
| 100 using ElementStack = HeapVector<std::pair<Member<Element>, RequestType>>; | |
| 101 const ElementStack& fullScreenElementStack() const { return m_fullScreenElem
entStack; } | |
| 102 | |
| 103 private: | 103 private: |
| 104 static Fullscreen* fromIfExistsSlow(Document&); | 104 static Fullscreen* fromIfExistsSlow(Document&); |
| 105 | 105 |
| 106 explicit Fullscreen(Document&); | 106 explicit Fullscreen(Document&); |
| 107 | 107 |
| 108 Document* document(); | 108 Document* document(); |
| 109 | 109 |
| 110 void clearFullscreenElementStack(); | 110 void clearFullscreenElementStack(); |
| 111 void popFullscreenElementStack(); | 111 void popFullscreenElementStack(); |
| 112 void pushFullscreenElementStack(Element&, RequestType); | 112 void pushFullscreenElementStack(Element&, RequestType); |
| 113 | 113 |
| 114 void enqueueChangeEvent(Document&, RequestType); | 114 void enqueueChangeEvent(Document&, RequestType); |
| 115 void enqueueErrorEvent(Element&, RequestType); | 115 void enqueueErrorEvent(Element&, RequestType); |
| 116 void eventQueueTimerFired(Timer<Fullscreen>*); | 116 void eventQueueTimerFired(Timer<Fullscreen>*); |
| 117 | 117 |
| 118 Member<Element> m_fullScreenElement; | 118 Member<Element> m_fullScreenElement; |
| 119 HeapVector<std::pair<Member<Element>, RequestType>> m_fullScreenElementStack
; | 119 HeapVector<std::pair<Member<Element>, RequestType>> m_fullScreenElementStack
; |
| 120 LayoutFullScreen* m_fullScreenLayoutObject; |
| 120 Timer<Fullscreen> m_eventQueueTimer; | 121 Timer<Fullscreen> m_eventQueueTimer; |
| 121 HeapDeque<Member<Event>> m_eventQueue; | 122 HeapDeque<Member<Event>> m_eventQueue; |
| 122 LayoutRect m_savedPlaceholderFrameRect; | 123 LayoutRect m_savedPlaceholderFrameRect; |
| 123 RefPtr<ComputedStyle> m_savedPlaceholderComputedStyle; | 124 RefPtr<ComputedStyle> m_savedPlaceholderComputedStyle; |
| 124 | 125 |
| 125 // TODO(alexmos, dcheng): Currently, this assumes that if fullscreen was | 126 // TODO(alexmos, dcheng): Currently, this assumes that if fullscreen was |
| 126 // 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 |
| 127 // possible to re-enter fullscreen for a different element in this | 128 // possible to re-enter fullscreen for a different element in this |
| 128 // 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 |
| 129 // 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 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 145 inline Fullscreen* Fullscreen::fromIfExists(Document& document) | 146 inline Fullscreen* Fullscreen::fromIfExists(Document& document) |
| 146 { | 147 { |
| 147 if (!document.hasFullscreenSupplement()) | 148 if (!document.hasFullscreenSupplement()) |
| 148 return 0; | 149 return 0; |
| 149 return fromIfExistsSlow(document); | 150 return fromIfExistsSlow(document); |
| 150 } | 151 } |
| 151 | 152 |
| 152 } // namespace blink | 153 } // namespace blink |
| 153 | 154 |
| 154 #endif // Fullscreen_h | 155 #endif // Fullscreen_h |
| OLD | NEW |