Bug 1475033 part 1 - Rename nsChangeHint_CSSOverflowChange to nsChangeHint_ScrollbarChange. r?heycam draft
authorXidorn Quan <me@upsuper.org>
Fri, 03 Aug 2018 16:42:33 +1000
changeset 829836 08831f306cf1b495e4a647746d58eac0e7e7e3d9
parent 829835 bbc61c879b6064bb6ea727699487b515c8de7f70
child 829837 e1d6f590fef8dda4db589bc16f74ff21e7e6badf
push id118795
push userxquan@mozilla.com
push dateThu, 16 Aug 2018 22:58:08 +0000
reviewersheycam
bugs1475033
milestone63.0a1
Bug 1475033 part 1 - Rename nsChangeHint_CSSOverflowChange to nsChangeHint_ScrollbarChange. r?heycam Prepare for scrollbar-width which should trigger the same kind of change. MozReview-Commit-ID: 1n9Y9bobBkJ
layout/base/RestyleManager.cpp
layout/base/nsChangeHint.h
layout/style/nsStyleStruct.cpp
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -594,17 +594,17 @@ RestyleManager::ChangeHintToString(nsCha
     "UpdateTransformLayer", "ReconstructFrame", "UpdateOverflow",
     "UpdateSubtreeOverflow", "UpdatePostTransformOverflow",
     "UpdateParentOverflow",
     "ChildrenOnlyTransform", "RecomputePosition", "UpdateContainingBlock",
     "BorderStyleNoneChange", "UpdateTextPath", "SchedulePaint",
     "NeutralChange", "InvalidateRenderingObservers",
     "ReflowChangesSizeOrPosition", "UpdateComputedBSize",
     "UpdateUsesOpacity", "UpdateBackgroundPosition",
-    "AddOrRemoveTransform", "CSSOverflowChange",
+    "AddOrRemoveTransform", "ScrollbarChange",
     "UpdateWidgetProperties", "UpdateTableCellSpans",
     "VisibilityChange"
   };
   static_assert(nsChangeHint_AllHints ==
                   static_cast<uint32_t>((1ull << ArrayLength(names)) - 1),
                 "Name list doesn't match change hints.");
   uint32_t hint = aHint & static_cast<uint32_t>((1ull << ArrayLength(names)) - 1);
   uint32_t rest = aHint & ~static_cast<uint32_t>((1ull << ArrayLength(names)) - 1);
@@ -1350,21 +1350,21 @@ RestyleManager::ProcessRestyledFrames(ns
     mDestroyedFrames = MakeUnique<nsTHashtable<nsPtrHashKey<const nsIFrame>>>();
   }
 
   AUTO_PROFILER_LABEL("RestyleManager::ProcessRestyledFrames", LAYOUT);
 
   nsPresContext* presContext = PresContext();
   nsCSSFrameConstructor* frameConstructor = presContext->FrameConstructor();
 
