| Index: Source/core/dom/Document.cpp
|
| diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
|
| index 32f95f96692d01ed682a4467ca04465a261e3b3a..906ec47d747233a88cb92065c899e520d0aaa230 100644
|
| --- a/Source/core/dom/Document.cpp
|
| +++ b/Source/core/dom/Document.cpp
|
| @@ -4795,9 +4795,15 @@ void Document::removeFromTopLayer(Element* element)
|
|
|
| HTMLDialogElement* Document::activeModalDialog() const
|
| {
|
| - if (m_topLayerElements.isEmpty())
|
| - return 0;
|
| - return toHTMLDialogElement(m_topLayerElements.last().get());
|
| + Vector<RefPtr<Element> >::const_reverse_iterator end = m_topLayerElements.rend();
|
| + for (Vector<RefPtr<Element> >::const_reverse_iterator it = m_topLayerElements.rbegin(); it != end; ++it) {
|
| + if (!it->get()->hasTagName(dialogTag))
|
| + continue;
|
| + HTMLDialogElement* dialog = toHTMLDialogElement(it->get());
|
| + if (dialog->isModal())
|
| + return dialog;
|
| + }
|
| + return 0;
|
| }
|
|
|
| void Document::webkitExitPointerLock()
|
|
|