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