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 22 matching lines...) Expand all Loading... | |
| 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; | |
| 44 class RenderStyle; | 43 class RenderStyle; |
| 45 | 44 |
| 46 class Fullscreen final | 45 class Fullscreen final |
| 47 : public NoBaseWillBeGarbageCollectedFinalized<Fullscreen> | 46 : public NoBaseWillBeGarbageCollectedFinalized<Fullscreen> |
| 48 , public DocumentSupplement | 47 , public DocumentSupplement |
| 49 , public DocumentLifecycleObserver { | 48 , public DocumentLifecycleObserver { |
| 50 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Fullscreen); | 49 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Fullscreen); |
| 51 public: | 50 public: |
| 52 virtual ~Fullscreen(); | 51 virtual ~Fullscreen(); |
| 53 static const char* supplementName(); | 52 static const char* supplementName(); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 67 void requestFullscreen(Element&, RequestType); | 66 void requestFullscreen(Element&, RequestType); |
| 68 static void fullyExitFullscreen(Document&); | 67 static void fullyExitFullscreen(Document&); |
| 69 void exitFullscreen(); | 68 void exitFullscreen(); |
| 70 | 69 |
| 71 static bool fullscreenEnabled(Document&); | 70 static bool fullscreenEnabled(Document&); |
| 72 Element* fullscreenElement() const { return !m_fullScreenElementStack.isEmpt y() ? m_fullScreenElementStack.last().first.get() : 0; } | 71 Element* fullscreenElement() const { return !m_fullScreenElementStack.isEmpt y() ? m_fullScreenElementStack.last().first.get() : 0; } |
| 73 | 72 |
| 74 void didEnterFullScreenForElement(Element*); | 73 void didEnterFullScreenForElement(Element*); |
| 75 void didExitFullScreenForElement(Element*); | 74 void didExitFullScreenForElement(Element*); |
| 76 | 75 |
| 77 void setFullScreenRenderer(RenderFullScreen*); | |
| 78 RenderFullScreen* fullScreenRenderer() const { return m_fullScreenRenderer; } | |
| 79 void fullScreenRendererDestroyed(); | |
| 80 | |
| 81 void elementRemoved(Element&); | 76 void elementRemoved(Element&); |
| 82 | 77 |
| 83 // Mozilla API | 78 // Mozilla API |
| 84 Element* webkitCurrentFullScreenElement() const { return m_fullScreenElement .get(); } | 79 Element* webkitCurrentFullScreenElement() const { return m_fullScreenElement .get(); } |
| 85 | 80 |
| 86 virtual void documentWasDetached() override; | 81 virtual void documentWasDetached() override; |
| 87 #if !ENABLE(OILPAN) | 82 #if !ENABLE(OILPAN) |
| 88 virtual void documentWasDisposed() override; | 83 virtual void documentWasDisposed() override; |
| 89 #endif | 84 #endif |
| 90 | 85 |
| 91 virtual void trace(Visitor*) override; | 86 virtual void trace(Visitor*) override; |
| 92 | 87 |
| 88 // Used for testing. | |
| 89 const WillBeHeapVector<std::pair<RefPtrWillBeMember<Element>, RequestType> > & fullScreenElementStack() { return m_fullScreenElementStack; } | |
|
esprehn
2014/12/15 09:45:32
Add ForTesting() for the function name?
Julien - ping for review
2014/12/15 17:02:53
Removed the for-testing comment as it could be use
| |
| 90 | |
| 93 private: | 91 private: |
| 94 static Fullscreen* fromIfExistsSlow(Document&); | 92 static Fullscreen* fromIfExistsSlow(Document&); |
| 95 | 93 |
| 96 explicit Fullscreen(Document&); | 94 explicit Fullscreen(Document&); |
| 97 | 95 |
| 98 Document* document(); | 96 Document* document(); |
| 99 | 97 |
| 100 void clearFullscreenElementStack(); | 98 void clearFullscreenElementStack(); |
| 101 void popFullscreenElementStack(); | 99 void popFullscreenElementStack(); |
| 102 void pushFullscreenElementStack(Element&, RequestType); | 100 void pushFullscreenElementStack(Element&, RequestType); |
| 103 | 101 |
| 104 void enqueueChangeEvent(Document&, RequestType); | 102 void enqueueChangeEvent(Document&, RequestType); |
| 105 void enqueueErrorEvent(Element&, RequestType); | 103 void enqueueErrorEvent(Element&, RequestType); |
| 106 void eventQueueTimerFired(Timer<Fullscreen>*); | 104 void eventQueueTimerFired(Timer<Fullscreen>*); |
| 107 | 105 |
| 108 RefPtrWillBeMember<Element> m_fullScreenElement; | 106 RefPtrWillBeMember<Element> m_fullScreenElement; |
| 109 WillBeHeapVector<std::pair<RefPtrWillBeMember<Element>, RequestType> > m_ful lScreenElementStack; | 107 WillBeHeapVector<std::pair<RefPtrWillBeMember<Element>, RequestType> > m_ful lScreenElementStack; |
| 110 RawPtrWillBeMember<RenderFullScreen> m_fullScreenRenderer; | |
| 111 Timer<Fullscreen> m_eventQueueTimer; | 108 Timer<Fullscreen> m_eventQueueTimer; |
| 112 WillBeHeapDeque<RefPtrWillBeMember<Event> > m_eventQueue; | 109 WillBeHeapDeque<RefPtrWillBeMember<Event> > m_eventQueue; |
| 113 LayoutRect m_savedPlaceholderFrameRect; | 110 LayoutRect m_savedPlaceholderFrameRect; |
| 114 RefPtr<RenderStyle> m_savedPlaceholderRenderStyle; | 111 RefPtr<RenderStyle> m_savedPlaceholderRenderStyle; |
| 115 }; | 112 }; |
| 116 | 113 |
| 117 inline bool Fullscreen::isActiveFullScreenElement(const Element& element) | 114 inline bool Fullscreen::isActiveFullScreenElement(const Element& element) |
| 118 { | 115 { |
| 119 Fullscreen* fullscreen = fromIfExists(element.document()); | 116 Fullscreen* fullscreen = fromIfExists(element.document()); |
| 120 if (!fullscreen) | 117 if (!fullscreen) |
| 121 return false; | 118 return false; |
| 122 return fullscreen->webkitCurrentFullScreenElement() == &element; | 119 return fullscreen->webkitCurrentFullScreenElement() == &element; |
| 123 } | 120 } |
| 124 | 121 |
| 125 inline Fullscreen* Fullscreen::fromIfExists(Document& document) | 122 inline Fullscreen* Fullscreen::fromIfExists(Document& document) |
| 126 { | 123 { |
| 127 if (!document.hasFullscreenSupplement()) | 124 if (!document.hasFullscreenSupplement()) |
| 128 return 0; | 125 return 0; |
| 129 return fromIfExistsSlow(document); | 126 return fromIfExistsSlow(document); |
| 130 } | 127 } |
| 131 | 128 |
| 132 } // namespace blink | 129 } // namespace blink |
| 133 | 130 |
| 134 #endif // Fullscreen_h | 131 #endif // Fullscreen_h |
| OLD | NEW |