Index: Source/core/dom/Document.cpp |
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp |
index 9edf98daaca23c90e4a0e54bc8660f76ed377b71..d681737be137a1d5de5c73a0cbac281cc2a4ba5c 100644 |
--- a/Source/core/dom/Document.cpp |
+++ b/Source/core/dom/Document.cpp |
@@ -450,6 +450,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) |
@@ -4777,11 +4778,40 @@ 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; |
esprehn
2014/01/21 18:59:05
Document::activeModalDialog() should just contain
falken
2014/01/22 06:08:02
Done.
|
+ 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; |
esprehn
2014/01/21 18:59:05
This should contain the loop.
|
} |
void Document::webkitExitPointerLock() |