diff --git a/layout/base/RestyleManager.cpp b/layout/base/RestyleManager.cpp index 11b72323f1a0..b2431378167e 100644 --- a/layout/base/RestyleManager.cpp +++ b/layout/base/RestyleManager.cpp @@ -148,7 +148,8 @@ SyncViewsAndInvalidateDescendants(nsIFrame* aFrame, { NS_PRECONDITION(gInApplyRenderingChangeToTree, "should only be called within ApplyRenderingChangeToTree"); - NS_ASSERTION(aChange == (aChange & (nsChangeHint_RepaintFrame | + NS_ASSERTION(nsChangeHint_size_t(aChange) == + (aChange & (nsChangeHint_RepaintFrame | nsChangeHint_SyncFrameView | nsChangeHint_UpdateOpacityLayer | nsChangeHint_SchedulePaint)), diff --git a/layout/base/nsChangeHint.h b/layout/base/nsChangeHint.h index edc497ce13a8..8be945cb72b0 100644 --- a/layout/base/nsChangeHint.h +++ b/layout/base/nsChangeHint.h @@ -210,6 +210,49 @@ inline bool NS_IsHintSubset(nsChangeHint aSubset, nsChangeHint aSuperSet) { return (aSubset & aSuperSet) == aSubset; } +// The functions below need an integral type to cast to to avoid +// infinite recursion. +typedef decltype(nsChangeHint(0) + nsChangeHint(0)) nsChangeHint_size_t; + +inline nsChangeHint MOZ_CONSTEXPR +operator|(nsChangeHint aLeft, nsChangeHint aRight) +{ + return nsChangeHint(nsChangeHint_size_t(aLeft) | nsChangeHint_size_t(aRight)); +} + +inline nsChangeHint MOZ_CONSTEXPR +operator&(nsChangeHint aLeft, nsChangeHint aRight) +{ + return nsChangeHint(nsChangeHint_size_t(aLeft) & nsChangeHint_size_t(aRight)); +} + +inline nsChangeHint& operator|=(nsChangeHint& aLeft, nsChangeHint aRight) +{ + return aLeft = aLeft | aRight; +} + +inline nsChangeHint& operator&=(nsChangeHint& aLeft, nsChangeHint aRight) +{ + return aLeft = aLeft & aRight; +} + +inline nsChangeHint MOZ_CONSTEXPR +operator~(nsChangeHint aArg) +{ + return nsChangeHint(~nsChangeHint_size_t(aArg)); +} + +inline nsChangeHint MOZ_CONSTEXPR +operator^(nsChangeHint aLeft, nsChangeHint aRight) +{ + return nsChangeHint(nsChangeHint_size_t(aLeft) ^ nsChangeHint_size_t(aRight)); +} + +inline nsChangeHint operator^=(nsChangeHint& aLeft, nsChangeHint aRight) +{ + return aLeft = aLeft ^ aRight; +} + /** * We have an optimization when processing change hints which prevents * us from visiting the descendants of a node when a hint on that node