Bug 1301258 - Part 1: Define macros for change hints always, never and sometimes handled for descendants. r=dbaron

MozReview-Commit-ID: 1lOl7U6rlC5
This commit is contained in:
Cameron McCormack 2017-03-21 16:33:05 +08:00
Родитель ae9a9c7afe
Коммит d2bf6adc7c
1 изменённых файлов: 71 добавлений и 39 удалений

Просмотреть файл

@ -219,10 +219,17 @@ enum nsChangeHint {
*/ */
nsChangeHint_AddOrRemoveTransform = 1 << 27, nsChangeHint_AddOrRemoveTransform = 1 << 27,
// IMPORTANT NOTE: When adding new hints, consider whether you need // IMPORTANT NOTE: When adding a new hint, you will need to add it to
// to add them to NS_HintsNotHandledForDescendantsIn() below. Please // one of:
// also add them to RestyleManager::ChangeHintToString and modify //
// nsChangeHint_AllHints below accordingly. // * nsChangeHint_Hints_NeverHandledForDescendants
// * nsChangeHint_Hints_AlwaysHandledForDescendants
// * nsChangeHint_Hints_SometimesHandledForDescendants
//
// and you also may need to handle it in NS_HintsNotHandledForDescendantsIn.
//
// Please also add it to RestyleManager::ChangeHintToString and
// modify nsChangeHint_AllHints below accordingly.
/** /**
* Dummy hint value for all hints. It exists for compile time check. * Dummy hint value for all hints. It exists for compile time check.
@ -298,46 +305,71 @@ inline nsChangeHint operator^=(nsChangeHint& aLeft, nsChangeHint aRight)
* in the same hint being handled on the descendants. * in the same hint being handled on the descendants.
*/ */
// The change hints that are always handled for descendants.
#define nsChangeHint_Hints_AlwaysHandledForDescendants ( \
nsChangeHint_ClearDescendantIntrinsics | \
nsChangeHint_NeedDirtyReflow | \
nsChangeHint_NeutralChange | \
nsChangeHint_ReconstructFrame | \
nsChangeHint_RepaintFrame | \
nsChangeHint_SchedulePaint | \
nsChangeHint_SyncFrameView | \
nsChangeHint_UpdateCursor | \
nsChangeHint_UpdateSubtreeOverflow | \
nsChangeHint_UpdateTextPath \
)
// The change hints that are never handled for descendants.
#define nsChangeHint_Hints_NeverHandledForDescendants ( \
nsChangeHint_BorderStyleNoneChange | \
nsChangeHint_ChildrenOnlyTransform | \
nsChangeHint_InvalidateRenderingObservers | \
nsChangeHint_RecomputePosition | \
nsChangeHint_UpdateBackgroundPosition | \
nsChangeHint_UpdateComputedBSize | \
nsChangeHint_UpdateContainingBlock | \
nsChangeHint_UpdateEffects | \
nsChangeHint_UpdateOpacityLayer | \
nsChangeHint_UpdateOverflow | \
nsChangeHint_UpdateParentOverflow | \
nsChangeHint_UpdatePostTransformOverflow | \
nsChangeHint_UpdateTransformLayer | \
nsChangeHint_UpdateUsesOpacity | \
nsChangeHint_AddOrRemoveTransform \
)
// The change hints that are sometimes considered to be handled for descendants.
#define nsChangeHint_Hints_SometimesHandledForDescendants (\
nsChangeHint_ClearAncestorIntrinsics | \
nsChangeHint_NeedReflow | \
nsChangeHint_ReflowChangesSizeOrPosition \
)
static_assert(!(nsChangeHint_Hints_AlwaysHandledForDescendants &
nsChangeHint_Hints_NeverHandledForDescendants) &&
!(nsChangeHint_Hints_AlwaysHandledForDescendants &
nsChangeHint_Hints_SometimesHandledForDescendants) &&
!(nsChangeHint_Hints_NeverHandledForDescendants &
nsChangeHint_Hints_SometimesHandledForDescendants) &&
!(nsChangeHint_AllHints ^
nsChangeHint_Hints_AlwaysHandledForDescendants ^
nsChangeHint_Hints_NeverHandledForDescendants ^
nsChangeHint_Hints_SometimesHandledForDescendants),
"change hints must be present in exactly one of "
"nsChangeHint_Hints_{Always,Never,Sometimes}"
"HandledForDescendants");
// The most hints that NS_HintsNotHandledForDescendantsIn could possibly return: // The most hints that NS_HintsNotHandledForDescendantsIn could possibly return:
#define nsChangeHint_Hints_NotHandledForDescendants nsChangeHint( \ #define nsChangeHint_Hints_NotHandledForDescendants ( \
nsChangeHint_UpdateTransformLayer | \ nsChangeHint_Hints_NeverHandledForDescendants | \
nsChangeHint_UpdateEffects | \ nsChangeHint_Hints_SometimesHandledForDescendants \
nsChangeHint_InvalidateRenderingObservers | \ )
nsChangeHint_UpdateOpacityLayer | \
nsChangeHint_UpdateOverflow | \
nsChangeHint_UpdatePostTransformOverflow | \
nsChangeHint_UpdateParentOverflow | \
nsChangeHint_ChildrenOnlyTransform | \
nsChangeHint_RecomputePosition | \
nsChangeHint_UpdateContainingBlock | \
nsChangeHint_AddOrRemoveTransform | \
nsChangeHint_BorderStyleNoneChange | \
nsChangeHint_NeedReflow | \
nsChangeHint_ReflowChangesSizeOrPosition | \
nsChangeHint_ClearAncestorIntrinsics | \
nsChangeHint_UpdateComputedBSize | \
nsChangeHint_UpdateUsesOpacity | \
nsChangeHint_UpdateBackgroundPosition)
// NB: Once we drop support for the old style system, this logic should be // NB: Once we drop support for the old style system, this logic should be
// inlined in the Servo style system to eliminate the FFI call. // inlined in the Servo style system to eliminate the FFI call.
inline nsChangeHint NS_HintsNotHandledForDescendantsIn(nsChangeHint aChangeHint) { inline nsChangeHint NS_HintsNotHandledForDescendantsIn(nsChangeHint aChangeHint) {
nsChangeHint result = nsChangeHint(aChangeHint & ( nsChangeHint result =
nsChangeHint_UpdateTransformLayer | aChangeHint & nsChangeHint_Hints_NeverHandledForDescendants;
nsChangeHint_UpdateEffects |
nsChangeHint_InvalidateRenderingObservers |
nsChangeHint_UpdateOpacityLayer |
nsChangeHint_UpdateOverflow |
nsChangeHint_UpdatePostTransformOverflow |
nsChangeHint_UpdateParentOverflow |
nsChangeHint_ChildrenOnlyTransform |
nsChangeHint_RecomputePosition |
nsChangeHint_UpdateContainingBlock |
nsChangeHint_AddOrRemoveTransform |
nsChangeHint_BorderStyleNoneChange |
nsChangeHint_UpdateComputedBSize |
nsChangeHint_UpdateUsesOpacity | \
nsChangeHint_UpdateBackgroundPosition));
if (!NS_IsHintSubset(nsChangeHint_NeedDirtyReflow, aChangeHint)) { if (!NS_IsHintSubset(nsChangeHint_NeedDirtyReflow, aChangeHint)) {
if (NS_IsHintSubset(nsChangeHint_NeedReflow, aChangeHint)) { if (NS_IsHintSubset(nsChangeHint_NeedReflow, aChangeHint)) {