Bug 1341648 - stylo: Include content rules from HTMLTableCellElement::WalkContentStyleRules ; r=bz
This also removes the TABLE_ATTRS_DIRTY optimization. Constructing nsMappedAttributes isn't really expensive and we do it all the time anyway. MozReview-Commit-ID: 2krt1nFUzgl
This commit is contained in:
@@ -322,7 +322,7 @@ TableRowsCollection::ParentDestroyed()
|
||||
|
||||
HTMLTableElement::HTMLTableElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
||||
: nsGenericHTMLElement(aNodeInfo),
|
||||
mTableInheritedAttributes(TABLE_ATTRS_DIRTY)
|
||||
mTableInheritedAttributes(nullptr)
|
||||
{
|
||||
SetHasWeirdParserInsertionMode();
|
||||
}
|
||||
@@ -863,20 +863,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;
|
||||
@@ -911,10 +906,7 @@ HTMLTableElement::BuildInheritedAttributes()
|
||||
void
|
||||
HTMLTableElement::ReleaseInheritedAttributes()
|
||||
{
|
||||
if (mTableInheritedAttributes &&
|
||||
mTableInheritedAttributes != TABLE_ATTRS_DIRTY)
|
||||
NS_RELEASE(mTableInheritedAttributes);
|
||||
mTableInheritedAttributes = TABLE_ATTRS_DIRTY;
|
||||
NS_IF_RELEASE(mTableInheritedAttributes);
|
||||
}
|
||||
|
||||
nsresult
|
||||
@@ -923,9 +915,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
|
||||
|
||||
Reference in New Issue
Block a user