From a066549418c3886bcff8c566f34428acdacc49ea Mon Sep 17 00:00:00 2001 From: eseidel Date: Sun, 3 Jul 2005 09:45:08 +0000 Subject: [PATCH] Bug #: 3831 Submitted by: eseidel Reviewed by: mjs * kwq/KWQListImpl.h: * kwq/KWQListImpl.mm: (KWQListImpl::findRef): Added to support KDOM::NodeImpl::compareDocumentPosition(NodeImpl *other) git-svn-id: https://svn.webkit.org/repository/webkit/trunk@9577 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- WebCore/ChangeLog-2005-08-23 | 9 +++++++++ WebCore/kwq/KWQListImpl.h | 1 + WebCore/kwq/KWQListImpl.mm | 21 +++++++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23 index e1a3432ea113..47173a1f3ff7 100644 --- a/WebCore/ChangeLog-2005-08-23 +++ b/WebCore/ChangeLog-2005-08-23 @@ -1,3 +1,12 @@ +2005-07-03 Eric Seidel + + Reviewed by mjs. + + * kwq/KWQListImpl.h: + * kwq/KWQListImpl.mm: + (KWQListImpl::findRef): Added to support + KDOM::NodeImpl::compareDocumentPosition(NodeImpl *other) + 2005-07-03 Eric Seidel Reviewed by mjs. diff --git a/WebCore/kwq/KWQListImpl.h b/WebCore/kwq/KWQListImpl.h index 8706973255e2..578e579cde8d 100644 --- a/WebCore/kwq/KWQListImpl.h +++ b/WebCore/kwq/KWQListImpl.h @@ -68,6 +68,7 @@ public: void prepend(const void *item); uint containsRef(const void *item) const; + int findRef(const void *item); KWQListImpl &assign(const KWQListImpl &impl, bool deleteItems); diff --git a/WebCore/kwq/KWQListImpl.mm b/WebCore/kwq/KWQListImpl.mm index 54c621590c5e..3899fa70759a 100644 --- a/WebCore/kwq/KWQListImpl.mm +++ b/WebCore/kwq/KWQListImpl.mm @@ -448,6 +448,27 @@ uint KWQListImpl::containsRef(const void *item) const return count; } +// Only used for KDOM::NodeImpl::compareDocumentPosition(NodeImpl *other) +// remove when no longer needed. +int KWQListImpl::findRef(const void *item) +{ + KWQListNode *node = head; + int index = 0; + + while (node != NULL && item != node->data) { + node = node->next; + index++; + } + + cur = node; + + if (node == NULL) { + return -1; + } + + return index; +} + KWQListImpl &KWQListImpl::assign(const KWQListImpl &impl, bool deleteItems) { clear(deleteItems); -- 2.36.0