summaryrefslogtreecommitdiffstats
path: root/dom/html/HTMLTableElement.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dom/html/HTMLTableElement.cpp')
-rw-r--r--dom/html/HTMLTableElement.cpp27
1 files changed, 11 insertions, 16 deletions
diff --git a/dom/html/HTMLTableElement.cpp b/dom/html/HTMLTableElement.cpp
index 5784fa691..df84a0f77 100644
--- a/dom/html/HTMLTableElement.cpp
+++ b/dom/html/HTMLTableElement.cpp
@@ -322,7 +322,7 @@ TableRowsCollection::ParentDestroyed()
HTMLTableElement::HTMLTableElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
: nsGenericHTMLElement(aNodeInfo),
- mTableInheritedAttributes(TABLE_ATTRS_DIRTY)
+ mTableInheritedAttributes(nullptr)
{
SetHasWeirdParserInsertionMode();
}
@@ -912,20 +912,15 @@ MapInheritedTableAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsMappedAttributes*
HTMLTableElement::GetAttributesMappedForCell()
{
- if (mTableInheritedAttributes) {
- if (mTableInheritedAttributes == TABLE_ATTRS_DIRTY)
- BuildInheritedAttributes();
- if (mTableInheritedAttributes != TABLE_ATTRS_DIRTY)
- return mTableInheritedAttributes;
- }
- return nullptr;
+ return mTableInheritedAttributes;
}
void
HTMLTableElement::BuildInheritedAttributes()
{
- NS_ASSERTION(mTableInheritedAttributes == TABLE_ATTRS_DIRTY,
+ NS_ASSERTION(!mTableInheritedAttributes,
"potential leak, plus waste of work");
+ MOZ_ASSERT(NS_IsMainThread());
nsIDocument *document = GetComposedDoc();
nsHTMLStyleSheet* sheet = document ?
document->GetAttributeStyleSheet() : nullptr;
@@ -960,10 +955,7 @@ HTMLTableElement::BuildInheritedAttributes()
void
HTMLTableElement::ReleaseInheritedAttributes()
{
- if (mTableInheritedAttributes &&
- mTableInheritedAttributes != TABLE_ATTRS_DIRTY)
- NS_RELEASE(mTableInheritedAttributes);
- mTableInheritedAttributes = TABLE_ATTRS_DIRTY;
+ NS_IF_RELEASE(mTableInheritedAttributes);
}
nsresult
@@ -972,9 +964,12 @@ HTMLTableElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
bool aCompileEventHandlers)
{
ReleaseInheritedAttributes();
- return nsGenericHTMLElement::BindToTree(aDocument, aParent,
- aBindingParent,
- aCompileEventHandlers);
+ nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
+ aBindingParent,
+ aCompileEventHandlers);
+ NS_ENSURE_SUCCESS(rv, rv);
+ BuildInheritedAttributes();
+ return NS_OK;
}
void