Bug 1223880 - part1: purge NS_CombineHint inline.
MozReview-Commit-ID: 7jVyVZpR3V5
--- a/dom/svg/SVGTransformableElement.cpp
+++ b/dom/svg/SVGTransformableElement.cpp
@@ -79,18 +79,18 @@ SVGTransformableElement::GetAttributeCha
}
}
if (isAdditionOrRemoval) {
// Reconstruct the frame tree to handle stacking context changes:
NS_UpdateHint(retval, nsChangeHint_ReconstructFrame);
} else {
// We just assume the old and new transforms are different.
- NS_UpdateHint(retval, NS_CombineHint(nsChangeHint_UpdatePostTransformOverflow,
- nsChangeHint_UpdateTransformLayer));
+ NS_UpdateHint(retval, nsChangeHint_UpdatePostTransformOverflow |
+ nsChangeHint_UpdateTransformLayer);
}
}
return retval;
}
bool
SVGTransformableElement::IsEventAttributeName(nsIAtom* aName)
{
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -834,22 +834,20 @@ RestyleManager::ProcessRestyledFrames(ns
FrameConstructor()->RecreateFramesForContent(content, false,
nsCSSFrameConstructor::REMOVE_FOR_RECONSTRUCTION, nullptr);
} else {
NS_ASSERTION(frame, "This shouldn't happen");
if (!frame->FrameMaintainsOverflow()) {
// frame does not maintain overflow rects, so avoid calling
// FinishAndStoreOverflow on it:
- hint = NS_SubtractHint(hint,
- NS_CombineHint(
- NS_CombineHint(nsChangeHint_UpdateOverflow,
- nsChangeHint_ChildrenOnlyTransform),
- NS_CombineHint(nsChangeHint_UpdatePostTransformOverflow,
- nsChangeHint_UpdateParentOverflow)));
+ hint = NS_SubtractHint(hint, nsChangeHint_UpdateOverflow |
+ nsChangeHint_ChildrenOnlyTransform |
+ nsChangeHint_UpdatePostTransformOverflow |
+ nsChangeHint_UpdateParentOverflow);
}
if (!(frame->GetStateBits() & NS_FRAME_MAY_BE_TRANSFORMED)) {
// Frame can not be transformed, and thus a change in transform will
// have no effect and we should not use the
// nsChangeHint_UpdatePostTransformOverflow hint.
hint = NS_SubtractHint(hint, nsChangeHint_UpdatePostTransformOverflow);
}
@@ -921,19 +919,18 @@ RestyleManager::ProcessRestyledFrames(ns
nsChangeHint_UpdateSubtreeOverflow))) {
if (hint & nsChangeHint_UpdateSubtreeOverflow) {
for (nsIFrame *cont = frame; cont; cont =
nsLayoutUtils::GetNextContinuationOrIBSplitSibling(cont)) {
AddSubtreeToOverflowTracker(cont);
}
// The work we just did in AddSubtreeToOverflowTracker
// subsumes some of the other hints:
- hint = NS_SubtractHint(hint,
- NS_CombineHint(nsChangeHint_UpdateOverflow,
- nsChangeHint_UpdatePostTransformOverflow));
+ hint = NS_SubtractHint(hint, nsChangeHint_UpdateOverflow |
+ nsChangeHint_UpdatePostTransformOverflow);
}
if (hint & nsChangeHint_ChildrenOnlyTransform) {
// The overflow areas of the child frames need to be updated:
nsIFrame* hintFrame = GetFrameForChildrenOnlyTransformHint(frame);
nsIFrame* childFrame = hintFrame->PrincipalChildList().FirstChild();
NS_ASSERTION(!nsLayoutUtils::GetNextContinuationOrIBSplitSibling(frame),
"SVG frames should not have continuations "
"or ib-split siblings");
--- a/layout/base/nsChangeHint.h
+++ b/layout/base/nsChangeHint.h
@@ -216,21 +216,16 @@ inline void operator>(nsChangeHint s1, n
inline void operator!=(nsChangeHint s1, nsChangeHint s2) {}
inline void operator==(nsChangeHint s1, nsChangeHint s2) {}
inline void operator<=(nsChangeHint s1, nsChangeHint s2) {}
inline void operator>=(nsChangeHint s1, nsChangeHint s2) {}
// Operators on nsChangeHints
// Merge two hints, taking the union
-inline nsChangeHint NS_CombineHint(nsChangeHint aH1, nsChangeHint aH2) {
- return (nsChangeHint)(aH1 | aH2);
-}
-
-// Merge two hints, taking the union
inline nsChangeHint NS_SubtractHint(nsChangeHint aH1, nsChangeHint aH2) {
return (nsChangeHint)(aH1 & ~aH2);
}
// Merge the "src" hint into the "dst" hint
// Returns true iff the destination changed
inline bool NS_UpdateHint(nsChangeHint& aDest, nsChangeHint aSrc) {
nsChangeHint r = (nsChangeHint)(aDest | aSrc);
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -562,18 +562,17 @@ nsStyleOutline::RecalcData()
}
}
nsChangeHint nsStyleOutline::CalcDifference(const nsStyleOutline& aOther) const
{
if (mActualOutlineWidth != aOther.mActualOutlineWidth ||
(mActualOutlineWidth > 0 &&
mOutlineOffset != aOther.mOutlineOffset)) {
- return NS_CombineHint(nsChangeHint_UpdateOverflow,
- nsChangeHint_SchedulePaint);
+ return nsChangeHint_UpdateOverflow | nsChangeHint_SchedulePaint;
}
if (mOutlineStyle != aOther.mOutlineStyle ||
mOutlineColor != aOther.mOutlineColor ||
mOutlineRadius != aOther.mOutlineRadius) {
if (mActualOutlineWidth > 0) {
return nsChangeHint_RepaintFrame;
}
@@ -1517,81 +1516,82 @@ nsStylePosition::CalcDifference(const ns
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
}
// Changes to "object-fit" & "object-position" require a repaint. They
// may also require a reflow, if we have a nsSubDocumentFrame, so that we
// can adjust the size & position of the subdocument.
if (mObjectFit != aOther.mObjectFit ||
mObjectPosition != aOther.mObjectPosition) {
- NS_UpdateHint(hint, NS_CombineHint(nsChangeHint_RepaintFrame,
- nsChangeHint_NeedReflow));
+ NS_UpdateHint(hint, nsChangeHint_RepaintFrame |
+ nsChangeHint_NeedReflow);
}
if (mOrder != aOther.mOrder) {
// "order" impacts both layout order and stacking order, so we need both a
// reflow and a repaint when it changes. (Technically, we only need a
// reflow if we're in a multi-line flexbox (which we can't be sure about,
// since that's determined by styling on our parent) -- there, "order" can
// affect which flex line we end up on, & hence can affect our sizing by
// changing the group of flex items we're competing with for space.)
- return NS_CombineHint(hint, NS_CombineHint(nsChangeHint_RepaintFrame,
- nsChangeHint_AllReflowHints));
+ return hint |
+ nsChangeHint_RepaintFrame |
+ nsChangeHint_AllReflowHints;
}
if (mBoxSizing != aOther.mBoxSizing) {
// Can affect both widths and heights; just a bad scene.
- return NS_CombineHint(hint, nsChangeHint_AllReflowHints);
+ return hint | nsChangeHint_AllReflowHints;
}
// Properties that apply to flex items:
// XXXdholbert These should probably be more targeted (bug 819536)
if (mAlignSelf != aOther.mAlignSelf ||
mFlexBasis != aOther.mFlexBasis ||
mFlexGrow != aOther.mFlexGrow ||
mFlexShrink != aOther.mFlexShrink) {
- return NS_CombineHint(hint, nsChangeHint_AllReflowHints);
+ return hint | nsChangeHint_AllReflowHints;
}
// Properties that apply to flex containers:
// - flex-direction can swap a flex container between vertical & horizontal.
// - align-items can change the sizing of a flex container & the positioning
// of its children.
// - flex-wrap changes whether a flex container's children are wrapped, which
// impacts their sizing/positioning and hence impacts the container's size.
if (mAlignItems != aOther.mAlignItems ||
mFlexDirection != aOther.mFlexDirection ||
mFlexWrap != aOther.mFlexWrap) {
- return NS_CombineHint(hint, nsChangeHint_AllReflowHints);
+ return hint | nsChangeHint_AllReflowHints;
}
// Properties that apply to grid containers:
// FIXME: only for grid containers
// (ie. 'display: grid' or 'display: inline-grid')
if (mGridTemplateColumns != aOther.mGridTemplateColumns ||
mGridTemplateRows != aOther.mGridTemplateRows ||
mGridTemplateAreas != aOther.mGridTemplateAreas ||
mGridAutoColumnsMin != aOther.mGridAutoColumnsMin ||
mGridAutoColumnsMax != aOther.mGridAutoColumnsMax ||
mGridAutoRowsMin != aOther.mGridAutoRowsMin ||
mGridAutoRowsMax != aOther.mGridAutoRowsMax ||
mGridAutoFlow != aOther.mGridAutoFlow) {
- return NS_CombineHint(hint, nsChangeHint_AllReflowHints);
+ return hint | nsChangeHint_AllReflowHints;
}
// Properties that apply to grid items:
// FIXME: only for grid items
// (ie. parent frame is 'display: grid' or 'display: inline-grid')
if (mGridColumnStart != aOther.mGridColumnStart ||
mGridColumnEnd != aOther.mGridColumnEnd ||
mGridRowStart != aOther.mGridRowStart ||
mGridRowEnd != aOther.mGridRowEnd ||
mGridColumnGap != aOther.mGridColumnGap ||
mGridRowGap != aOther.mGridRowGap) {
- return NS_CombineHint(hint, nsChangeHint_AllReflowHints);
+ return hint | nsChangeHint_AllReflowHints;
}
// Changing 'justify-content/items/self' might affect the positioning,
// but it won't affect any sizing.
if (mJustifyContent != aOther.mJustifyContent ||
mJustifyItems != aOther.mJustifyItems ||
mJustifySelf != aOther.mJustifySelf) {
NS_UpdateHint(hint, nsChangeHint_NeedReflow);
@@ -1634,18 +1634,18 @@ nsStylePosition::CalcDifference(const ns
nsChangeHint_ReflowChangesSizeOrPosition);
}
if (isVertical ? heightChanged : widthChanged) {
// None of our inline-size differences can affect descendant
// intrinsic sizes and none of them need to force children to
// reflow.
NS_UpdateHint(hint, NS_SubtractHint(nsChangeHint_AllReflowHints,
- NS_CombineHint(nsChangeHint_ClearDescendantIntrinsics,
- nsChangeHint_NeedDirtyReflow)));
+ nsChangeHint_ClearDescendantIntrinsics |
+ nsChangeHint_NeedDirtyReflow));
}
} else {
if (widthChanged || heightChanged) {
NS_UpdateHint(hint, nsChangeHint_NeutralChange);
}
}
// If any of the offsets have changed, then return the respective hints
@@ -2966,18 +2966,18 @@ nsChangeHint nsStyleDisplay::CalcDiffere
// specifies 'textfield'.
return nsChangeHint_ReconstructFrame;
}
if (mFloats != aOther.mFloats) {
// Changing which side we float on doesn't affect descendants directly
NS_UpdateHint(hint,
NS_SubtractHint(nsChangeHint_AllReflowHints,
- NS_CombineHint(nsChangeHint_ClearDescendantIntrinsics,
- nsChangeHint_NeedDirtyReflow)));
+ nsChangeHint_ClearDescendantIntrinsics |
+ nsChangeHint_NeedDirtyReflow));
}
if (mVerticalAlign != aOther.mVerticalAlign) {
// XXX Can this just be AllReflowHints + RepaintFrame, and be included in
// the block below?
NS_UpdateHint(hint, NS_STYLE_HINT_REFLOW);
}
@@ -2985,33 +2985,33 @@ nsChangeHint nsStyleDisplay::CalcDiffere
// necessarily require a repaint, reflow should suffice.
if (mBreakType != aOther.mBreakType
|| mBreakInside != aOther.mBreakInside
|| mBreakBefore != aOther.mBreakBefore
|| mBreakAfter != aOther.mBreakAfter
|| mAppearance != aOther.mAppearance
|| mOrient != aOther.mOrient
|| mOverflowClipBox != aOther.mOverflowClipBox)
- NS_UpdateHint(hint, NS_CombineHint(nsChangeHint_AllReflowHints,
- nsChangeHint_RepaintFrame));
+ NS_UpdateHint(hint, nsChangeHint_AllReflowHints |
+ nsChangeHint_RepaintFrame);
if (mIsolation != aOther.mIsolation) {
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
}
/* If we've added or removed the transform property, we need to reconstruct the frame to add
* or remove the view object, and also to handle abs-pos and fixed-pos containers.
*/
if (HasTransformStyle() != aOther.HasTransformStyle()) {
// We do not need to apply nsChangeHint_UpdateTransformLayer since
// nsChangeHint_RepaintFrame will forcibly invalidate the frame area and
// ensure layers are rebuilt (or removed).
- NS_UpdateHint(hint, NS_CombineHint(nsChangeHint_UpdateContainingBlock,
- NS_CombineHint(nsChangeHint_UpdateOverflow,
- nsChangeHint_RepaintFrame)));
+ NS_UpdateHint(hint, nsChangeHint_UpdateContainingBlock |
+ nsChangeHint_UpdateOverflow |
+ nsChangeHint_RepaintFrame);
} else {
/* Otherwise, if we've kept the property lying around and we already had a
* transform, we need to see whether or not we've changed the transform.
* If so, we need to recompute its overflow rect (which probably changed
* if the transform changed) and to redraw within the bounds of that new
* overflow rect.
*
* If the property isn't present in either style struct, we still do the
@@ -3029,21 +3029,21 @@ nsChangeHint nsStyleDisplay::CalcDiffere
aOther.mSpecifiedTransform) {
NS_UpdateHint(transformHint, nsChangeHint_UpdatePostTransformOverflow);
} else {
NS_UpdateHint(transformHint, nsChangeHint_UpdateOverflow);
}
}
const nsChangeHint kUpdateOverflowAndRepaintHint =
- NS_CombineHint(nsChangeHint_UpdateOverflow, nsChangeHint_RepaintFrame);
+ nsChangeHint_UpdateOverflow | nsChangeHint_RepaintFrame;
for (uint8_t index = 0; index < 3; ++index)
if (mTransformOrigin[index] != aOther.mTransformOrigin[index]) {
- NS_UpdateHint(transformHint, NS_CombineHint(nsChangeHint_UpdateTransformLayer,
- nsChangeHint_UpdatePostTransformOverflow));
+ NS_UpdateHint(transformHint, nsChangeHint_UpdateTransformLayer |
+ nsChangeHint_UpdatePostTransformOverflow);
break;
}
for (uint8_t index = 0; index < 2; ++index)
if (mPerspectiveOrigin[index] != aOther.mPerspectiveOrigin[index]) {
NS_UpdateHint(transformHint, kUpdateOverflowAndRepaintHint);
break;
}
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -115,18 +115,17 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
nsStyleFont(const nsStyleFont& aStyleFont);
explicit nsStyleFont(StyleStructContext aContext);
~nsStyleFont() {
MOZ_COUNT_DTOR(nsStyleFont);
}
nsChangeHint CalcDifference(const nsStyleFont& aOther) const;
static nsChangeHint MaxDifference() {
- return NS_CombineHint(NS_STYLE_HINT_REFLOW,
- nsChangeHint_NeutralChange);
+ return NS_STYLE_HINT_REFLOW | nsChangeHint_NeutralChange;
}
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
// 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;
}
@@ -1303,20 +1302,20 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
this->~nsStyleOutline();
aContext->PresShell()->
FreeByObjectID(mozilla::eArenaObjectID_nsStyleOutline, this);
}
void RecalcData();
nsChangeHint CalcDifference(const nsStyleOutline& aOther) const;
static nsChangeHint MaxDifference() {
- return NS_CombineHint(NS_CombineHint(nsChangeHint_UpdateOverflow,
- nsChangeHint_SchedulePaint),
- NS_CombineHint(nsChangeHint_RepaintFrame,
- nsChangeHint_NeutralChange));
+ return nsChangeHint_UpdateOverflow |
+ nsChangeHint_SchedulePaint |
+ nsChangeHint_RepaintFrame |
+ nsChangeHint_NeutralChange;
}
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
// CalcDifference never returns the reflow hints that are sometimes
// handled for descendants at all.
return nsChangeHint(0);
}
nsStyleCorners mOutlineRadius; // [reset] coord, percent, calc
@@ -1415,18 +1414,17 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
void Destroy(nsPresContext* aContext) {
this->~nsStyleList();
aContext->PresShell()->
FreeByObjectID(mozilla::eArenaObjectID_nsStyleList, this);
}
nsChangeHint CalcDifference(const nsStyleList& aOther) const;
static nsChangeHint MaxDifference() {
- return NS_CombineHint(NS_STYLE_HINT_FRAMECHANGE,
- nsChangeHint_NeutralChange);
+ return NS_STYLE_HINT_FRAMECHANGE | nsChangeHint_NeutralChange;
}
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
// 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;
}
@@ -1641,21 +1639,21 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
this->~nsStylePosition();
aContext->PresShell()->
FreeByObjectID(mozilla::eArenaObjectID_nsStylePosition, this);
}
nsChangeHint CalcDifference(const nsStylePosition& aOther,
const nsStyleVisibility* aOldStyleVisibility) const;
static nsChangeHint MaxDifference() {
- return NS_CombineHint(NS_STYLE_HINT_REFLOW,
- nsChangeHint(nsChangeHint_NeutralChange |
- nsChangeHint_RecomputePosition |
- nsChangeHint_UpdateParentOverflow |
- nsChangeHint_UpdateComputedBSize));
+ return NS_STYLE_HINT_REFLOW |
+ nsChangeHint_NeutralChange |
+ nsChangeHint_RecomputePosition |
+ nsChangeHint_UpdateParentOverflow |
+ nsChangeHint_UpdateComputedBSize;
}
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
// CalcDifference can return all of the reflow hints that are
// sometimes handled for descendants as hints not handled for
// descendants.
return nsChangeHint(0);
}
@@ -3058,19 +3056,19 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
void Destroy(nsPresContext* aContext) {
this->~nsStyleUserInterface();
aContext->PresShell()->
FreeByObjectID(mozilla::eArenaObjectID_nsStyleUserInterface, this);
}
nsChangeHint CalcDifference(const nsStyleUserInterface& aOther) const;
static nsChangeHint MaxDifference() {
- return NS_CombineHint(NS_STYLE_HINT_FRAMECHANGE,
- NS_CombineHint(nsChangeHint_UpdateCursor,
- nsChangeHint_NeutralChange));
+ return NS_STYLE_HINT_FRAMECHANGE |
+ nsChangeHint_UpdateCursor |
+ nsChangeHint_NeutralChange;
}
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
// 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;
}
@@ -3147,18 +3145,17 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
void Destroy(nsPresContext* aContext) {
this->~nsStyleColumn();
aContext->PresShell()->
FreeByObjectID(mozilla::eArenaObjectID_nsStyleColumn, this);
}
nsChangeHint CalcDifference(const nsStyleColumn& aOther) const;
static nsChangeHint MaxDifference() {
- return NS_CombineHint(NS_STYLE_HINT_FRAMECHANGE,
- nsChangeHint_NeutralChange);
+ return NS_STYLE_HINT_FRAMECHANGE | nsChangeHint_NeutralChange;
}
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
// 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;
}
@@ -3244,19 +3241,20 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
void Destroy(nsPresContext* aContext) {
this->~nsStyleSVG();
aContext->PresShell()->
FreeByObjectID(mozilla::eArenaObjectID_nsStyleSVG, this);
}
nsChangeHint CalcDifference(const nsStyleSVG& aOther) const;
static nsChangeHint MaxDifference() {
- return NS_CombineHint(NS_CombineHint(nsChangeHint_UpdateEffects,
- NS_CombineHint(nsChangeHint_NeedReflow, nsChangeHint_NeedDirtyReflow)), // XXX remove nsChangeHint_NeedDirtyReflow: bug 876085
- nsChangeHint_RepaintFrame);
+ return nsChangeHint_UpdateEffects |
+ nsChangeHint_NeedReflow |
+ nsChangeHint_NeedDirtyReflow | // XXX remove me: bug 876085
+ nsChangeHint_RepaintFrame;
}
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
// CalcDifference never returns nsChangeHint_NeedReflow as a hint
// not handled for descendants, and never returns
// nsChangeHint_ClearAncestorIntrinsics at all.
return nsChangeHint_NeedReflow;
}