Backed out 6 changesets (bug 1342303) for build bustage a=backout

Backed out changeset 89137679a68c (bug 1342303)
Backed out changeset 20a1bcb47c33 (bug 1342303)
Backed out changeset bc3b2e7a383b (bug 1342303)
Backed out changeset bdc491b9ebde (bug 1342303)
Backed out changeset 5c6042dee665 (bug 1342303)
Backed out changeset b5de1dfff82f (bug 1342303)

MozReview-Commit-ID: BjlVAX480jI
This commit is contained in:
Wes Kocher
2017-03-02 16:35:43 -08:00
parent d994bac8f8
commit 29eb490f36
11 changed files with 244 additions and 252 deletions

View File

@@ -431,22 +431,25 @@ GroupRule::GroupRule(uint32_t aLineNumber, uint32_t aColumnNumber)
{
}
static bool
SetParentRuleReference(Rule* aRule, void* aParentRule)
{
GroupRule* parentRule = static_cast<GroupRule*>(aParentRule);
aRule->SetParentRule(parentRule);
return true;
}
GroupRule::GroupRule(const GroupRule& aCopy)
: Rule(aCopy)
{
for (const Rule* rule : aCopy.mRules) {
RefPtr<Rule> clone = rule->Clone();
mRules.AppendObject(clone);
clone->SetParentRule(this);
}
const_cast<GroupRule&>(aCopy).mRules.EnumerateForwards(GroupRule::CloneRuleInto, &mRules);
mRules.EnumerateForwards(SetParentRuleReference, this);
}
GroupRule::~GroupRule()
{
MOZ_ASSERT(!mSheet, "SetStyleSheet should have been called");
for (Rule* rule : mRules) {
rule->SetParentRule(nullptr);
}
mRules.EnumerateForwards(SetParentRuleReference, nullptr);
if (mRuleCollection) {
mRuleCollection->DropReference();
}
@@ -465,12 +468,17 @@ GroupRule::IsCCLeaf() const
return false;
}
static bool
SetStyleSheetReference(Rule* aRule, void* aSheet)
{
aRule->SetStyleSheet(reinterpret_cast<StyleSheet*>(aSheet));
return true;
}
NS_IMPL_CYCLE_COLLECTION_CLASS(GroupRule)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(GroupRule, Rule)
for (Rule* rule : tmp->mRules) {
rule->SetParentRule(nullptr);
}
tmp->mRules.EnumerateForwards(SetParentRuleReference, nullptr);
// If tmp does not have a stylesheet, neither do its descendants. In that
// case, don't try to null out their stylesheet, to avoid O(N^2) behavior in
// depth of group rule nesting. But if tmp _does_ have a stylesheet (which
@@ -478,9 +486,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(GroupRule, Rule)
// need to null out the stylesheet pointer on descendants now, before we clear
// tmp->mRules.
if (tmp->GetStyleSheet()) {
for (Rule* rule : tmp->mRules) {
rule->SetStyleSheet(nullptr);
}
tmp->mRules.EnumerateForwards(SetStyleSheetReference, nullptr);
}
tmp->mRules.Clear();
if (tmp->mRuleCollection) {
@@ -508,9 +514,7 @@ GroupRule::SetStyleSheet(StyleSheet* aSheet)
// depth when seting the sheet to null during unlink, if we happen to unlin in
// order from most nested rule up to least nested rule.
if (aSheet != GetStyleSheet()) {
for (Rule* rule : mRules) {
rule->SetStyleSheet(aSheet);
}
mRules.EnumerateForwards(SetStyleSheetReference, aSheet);
Rule::SetStyleSheet(aSheet);
}
}
@@ -546,12 +550,8 @@ GroupRule::GetStyleRuleAt(int32_t aIndex) const
bool
GroupRule::EnumerateRulesForwards(RuleEnumFunc aFunc, void * aData) const
{
for (const Rule* rule : mRules) {
if (!aFunc(const_cast<Rule*>(rule), aData)) {
return false;
}
}
return true;
return
const_cast<GroupRule*>(this)->mRules.EnumerateForwards(aFunc, aData);
}
/*