<rdar://problem/
3805137> REGRESSION: Cannot search on pricetool.com
The problem here is that residual style handling can cause an
element associated with a misnested form to lose the association,
because it can become detached and then reattached in this
case. So we need to maintain the association.
* khtml/html/html_formimpl.h: Added list of dormant elements to form,
and dormant bit to generic form element.
* khtml/html/html_formimpl.cpp:
(DOM::HTMLFormElementImpl::~HTMLFormElementImpl): Clear m_form field for
dormant elements too.
(DOM::HTMLFormElementImpl::registerFormElement): Remove from dormant list
in addition to adding to main list.
(DOM::HTMLFormElementImpl::removeFormElement): Remove from both lists.
(DOM::HTMLFormElementImpl::makeFormElementDormant): New method, remove from
main list, add to dormant list.
(DOM::HTMLGenericFormElementImpl::HTMLGenericFormElementImpl): Initialize
dormant bit to false.
(DOM::HTMLGenericFormElementImpl::insertedIntoDocument): If the element is
dormant and has a form, re-register it and clear the dormant bit.
(DOM::HTMLGenericFormElementImpl::removedFromDocument): If the document has
a form, tell the form it is dormant and set the dormant bit.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@7633
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2004-09-21 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ <rdar://problem/3805137> REGRESSION: Cannot search on pricetool.com
+
+ The problem here is that residual style handling can cause an
+ element associated with a misnested form to lose the association,
+ because it can become detached and then reattached in this
+ case. So we need to maintain the association.
+
+ * khtml/html/html_formimpl.h: Added list of dormant elements to form,
+ and dormant bit to generic form element.
+ * khtml/html/html_formimpl.cpp:
+ (DOM::HTMLFormElementImpl::~HTMLFormElementImpl): Clear m_form field for
+ dormant elements too.
+ (DOM::HTMLFormElementImpl::registerFormElement): Remove from dormant list
+ in addition to adding to main list.
+ (DOM::HTMLFormElementImpl::removeFormElement): Remove from both lists.
+ (DOM::HTMLFormElementImpl::makeFormElementDormant): New method, remove from
+ main list, add to dormant list.
+ (DOM::HTMLGenericFormElementImpl::HTMLGenericFormElementImpl): Initialize
+ dormant bit to false.
+ (DOM::HTMLGenericFormElementImpl::insertedIntoDocument): If the element is
+ dormant and has a form, re-register it and clear the dormant bit.
+ (DOM::HTMLGenericFormElementImpl::removedFromDocument): If the document has
+ a form, tell the form it is dormant and set the dormant bit.
+
2004-09-22 Chris Blumenberg <cblu@apple.com>
Fixed: <rdar://problem/3811187> REGRESSION (Mail): Control-click past end of document does not spell check last word
QPtrListIterator<HTMLGenericFormElementImpl> it(formElements);
for (; it.current(); ++it)
it.current()->m_form = 0;
+ QPtrListIterator<HTMLGenericFormElementImpl> it2(dormantFormElements);
+ for (; it2.current(); ++it2)
+ it2.current()->m_form = 0;
}
NodeImpl::Id HTMLFormElementImpl::id() const
void HTMLFormElementImpl::registerFormElement(HTMLGenericFormElementImpl *e)
{
formElements.append(e);
+ dormantFormElements.remove(e);
}
void HTMLFormElementImpl::removeFormElement(HTMLGenericFormElementImpl *e)
{
formElements.remove(e);
+ dormantFormElements.remove(e);
+}
+
+void HTMLFormElementImpl::makeFormElementDormant(HTMLGenericFormElementImpl *e)
+{
+ dormantFormElements.append(e);
+ formElements.remove(e);
}
bool HTMLFormElementImpl::isURLAttribute(AttributeImpl *attr) const
{
m_disabled = m_readOnly = false;
m_name = 0;
+ m_dormant = false;
if (f)
m_form = f;
}
}
+void HTMLGenericFormElementImpl::insertedIntoDocument()
+{
+ if (m_form && m_dormant)
+ m_form->registerFormElement(this);
+
+ m_dormant = false;
+
+ HTMLElementImpl::insertedIntoDocument();
+}
+
void HTMLGenericFormElementImpl::removedFromDocument()
{
if (m_form)
- m_form->removeFormElement(this);
- m_form = 0;
+ m_form->makeFormElementDormant(this);
+
+ m_dormant = true;
HTMLElementImpl::removedFromDocument();
}
void radioClicked( HTMLGenericFormElementImpl *caller );
- void registerFormElement(khtml::RenderFormElement *);
- void removeFormElement(khtml::RenderFormElement *);
-
void registerFormElement(HTMLGenericFormElementImpl *);
void removeFormElement(HTMLGenericFormElementImpl *);
+ void makeFormElementDormant(HTMLGenericFormElementImpl *);
bool prepareSubmit();
void submit(bool activateSubmitButton);
friend class HTMLFormCollectionImpl;
QPtrList<HTMLGenericFormElementImpl> formElements;
+ QPtrList<HTMLGenericFormElementImpl> dormantFormElements;
DOMString m_url;
DOMString m_target;
DOMString m_enctype;
virtual void parseHTMLAttribute(HTMLAttributeImpl *attr);
virtual void attach();
+ virtual void insertedIntoDocument();
virtual void removedFromDocument();
virtual void reset() {}
bool m_disabled, m_readOnly;
bool m_inited : 1;
+ bool m_dormant : 1;
};
// -------------------------------------------------------------------------