Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Side by Side Diff: third_party/WebKit/Source/core/dom/Fullscreen.h

Issue 2107233002: Reland "Implement FullScreen using top layer." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: new untested DCHECK Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 GarbageCollectedFinalized<Fullscreen> 47 : public GarbageCollectedFinalized<Fullscreen>
49 , public Supplement<Document> 48 , public Supplement<Document>
50 , public ContextLifecycleObserver { 49 , public ContextLifecycleObserver {
51 USING_GARBAGE_COLLECTED_MIXIN(Fullscreen); 50 USING_GARBAGE_COLLECTED_MIXIN(Fullscreen);
52 public: 51 public:
53 virtual ~Fullscreen(); 52 virtual ~Fullscreen();
54 static const char* supplementName(); 53 static const char* supplementName();
(...skipping 19 matching lines...) Expand all
74 73
75 static void fullyExitFullscreen(Document&); 74 static void fullyExitFullscreen(Document&);
76 void exitFullscreen(); 75 void exitFullscreen();
77 76
78 static bool fullscreenEnabled(Document&); 77 static bool fullscreenEnabled(Document&);
79 Element* fullscreenElement() const { return !m_fullScreenElementStack.isEmpt y() ? m_fullScreenElementStack.last().first.get() : 0; } 78 Element* fullscreenElement() const { return !m_fullScreenElementStack.isEmpt y() ? m_fullScreenElementStack.last().first.get() : 0; }
80 79
81 void didEnterFullscreenForElement(Element*); 80 void didEnterFullscreenForElement(Element*);
82 void didExitFullscreen(); 81 void didExitFullscreen();
83 82
84 void setFullScreenLayoutObject(LayoutFullScreen*); 83 void didUpdateSize(Element&);
85 LayoutFullScreen* fullScreenLayoutObject() const { return m_fullScreenLayout Object; }
86 void fullScreenLayoutObjectDestroyed();
87 84
88 void elementRemoved(Element&); 85 void elementRemoved(Element&);
89 86
90 // Returns true if the current fullscreen element stack corresponds to a 87 // Returns true if the current fullscreen element stack corresponds to a
91 // container for an actual fullscreen element in a descendant 88 // container for an actual fullscreen element in a descendant
92 // out-of-process iframe. 89 // out-of-process iframe.
93 bool forCrossProcessDescendant() { return m_forCrossProcessDescendant; } 90 bool forCrossProcessDescendant() { return m_forCrossProcessDescendant; }
94 91
95 // Mozilla API 92 // Mozilla API
96 Element* webkitCurrentFullScreenElement() const { return m_fullScreenElement .get(); } 93 Element* webkitCurrentFullScreenElement() const { return m_fullScreenElement .get(); }
97 94
98 // ContextLifecycleObserver: 95 // ContextLifecycleObserver:
99 void contextDestroyed() override; 96 void contextDestroyed() override;
100 97
101 DECLARE_VIRTUAL_TRACE(); 98 DECLARE_VIRTUAL_TRACE();
102 99
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;
121 Timer<Fullscreen> m_eventQueueTimer; 120 Timer<Fullscreen> m_eventQueueTimer;
122 HeapDeque<Member<Event>> m_eventQueue; 121 HeapDeque<Member<Event>> m_eventQueue;
123 LayoutRect m_savedPlaceholderFrameRect; 122 LayoutRect m_savedPlaceholderFrameRect;
124 RefPtr<ComputedStyle> m_savedPlaceholderComputedStyle; 123 RefPtr<ComputedStyle> m_savedPlaceholderComputedStyle;
125 124
126 // TODO(alexmos, dcheng): Currently, this assumes that if fullscreen was 125 // TODO(alexmos, dcheng): Currently, this assumes that if fullscreen was
127 // entered for an element in an out-of-process iframe, then it's not 126 // entered for an element in an out-of-process iframe, then it's not
128 // possible to re-enter fullscreen for a different element in this 127 // possible to re-enter fullscreen for a different element in this
129 // document, since that requires a user gesture, which can't be obtained 128 // document, since that requires a user gesture, which can't be obtained
130 // since nothing in this document is visible, and since user gestures can't 129 // since nothing in this document is visible, and since user gestures can't
(...skipping 15 matching lines...) Expand all
146 inline Fullscreen* Fullscreen::fromIfExists(Document& document) 145 inline Fullscreen* Fullscreen::fromIfExists(Document& document)
147 { 146 {
148 if (!document.hasFullscreenSupplement()) 147 if (!document.hasFullscreenSupplement())
149 return 0; 148 return 0;
150 return fromIfExistsSlow(document); 149 return fromIfExistsSlow(document);
151 } 150 }
152 151
153 } // namespace blink 152 } // namespace blink
154 153
155 #endif // Fullscreen_h 154 #endif // Fullscreen_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | third_party/WebKit/Source/core/dom/Fullscreen.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698