rendered paste bodydiff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp
index 49c13bb..71f5d1d 100644
--- a/WebCore/dom/Document.cpp
+++ b/WebCore/dom/Document.cpp
@@ -491,7 +491,7 @@ inline void Document::DocumentOrderedMap::clear()
+ //ASSERT(!m_deletionHasBegun);
if (m_selfOnlyRefCount) {
// If removing a child removes the last self-only ref, we don't
// want the document to be destructed until after
@@ -529,7 +529,7 @@ void Document::removedLastRef()
selfOnlyDeref();
} else {
#ifndef NDEBUG
- m_deletionHasBegun = true;
+ //m_deletionHasBegun = true;
#endif
delete this;
}
@@ -4652,6 +4652,11 @@ static PassRefPtr<RenderStyle> cloneRenderStyleWithState(const RenderStyle* curr
return newStyle.release();
}
+static inline bool isDeletedValue(RenderStyle* style)
+{
+ return style == TextAutoSizingKey::deletedKeyStyle();
+}
+
TextAutoSizingKey::TextAutoSizingKey()
: m_style(0)
, m_document(0)
@@ -4662,13 +4667,15 @@ TextAutoSizingKey::TextAutoSizingKey(RenderStyle* style, Document* document)
: m_style(style)
, m_document(document)
{
+ //ASSERT(style); // Can be deleted value.
ref();
}
TextAutoSizingKey::TextAutoSizingKey(const TextAutoSizingKey& other)
- : m_style(other.m_style)
- , m_document(other.m_document)
+ : m_style(other.style())
+ , m_document(other.document())
{
+ //ASSERT(other.style()); // Can be deleted value.
ref();
}
@@ -4689,13 +4696,15 @@ TextAutoSizingKey& TextAutoSizingKey::operator=(const TextAutoSizingKey& other)
void TextAutoSizingKey::ref() const
{
- if (style())
- style()->ref();
+ if (isDeletedValue(style()) || !style())
+ return;
+
+ style()->ref();
}
void TextAutoSizingKey::deref() const
{
- if (!style())
+ if (isDeletedValue(style()) || !style())
return;
ASSERT(document() && document()->renderArena());
@@ -4885,7 +4894,7 @@ void Document::validateAutoSizingNodes()
TextAutoSizingKey key = it->first;
RefPtr<TextAutoSizingValue> value = it->second;
// Update all the nodes in the collection to reflect the new candidate size.
- if (!value)
+ if (!value) // Deleted value.
continue;
value->removeStaleNodes();
diff --git a/WebCore/dom/Document.h b/WebCore/dom/Document.h
index c888ff0..61321a0 100644
--- a/WebCore/dom/Document.h
+++ b/WebCore/dom/Document.h
@@ -199,15 +199,13 @@ public:
TextAutoSizingKey(const TextAutoSizingKey&);
TextAutoSizingKey& operator=(const TextAutoSizingKey&);
- Document* document() const { return m_document != deletedKeyDocument() ? m_document : 0; }
- RenderStyle* style() const { return m_style != deletedKeyStyle() ? m_style : 0; }
+ Document* document() const { return m_document; }
+ RenderStyle* style() const { return m_style; }
static Document* deletedKeyDocument() { return (Document*) -1; }
static RenderStyle* deletedKeyStyle() { return (RenderStyle*) -1; }
private:
- friend bool operator==(const TextAutoSizingKey& a, const TextAutoSizingKey& b);
-
void ref() const;
void deref() const;
@@ -217,9 +215,9 @@ private:
inline bool operator==(const TextAutoSizingKey& a, const TextAutoSizingKey& b)
{
- if (a.style() && b.style())
+ if (a.style() && a.style() != a.deletedKeyStyle() && b.style() && b.style() != b.deletedKeyStyle())
return a.style()->equalForTextAutosizing(b.style());
- return a.m_style == b.m_style;
+ return a.style() == b.style();
}
struct TextAutoSizingHash {
@@ -279,16 +277,16 @@ public:
void selfOnlyRef()
{
- ASSERT(!m_deletionHasBegun);
+ // ASSERT(!m_deletionHasBegun);
++m_selfOnlyRefCount;
}
void selfOnlyDeref()
{
- ASSERT(!m_deletionHasBegun);
+ //ASSERT(!m_deletionHasBegun);
--m_selfOnlyRefCount;
if (!m_selfOnlyRefCount && !refCount()) {
#ifndef NDEBUG
- m_deletionHasBegun = true;
+ //m_deletionHasBegun = true;
#endif
delete this;
}