1
0
mirror of https://github.com/roytam1/UXP.git synced 2026-05-26 13:58:49 +00:00

Issue #1375 - Include content rules from HTMLTableCellElement::WalkContentStyleRules and move to the mapped attr functionality

* Bugs 1341647 and 1341648
This commit is contained in:
Matt A. Tobin
2020-04-17 05:07:41 -04:00
committed by Roy Tam
parent 922cbf0217
commit 6b48075b57
16 changed files with 158 additions and 259 deletions
+11 -16
View File
@@ -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