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

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

Issue 476433002: Sync fullscreen element removal with the spec (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: nits 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 | « Source/core/dom/FullscreenElementStack.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/FullscreenElementStack.cpp
diff --git a/Source/core/dom/FullscreenElementStack.cpp b/Source/core/dom/FullscreenElementStack.cpp
index 075c6f486ed48db1c41c59a0752adaf3678371c1..22449065918835c60cda2064a3584e8f24dc2f2f 100644
--- a/Source/core/dom/FullscreenElementStack.cpp
+++ b/Source/core/dom/FullscreenElementStack.cpp
@@ -556,29 +556,27 @@ void FullscreenElementStack::eventQueueTimerFired(Timer<FullscreenElementStack>*
}
}
-void FullscreenElementStack::fullScreenElementRemoved()
+void FullscreenElementStack::elementRemoved(Element& element)
{
- m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(false);
- fullyExitFullscreen();
-}
-
-void FullscreenElementStack::removeFullScreenElementOfSubtree(Node* node, bool amongChildrenOnly)
-{
- if (!m_fullScreenElement)
- return;
+ // If an element |element| in a fullscreen element stack is removed from a document |document|,
+ // run these steps:
- // If the node isn't in a document it can't have a fullscreen'd child.
- if (!node->inDocument())
+ // 1. If |element| was at the top of |document|'s fullscreen element stack, act as if the
+ // exitFullscreen() method was invoked on that document.
+ if (fullscreenElement() == &element) {
+ exitFullscreen();
return;
+ }
- bool elementInSubtree = false;
- if (amongChildrenOnly)
- elementInSubtree = m_fullScreenElement->isDescendantOf(node);
- else
- elementInSubtree = (m_fullScreenElement == node) || m_fullScreenElement->isDescendantOf(node);
+ // 2. Otherwise, remove |element| from |document|'s fullscreen element stack.
+ for (size_t i = 0; i < m_fullScreenElementStack.size(); ++i) {
+ if (m_fullScreenElementStack[i].first.get() == &element) {
+ m_fullScreenElementStack.remove(i);
+ return;
+ }
+ }
- if (elementInSubtree)
- fullScreenElementRemoved();
+ // NOTE: |element| was not in the fullscreen element stack.
}
void FullscreenElementStack::clearFullscreenElementStack()
« no previous file with comments | « Source/core/dom/FullscreenElementStack.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698