Break the association between form controls and their owner when the owner leaves the tree
Created attachment 132402 [details] Patch
Created attachment 132409 [details] Added expectation
Comment on attachment 132409 [details] Added expectation View in context: https://bugs.webkit.org/attachment.cgi?id=132409&action=review > Source/WebCore/html/HTMLFormElement.cpp:161 > + for (unsigned i = 0; i < m_associatedElements.size(); ++i) > + m_associatedElements[i]->formRemovedFromTree(root); This is a bad iteration pattern. formRemovedFromTree() updates m_associatedElements. Form-association code is complex, and introducing FormAssociatedElement::m_formNeedsSameRootCheck makes it more complex. I'd like to avoid m_formNeedsRootCheck as possible. I'd like to change formRemovedFromTree() so that it unregister a control only if the control has form= attribute or its root is different from the root of this form.
(In reply to comment #3) > I'd like to change formRemovedFromTree() so that it unregister a control only if the control has form= attribute or its root is different from the root of this form. and it does nothing otherwise. I don't think findRoot cost is significant.
Created attachment 136504 [details] Patch
Comment on attachment 132409 [details] Added expectation View in context: https://bugs.webkit.org/attachment.cgi?id=132409&action=review >> Source/WebCore/html/HTMLFormElement.cpp:161 >> + m_associatedElements[i]->formRemovedFromTree(root); > > This is a bad iteration pattern. formRemovedFromTree() updates m_associatedElements. > > Form-association code is complex, and introducing FormAssociatedElement::m_formNeedsSameRootCheck makes it more complex. I'd like to avoid m_formNeedsRootCheck as possible. > I'd like to change formRemovedFromTree() so that it unregister a control only if the control has form= attribute or its root is different from the root of this form. Changed to make a copy of the vector before iterating. I've removed m_formNeedsSameRootCheck, greatly simplifying this patch. Note that a form with an ID going away is already handled in HTMLFormElement::removedFromDocument.
Comment on attachment 136504 [details] Patch ok
Comment on attachment 136504 [details] Patch Clearing flags on attachment: 136504 Committed r113817: <http://trac.webkit.org/changeset/113817>
All reviewed patches have been landed. Closing bug.