Bug 1169440 patch 3 - Add nsChangeHint_ReflowChangesSizeOrPosition. r=heycam

This commit is contained in:
L. David Baron 2015-06-20 21:54:15 -07:00
parent 35609ff728
commit 448c478aff
3 changed files with 112 additions and 92 deletions

View File

@ -4233,7 +4233,8 @@ RestyleManager::ChangeHintToString(nsChangeHint aHint)
"UpdateParentOverflow",
"ChildrenOnlyTransform", "RecomputePosition", "AddOrRemoveTransform",
"BorderStyleNoneChange", "UpdateTextPath", "SchedulePaint",
"NeutralChange", "InvalidateRenderingObservers"
"NeutralChange", "InvalidateRenderingObservers",
"ReflowChangesSizeOrPosition"
};
uint32_t hint = aHint & ((1 << ArrayLength(names)) - 1);
uint32_t rest = aHint & ~((1 << ArrayLength(names)) - 1);

View File

@ -167,7 +167,14 @@ enum nsChangeHint {
/**
* This will cause rendering observers to be invalidated.
*/
nsChangeHint_InvalidateRenderingObservers = 0x400000
nsChangeHint_InvalidateRenderingObservers = 0x400000,
/**
* Indicates that the reflow changes the size or position of the
* element, and thus the reflow must start from at least the frame's
* parent.
*/
nsChangeHint_ReflowChangesSizeOrPosition = 0x800000,
// IMPORTANT NOTE: When adding new hints, consider whether you need to
// add them to NS_HintsNotHandledForDescendantsIn() below. Please also
@ -275,6 +282,7 @@ inline nsChangeHint operator^=(nsChangeHint& aLeft, nsChangeHint aRight)
nsChangeHint_AddOrRemoveTransform | \
nsChangeHint_BorderStyleNoneChange | \
nsChangeHint_NeedReflow | \
nsChangeHint_ReflowChangesSizeOrPosition | \
nsChangeHint_ClearAncestorIntrinsics)
inline nsChangeHint NS_HintsNotHandledForDescendantsIn(nsChangeHint aChangeHint) {
@ -291,11 +299,19 @@ inline nsChangeHint NS_HintsNotHandledForDescendantsIn(nsChangeHint aChangeHint)
nsChangeHint_AddOrRemoveTransform |
nsChangeHint_BorderStyleNoneChange));
if (!NS_IsHintSubset(nsChangeHint_NeedDirtyReflow, aChangeHint) &&
NS_IsHintSubset(nsChangeHint_NeedReflow, aChangeHint)) {
// If NeedDirtyReflow is *not* set, then NeedReflow is a
// non-inherited hint.
NS_UpdateHint(result, nsChangeHint_NeedReflow);
if (!NS_IsHintSubset(nsChangeHint_NeedDirtyReflow, aChangeHint)) {
if (NS_IsHintSubset(nsChangeHint_NeedReflow, aChangeHint)) {
// If NeedDirtyReflow is *not* set, then NeedReflow is a
// non-inherited hint.
NS_UpdateHint(result, nsChangeHint_NeedReflow);
}
if (NS_IsHintSubset(nsChangeHint_ReflowChangesSizeOrPosition,
aChangeHint)) {
// If NeedDirtyReflow is *not* set, then ReflowChangesSizeOrPosition is a
// non-inherited hint.
NS_UpdateHint(result, nsChangeHint_ReflowChangesSizeOrPosition);
}
}
if (!NS_IsHintSubset(nsChangeHint_ClearDescendantIntrinsics, aChangeHint) &&
@ -320,6 +336,7 @@ inline nsChangeHint NS_HintsNotHandledForDescendantsIn(nsChangeHint aChangeHint)
nsChangeHint_SchedulePaint)
#define nsChangeHint_AllReflowHints \
nsChangeHint(nsChangeHint_NeedReflow | \
nsChangeHint_ReflowChangesSizeOrPosition|\
nsChangeHint_ClearAncestorIntrinsics | \
nsChangeHint_ClearDescendantIntrinsics | \
nsChangeHint_NeedDirtyReflow)

View File

@ -92,11 +92,11 @@ public:
nsChangeHint_NeutralChange);
}
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
// CalcDifference never returns nsChangeHint_NeedReflow or
// nsChangeHint_ClearAncestorIntrinsics as hints not handled for
// descendants.
return NS_CombineHint(nsChangeHint_NeedReflow,
nsChangeHint_ClearAncestorIntrinsics);
// CalcDifference never returns the reflow hints that are sometimes
// handled for descendants as hints not handled for descendants.
return nsChangeHint_NeedReflow |
nsChangeHint_ReflowChangesSizeOrPosition |
nsChangeHint_ClearAncestorIntrinsics;
}
static nsChangeHint CalcFontDifference(const nsFont& aFont1, const nsFont& aFont2);
@ -340,8 +340,8 @@ struct nsStyleColor {
return NS_STYLE_HINT_VISUAL;
}
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
// CalcDifference never returns nsChangeHint_NeedReflow or
// nsChangeHint_ClearAncestorIntrinsics at all.
// CalcDifference never returns the reflow hints that are sometimes
// handled for descendants at all.
return nsChangeHint(0);
}
@ -378,8 +378,8 @@ struct nsStyleBackground {
nsChangeHint_NeutralChange));
}
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
// CalcDifference never returns nsChangeHint_NeedReflow or
// nsChangeHint_ClearAncestorIntrinsics at all.
// CalcDifference never returns the reflow hints that are sometimes
// handled for descendants at all.
return nsChangeHint(0);
}
@ -846,11 +846,11 @@ struct nsStyleBorder {
nsChangeHint_NeutralChange));
}
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
// CalcDifference never returns nsChangeHint_NeedReflow or
// nsChangeHint_ClearAncestorIntrinsics as hints not handled for
// descendants.
return NS_CombineHint(nsChangeHint_NeedReflow,
nsChangeHint_ClearAncestorIntrinsics);
// CalcDifference never returns the reflow hints that are sometimes
// handled for descendants as hints not handled for descendants.
return nsChangeHint_NeedReflow |
nsChangeHint_ReflowChangesSizeOrPosition |
nsChangeHint_ClearAncestorIntrinsics;
}
void EnsureBorderColors() {
@ -1082,8 +1082,8 @@ struct nsStyleOutline {
nsChangeHint_NeutralChange));
}
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
// CalcDifference never returns nsChangeHint_NeedReflow or
// nsChangeHint_ClearAncestorIntrinsics at all.
// CalcDifference never returns the reflow hints that are sometimes
// handled for descendants at all.
return nsChangeHint(0);
}
@ -1175,11 +1175,11 @@ struct nsStyleList {
nsChangeHint_NeutralChange);
}
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
// CalcDifference never returns nsChangeHint_NeedReflow or
// nsChangeHint_ClearAncestorIntrinsics as hints not handled for
// descendants.
return NS_CombineHint(nsChangeHint_NeedReflow,
nsChangeHint_ClearAncestorIntrinsics);
// CalcDifference never returns the reflow hints that are sometimes
// handled for descendants as hints not handled for descendants.
return nsChangeHint_NeedReflow |
nsChangeHint_ReflowChangesSizeOrPosition |
nsChangeHint_ClearAncestorIntrinsics;
}
imgRequestProxy* GetListStyleImage() const { return mListStyleImage; }
@ -1351,8 +1351,9 @@ struct nsStylePosition {
nsChangeHint_UpdateParentOverflow));
}
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
// CalcDifference can return both nsChangeHint_ClearAncestorIntrinsics and
// nsChangeHint_NeedReflow as hints not handled for descendants.
// CalcDifference can return all of the reflow hints that are
// sometimes handled for descendants as hints not handled for
// descendants.
return nsChangeHint(0);
}
@ -1590,11 +1591,11 @@ struct nsStyleTextReset {
nsChangeHint_UpdateSubtreeOverflow);
}
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
// CalcDifference never returns nsChangeHint_NeedReflow or
// nsChangeHint_ClearAncestorIntrinsics as hints not handled for
// descendants.
return NS_CombineHint(nsChangeHint_NeedReflow,
nsChangeHint_ClearAncestorIntrinsics);
// CalcDifference never returns the reflow hints that are sometimes
// handled for descendants as hints not handled for descendants.
return nsChangeHint_NeedReflow |
nsChangeHint_ReflowChangesSizeOrPosition |
nsChangeHint_ClearAncestorIntrinsics;
}
nsStyleCoord mVerticalAlign; // [reset] coord, percent, calc, enum (see nsStyleConsts.h)
@ -1628,11 +1629,11 @@ struct nsStyleText {
return NS_STYLE_HINT_FRAMECHANGE;
}
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
// CalcDifference never returns nsChangeHint_NeedReflow or
// nsChangeHint_ClearAncestorIntrinsics as hints not handled for
// descendants.
return NS_CombineHint(nsChangeHint_NeedReflow,
nsChangeHint_ClearAncestorIntrinsics);
// CalcDifference never returns the reflow hints that are sometimes
// handled for descendants as hints not handled for descendants.
return nsChangeHint_NeedReflow |
nsChangeHint_ReflowChangesSizeOrPosition |
nsChangeHint_ClearAncestorIntrinsics;
}
uint8_t mTextAlign; // [inherited] see nsStyleConsts.h
@ -1820,11 +1821,11 @@ struct nsStyleVisibility {
return NS_STYLE_HINT_FRAMECHANGE;
}
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
// CalcDifference never returns nsChangeHint_NeedReflow or
// nsChangeHint_ClearAncestorIntrinsics as hints not handled for
// descendants.
return NS_CombineHint(nsChangeHint_NeedReflow,
nsChangeHint_ClearAncestorIntrinsics);
// CalcDifference never returns the reflow hints that are sometimes
// handled for descendants as hints not handled for descendants.
return nsChangeHint_NeedReflow |
nsChangeHint_ReflowChangesSizeOrPosition |
nsChangeHint_ClearAncestorIntrinsics;
}
nsStyleImageOrientation mImageOrientation; // [inherited]
@ -2056,8 +2057,9 @@ struct nsStyleDisplay {
nsChangeHint_NeutralChange);
}
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
// CalcDifference can return both nsChangeHint_ClearAncestorIntrinsics and
// nsChangeHint_NeedReflow as hints not handled for descendants.
// CalcDifference can return all of the reflow hints that are
// sometimes handled for descendants as hints not handled for
// descendants.
return nsChangeHint(0);
}
@ -2309,11 +2311,11 @@ struct nsStyleTable {
return NS_STYLE_HINT_FRAMECHANGE;
}
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
// CalcDifference never returns nsChangeHint_NeedReflow or
// nsChangeHint_ClearAncestorIntrinsics as hints not handled for
// descendants.
return NS_CombineHint(nsChangeHint_NeedReflow,
nsChangeHint_ClearAncestorIntrinsics);
// CalcDifference never returns the reflow hints that are sometimes
// handled for descendants as hints not handled for descendants.
return nsChangeHint_NeedReflow |
nsChangeHint_ReflowChangesSizeOrPosition |
nsChangeHint_ClearAncestorIntrinsics;
}
uint8_t mLayoutStrategy;// [reset] see nsStyleConsts.h NS_STYLE_TABLE_LAYOUT_*
@ -2340,11 +2342,11 @@ struct nsStyleTableBorder {
return NS_STYLE_HINT_FRAMECHANGE;
}
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
// CalcDifference never returns nsChangeHint_NeedReflow or
// nsChangeHint_ClearAncestorIntrinsics as hints not handled for
// descendants.
return NS_CombineHint(nsChangeHint_NeedReflow,
nsChangeHint_ClearAncestorIntrinsics);
// CalcDifference never returns the reflow hints that are sometimes
// handled for descendants as hints not handled for descendants.
return nsChangeHint_NeedReflow |
nsChangeHint_ReflowChangesSizeOrPosition |
nsChangeHint_ClearAncestorIntrinsics;
}
nscoord mBorderSpacingCol;// [inherited]
@ -2439,11 +2441,11 @@ struct nsStyleQuotes {
return NS_STYLE_HINT_FRAMECHANGE;
}
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
// CalcDifference never returns nsChangeHint_NeedReflow or
// nsChangeHint_ClearAncestorIntrinsics as hints not handled for
// descendants.
return NS_CombineHint(nsChangeHint_NeedReflow,
nsChangeHint_ClearAncestorIntrinsics);
// CalcDifference never returns the reflow hints that are sometimes
// handled for descendants as hints not handled for descendants.
return nsChangeHint_NeedReflow |
nsChangeHint_ReflowChangesSizeOrPosition |
nsChangeHint_ClearAncestorIntrinsics;
}
uint32_t QuotesCount(void) const { return mQuotesCount; } // [inherited]
@ -2514,11 +2516,11 @@ struct nsStyleContent {
return NS_STYLE_HINT_FRAMECHANGE;
}
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
// CalcDifference never returns nsChangeHint_NeedReflow or
// nsChangeHint_ClearAncestorIntrinsics as hints not handled for
// descendants.
return NS_CombineHint(nsChangeHint_NeedReflow,
nsChangeHint_ClearAncestorIntrinsics);
// CalcDifference never returns the reflow hints that are sometimes
// handled for descendants as hints not handled for descendants.
return nsChangeHint_NeedReflow |
nsChangeHint_ReflowChangesSizeOrPosition |
nsChangeHint_ClearAncestorIntrinsics;
}
uint32_t ContentCount(void) const { return mContentCount; } // [reset]
@ -2627,11 +2629,11 @@ struct nsStyleUIReset {
return NS_STYLE_HINT_FRAMECHANGE;
}
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
// CalcDifference never returns nsChangeHint_NeedReflow or
// nsChangeHint_ClearAncestorIntrinsics as hints not handled for
// descendants.
return NS_CombineHint(nsChangeHint_NeedReflow,
nsChangeHint_ClearAncestorIntrinsics);
// CalcDifference never returns the reflow hints that are sometimes
// handled for descendants as hints not handled for descendants.
return nsChangeHint_NeedReflow |
nsChangeHint_ReflowChangesSizeOrPosition |
nsChangeHint_ClearAncestorIntrinsics;
}
uint8_t mUserSelect; // [reset] (selection-style)
@ -2691,11 +2693,11 @@ struct nsStyleUserInterface {
nsChangeHint_NeutralChange));
}
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
// CalcDifference never returns nsChangeHint_NeedReflow or
// nsChangeHint_ClearAncestorIntrinsics as hints not handled for
// descendants.
return NS_CombineHint(nsChangeHint_NeedReflow,
nsChangeHint_ClearAncestorIntrinsics);
// CalcDifference never returns the reflow hints that are sometimes
// handled for descendants as hints not handled for descendants.
return nsChangeHint_NeedReflow |
nsChangeHint_ReflowChangesSizeOrPosition |
nsChangeHint_ClearAncestorIntrinsics;
}
uint8_t mUserInput; // [inherited]
@ -2736,11 +2738,11 @@ struct nsStyleXUL {
return NS_STYLE_HINT_FRAMECHANGE;
}
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
// CalcDifference never returns nsChangeHint_NeedReflow or
// nsChangeHint_ClearAncestorIntrinsics as hints not handled for
// descendants.
return NS_CombineHint(nsChangeHint_NeedReflow,
nsChangeHint_ClearAncestorIntrinsics);
// CalcDifference never returns the reflow hints that are sometimes
// handled for descendants as hints not handled for descendants.
return nsChangeHint_NeedReflow |
nsChangeHint_ReflowChangesSizeOrPosition |
nsChangeHint_ClearAncestorIntrinsics;
}
float mBoxFlex; // [reset] see nsStyleConsts.h
@ -2773,11 +2775,11 @@ struct nsStyleColumn {
nsChangeHint_NeutralChange);
}
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
// CalcDifference never returns nsChangeHint_NeedReflow or
// nsChangeHint_ClearAncestorIntrinsics as hints not handled for
// descendants.
return NS_CombineHint(nsChangeHint_NeedReflow,
nsChangeHint_ClearAncestorIntrinsics);
// CalcDifference never returns the reflow hints that are sometimes
// handled for descendants as hints not handled for descendants.
return nsChangeHint_NeedReflow |
nsChangeHint_ReflowChangesSizeOrPosition |
nsChangeHint_ClearAncestorIntrinsics;
}
/**
@ -3148,11 +3150,11 @@ struct nsStyleSVGReset {
NS_CombineHint(nsChangeHint_UpdateOverflow, NS_STYLE_HINT_REFLOW));
}
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
// CalcDifference never returns nsChangeHint_NeedReflow or
// nsChangeHint_ClearAncestorIntrinsics as hints not handled for
// descendants.
return NS_CombineHint(nsChangeHint_NeedReflow,
nsChangeHint_ClearAncestorIntrinsics);
// CalcDifference never returns the reflow hints that are sometimes
// handled for descendants as hints not handled for descendants.
return nsChangeHint_NeedReflow |
nsChangeHint_ReflowChangesSizeOrPosition |
nsChangeHint_ClearAncestorIntrinsics;
}
bool HasFilters() const {