Bug 1277163 - Rename nsStyleContext* argument to Calc(Style)Difference methods to indicate it's the new style. r=dbaron

MozReview-Commit-ID: 9AvGc1tjJpx
This commit is contained in:
Cameron McCormack 2016-06-21 11:47:54 +10:00
parent b81a902c6b
commit 2a58c3e595
4 changed files with 380 additions and 379 deletions

View File

@ -896,7 +896,7 @@ nsStyleContext::ApplyStyleFixups(bool aSkipParentDisplayBasedStyleFixup)
}
nsChangeHint
nsStyleContext::CalcStyleDifference(nsStyleContext* aOther,
nsStyleContext::CalcStyleDifference(nsStyleContext* aNewContext,
nsChangeHint aParentHintsNotHandledForDescendants,
uint32_t* aEqualStructs,
uint32_t* aSamePointerStructs)
@ -914,7 +914,7 @@ nsStyleContext::CalcStyleDifference(nsStyleContext* aOther,
*aEqualStructs = 0;
nsChangeHint hint = NS_STYLE_HINT_NONE;
NS_ENSURE_TRUE(aOther, hint);
NS_ENSURE_TRUE(aNewContext, hint);
// We must always ensure that we populate the structs on the new style
// context that are filled in on the old context, so that if we get
// two style changes in succession, the second of which causes a real
@ -937,7 +937,7 @@ nsStyleContext::CalcStyleDifference(nsStyleContext* aOther,
// (Things like 'em' units are handled by the change hint produced
// by font-size changing, so we don't need to worry about them like
// we worry about 'inherit' values.)
bool compare = mSource != aOther->mSource;
bool compare = mSource != aNewContext->mSource;
DebugOnly<uint32_t> structsFound = 0;
@ -947,7 +947,7 @@ nsStyleContext::CalcStyleDifference(nsStyleContext* aOther,
const nsStyleVariables* thisVariables = PeekStyleVariables();
if (thisVariables) {
structsFound |= NS_STYLE_INHERIT_BIT(Variables);
const nsStyleVariables* otherVariables = aOther->StyleVariables();
const nsStyleVariables* otherVariables = aNewContext->StyleVariables();
if (thisVariables->mVariables == otherVariables->mVariables) {
*aEqualStructs |= NS_STYLE_INHERIT_BIT(Variables);
} else {
@ -964,7 +964,7 @@ nsStyleContext::CalcStyleDifference(nsStyleContext* aOther,
const nsStyle##struct_* this##struct_ = PeekStyle##struct_(); \
if (this##struct_) { \
structsFound |= NS_STYLE_INHERIT_BIT(struct_); \
const nsStyle##struct_* other##struct_ = aOther->Style##struct_(); \
const nsStyle##struct_* other##struct_ = aNewContext->Style##struct_(); \
nsChangeHint maxDifference = nsStyle##struct_::MaxDifference(); \
nsChangeHint differenceAlwaysHandledForDescendants = \
nsStyle##struct_::DifferenceAlwaysHandledForDescendants(); \
@ -1065,7 +1065,7 @@ nsStyleContext::CalcStyleDifference(nsStyleContext* aOther,
#define STYLE_STRUCT(name_, callback_) \
{ \
const nsStyle##name_* data = PeekStyle##name_(); \
if (!data || data == aOther->Style##name_()) { \
if (!data || data == aNewContext->Style##name_()) { \
*aSamePointerStructs |= NS_STYLE_INHERIT_BIT(name_); \
} \
}
@ -1073,7 +1073,7 @@ nsStyleContext::CalcStyleDifference(nsStyleContext* aOther,
#undef STYLE_STRUCT
// Note that we do not check whether this->RelevantLinkVisited() !=
// aOther->RelevantLinkVisited(); we don't need to since
// aNewContext->RelevantLinkVisited(); we don't need to since
// nsCSSFrameConstructor::DoContentStateChanged always adds
// nsChangeHint_RepaintFrame for NS_EVENT_STATE_VISITED changes (and
// needs to, since HasStateDependentStyle probably doesn't work right
@ -1089,7 +1089,7 @@ nsStyleContext::CalcStyleDifference(nsStyleContext* aOther,
// things that can depend on :visited) for the properties on which we
// call GetVisitedDependentColor.
nsStyleContext *thisVis = GetStyleIfVisited(),
*otherVis = aOther->GetStyleIfVisited();
*otherVis = aNewContext->GetStyleIfVisited();
if (!thisVis != !otherVis) {
// One style context has a style-if-visited and the other doesn't.
// Presume a difference.

View File

@ -376,7 +376,7 @@ public:
/**
* Compute the style changes needed during restyling when this style
* context is being replaced by aOther. (This is nonsymmetric since
* context is being replaced by aNewContext. (This is nonsymmetric since
* we optimize by skipping comparison for styles that have never been
* requested.)
*
@ -393,7 +393,7 @@ public:
* aEqualStructs must not be null. Into it will be stored a bitfield
* representing which structs were compared to be non-equal.
*/
nsChangeHint CalcStyleDifference(nsStyleContext* aOther,
nsChangeHint CalcStyleDifference(nsStyleContext* aNewContext,
nsChangeHint aParentHintsNotHandledForDescendants,
uint32_t* aEqualStructs,
uint32_t* aSamePointerStructs);

File diff suppressed because it is too large Load Diff

View File

@ -119,7 +119,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleFont
MOZ_COUNT_DTOR(nsStyleFont);
}
nsChangeHint CalcDifference(const nsStyleFont& aOther) const;
nsChangeHint CalcDifference(const nsStyleFont& aNewData) const;
static nsChangeHint MaxDifference() {
return NS_STYLE_HINT_REFLOW |
nsChangeHint_NeutralChange;
@ -387,7 +387,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleColor
MOZ_COUNT_DTOR(nsStyleColor);
}
nsChangeHint CalcDifference(const nsStyleColor& aOther) const;
nsChangeHint CalcDifference(const nsStyleColor& aNewData) const;
static nsChangeHint MaxDifference() {
return nsChangeHint_RepaintFrame;
}
@ -692,7 +692,7 @@ struct nsStyleImageLayers {
// Compute the change hint required by changes in just this layer.
// aPositionChangeHint indicates the hint for position change.
nsChangeHint CalcDifference(const Layer& aOther,
nsChangeHint CalcDifference(const Layer& aNewLayer,
nsChangeHint aPositionChangeHint) const;
// An equality operator that compares the images using URL-equality
@ -741,7 +741,7 @@ struct nsStyleImageLayers {
mLayers[i].UntrackImages(aContext);
}
nsChangeHint CalcDifference(const nsStyleImageLayers& aOther,
nsChangeHint CalcDifference(const nsStyleImageLayers& aNewLayers,
nsChangeHint aPositionChangeHint) const;
bool HasLayerWithImage() const;
@ -769,7 +769,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleBackground {
}
void Destroy(nsPresContext* aContext);
nsChangeHint CalcDifference(const nsStyleBackground& aOther) const;
nsChangeHint CalcDifference(const nsStyleBackground& aNewData) const;
static nsChangeHint MaxDifference() {
return nsChangeHint_UpdateEffects |
nsChangeHint_RepaintFrame |
@ -825,7 +825,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleMargin
}
void Destroy(nsPresContext* aContext);
nsChangeHint CalcDifference(const nsStyleMargin& aOther) const;
nsChangeHint CalcDifference(const nsStyleMargin& aNewData) const;
static nsChangeHint MaxDifference() {
return nsChangeHint_NeedReflow |
nsChangeHint_ReflowChangesSizeOrPosition |
@ -872,7 +872,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStylePadding
}
void Destroy(nsPresContext* aContext);
nsChangeHint CalcDifference(const nsStylePadding& aOther) const;
nsChangeHint CalcDifference(const nsStylePadding& aNewData) const;
static nsChangeHint MaxDifference() {
return NS_STYLE_HINT_REFLOW & ~nsChangeHint_ClearDescendantIntrinsics;
}
@ -1074,7 +1074,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleBorder
}
void Destroy(nsPresContext* aContext);
nsChangeHint CalcDifference(const nsStyleBorder& aOther) const;
nsChangeHint CalcDifference(const nsStyleBorder& aNewData) const;
static nsChangeHint MaxDifference() {
return NS_STYLE_HINT_REFLOW |
nsChangeHint_UpdateOverflow |
@ -1308,7 +1308,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleOutline
}
void RecalcData();
nsChangeHint CalcDifference(const nsStyleOutline& aOther) const;
nsChangeHint CalcDifference(const nsStyleOutline& aNewData) const;
static nsChangeHint MaxDifference() {
return nsChangeHint_UpdateOverflow |
nsChangeHint_SchedulePaint |
@ -1420,7 +1420,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleList
FreeByObjectID(mozilla::eArenaObjectID_nsStyleList, this);
}
nsChangeHint CalcDifference(const nsStyleList& aOther) const;
nsChangeHint CalcDifference(const nsStyleList& aNewData) const;
static nsChangeHint MaxDifference() {
return NS_STYLE_HINT_FRAMECHANGE |
nsChangeHint_NeutralChange;
@ -1645,7 +1645,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStylePosition
FreeByObjectID(mozilla::eArenaObjectID_nsStylePosition, this);
}
nsChangeHint CalcDifference(const nsStylePosition& aOther,
nsChangeHint CalcDifference(const nsStylePosition& aNewData,
const nsStyleVisibility* aOldStyleVisibility) const;
static nsChangeHint MaxDifference() {
return NS_STYLE_HINT_REFLOW |
@ -1940,7 +1940,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleTextReset
mTextDecorationStyle |= BORDER_COLOR_FOREGROUND;
}
nsChangeHint CalcDifference(const nsStyleTextReset& aOther) const;
nsChangeHint CalcDifference(const nsStyleTextReset& aNewData) const;
static nsChangeHint MaxDifference() {
return nsChangeHint(
NS_STYLE_HINT_REFLOW |
@ -1981,7 +1981,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleText
FreeByObjectID(mozilla::eArenaObjectID_nsStyleText, this);
}
nsChangeHint CalcDifference(const nsStyleText& aOther) const;
nsChangeHint CalcDifference(const nsStyleText& aNewData) const;
static nsChangeHint MaxDifference() {
return NS_STYLE_HINT_FRAMECHANGE |
nsChangeHint_UpdateSubtreeOverflow |
@ -2200,7 +2200,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleVisibility
FreeByObjectID(mozilla::eArenaObjectID_nsStyleVisibility, this);
}
nsChangeHint CalcDifference(const nsStyleVisibility& aOther) const;
nsChangeHint CalcDifference(const nsStyleVisibility& aNewData) const;
static nsChangeHint MaxDifference() {
return NS_STYLE_HINT_FRAMECHANGE |
nsChangeHint_NeutralChange;
@ -2481,7 +2481,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay
FreeByObjectID(mozilla::eArenaObjectID_nsStyleDisplay, this);
}
nsChangeHint CalcDifference(const nsStyleDisplay& aOther) const;
nsChangeHint CalcDifference(const nsStyleDisplay& aNewData) const;
static nsChangeHint MaxDifference() {
// All the parts of FRAMECHANGE are present in CalcDifference.
return nsChangeHint(NS_STYLE_HINT_FRAMECHANGE |
@ -2753,7 +2753,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleTable
FreeByObjectID(mozilla::eArenaObjectID_nsStyleTable, this);
}
nsChangeHint CalcDifference(const nsStyleTable& aOther) const;
nsChangeHint CalcDifference(const nsStyleTable& aNewData) const;
static nsChangeHint MaxDifference() {
return NS_STYLE_HINT_FRAMECHANGE;
}
@ -2786,7 +2786,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleTableBorder
FreeByObjectID(mozilla::eArenaObjectID_nsStyleTableBorder, this);
}
nsChangeHint CalcDifference(const nsStyleTableBorder& aOther) const;
nsChangeHint CalcDifference(const nsStyleTableBorder& aNewData) const;
static nsChangeHint MaxDifference() {
return NS_STYLE_HINT_FRAMECHANGE;
}
@ -2882,7 +2882,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleContent
}
void Destroy(nsPresContext* aContext);
nsChangeHint CalcDifference(const nsStyleContent& aOther) const;
nsChangeHint CalcDifference(const nsStyleContent& aNewData) const;
static nsChangeHint MaxDifference() {
return NS_STYLE_HINT_FRAMECHANGE;
}
@ -2997,7 +2997,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUIReset
FreeByObjectID(mozilla::eArenaObjectID_nsStyleUIReset, this);
}
nsChangeHint CalcDifference(const nsStyleUIReset& aOther) const;
nsChangeHint CalcDifference(const nsStyleUIReset& aNewData) const;
static nsChangeHint MaxDifference() {
return NS_STYLE_HINT_FRAMECHANGE;
}
@ -3063,7 +3063,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUserInterface
FreeByObjectID(mozilla::eArenaObjectID_nsStyleUserInterface, this);
}
nsChangeHint CalcDifference(const nsStyleUserInterface& aOther) const;
nsChangeHint CalcDifference(const nsStyleUserInterface& aNewData) const;
static nsChangeHint MaxDifference() {
return NS_STYLE_HINT_FRAMECHANGE |
nsChangeHint_UpdateCursor |
@ -3114,7 +3114,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleXUL
FreeByObjectID(mozilla::eArenaObjectID_nsStyleXUL, this);
}
nsChangeHint CalcDifference(const nsStyleXUL& aOther) const;
nsChangeHint CalcDifference(const nsStyleXUL& aNewData) const;
static nsChangeHint MaxDifference() {
return NS_STYLE_HINT_FRAMECHANGE;
}
@ -3152,7 +3152,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleColumn
FreeByObjectID(mozilla::eArenaObjectID_nsStyleColumn, this);
}
nsChangeHint CalcDifference(const nsStyleColumn& aOther) const;
nsChangeHint CalcDifference(const nsStyleColumn& aNewData) const;
static nsChangeHint MaxDifference() {
return NS_STYLE_HINT_FRAMECHANGE |
nsChangeHint_NeutralChange;
@ -3249,7 +3249,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleSVG
FreeByObjectID(mozilla::eArenaObjectID_nsStyleSVG, this);
}
nsChangeHint CalcDifference(const nsStyleSVG& aOther) const;
nsChangeHint CalcDifference(const nsStyleSVG& aNewData) const;
static nsChangeHint MaxDifference() {
return nsChangeHint_UpdateEffects |
nsChangeHint_NeedReflow |
@ -3577,7 +3577,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleSVGReset
}
void Destroy(nsPresContext* aContext);
nsChangeHint CalcDifference(const nsStyleSVGReset& aOther) const;
nsChangeHint CalcDifference(const nsStyleSVGReset& aNewData) const;
static nsChangeHint MaxDifference() {
return nsChangeHint_UpdateEffects |
nsChangeHint_UpdateOverflow |
@ -3632,7 +3632,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleVariables
FreeByObjectID(mozilla::eArenaObjectID_nsStyleVariables, this);
}
nsChangeHint CalcDifference(const nsStyleVariables& aOther) const;
nsChangeHint CalcDifference(const nsStyleVariables& aNewData) const;
static nsChangeHint MaxDifference() {
return nsChangeHint(0);
}
@ -3662,7 +3662,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleEffects
FreeByObjectID(mozilla::eArenaObjectID_nsStyleEffects, this);
}
nsChangeHint CalcDifference(const nsStyleEffects& aOther) const;
nsChangeHint CalcDifference(const nsStyleEffects& aNewData) const;
static nsChangeHint MaxDifference() {
return nsChangeHint_AllReflowHints |
nsChangeHint_UpdateOverflow |