diff options
Diffstat (limited to 'WebCore/rendering/style/ContentData.cpp')
-rw-r--r-- | WebCore/rendering/style/ContentData.cpp | 65 |
1 files changed, 24 insertions, 41 deletions
diff --git a/WebCore/rendering/style/ContentData.cpp b/WebCore/rendering/style/ContentData.cpp index b0f9e81..d150f77 100644 --- a/WebCore/rendering/style/ContentData.cpp +++ b/WebCore/rendering/style/ContentData.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -22,7 +22,6 @@ #include "config.h" #include "ContentData.h" -#include "CounterContent.h" #include "StyleImage.h" #include <wtf/text/StringImpl.h> @@ -32,42 +31,26 @@ void ContentData::clear() { deleteContent(); - ContentData* n = m_next; - m_next = 0; - - // Reverse the list so we can delete without recursing. - ContentData* last = 0; - ContentData* c; - while ((c = n)) { - n = c->m_next; - c->m_next = last; - last = c; - } - for (c = last; c; c = n) { - n = c->m_next; - c->m_next = 0; - delete c; - } + // Delete the singly-linked list without recursing. + for (OwnPtr<ContentData> next = m_next.release(); next; next = next->m_next.release()) { } } +// FIXME: Why isn't this just operator==? +// FIXME: This is not a good name for a boolean-returning function. bool ContentData::dataEquivalent(const ContentData& other) const { if (type() != other.type()) return false; switch (type()) { - case CONTENT_NONE: - return true; - break; - case CONTENT_TEXT: - return equal(text(), other.text()); - break; - case CONTENT_OBJECT: - return StyleImage::imagesEquivalent(image(), other.image()); - break; - case CONTENT_COUNTER: - return *counter() == *other.counter(); - break; + case CONTENT_NONE: + return true; + case CONTENT_TEXT: + return equal(text(), other.text()); + case CONTENT_OBJECT: + return StyleImage::imagesEquivalent(image(), other.image()); + case CONTENT_COUNTER: + return *counter() == *other.counter(); } ASSERT_NOT_REACHED(); @@ -77,17 +60,17 @@ bool ContentData::dataEquivalent(const ContentData& other) const void ContentData::deleteContent() { switch (m_type) { - case CONTENT_NONE: - break; - case CONTENT_OBJECT: - m_content.m_image->deref(); - break; - case CONTENT_TEXT: - m_content.m_text->deref(); - break; - case CONTENT_COUNTER: - delete m_content.m_counter; - break; + case CONTENT_NONE: + break; + case CONTENT_OBJECT: + m_content.m_image->deref(); + break; + case CONTENT_TEXT: + m_content.m_text->deref(); + break; + case CONTENT_COUNTER: + delete m_content.m_counter; + break; } m_type = CONTENT_NONE; |