-  // Handle nsChangeHint_CSSOverflowChange, by either updating the
+  // Handle nsChangeHint_ScrollbarChange, by either updating the
   // scrollbars on the viewport, or upgrading the change hint to frame-reconstruct.
   for (nsStyleChangeData& data : aChangeList) {
-    if (data.mHint & nsChangeHint_CSSOverflowChange) {
-      data.mHint &= ~nsChangeHint_CSSOverflowChange;
+    if (data.mHint & nsChangeHint_ScrollbarChange) {
+      data.mHint &= ~nsChangeHint_ScrollbarChange;
       bool doReconstruct = true; // assume the worst
 
       // Only bother with this if we're html/body, since:
       //  (a) It'd be *expensive* to reframe these particular nodes.  They're
       //      at the root, so reframing would mean rebuilding the world.
       //  (b) It's often *unnecessary* to reframe for "overflow" changes on
       //      these particular nodes.  In general, the only reason we reframe
       //      for "overflow" changes is so we can construct (or destroy) a
--- a/layout/base/nsChangeHint.h
+++ b/layout/base/nsChangeHint.h
@@ -217,24 +217,26 @@ enum nsChangeHint : uint32_t {
 
   /**
    * Indicates that a frame has changed to or from having the CSS
    * transform property set.
    */
   nsChangeHint_AddOrRemoveTransform = 1 << 27,
 
   /**
-   * Indicates that the overflow-x and/or overflow-y property changed.
+   * Indicates that the presence of scrollbars might have changed.
+   *
+   * This happens when at least one of overflow-{x,y} properties changed.
    *
    * In most cases, this is equivalent to nsChangeHint_ReconstructFrame. But
    * in some special cases where the change is really targeting the viewport's
    * scrollframe, this is instead equivalent to nsChangeHint_AllReflowHints
    * (because the viewport always has an associated scrollframe).
    */
-  nsChangeHint_CSSOverflowChange = 1 << 28,
+  nsChangeHint_ScrollbarChange = 1 << 28,
 
   /**
    * Indicates that nsIFrame::UpdateWidgetProperties needs to be called.
    * This is used for -moz-window-* properties.
    */
   nsChangeHint_UpdateWidgetProperties = 1 << 29,
 
   /**
@@ -351,17 +353,17 @@ inline nsChangeHint operator^=(nsChangeH
   nsChangeHint_UpdateTextPath |                            \
   nsChangeHint_VisibilityChange                            \
 )
 
 // The change hints that are never handled for descendants.
 #define nsChangeHint_Hints_NeverHandledForDescendants (    \
   nsChangeHint_BorderStyleNoneChange |                     \
   nsChangeHint_ChildrenOnlyTransform |                     \
-  nsChangeHint_CSSOverflowChange |                         \
+  nsChangeHint_ScrollbarChange |                           \
   nsChangeHint_InvalidateRenderingObservers |              \
   nsChangeHint_RecomputePosition |                         \
   nsChangeHint_UpdateBackgroundPosition |                  \
   nsChangeHint_UpdateComputedBSize |                       \
   nsChangeHint_UpdateContainingBlock |                     \
   nsChangeHint_UpdateEffects |                             \
   nsChangeHint_UpdateOpacityLayer |                        \
   nsChangeHint_UpdateOverflow |                            \
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -3766,17 +3766,17 @@ nsStyleDisplay::CalcDifference(const nsS
     // values such as 'none'.) We need to reframe since we want to use
     // nsTextControlFrame instead of nsNumberControlFrame if the author
     // specifies 'textfield'.
     return nsChangeHint_ReconstructFrame;
   }
 
   if (mOverflowX != aNewData.mOverflowX
       || mOverflowY != aNewData.mOverflowY) {
-    hint |= nsChangeHint_CSSOverflowChange;
+    hint |= nsChangeHint_ScrollbarChange;
   }
 
   /* Note: When mScrollBehavior, mScrollSnapTypeX, mScrollSnapTypeY,
    * mScrollSnapPointsX, mScrollSnapPointsY, or mScrollSnapDestination are
    * changed, nsChangeHint_NeutralChange is not sufficient to enter
    * nsCSSFrameConstructor::PropagateScrollToViewport. By using the same hint
    * as used when the overflow css property changes,
    * nsChangeHint_ReconstructFrame, PropagateScrollToViewport will be called.
@@ -3803,17 +3803,17 @@ nsStyleDisplay::CalcDifference(const nsS
       // float area changes arbitrarily along its block axis, more is required
       // to get the siblings to adjust properly. Hinting overflow change is
       // sufficient to trigger the correct calculation, but may be too
       // heavyweight.
 
       // XXX What is the minimum hint to ensure mShapeInfo is regenerated in
       // the next reflow?
       hint |= nsChangeHint_ReflowHintsForFloatAreaChange |
-              nsChangeHint_CSSOverflowChange;
+              nsChangeHint_ScrollbarChange;
     } else {
       // shape-outside or shape-margin or shape-image-threshold changed,
       // but we don't need to reflow because we're not floating.
       hint |= nsChangeHint_NeutralChange;
     }
   }
 
   if (mVerticalAlign != aNewData.mVerticalAlign) {