summaryrefslogtreecommitdiffstats
path: root/WebCore/rendering/style/ContentData.cpp
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2010-09-08 12:18:00 +0100
committerKristian Monsen <kristianm@google.com>2010-09-11 12:08:58 +0100
commit5ddde30071f639962dd557c453f2ad01f8f0fd00 (patch)
tree775803c4ab35af50aa5f5472cd1fb95fe9d5152d /WebCore/rendering/style/ContentData.cpp
parent3e63d9b33b753ca86d0765d1b3d711114ba9e34f (diff)
downloadexternal_webkit-5ddde30071f639962dd557c453f2ad01f8f0fd00.zip
external_webkit-5ddde30071f639962dd557c453f2ad01f8f0fd00.tar.gz
external_webkit-5ddde30071f639962dd557c453f2ad01f8f0fd00.tar.bz2
Merge WebKit at r66666 : Initial merge by git.
Change-Id: I57dedeb49859adc9c539e760f0e749768c66626f
Diffstat (limited to 'WebCore/rendering/style/ContentData.cpp')
-rw-r--r--WebCore/rendering/style/ContentData.cpp65
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;