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

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

Issue 18896003: [WIP] Migrate Fullscreen to use top layer instead of RenderFullScreen (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix some failing tests Created 6 years, 11 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/Document.h ('k') | Source/core/dom/FullscreenElementStack.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 27207a8de35eb20383e80ee5c5b0ce87fc6efed2..1569f4a58adb51987d25bcadd5babf58924b4e30 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -429,6 +429,7 @@ Document::Document(const DocumentInit& initializer, DocumentClassFlags documentC
, m_weakFactory(this)
, m_contextDocument(initializer.contextDocument())
, m_hasFullscreenElementStack(false)
+ , m_activeModalDialog(0)
, m_loadEventDelayCount(0)
, m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired)
, m_referrerPolicy(ReferrerPolicyDefault)
@@ -4722,9 +4723,9 @@ void Document::addToTopLayer(Element* element, const Element* before)
{
if (element->isInTopLayer())
return;
-
ASSERT(!m_topLayerElements.contains(element));
ASSERT(!before || m_topLayerElements.contains(before));
+
if (before) {
size_t beforePosition = m_topLayerElements.find(before);
m_topLayerElements.insert(beforePosition, element);
@@ -4744,11 +4745,41 @@ void Document::removeFromTopLayer(Element* element)
element->setIsInTopLayer(false);
}
+void Document::addToModalDialogStack(HTMLDialogElement* dialog)
+{
+ if (dialog->isModal())
+ return;
+ addToTopLayer(dialog);
+ dialog->setModal(true);
+ m_activeModalDialog = dialog;
+}
+
+void Document::removeFromModalDialogStack(HTMLDialogElement* dialog)
+{
+ if (!dialog->isModal())
+ return;
+
+ removeFromTopLayer(dialog);
+ dialog->setModal(false);
+ if (m_activeModalDialog != dialog)
+ return;
+
+ m_activeModalDialog = 0;
+ Vector<RefPtr<Element> >::reverse_iterator end = m_topLayerElements.rend();
+ for (Vector<RefPtr<Element> >::reverse_iterator it = m_topLayerElements.rbegin(); it != end; ++it) {
+ if (!it->get()->hasTagName(dialogTag))
+ continue;
+ HTMLDialogElement* dialog = toHTMLDialogElement(it->get());
+ if (dialog->isModal()) {
+ m_activeModalDialog = dialog;
+ return;
+ }
+ }
+}
+
HTMLDialogElement* Document::activeModalDialog() const
{
- if (m_topLayerElements.isEmpty())
- return 0;
- return toHTMLDialogElement(m_topLayerElements.last().get());
+ return m_activeModalDialog;
}
void Document::webkitExitPointerLock()
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/FullscreenElementStack.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698