Commit c70d1c6a authored by andersca's avatar andersca

2006-01-03 Anders Carlsson <andersca@mac.com>

        Reviewed by Darin.

        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5177
        Javascript cloneNode(deep) does not clone form elements correctly

        * khtml/html/html_elementimpl.cpp:
        (HTMLElementImpl::cloneNode):
        Call copyNonAttributeProperties on the new node.

        * khtml/html/html_formimpl.cpp:
        (DOM::HTMLInputElementImpl::copyNonAttributeProperties):
        * khtml/html/html_formimpl.h:
        Copy m_value, m_checked and m_indeterminate here.

        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::importNode):
        Call copyNonAttributeProperties on the new node.

        * khtml/xml/dom_elementimpl.cpp:
        (ElementImpl::cloneNode):
        Call copyNonAttributeProperties on the new node.

        * khtml/xml/dom_elementimpl.h:
        (DOM::ElementImpl::copyNonAttributeProperties):
        Add function declaration.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@11852 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 7c79e17d
2006-01-03 Anders Carlsson <andersca@mac.com>
Reviewed by Darin.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5177
Javascript cloneNode(deep) does not clone form elements correctly
* khtml/html/html_elementimpl.cpp:
(HTMLElementImpl::cloneNode):
Call copyNonAttributeProperties on the new node.
* khtml/html/html_formimpl.cpp:
(DOM::HTMLInputElementImpl::copyNonAttributeProperties):
* khtml/html/html_formimpl.h:
Copy m_value, m_checked and m_indeterminate here.
* khtml/xml/dom_docimpl.cpp:
(DocumentImpl::importNode):
Call copyNonAttributeProperties on the new node.
* khtml/xml/dom_elementimpl.cpp:
(ElementImpl::cloneNode):
Call copyNonAttributeProperties on the new node.
* khtml/xml/dom_elementimpl.h:
(DOM::ElementImpl::copyNonAttributeProperties):
Add function declaration.
2006-01-02 Maciej Stachowiak <mjs@apple.com>
Rubber stamped by Eric.
......
......@@ -114,6 +114,8 @@ NodeImpl *HTMLElementImpl::cloneNode(bool deep)
if (m_inlineStyleDecl)
*clone->getInlineStyleDecl() = *m_inlineStyleDecl;
clone->copyNonAttributeProperties(this);
if (deep)
cloneChildNodes(clone);
......
......@@ -1917,6 +1917,15 @@ void HTMLInputElementImpl::setIndeterminate(bool _indeterminate)
theme()->stateChanged(renderer(), CheckedState);
}
void HTMLInputElementImpl::copyNonAttributeProperties(const ElementImpl *source)
{
const HTMLInputElementImpl *sourceElem = static_cast<const HTMLInputElementImpl *>(source);
m_value = sourceElem->m_value;
m_checked = sourceElem->m_checked;
m_indeterminate = sourceElem->m_indeterminate;
}
DOMString HTMLInputElementImpl::value() const
{
DOMString value = m_value;
......
......@@ -376,6 +376,8 @@ public:
virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
virtual void parseMappedAttribute(MappedAttributeImpl *attr);
virtual void copyNonAttributeProperties(const ElementImpl *source);
virtual void attach();
virtual bool rendererIsNeeded(khtml::RenderStyle *);
virtual khtml::RenderObject *createRenderer(RenderArena *, khtml::RenderStyle *);
......
......@@ -696,6 +696,8 @@ NodeImpl *DocumentImpl::importNode(NodeImpl *importedNode, bool deep, int &excep
}
}
newElement->copyNonAttributeProperties(oldElement);
if (deep) {
for (NodeImpl *oldChild = oldElement->firstChild(); oldChild; oldChild = oldChild->nextSibling()) {
NodeImpl *newChild = importNode(oldChild, true, exceptioncode);
......
......@@ -283,6 +283,8 @@ NodeImpl *ElementImpl::cloneNode(bool deep)
if (namedAttrMap)
*clone->attributes() = *namedAttrMap;
clone->copyNonAttributeProperties(this);
if (deep)
cloneChildNodes(clone);
......
......@@ -237,6 +237,8 @@ public:
// not part of the DOM
void setAttributeMap(NamedAttrMapImpl*);
virtual void copyNonAttributeProperties(const ElementImpl *source) {}
// State of the element.
virtual QString state() { return QString::null; }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment