diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-04-17 05:07:41 -0400 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2020-04-17 05:07:41 -0400 |
commit | 5f297c5f57583b0f9d27d714beb285919f42d655 (patch) | |
tree | f67fd1bafe4c449fc6527e172deb59411bfbf85f /dom/base/nsMappedAttributes.cpp | |
parent | f07f8aecb8a03d33d0b90d685d85960a29543c75 (diff) | |
download | UXP-5f297c5f57583b0f9d27d714beb285919f42d655.tar UXP-5f297c5f57583b0f9d27d714beb285919f42d655.tar.gz UXP-5f297c5f57583b0f9d27d714beb285919f42d655.tar.lz UXP-5f297c5f57583b0f9d27d714beb285919f42d655.tar.xz UXP-5f297c5f57583b0f9d27d714beb285919f42d655.zip |
Issue #1375 - Include content rules from HTMLTableCellElement::WalkContentStyleRules and move to the mapped attr functionality
* Bugs 1341647 and 1341648
Diffstat (limited to 'dom/base/nsMappedAttributes.cpp')
-rw-r--r-- | dom/base/nsMappedAttributes.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/dom/base/nsMappedAttributes.cpp b/dom/base/nsMappedAttributes.cpp index a3accd2a7..9e80c94df 100644 --- a/dom/base/nsMappedAttributes.cpp +++ b/dom/base/nsMappedAttributes.cpp @@ -62,11 +62,17 @@ nsMappedAttributes::Clone(bool aWillAddAttr) void* nsMappedAttributes::operator new(size_t aSize, uint32_t aAttrCount) CPP_THROW_NEW { - NS_ASSERTION(aAttrCount > 0, "zero-attribute nsMappedAttributes requested"); + size_t size = aSize + aAttrCount * sizeof(InternalAttr); // aSize will include the mAttrs buffer so subtract that. - void* newAttrs = ::operator new(aSize - sizeof(void*[1]) + - aAttrCount * sizeof(InternalAttr)); + // We don't want to under-allocate, however, so do not subtract + // if we have zero attributes. The zero attribute case only happens + // for <body>'s mapped attributes + if (aAttrCount != 0) { + size -= sizeof(void*[1]); + } + + void* newAttrs = ::operator new(size); #ifdef DEBUG static_cast<nsMappedAttributes*>(newAttrs)->mBufferSize = aAttrCount; |