Bug 1289622 - Delegate CalcStyleDifference to a templated helper. r=heycam

This commit is contained in:
Bobby Holley 2016-07-26 11:54:05 -07:00
parent 55b3f93f9f
commit 9f75d89883
2 changed files with 23 additions and 4 deletions

View File

@ -891,11 +891,12 @@ nsStyleContext::ApplyStyleFixups(bool aSkipParentDisplayBasedStyleFixup)
#undef GET_UNIQUE_STYLE_DATA #undef GET_UNIQUE_STYLE_DATA
} }
template<class StyleContextLike>
nsChangeHint nsChangeHint
nsStyleContext::CalcStyleDifference(nsStyleContext* aNewContext, nsStyleContext::CalcStyleDifferenceInternal(StyleContextLike* aNewContext,
nsChangeHint aParentHintsNotHandledForDescendants, nsChangeHint aParentHintsNotHandledForDescendants,
uint32_t* aEqualStructs, uint32_t* aEqualStructs,
uint32_t* aSamePointerStructs) uint32_t* aSamePointerStructs)
{ {
PROFILER_LABEL("nsStyleContext", "CalcStyleDifference", PROFILER_LABEL("nsStyleContext", "CalcStyleDifference",
js::ProfileEntry::Category::CSS); js::ProfileEntry::Category::CSS);
@ -1213,6 +1214,16 @@ nsStyleContext::CalcStyleDifference(nsStyleContext* aNewContext,
return hint & ~nsChangeHint_NeutralChange; return hint & ~nsChangeHint_NeutralChange;
} }
nsChangeHint
nsStyleContext::CalcStyleDifference(nsStyleContext* aNewContext,
nsChangeHint aParentHintsNotHandledForDescendants,
uint32_t* aEqualStructs,
uint32_t* aSamePointerStructs)
{
return CalcStyleDifferenceInternal(aNewContext, aParentHintsNotHandledForDescendants,
aEqualStructs, aSamePointerStructs);
}
#ifdef DEBUG #ifdef DEBUG
void nsStyleContext::List(FILE* out, int32_t aIndent, bool aListDescendants) void nsStyleContext::List(FILE* out, int32_t aIndent, bool aListDescendants)
{ {

View File

@ -398,6 +398,14 @@ public:
uint32_t* aEqualStructs, uint32_t* aEqualStructs,
uint32_t* aSamePointerStructs); uint32_t* aSamePointerStructs);
private:
template<class StyleContextLike>
nsChangeHint CalcStyleDifferenceInternal(StyleContextLike* aNewContext,
nsChangeHint aParentHintsNotHandledForDescendants,
uint32_t* aEqualStructs,
uint32_t* aSamePointerStructs);
public:
/** /**
* Get a color that depends on link-visitedness using this and * Get a color that depends on link-visitedness using this and
* this->GetStyleIfVisited(). * this->GetStyleIfVisited().