[webkit-changes] cvs commit: WebCore/khtml/xml dom_docimpl.cpp
dom_elementimpl.cpp dom_elementimpl.h
Anders
andersca at opensource.apple.com
Tue Jan 3 00:12:31 PST 2006
andersca 06/01/03 00:12:30
Modified: . ChangeLog
khtml/html html_elementimpl.cpp html_formimpl.cpp
html_formimpl.h
khtml/xml dom_docimpl.cpp dom_elementimpl.cpp
dom_elementimpl.h
Log:
2006-01-03 Anders Carlsson <andersca at 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.
Revision Changes Path
1.75 +28 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -r1.74 -r1.75
--- ChangeLog 3 Jan 2006 03:48:58 -0000 1.74
+++ ChangeLog 3 Jan 2006 08:12:26 -0000 1.75
@@ -1,3 +1,31 @@
+2006-01-03 Anders Carlsson <andersca at 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 at apple.com>
Rubber stamped by Eric.
1.117 +2 -0 WebCore/khtml/html/html_elementimpl.cpp
Index: html_elementimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_elementimpl.cpp,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -r1.116 -r1.117
--- html_elementimpl.cpp 31 Dec 2005 00:14:24 -0000 1.116
+++ html_elementimpl.cpp 3 Jan 2006 08:12:27 -0000 1.117
@@ -114,6 +114,8 @@
if (m_inlineStyleDecl)
*clone->getInlineStyleDecl() = *m_inlineStyleDecl;
+ clone->copyNonAttributeProperties(this);
+
if (deep)
cloneChildNodes(clone);
1.219 +9 -0 WebCore/khtml/html/html_formimpl.cpp
Index: html_formimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_formimpl.cpp,v
retrieving revision 1.218
retrieving revision 1.219
diff -u -r1.218 -r1.219
--- html_formimpl.cpp 31 Dec 2005 00:14:24 -0000 1.218
+++ html_formimpl.cpp 3 Jan 2006 08:12:27 -0000 1.219
@@ -1917,6 +1917,15 @@
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;
1.102 +2 -0 WebCore/khtml/html/html_formimpl.h
Index: html_formimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_formimpl.h,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -r1.101 -r1.102
--- html_formimpl.h 27 Dec 2005 12:05:34 -0000 1.101
+++ html_formimpl.h 3 Jan 2006 08:12:28 -0000 1.102
@@ -376,6 +376,8 @@
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 *);
1.296 +2 -0 WebCore/khtml/xml/dom_docimpl.cpp
Index: dom_docimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom_docimpl.cpp,v
retrieving revision 1.295
retrieving revision 1.296
diff -u -r1.295 -r1.296
--- dom_docimpl.cpp 31 Dec 2005 00:14:29 -0000 1.295
+++ dom_docimpl.cpp 3 Jan 2006 08:12:29 -0000 1.296
@@ -696,6 +696,8 @@
}
}
+ newElement->copyNonAttributeProperties(oldElement);
+
if (deep) {
for (NodeImpl *oldChild = oldElement->firstChild(); oldChild; oldChild = oldChild->nextSibling()) {
NodeImpl *newChild = importNode(oldChild, true, exceptioncode);
1.106 +2 -0 WebCore/khtml/xml/dom_elementimpl.cpp
Index: dom_elementimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom_elementimpl.cpp,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -r1.105 -r1.106
--- dom_elementimpl.cpp 23 Dec 2005 18:44:28 -0000 1.105
+++ dom_elementimpl.cpp 3 Jan 2006 08:12:29 -0000 1.106
@@ -283,6 +283,8 @@
if (namedAttrMap)
*clone->attributes() = *namedAttrMap;
+ clone->copyNonAttributeProperties(this);
+
if (deep)
cloneChildNodes(clone);
1.68 +2 -0 WebCore/khtml/xml/dom_elementimpl.h
Index: dom_elementimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom_elementimpl.h,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- dom_elementimpl.h 19 Dec 2005 20:41:46 -0000 1.67
+++ dom_elementimpl.h 3 Jan 2006 08:12:29 -0000 1.68
@@ -237,6 +237,8 @@
// not part of the DOM
void setAttributeMap(NamedAttrMapImpl*);
+ virtual void copyNonAttributeProperties(const ElementImpl *source) {}
+
// State of the element.
virtual QString state() { return QString::null; }
More information about the webkit-changes
mailing list