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

Unified Diff: Source/core/dom/Fullscreen.cpp

Issue 470723002: Sync "fully exit fullscreen" with the spec (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: test with window.open() Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fullscreen/model/fully-exit-fullscreen-single.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Fullscreen.cpp
diff --git a/Source/core/dom/Fullscreen.cpp b/Source/core/dom/Fullscreen.cpp
index e2e2d61085182817d15215f6af7ce1fb03380930..04eda51217cb418797876e31527b34318368c8ee 100644
--- a/Source/core/dom/Fullscreen.cpp
+++ b/Source/core/dom/Fullscreen.cpp
@@ -287,18 +287,22 @@ void Fullscreen::requestFullscreen(Element& element, RequestType requestType)
void Fullscreen::fullyExitFullscreen()
{
- // "To fully exit fullscreen act as if the exitFullscreen() method was invoked on the top-level browsing
- // context's document and subsequently empty that document's fullscreen element stack."
- if (!fullscreenElementFrom(document()->topDocument()))
+ // To fully exit fullscreen, run these steps:
+
+ // 1. Let |doc| be the top-level browsing context's document.
+ Document& doc = document()->topDocument();
+
+ // 2. If |doc|'s fullscreen element stack is empty, terminate these steps.
+ if (!fullscreenElementFrom(doc))
return;
- // To achieve that aim, remove all the elements from the top document's stack except for the first before
- // calling exitFullscreen():
- WillBeHeapVector<std::pair<RefPtrWillBeMember<Element>, RequestType> > replacementFullscreenElementStack;
- Fullscreen& topFullscreen = from(document()->topDocument());
- replacementFullscreenElementStack.append(topFullscreen.m_fullScreenElementStack.last());
- topFullscreen.m_fullScreenElementStack.swap(replacementFullscreenElementStack);
- topFullscreen.exitFullscreen();
+ // 3. Remove elements from |doc|'s fullscreen element stack until only the top element is left.
+ size_t stackSize = from(doc).m_fullScreenElementStack.size();
+ from(doc).m_fullScreenElementStack.remove(0, stackSize - 1);
+ ASSERT(from(doc).m_fullScreenElementStack.size() == 1);
+
+ // 4. Act as if the exitFullscreen() method was invoked on |doc|.
+ from(doc).exitFullscreen();
}
void Fullscreen::exitFullscreen()
« no previous file with comments | « LayoutTests/fullscreen/model/fully-exit-fullscreen-single.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698