[webkit-changes] cvs commit: WebCore/khtml/xml dom_nodeimpl.cpp
dom_nodeimpl.h
David
hyatt at opensource.apple.com
Sun Jul 31 20:25:29 PDT 2005
hyatt 05/07/31 20:25:29
Modified: . ChangeLog
khtml/xml dom_nodeimpl.cpp dom_nodeimpl.h
Log:
No editor working
Revision Changes Path
1.4510 +21 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.4509
retrieving revision 1.4510
diff -u -r1.4509 -r1.4510
--- ChangeLog 1 Aug 2005 03:20:45 -0000 1.4509
+++ ChangeLog 1 Aug 2005 03:25:25 -0000 1.4510
@@ -1,3 +1,24 @@
+2005-07-31 David Hyatt <hyatt at apple.com>
+
+ Make node lists more refined in their invalidation when children are added/removed
+ in the DOM or attributes are changed. This is sort of a band-aid fix. The
+ architecture of node list notifications (as well as how they are stored) should
+ be revisited.
+
+ Reviewed by darin
+
+ * khtml/xml/dom_nodeimpl.cpp:
+ (DOM::NodeImpl::notifyLocalNodeListsAttributeChanged):
+ (DOM::NodeImpl::notifyNodeListsAttributeChanged):
+ (DOM::NodeImpl::notifyLocalNodeListsChildrenChanged):
+ (DOM::NodeImpl::notifyNodeListsChildrenChanged):
+ (DOM::NodeImpl::dispatchSubtreeModifiedEvent):
+ (DOM::NodeListImpl::rootNodeChildrenChanged):
+ * khtml/xml/dom_nodeimpl.h:
+ (DOM::NodeListImpl::rootNodeAttributeChanged):
+ (DOM::NameNodeListImpl::rootNodeChildrenChanged):
+ (DOM::NameNodeListImpl::rootNodeAttributeChanged):
+
2005-07-31 Justin Garcia <justin.garcia at apple.com>
Reviewed by mjs
1.167 +32 -9 WebCore/khtml/xml/dom_nodeimpl.cpp
Index: dom_nodeimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom_nodeimpl.cpp,v
retrieving revision 1.166
retrieving revision 1.167
diff -u -r1.166 -r1.167
--- dom_nodeimpl.cpp 31 Jul 2005 01:08:12 -0000 1.166
+++ dom_nodeimpl.cpp 1 Aug 2005 03:25:29 -0000 1.167
@@ -837,7 +837,7 @@
m_nodeLists->remove(list);
}
-void NodeImpl::notifyLocalNodeListsSubtreeModified()
+void NodeImpl::notifyLocalNodeListsAttributeChanged()
{
if (!m_nodeLists)
return;
@@ -845,23 +845,47 @@
QPtrDictIterator<NodeListImpl> i(*m_nodeLists);
while (NodeListImpl *list = i.current()) {
- list->rootNodeSubtreeModified();
+ list->rootNodeAttributeChanged();
++i;
}
}
-void NodeImpl::notifyNodeListsSubtreeModified()
+void NodeImpl::notifyNodeListsAttributeChanged()
{
for (NodeImpl *n = this; n; n = n->parentNode()) {
- n->notifyLocalNodeListsSubtreeModified();
+ n->notifyLocalNodeListsAttributeChanged();
+ }
+}
+
+void NodeImpl::notifyLocalNodeListsChildrenChanged()
+{
+ if (!m_nodeLists)
+ return;
+
+ QPtrDictIterator<NodeListImpl> i(*m_nodeLists);
+
+ while (NodeListImpl *list = i.current()) {
+ list->rootNodeChildrenChanged();
+ ++i;
+ }
+}
+
+void NodeImpl::notifyNodeListsChildrenChanged()
+{
+ for (NodeImpl *n = this; n; n = n->parentNode()) {
+ n->notifyLocalNodeListsChildrenChanged();
}
}
bool NodeImpl::dispatchSubtreeModifiedEvent(bool sendChildrenChanged)
{
- notifyNodeListsSubtreeModified();
- if (sendChildrenChanged)
+ // FIXME: Pull this whole if clause out of this function.
+ if (sendChildrenChanged) {
+ notifyNodeListsChildrenChanged();
childrenChanged();
+ } else
+ notifyNodeListsAttributeChanged(); // FIXME: Can do better some day. Really only care about the name attribute changing.
+
if (!getDocument()->hasListenerType(DocumentImpl::DOMSUBTREEMODIFIED_LISTENER))
return false;
int exceptioncode = 0;
@@ -2538,13 +2562,12 @@
}
-void NodeListImpl::rootNodeSubtreeModified()
+void NodeListImpl::rootNodeChildrenChanged()
{
- isLengthCacheValid = false;
+ isLengthCacheValid = false;
isItemCacheValid = false;
}
-
ChildNodeListImpl::ChildNodeListImpl( NodeImpl *n )
: NodeListImpl(n)
{
1.94 +9 -4 WebCore/khtml/xml/dom_nodeimpl.h
Index: dom_nodeimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom_nodeimpl.h,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -r1.93 -r1.94
--- dom_nodeimpl.h 31 Jul 2005 01:08:13 -0000 1.93
+++ dom_nodeimpl.h 1 Aug 2005 03:25:29 -0000 1.94
@@ -454,9 +454,11 @@
void registerNodeList(NodeListImpl *list);
void unregisterNodeList(NodeListImpl *list);
- void notifyNodeListsSubtreeModified();
- void notifyLocalNodeListsSubtreeModified();
-
+ void notifyNodeListsChildrenChanged();
+ void notifyLocalNodeListsChildrenChanged();
+ void notifyNodeListsAttributeChanged();
+ void notifyLocalNodeListsAttributeChanged();
+
SharedPtr<NodeListImpl> getElementsByTagName(const DOMString &name) { return getElementsByTagNameNS("*", name); }
SharedPtr<NodeListImpl> getElementsByTagNameNS(const DOMString &namespaceURI, const DOMString &localName);
@@ -567,7 +569,8 @@
// Other methods (not part of DOM)
- void rootNodeSubtreeModified();
+ virtual void rootNodeChildrenChanged();
+ virtual void rootNodeAttributeChanged() {}
protected:
// helper functions for searching all ElementImpls in a tree
@@ -611,6 +614,8 @@
virtual NodeImpl *item ( unsigned long index ) const;
// Other methods (not part of DOM)
+ virtual void rootNodeChildrenChanged() {};
+ virtual void rootNodeAttributeChanged() { NodeListImpl::rootNodeChildrenChanged(); }
protected:
virtual bool nodeMatches( NodeImpl *testNode ) const;
More information about the webkit-changes
mailing list