Bug 1228921 - Write nsChangeHint constants using left shifts. r=xidorn
authorL. David Baron <dbaron@dbaron.org>
Mon, 30 Nov 2015 21:37:08 -0800
changeset 274886 baff26beaa869743019dba6fb7e179b9eaba8952
parent 274885 9dde6025527fbf1c44b2ef6cdcfdd7062c51e24a
child 274887 e2e4a5407b8facaf4d05f9ab43ef2d91d119f546
push id29739
push usercbook@mozilla.com
push dateTue, 01 Dec 2015 14:26:30 +0000
treeherdermozilla-central@974fe614d529 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersxidorn
bugs1228921
milestone45.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1228921 - Write nsChangeHint constants using left shifts. r=xidorn This means I don't have to carefully count (or copy and paste) 0s when adding new constants.
layout/base/nsChangeHint.h
--- a/layout/base/nsChangeHint.h
+++ b/layout/base/nsChangeHint.h
@@ -15,189 +15,189 @@
 struct nsCSSSelector;
 
 // Defines for various style related constants
 
 enum nsChangeHint {
   // change was visual only (e.g., COLOR=)
   // Invalidates all descendant frames (including following
   // placeholders to out-of-flow frames).
-  nsChangeHint_RepaintFrame = 0x01,
+  nsChangeHint_RepaintFrame = 1 << 0,
 
   // For reflow, we want flags to give us arbitrary FrameNeedsReflow behavior.
   // just do a FrameNeedsReflow.
-  nsChangeHint_NeedReflow = 0x02,
+  nsChangeHint_NeedReflow = 1 << 1,
 
   // Invalidate intrinsic widths on the frame's ancestors.  Must not be set
   // without setting nsChangeHint_NeedReflow.
-  nsChangeHint_ClearAncestorIntrinsics = 0x04,
+  nsChangeHint_ClearAncestorIntrinsics = 1 << 2,
 
   // Invalidate intrinsic widths on the frame's descendants.  Must not be set
   // without also setting nsChangeHint_ClearAncestorIntrinsics.
-  nsChangeHint_ClearDescendantIntrinsics = 0x08,
+  nsChangeHint_ClearDescendantIntrinsics = 1 << 3,
 
   // Force unconditional reflow of all descendants.  Must not be set without
   // setting nsChangeHint_NeedReflow, but is independent of both the
   // Clear*Intrinsics flags.
-  nsChangeHint_NeedDirtyReflow = 0x10,
+  nsChangeHint_NeedDirtyReflow = 1 << 4,
 
   // change requires view to be updated, if there is one (e.g., clip:).
   // Updates all descendants (including following placeholders to out-of-flows).
-  nsChangeHint_SyncFrameView = 0x20,
+  nsChangeHint_SyncFrameView = 1 << 5,
 
   // The currently shown mouse cursor needs to be updated
-  nsChangeHint_UpdateCursor = 0x40,
+  nsChangeHint_UpdateCursor = 1 << 6,
 
   /**
    * Used when the computed value (a URI) of one or more of an element's
    * filter/mask/clip/etc CSS properties changes, causing the element's frame
    * to start/stop referencing (or reference different) SVG resource elements.
    * (_Not_ used to handle changes to referenced resource elements.) Using this
    * hint results in nsSVGEffects::UpdateEffects being called on the element's
    * frame.
    */
-  nsChangeHint_UpdateEffects = 0x80,
+  nsChangeHint_UpdateEffects = 1 << 7,
 
   /**
    * Visual change only, but the change can be handled entirely by
    * updating the layer(s) for the frame.
    * Updates all descendants (including following placeholders to out-of-flows).
    */
-  nsChangeHint_UpdateOpacityLayer = 0x100,
+  nsChangeHint_UpdateOpacityLayer = 1 << 8,
   /**
    * Updates all descendants. Any placeholder descendants' out-of-flows
    * are also descendants of the transformed frame, so they're updated.
    */
-  nsChangeHint_UpdateTransformLayer = 0x200,
+  nsChangeHint_UpdateTransformLayer = 1 << 9,
 
   /**
    * Change requires frame change (e.g., display:).
    * This subsumes all the above. Reconstructs all frame descendants,
    * including following placeholders to out-of-flows.
    */
-  nsChangeHint_ReconstructFrame = 0x400,
+  nsChangeHint_ReconstructFrame = 1 << 10,
 
   /**
    * The frame's overflow area has changed. Does not update any descendant
    * frames.
    */
-  nsChangeHint_UpdateOverflow = 0x800,
+  nsChangeHint_UpdateOverflow = 1 << 11,
 
   /**
    * The overflow area of the frame and all of its descendants has changed. This
    * can happen through a text-decoration change.   
    */
-  nsChangeHint_UpdateSubtreeOverflow = 0x1000,
+  nsChangeHint_UpdateSubtreeOverflow = 1 << 12,
 
   /**
    * The frame's overflow area has changed, through a change in its transform.
    * In other words, the frame's pre-transform overflow is unchanged, but
    * its post-transform overflow has changed, and thus its effect on its
    * parent's overflow has changed.  If the pre-transform overflow has
    * changed, see nsChangeHint_UpdateOverflow.
    * Does not update any descendant frames.
    */
-  nsChangeHint_UpdatePostTransformOverflow = 0x2000,
+  nsChangeHint_UpdatePostTransformOverflow = 1 << 13,
 
   /**
    * This frame's effect on its parent's overflow area has changed.
    * (But neither its pre-transform nor post-transform overflow have
    * changed; if those are the case, see
    * nsChangeHint_UpdatePostTransformOverflow.)
    */
-  nsChangeHint_UpdateParentOverflow = 0x4000,
+  nsChangeHint_UpdateParentOverflow = 1 << 14,
 
   /**
    * The children-only transform of an SVG frame changed, requiring the
    * overflow rects of the frame's immediate children to be updated.
    */
-  nsChangeHint_ChildrenOnlyTransform = 0x8000,
+  nsChangeHint_ChildrenOnlyTransform = 1 << 15,
 
   /**
    * The frame's offsets have changed, while its dimensions might have
    * changed as well.  This hint is used for positioned frames if their
    * offset changes.  If we decide that the dimensions are likely to
    * change, this will trigger a reflow.
    *
    * Note that this should probably be used in combination with
    * nsChangeHint_UpdateOverflow in order to get the overflow areas of
    * the ancestors updated as well.
    */
-  nsChangeHint_RecomputePosition = 0x10000,
+  nsChangeHint_RecomputePosition = 1 << 16,
 
   /**
    * Behaves like ReconstructFrame, but only if the frame has descendants
    * that are absolutely or fixed position. Use this hint when a style change
    * has changed whether the frame is a container for fixed-pos or abs-pos
    * elements, but reframing is otherwise not needed.
    */
-  nsChangeHint_UpdateContainingBlock = 0x20000,
+  nsChangeHint_UpdateContainingBlock = 1 << 17,
 
   /**
    * This change hint has *no* change handling behavior.  However, it
    * exists to be a non-inherited hint, because when the border-style
    * changes, and it's inherited by a child, that might require a reflow
    * due to the border-width change on the child.
    */
-  nsChangeHint_BorderStyleNoneChange = 0x40000,
+  nsChangeHint_BorderStyleNoneChange = 1 << 18,
 
   /**
    * SVG textPath needs to be recomputed because the path has changed.
    * This means that the glyph positions of the text need to be recomputed.
    */
-  nsChangeHint_UpdateTextPath = 0x80000,
+  nsChangeHint_UpdateTextPath = 1 << 19,
 
   /**
    * This will schedule an invalidating paint. This is useful if something
    * has changed which will be invalidated by DLBI.
    */
-  nsChangeHint_SchedulePaint = 0x100000,
+  nsChangeHint_SchedulePaint = 1 << 20,
 
   /**
    * A hint reflecting that style data changed with no change handling
    * behavior.  We need to return this, rather than NS_STYLE_HINT_NONE,
    * so that certain optimizations that manipulate the style context tree are
    * correct.
    *
    * nsChangeHint_NeutralChange must be returned by CalcDifference on a given
    * style struct if the data in the style structs are meaningfully different
    * and if no other change hints are returned.  If any other change hints are
    * set, then nsChangeHint_NeutralChange need not also be included, but it is
    * safe to do so.  (An example of style structs having non-meaningfully
    * different data would be cached information that would be re-calculated
    * to the same values, such as nsStyleBorder::mSubImages.)
    */
-  nsChangeHint_NeutralChange = 0x200000,
+  nsChangeHint_NeutralChange = 1 << 21,
 
   /**
    * This will cause rendering observers to be invalidated.
    */
-  nsChangeHint_InvalidateRenderingObservers = 0x400000,
+  nsChangeHint_InvalidateRenderingObservers = 1 << 22,
 
   /**
    * 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,
+  nsChangeHint_ReflowChangesSizeOrPosition = 1 << 23,
 
   /**
    * Indicates that the style changes the computed BSize --- e.g. 'height'.
    */
-  nsChangeHint_UpdateComputedBSize = 0x1000000,
+  nsChangeHint_UpdateComputedBSize = 1 << 24,
 
   /**
    * Indicates that the 'opacity' property changed between 1 and non-1.
    *
    * Used as extra data for handling UpdateOpacityLayer hints.
    *
    * Note that we do not send this hint if the non-1 value was 0.99 or
    * greater, since in that case we send a RepaintFrame hint instead.
    */
-  nsChangeHint_UpdateUsesOpacity = 0x2000000,
+  nsChangeHint_UpdateUsesOpacity = 1 << 25,
 
   // IMPORTANT NOTE: When adding new hints, consider whether you need to
   // add them to NS_HintsNotHandledForDescendantsIn() below.  Please also
   // add them to RestyleManager::ChangeHintToString.
 };
 
 // Redefine these operators to return nothing. This will catch any use
 // of these operators on hints. We should not be using these operators