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*); | 80 void didUpdateSize(Element&); |
| 82 LayoutFullScreen* fullScreenLayoutObject() const { return m_fullScreenLayout Object; } | |
| 83 void fullScreenLayoutObjectDestroyed(); | |
| 84 | 81 |
| 85 void elementRemoved(Element&); | 82 void elementRemoved(Element&); |
| 86 | 83 |
| 87 // Mozilla API | 84 // Mozilla API |
| 88 Element* webkitCurrentFullScreenElement() const { return m_fullScreenElement .get(); } | 85 Element* webkitCurrentFullScreenElement() const { return m_fullScreenElement .get(); } |
| 89 | 86 |
| 90 void documentWasDetached() override; | 87 void documentWasDetached() override; |
| 91 #if !ENABLE(OILPAN) | 88 #if !ENABLE(OILPAN) |
| 92 void documentWasDisposed() override; | 89 void documentWasDisposed() override; |
| 93 #endif | 90 #endif |
| 94 | 91 |
| 95 DECLARE_VIRTUAL_TRACE(); | 92 DECLARE_VIRTUAL_TRACE(); |
| 96 | 93 |
| 94 const WillBeHeapVector<std::pair<RefPtrWillBeMember<Element>, RequestType>>& fullScreenElementStack() const { return m_fullScreenElementStack; } | |
|
esprehn
2015/10/09 10:34:00
You might do something like:
using ElementStack =
dsinclair
2015/10/13 15:50:43
Done.
| |
| 95 | |
| 97 private: | 96 private: |
| 98 static Fullscreen* fromIfExistsSlow(Document&); | 97 static Fullscreen* fromIfExistsSlow(Document&); |
| 99 | 98 |
| 100 explicit Fullscreen(Document&); | 99 explicit Fullscreen(Document&); |
| 101 | 100 |
| 102 Document* document(); | 101 Document* document(); |
| 103 | 102 |
| 104 void clearFullscreenElementStack(); | 103 void clearFullscreenElementStack(); |
| 105 void popFullscreenElementStack(); | 104 void popFullscreenElementStack(); |
| 106 void pushFullscreenElementStack(Element&, RequestType); | 105 void pushFullscreenElementStack(Element&, RequestType); |
| 107 | 106 |
| 108 void enqueueChangeEvent(Document&, RequestType); | 107 void enqueueChangeEvent(Document&, RequestType); |
| 109 void enqueueErrorEvent(Element&, RequestType); | 108 void enqueueErrorEvent(Element&, RequestType); |
| 110 void eventQueueTimerFired(Timer<Fullscreen>*); | 109 void eventQueueTimerFired(Timer<Fullscreen>*); |
| 111 | 110 |
| 112 RefPtrWillBeMember<Element> m_fullScreenElement; | 111 RefPtrWillBeMember<Element> m_fullScreenElement; |
| 113 WillBeHeapVector<std::pair<RefPtrWillBeMember<Element>, RequestType>> m_full ScreenElementStack; | 112 WillBeHeapVector<std::pair<RefPtrWillBeMember<Element>, RequestType>> m_full ScreenElementStack; |
| 114 LayoutFullScreen* m_fullScreenLayoutObject; | |
| 115 Timer<Fullscreen> m_eventQueueTimer; | 113 Timer<Fullscreen> m_eventQueueTimer; |
| 116 WillBeHeapDeque<RefPtrWillBeMember<Event>> m_eventQueue; | 114 WillBeHeapDeque<RefPtrWillBeMember<Event>> m_eventQueue; |
| 117 LayoutRect m_savedPlaceholderFrameRect; | 115 LayoutRect m_savedPlaceholderFrameRect; |
| 118 RefPtr<ComputedStyle> m_savedPlaceholderComputedStyle; | 116 RefPtr<ComputedStyle> m_savedPlaceholderComputedStyle; |
| 119 }; | 117 }; |
| 120 | 118 |
| 121 inline bool Fullscreen::isActiveFullScreenElement(const Element& element) | 119 inline bool Fullscreen::isActiveFullScreenElement(const Element& element) |
| 122 { | 120 { |
| 123 Fullscreen* fullscreen = fromIfExists(element.document()); | 121 Fullscreen* fullscreen = fromIfExists(element.document()); |
| 124 if (!fullscreen) | 122 if (!fullscreen) |
| 125 return false; | 123 return false; |
| 126 return fullscreen->webkitCurrentFullScreenElement() == &element; | 124 return fullscreen->webkitCurrentFullScreenElement() == &element; |
| 127 } | 125 } |
| 128 | 126 |
| 129 inline Fullscreen* Fullscreen::fromIfExists(Document& document) | 127 inline Fullscreen* Fullscreen::fromIfExists(Document& document) |
| 130 { | 128 { |
| 131 if (!document.hasFullscreenSupplement()) | 129 if (!document.hasFullscreenSupplement()) |
| 132 return 0; | 130 return 0; |
| 133 return fromIfExistsSlow(document); | 131 return fromIfExistsSlow(document); |
| 134 } | 132 } |
| 135 | 133 |
| 136 } // namespace blink | 134 } // namespace blink |
| 137 | 135 |
| 138 #endif // Fullscreen_h | 136 #endif // Fullscreen_h |
| OLD | NEW |