Bug 1291707 part 4 - Not recalc quotes and counters in EndUpdate. r=bz draft
authorXidorn Quan <xidorn+moz@upsuper.org>
Mon, 08 Aug 2016 22:52:13 +1000
changeset 400845 8ffea7f768b79315c6a4214228a14a3d2a3bd742
parent 400844 00251e8763546c2cccdf9e637e5c58ea38a26612
child 528341 83e946a5a3541e8d2a034d145155c14a02b617d5
push id26297
push userxquan@mozilla.com
push dateMon, 15 Aug 2016 23:30:49 +0000
reviewersbz
bugs1291707
milestone51.0a1
Bug 1291707 part 4 - Not recalc quotes and counters in EndUpdate. r=bz It will be called in the next flush, so no need to do it eagerly. MozReview-Commit-ID: 1B8pzn0dqBO
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsCSSFrameConstructor.h
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -1530,17 +1530,19 @@ nsCSSFrameConstructor::nsCSSFrameConstru
   : nsFrameManager(aPresShell)
   , mDocument(aDocument)
   , mRootElementFrame(nullptr)
   , mRootElementStyleFrame(nullptr)
   , mDocElementContainingBlock(nullptr)
   , mGfxScrollFrame(nullptr)
   , mPageSequenceFrame(nullptr)
   , mCurrentDepth(0)
+#ifdef DEBUG
   , mUpdateCount(0)
+#endif
   , mQuotesDirty(false)
   , mCountersDirty(false)
   , mIsDestroyingFrameTree(false)
   , mHasRootAbsPosContainingBlock(false)
   , mAlwaysCreateFramesForIgnorableWhitespace(false)
 {
 #ifdef DEBUG
   static bool gFirstTime = true;
@@ -8601,31 +8603,28 @@ nsCSSFrameConstructor::BeginUpdate() {
 
   nsRootPresContext* rootPresContext =
     mPresShell->GetPresContext()->GetRootPresContext();
   if (rootPresContext) {
     rootPresContext->IncrementDOMGeneration();
   }
 
   ++sGlobalGenerationNumber;
+#ifdef DEBUG
   ++mUpdateCount;
+#endif
 }
 
 void
 nsCSSFrameConstructor::EndUpdate()
 {
-  if (mUpdateCount == 1) {
-    // This is the end of our last update.  Before we decrement
-    // mUpdateCount, recalc quotes and counters as needed.
-
-    RecalcQuotesAndCounters();
-    NS_ASSERTION(mUpdateCount == 1, "Odd update count");
-  }
+#ifdef DEBUG
   NS_ASSERTION(mUpdateCount, "Negative mUpdateCount!");
   --mUpdateCount;
+#endif
 }
 
 void
 nsCSSFrameConstructor::RecalcQuotesAndCounters()
 {
   if (mQuotesDirty) {
     mQuotesDirty = false;
     mQuoteList.RecalcAll();
--- a/layout/base/nsCSSFrameConstructor.h
+++ b/layout/base/nsCSSFrameConstructor.h
@@ -2070,17 +2070,19 @@ private:
   // the real "initial containing block" according to CSS 2.1.
   nsContainerFrame*   mDocElementContainingBlock;
   nsIFrame*           mGfxScrollFrame;
   nsIFrame*           mPageSequenceFrame;
   nsQuoteList         mQuoteList;
   nsCounterManager    mCounterManager;
   // Current ProcessChildren depth.
   uint16_t            mCurrentDepth;
+#ifdef DEBUG
   uint16_t            mUpdateCount;
+#endif
   bool                mQuotesDirty : 1;
   bool                mCountersDirty : 1;
   bool                mIsDestroyingFrameTree : 1;
   // This is true if mDocElementContainingBlock supports absolute positioning
   bool                mHasRootAbsPosContainingBlock : 1;
   bool                mAlwaysCreateFramesForIgnorableWhitespace : 1;
 
   nsCOMPtr<nsILayoutHistoryState> mTempFrameTreeState;