diff --git a/content/base/src/nsMappedAttributes.h b/content/base/src/nsMappedAttributes.h index 7367779cd18..d402531d52e 100644 --- a/content/base/src/nsMappedAttributes.h +++ b/content/base/src/nsMappedAttributes.h @@ -108,6 +108,12 @@ public: virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const; #endif + PRInt64 SizeOf() const { + NS_ASSERTION(mAttrCount == mBufferSize, + "mBufferSize and mAttrCount are expected to be the same."); + return sizeof(*this) - sizeof(void*) + mAttrCount * sizeof(InternalAttr); + } + private: nsMappedAttributes(const nsMappedAttributes& aCopy); ~nsMappedAttributes(); diff --git a/layout/style/nsHTMLStyleSheet.cpp b/layout/style/nsHTMLStyleSheet.cpp index e5c95faa211..6785a12a22b 100644 --- a/layout/style/nsHTMLStyleSheet.cpp +++ b/layout/style/nsHTMLStyleSheet.cpp @@ -540,7 +540,7 @@ GetHashEntryAttributesSize(PLDHashTable* aTable, PLDHashEntryHdr* aEntry, PRInt64 size = *static_cast(aArg); NS_ASSERTION(entry->mAttributes, "entry->mAttributes should not be null!"); - size += sizeof(*entry->mAttributes); + size += entry->mAttributes->SizeOf(); return PL_DHASH_NEXT; }