Bug 1672007 - Remove dead DEBUG_REFLOW code. r=emilio
authorTing-Yu Lin <tlin@mozilla.com>
Mon, 19 Oct 2020 18:59:25 +0000
changeset 553469 681a0c4f3d6f27fbd4c29c1b2783aa60b29881b0
parent 553468 e78132f19d4f604502179305f53a5f2781e6fbcf
child 553470 e34634758f51dbe626c14a21ab333e7ffd1e4c60
push id128931
push useraethanyc@gmail.com
push dateMon, 19 Oct 2020 21:03:46 +0000
treeherderautoland@681a0c4f3d6f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1672007, 300030
milestone83.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 1672007 - Remove dead DEBUG_REFLOW code. r=emilio For future archaeologist: `eReflowReason` used in `nsAdaptorPrintReason` was originally defined in nsHTMLReflowState.h (today's ReflowInput.h), and was removed in Bug 300030 https://github.com/mozilla/gecko-dev/commit/31f1898810f733c40bfe3fd4b25295885feb2e39 Differential Revision: https://phabricator.services.mozilla.com/D94042
layout/generic/nsIFrame.cpp
layout/xul/nsDocElementBoxFrame.cpp
layout/xul/nsRootBoxFrame.cpp
layout/xul/nsSprocketLayout.cpp
--- a/layout/generic/nsIFrame.cpp
+++ b/layout/generic/nsIFrame.cpp
@@ -10330,24 +10330,16 @@ nsresult nsIFrame::DoXULLayout(nsBoxLayo
 }
 
 void nsIFrame::BoxReflow(nsBoxLayoutState& aState, nsPresContext* aPresContext,
                          ReflowOutput& aDesiredSize,
                          gfxContext* aRenderingContext, nscoord aX, nscoord aY,
                          nscoord aWidth, nscoord aHeight, bool aMoveFrame) {
   DO_GLOBAL_REFLOW_COUNT("nsBoxToBlockAdaptor");
 
-#ifdef DEBUG_REFLOW
-  nsAdaptorAddIndents();
-  printf("Reflowing: ");
-  mFrame->ListTag(stdout);
-  printf("\n");
-  gIndent2++;
-#endif
-
   nsBoxLayoutMetrics* metrics = BoxMetrics();
   if (MOZ_UNLIKELY(!metrics)) {
     // Can't proceed without BoxMetrics. This should only happen if something
     // is seriously broken, e.g. if we try to do XUL layout on a non-XUL frame.
     // (If this is a content process, we'll abort even in release builds,
     // because XUL layout mixup is extra surprising in content, and aborts are
     // less catastrophic in content vs. in chrome.)
     MOZ_RELEASE_ASSERT(!XRE_IsContentProcess(),
@@ -10507,25 +10499,16 @@ void nsIFrame::BoxReflow(nsBoxLayoutStat
       if (nsLayoutUtils::FontSizeInflationEnabled(aPresContext)) {
         this->MarkSubtreeDirty();
       }
     }
     if (metrics->mLastSize.height != aHeight) {
       reflowInput.SetVResize(true);
     }
 
-#ifdef DEBUG_REFLOW
-    nsAdaptorAddIndents();
-    printf("Size=(%d,%d)\n", reflowInput.ComputedWidth(),
-           reflowInput.ComputedHeight());
-    nsAdaptorAddIndents();
-    nsAdaptorPrintReason(reflowInput);
-    printf("\n");
-#endif
-
     // place the child and reflow
 
     Reflow(aPresContext, aDesiredSize, reflowInput, status);
 
     NS_ASSERTION(status.IsComplete(), "bad status");
 
     ReflowChildFlags layoutFlags = aState.LayoutFlags();
     nsContainerFrame::FinishReflowChild(
@@ -10542,33 +10525,18 @@ void nsIFrame::BoxReflow(nsBoxLayoutStat
       } else
         metrics->mAscent = aDesiredSize.BlockStartAscent();
     }
 
   } else {
     aDesiredSize.SetBlockStartAscent(metrics->mBlockAscent);
   }
 
-#ifdef DEBUG_REFLOW
-  if (aHeight != NS_UNCONSTRAINEDSIZE && aDesiredSize.Height() != aHeight) {
-    nsAdaptorAddIndents();
-    printf("*****got taller!*****\n");
-  }
-  if (aWidth != NS_UNCONSTRAINEDSIZE && aDesiredSize.Width() != aWidth) {
-    nsAdaptorAddIndents();
-    printf("*****got wider!******\n");
-  }
-#endif
-
   metrics->mLastSize.width = aDesiredSize.Width();
   metrics->mLastSize.height = aDesiredSize.Height();
-
-#ifdef DEBUG_REFLOW
-  gIndent2--;
-#endif
 }
 
 nsBoxLayoutMetrics* nsIFrame::BoxMetrics() const {
   nsBoxLayoutMetrics* metrics = GetProperty(BoxMetricsProperty());
   NS_ASSERTION(
       metrics,
       "A box layout method was called but InitBoxMetrics was never called");
   return metrics;
@@ -11279,65 +11247,16 @@ nsIFrame::PhysicalAxes nsIFrame::ShouldA
 
   // If we're paginated and a block, and have NS_BLOCK_CLIP_PAGINATED_OVERFLOW
   // set, then we want to clip our overflow.
   bool clip = HasAnyStateBits(NS_BLOCK_CLIP_PAGINATED_OVERFLOW) &&
               PresContext()->IsPaginated() && IsBlockFrame();
   return clip ? PhysicalAxes::Both : PhysicalAxes::None;
 }
 
-// Box layout debugging
-#ifdef DEBUG_REFLOW
-int32_t gIndent2 = 0;
-
-void nsAdaptorAddIndents() {
-  for (int32_t i = 0; i < gIndent2; i++) {
-    printf(" ");
-  }
-}
-
-void nsAdaptorPrintReason(ReflowInput& aReflowInput) {
-  char* reflowReasonString;
-
-  switch (aReflowInput.reason) {
-    case eReflowReason_Initial:
-      reflowReasonString = "initial";
-      break;
-
-    case eReflowReason_Resize:
-      reflowReasonString = "resize";
-      break;
-    case eReflowReason_Dirty:
-      reflowReasonString = "dirty";
-      break;
-    case eReflowReason_StyleChange:
-      reflowReasonString = "stylechange";
-      break;
-    case eReflowReason_Incremental: {
-      switch (aReflowInput.reflowCommand->Type()) {
-        case eReflowType_StyleChanged:
-          reflowReasonString = "incremental (StyleChanged)";
-          break;
-        case eReflowType_ReflowDirty:
-          reflowReasonString = "incremental (ReflowDirty)";
-          break;
-        default:
-          reflowReasonString = "incremental (Unknown)";
-      }
-    } break;
-    default:
-      reflowReasonString = "unknown";
-      break;
-  }
-
-  printf("%s", reflowReasonString);
-}
-
-#endif
-
 #ifdef DEBUG
 static void GetTagName(nsIFrame* aFrame, nsIContent* aContent, int aResultSize,
                        char* aResult) {
   if (aContent) {
     snprintf(aResult, aResultSize, "%s@%p",
              nsAtomCString(aContent->NodeInfo()->NameAtom()).get(), aFrame);
   } else {
     snprintf(aResult, aResultSize, "@%p", aFrame);
--- a/layout/xul/nsDocElementBoxFrame.cpp
+++ b/layout/xul/nsDocElementBoxFrame.cpp
@@ -15,18 +15,16 @@
 #include "nsStyleConsts.h"
 #include "nsGkAtoms.h"
 #include "nsBoxFrame.h"
 #include "nsStackLayout.h"
 #include "nsIAnonymousContentCreator.h"
 #include "nsNodeInfoManager.h"
 #include "nsContentCreatorFunctions.h"
 
-//#define DEBUG_REFLOW
-
 using namespace mozilla;
 using namespace mozilla::dom;
 
 class nsDocElementBoxFrame final : public nsBoxFrame,
                                    public nsIAnonymousContentCreator {
  public:
   virtual void DestroyFrom(nsIFrame* aDestructRoot,
                            PostDestroyData& aPostDestroyData) override;
--- a/layout/xul/nsRootBoxFrame.cpp
+++ b/layout/xul/nsRootBoxFrame.cpp
@@ -17,18 +17,16 @@
 #include "mozilla/BasicEvents.h"
 #include "mozilla/DisplayPortUtils.h"
 #include "mozilla/PresShell.h"
 
 using namespace mozilla;
 
 // Interface IDs
 
-//#define DEBUG_REFLOW
-
 // static
 nsIPopupContainer* nsIPopupContainer::GetPopupContainer(PresShell* aPresShell) {
   if (!aPresShell) {
     return nullptr;
   }
   nsIFrame* rootFrame = aPresShell->GetRootFrame();
   if (!rootFrame) {
     return nullptr;
@@ -139,31 +137,23 @@ void nsRootBoxFrame::RemoveFrame(ChildLi
   NS_ASSERTION(aListID == kPrincipalList, "unexpected child list ID");
   if (aOldFrame == mFrames.FirstChild()) {
     nsBoxFrame::RemoveFrame(aListID, aOldFrame);
   } else {
     MOZ_CRASH("unknown aOldFrame");
   }
 }
 
-#ifdef DEBUG_REFLOW
-int32_t gReflows = 0;
-#endif
-
 void nsRootBoxFrame::Reflow(nsPresContext* aPresContext,
                             ReflowOutput& aDesiredSize,
                             const ReflowInput& aReflowInput,
                             nsReflowStatus& aStatus) {
   DO_GLOBAL_REFLOW_COUNT("nsRootBoxFrame");
   MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
 
-#ifdef DEBUG_REFLOW
-  gReflows++;
-  printf("----Reflow %d----\n", gReflows);
-#endif
   return nsBoxFrame::Reflow(aPresContext, aDesiredSize, aReflowInput, aStatus);
 }
 
 void nsRootBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
                                       const nsDisplayListSet& aLists) {
   if (mContent && mContent->GetProperty(nsGkAtoms::DisplayPortMargins)) {
     // The XUL document's root element may have displayport margins set in
     // ChromeProcessController::InitializeRoot, and we should to supply the
--- a/layout/xul/nsSprocketLayout.cpp
+++ b/layout/xul/nsSprocketLayout.cpp
@@ -245,23 +245,16 @@ nsSprocketLayout::XULLayout(nsIFrame* aB
   // do another pass.
   bool childResized = false;
 
   // |passes| stores our number of passes.  If for any reason we end up doing
   // more than, say, 10 passes, we assert to indicate that something is
   // seriously screwed up.
   passes = 0;
   do {
-#ifdef DEBUG_REFLOW
-    if (passes > 0) {
-      AddIndents();
-      printf("ChildResized doing pass: %d\n", passes);
-    }
-#endif
-
     // Always assume that we're done.  This will change if, for example,
     // children don't stay the same size after being flowed.
     finished = true;
 
     // Handle box packing.
     HandleBoxPack(aBox, frameState, x, y, originalClientRect, clientRect);
 
     // Now that packing is taken care of we set up a few additional