зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1637240 - Clean up iteration to find closest ancestor dialog in dialog form submission. r=sefeng
Differential Revision: https://phabricator.services.mozilla.com/D74845
This commit is contained in:
Родитель
d8b0ded34b
Коммит
099b4efd86
|
@ -50,6 +50,7 @@ namespace dom {
|
|||
nsINode* mCurrent; \
|
||||
}; \
|
||||
class name_ : public Inclusive##name_ { \
|
||||
public: \
|
||||
using Super = Inclusive##name_; \
|
||||
explicit name_(const nsINode& aNode) \
|
||||
: Inclusive##name_(aNode.method_()) {} \
|
||||
|
|
|
@ -23,6 +23,11 @@ class FilteredNodeIterator : public Iter {
|
|||
EnsureValid();
|
||||
}
|
||||
|
||||
static T* First(const nsINode& aNode) {
|
||||
FilteredNodeIterator iter(aNode);
|
||||
return *iter;
|
||||
}
|
||||
|
||||
FilteredNodeIterator& begin() { return *this; }
|
||||
using Iter::end;
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "nsCExternalHandlerService.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
#include "mozilla/dom/AncestorIterator.h"
|
||||
#include "mozilla/dom/Directory.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/StaticPrefs_dom.h"
|
||||
|
@ -831,14 +832,8 @@ nsresult HTMLFormSubmission::GetFromForm(HTMLFormElement* aForm,
|
|||
}
|
||||
|
||||
if (method == NS_FORM_METHOD_DIALOG) {
|
||||
HTMLDialogElement* dialog = nullptr;
|
||||
for (nsIContent* parent = aForm->GetParent(); parent;
|
||||
parent = parent->GetParent()) {
|
||||
dialog = HTMLDialogElement::FromNodeOrNull(parent);
|
||||
if (dialog) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
HTMLDialogElement* dialog =
|
||||
AncestorsOfType<HTMLDialogElement>::First(*aForm);
|
||||
|
||||
// If there isn't one, or if it does not have an open attribute, do
|
||||
// nothing.
|
||||
|
|
Загрузка…
Ссылка в новой задаче