Bug 1401992 - Don't cross anonymous boundaries when finding the fieldset. r=bz

MozReview-Commit-ID: DiywRognpqx
This commit is contained in:
Bobby Holley 2017-09-22 12:34:00 -07:00
Родитель 528cd7a92c
Коммит 2ceae78919
1 изменённых файлов: 6 добавлений и 2 удалений

Просмотреть файл

@ -545,7 +545,7 @@ nsGenericHTMLElement::FindAncestorForm(HTMLFormElement* aCurrentForm)
"FindAncestorForm should not be called if @form is set!");
// Make sure we don't end up finding a form that's anonymous from
// our point of view.
// our point of view. See also nsGenericHTMLFormElement::UpdateFieldSet.
nsIContent* bindingParent = GetBindingParent();
nsIContent* content = this;
@ -2365,7 +2365,11 @@ nsGenericHTMLFormElement::UpdateFieldSet(bool aNotify)
nsIContent* parent = nullptr;
nsIContent* prev = nullptr;
for (parent = GetParent(); parent;
// Don't walk out of anonymous subtrees. Note the similar code in
// nsGenericHTMLElement::FindAncestorForm.
nsIContent* bindingParent = GetBindingParent();
for (parent = GetParent(); parent && parent != bindingParent;
prev = parent, parent = parent->GetParent()) {
HTMLFieldSetElement* fieldset =
HTMLFieldSetElement::FromContent(parent);