| 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 * |
| 11 * This library is free software; you can redistribute it and/or | 11 * This library is free software; you can redistribute it and/or |
| 12 * modify it under the terms of the GNU Library General Public | 12 * modify it under the terms of the GNU Library General Public |
| 13 * License as published by the Free Software Foundation; either | 13 * License as published by the Free Software Foundation; either |
| 14 * version 2 of the License, or (at your option) any later version. | 14 * version 2 of the License, or (at your option) any later version. |
| 15 * | 15 * |
| 16 * This library is distributed in the hope that it will be useful, | 16 * This library is distributed in the hope that it will be useful, |
| 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 19 * Library General Public License for more details. | 19 * Library General Public License for more details. |
| 20 * | 20 * |
| 21 * You should have received a copy of the GNU Library General Public License | 21 * You should have received a copy of the GNU Library General Public License |
| 22 * along with this library; see the file COPYING.LIB. If not, write to | 22 * along with this library; see the file COPYING.LIB. If not, write to |
| 23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 24 * Boston, MA 02110-1301, USA. | 24 * Boston, MA 02110-1301, USA. |
| 25 * | 25 * |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #ifndef FullscreenElementStack_h | 28 #ifndef Fullscreen_h |
| 29 #define FullscreenElementStack_h | 29 #define Fullscreen_h |
| 30 | 30 |
| 31 #include "core/dom/Document.h" | 31 #include "core/dom/Document.h" |
| 32 #include "core/dom/DocumentLifecycleObserver.h" | 32 #include "core/dom/DocumentLifecycleObserver.h" |
| 33 #include "core/dom/Element.h" | 33 #include "core/dom/Element.h" |
| 34 #include "platform/Supplementable.h" | 34 #include "platform/Supplementable.h" |
| 35 #include "platform/Timer.h" | 35 #include "platform/Timer.h" |
| 36 #include "platform/geometry/LayoutRect.h" | 36 #include "platform/geometry/LayoutRect.h" |
| 37 #include "wtf/Deque.h" | 37 #include "wtf/Deque.h" |
| 38 #include "wtf/RefPtr.h" | 38 #include "wtf/RefPtr.h" |
| 39 #include "wtf/Vector.h" | 39 #include "wtf/Vector.h" |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 | 42 |
| 43 class RenderFullScreen; | 43 class RenderFullScreen; |
| 44 class RenderStyle; | 44 class RenderStyle; |
| 45 | 45 |
| 46 class FullscreenElementStack FINAL | 46 class Fullscreen FINAL |
| 47 : public NoBaseWillBeGarbageCollectedFinalized<FullscreenElementStack> | 47 : public NoBaseWillBeGarbageCollectedFinalized<Fullscreen> |
| 48 , public DocumentSupplement | 48 , public DocumentSupplement |
| 49 , public DocumentLifecycleObserver { | 49 , public DocumentLifecycleObserver { |
| 50 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(FullscreenElementStack); | 50 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Fullscreen); |
| 51 public: | 51 public: |
| 52 virtual ~FullscreenElementStack(); | 52 virtual ~Fullscreen(); |
| 53 static const char* supplementName(); | 53 static const char* supplementName(); |
| 54 static FullscreenElementStack& from(Document&); | 54 static Fullscreen& from(Document&); |
| 55 static FullscreenElementStack* fromIfExists(Document&); | 55 static Fullscreen* fromIfExists(Document&); |
| 56 static Element* fullscreenElementFrom(Document&); | 56 static Element* fullscreenElementFrom(Document&); |
| 57 static Element* currentFullScreenElementFrom(Document&); | 57 static Element* currentFullScreenElementFrom(Document&); |
| 58 static bool isFullScreen(Document&); | 58 static bool isFullScreen(Document&); |
| 59 static bool isActiveFullScreenElement(const Element&); | 59 static bool isActiveFullScreenElement(const Element&); |
| 60 | 60 |
| 61 enum RequestType { | 61 enum RequestType { |
| 62 UnprefixedRequest, // Element.requestFullscreen() | 62 UnprefixedRequest, // Element.requestFullscreen() |
| 63 PrefixedRequest, // Element.webkitRequestFullscreen() | 63 PrefixedRequest, // Element.webkitRequestFullscreen() |
| 64 PrefixedMozillaRequest, // Element.webkitRequestFullScreen() | 64 PrefixedMozillaRequest, // Element.webkitRequestFullScreen() |
| 65 PrefixedMozillaAllowKeyboardInputRequest, // Element.webkitRequestFullSc
reen(Element.ALLOW_KEYBOARD_INPUT) | 65 PrefixedMozillaAllowKeyboardInputRequest, // Element.webkitRequestFullSc
reen(Element.ALLOW_KEYBOARD_INPUT) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 90 Element* webkitCurrentFullScreenElement() const { return m_fullScreenElement
.get(); } | 90 Element* webkitCurrentFullScreenElement() const { return m_fullScreenElement
.get(); } |
| 91 | 91 |
| 92 virtual void documentWasDetached() OVERRIDE; | 92 virtual void documentWasDetached() OVERRIDE; |
| 93 #if !ENABLE(OILPAN) | 93 #if !ENABLE(OILPAN) |
| 94 virtual void documentWasDisposed() OVERRIDE; | 94 virtual void documentWasDisposed() OVERRIDE; |
| 95 #endif | 95 #endif |
| 96 | 96 |
| 97 virtual void trace(Visitor*) OVERRIDE; | 97 virtual void trace(Visitor*) OVERRIDE; |
| 98 | 98 |
| 99 private: | 99 private: |
| 100 static FullscreenElementStack* fromIfExistsSlow(Document&); | 100 static Fullscreen* fromIfExistsSlow(Document&); |
| 101 | 101 |
| 102 explicit FullscreenElementStack(Document&); | 102 explicit Fullscreen(Document&); |
| 103 | 103 |
| 104 Document* document(); | 104 Document* document(); |
| 105 | 105 |
| 106 static bool elementReady(Element&, RequestType); | 106 static bool elementReady(Element&, RequestType); |
| 107 | 107 |
| 108 void clearFullscreenElementStack(); | 108 void clearFullscreenElementStack(); |
| 109 void popFullscreenElementStack(); | 109 void popFullscreenElementStack(); |
| 110 void pushFullscreenElementStack(Element&, RequestType); | 110 void pushFullscreenElementStack(Element&, RequestType); |
| 111 | 111 |
| 112 void enqueueChangeEvent(Document&, RequestType); | 112 void enqueueChangeEvent(Document&, RequestType); |
| 113 void enqueueErrorEvent(Element&, RequestType); | 113 void enqueueErrorEvent(Element&, RequestType); |
| 114 void eventQueueTimerFired(Timer<FullscreenElementStack>*); | 114 void eventQueueTimerFired(Timer<Fullscreen>*); |
| 115 | 115 |
| 116 bool m_areKeysEnabledInFullScreen; | 116 bool m_areKeysEnabledInFullScreen; |
| 117 RefPtrWillBeMember<Element> m_fullScreenElement; | 117 RefPtrWillBeMember<Element> m_fullScreenElement; |
| 118 WillBeHeapVector<std::pair<RefPtrWillBeMember<Element>, RequestType> > m_ful
lScreenElementStack; | 118 WillBeHeapVector<std::pair<RefPtrWillBeMember<Element>, RequestType> > m_ful
lScreenElementStack; |
| 119 RawPtrWillBeMember<RenderFullScreen> m_fullScreenRenderer; | 119 RawPtrWillBeMember<RenderFullScreen> m_fullScreenRenderer; |
| 120 Timer<FullscreenElementStack> m_eventQueueTimer; | 120 Timer<Fullscreen> m_eventQueueTimer; |
| 121 WillBeHeapDeque<RefPtrWillBeMember<Event> > m_eventQueue; | 121 WillBeHeapDeque<RefPtrWillBeMember<Event> > m_eventQueue; |
| 122 LayoutRect m_savedPlaceholderFrameRect; | 122 LayoutRect m_savedPlaceholderFrameRect; |
| 123 RefPtr<RenderStyle> m_savedPlaceholderRenderStyle; | 123 RefPtr<RenderStyle> m_savedPlaceholderRenderStyle; |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 inline bool FullscreenElementStack::isActiveFullScreenElement(const Element& ele
ment) | 126 inline bool Fullscreen::isActiveFullScreenElement(const Element& element) |
| 127 { | 127 { |
| 128 FullscreenElementStack* fullscreen = fromIfExists(element.document()); | 128 Fullscreen* fullscreen = fromIfExists(element.document()); |
| 129 if (!fullscreen) | 129 if (!fullscreen) |
| 130 return false; | 130 return false; |
| 131 return fullscreen->webkitCurrentFullScreenElement() == &element; | 131 return fullscreen->webkitCurrentFullScreenElement() == &element; |
| 132 } | 132 } |
| 133 | 133 |
| 134 inline FullscreenElementStack* FullscreenElementStack::fromIfExists(Document& do
cument) | 134 inline Fullscreen* Fullscreen::fromIfExists(Document& document) |
| 135 { | 135 { |
| 136 if (!document.hasFullscreenElementStack()) | 136 if (!document.hasFullscreenSupplement()) |
| 137 return 0; | 137 return 0; |
| 138 return fromIfExistsSlow(document); | 138 return fromIfExistsSlow(document); |
| 139 } | 139 } |
| 140 | 140 |
| 141 } // namespace blink | 141 } // namespace blink |
| 142 | 142 |
| 143 // Needed by the HeapVector<> element stack. | 143 // Needed by the HeapVector<> element stack. |
| 144 namespace WTF { | 144 namespace WTF { |
| 145 | 145 |
| 146 template<>struct IsPod<blink::FullscreenElementStack::RequestType> { | 146 template<>struct IsPod<blink::Fullscreen::RequestType> { |
| 147 static const bool value = true; | 147 static const bool value = true; |
| 148 }; | 148 }; |
| 149 | 149 |
| 150 } // namespace WTF | 150 } // namespace WTF |
| 151 | 151 |
| 152 #endif // FullscreenElementStack_h | 152 #endif // Fullscreen_h |
| OLD | NEW |