Bug 1340966 Part 3 - Add assertion in SetNextInFlowNeedsReflow(), to verify that it's never called on fully-complete frames draft
authorTing-Yu Lin <tlin@mozilla.com>
Thu, 07 Sep 2017 11:26:44 +0800
changeset 662133 3b12516f5cb90630d58b659e3cdd5b979c4061e0
parent 662132 d4dc0b022c145c272993c154bf2d88800d625dc2
child 730753 255482b459973efdba0a2f6aa2820fd5e3b82d74
push id78960
push userbmo:tlin@mozilla.com
push dateMon, 11 Sep 2017 03:46:33 +0000
bugs1340966, 379349
milestone57.0a1
Bug 1340966 Part 3 - Add assertion in SetNextInFlowNeedsReflow(), to verify that it's never called on fully-complete frames The original version of the comment [1] "you wouldn't set mNextInFlowNeedsReflow when IsComplete() is true" was written before OverflowIncomplete was introduced in bug 379349. So I believe we should assert !IsFullyComplete() in SetNextInFlowNeedsReflow() rather than assert !IsComplete() (as the old comment implies we could). [1] https://hg.mozilla.org/mozilla-central/annotate/9b2a99adc05e/layout/generic/nsIFrame.h#l288 MozReview-Commit-ID: 2yrL79jOV8A
layout/generic/nsIFrame.h
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -284,20 +284,24 @@ public:
     mCompletion = Completion::Incomplete;
   }
   void SetOverflowIncomplete() {
     mCompletion = Completion::OverflowIncomplete;
   }
 
   // mNextInFlowNeedsReflow bit flag means that the next-in-flow is dirty,
   // and also needs to be reflowed. This status only makes sense for a frame
-  // that is not complete, i.e. you wouldn't set mNextInFlowNeedsReflow when
-  // IsComplete() is true.
+  // that is not complete, i.e. you wouldn't call SetNextInFlowNeedsReflow()
+  // when IsFullyComplete() is true.
   bool NextInFlowNeedsReflow() const { return mNextInFlowNeedsReflow; }
-  void SetNextInFlowNeedsReflow() { mNextInFlowNeedsReflow = true; }
+  void SetNextInFlowNeedsReflow() {
+    MOZ_ASSERT(!IsFullyComplete(),
+               "A fully complete frame shouldn't set this bit.");
+    mNextInFlowNeedsReflow = true;
+  }
 
   // mTruncated bit flag means that the part of the frame before the first
   // possible break point was unable to fit in the available space.
   // Therefore, the entire frame should be moved to the next continuation of
   // the parent frame. A frame that begins at the top of the page must never
   // be truncated. Doing so would likely cause an infinite loop.
   bool IsTruncated() const { return mTruncated; }
   void UpdateTruncated(const mozilla::ReflowInput& aReflowInput,