Bug 1485495 - Use AutoRestore to restore aState.mAdditionalStateBits. r=dholbert
authorTing-Yu Lin <tlin@mozilla.com>
Mon, 27 Aug 2018 18:38:58 +0000
changeset 481932 c673b6f64457db9dba65a2cc235b6a38f29aef14
parent 481931 70f6cffb8052574210987ad09ffb3da98fadf548
child 481933 edb57a49546ffb8911e718059e991342d3fd74be
push id232
push userfmarier@mozilla.com
push dateWed, 05 Sep 2018 20:45:54 +0000
reviewersdholbert
bugs1485495
milestone63.0a1
Bug 1485495 - Use AutoRestore to restore aState.mAdditionalStateBits. r=dholbert Depends On D4020 Differential Revision: https://phabricator.services.mozilla.com/D4021
layout/base/nsCSSFrameConstructor.cpp
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -5938,17 +5938,17 @@ nsCSSFrameConstructor::ConstructFramesFr
                        aFrameItems);
     return;
   }
 
   // Start background loads during frame construction so that we're
   // guaranteed that they will be started before onload fires.
   computedStyle->StartBackgroundImageLoads();
 
-  nsFrameState savedStateBits = aState.mAdditionalStateBits;
+  AutoRestore<nsFrameState> savedStateBits(aState.mAdditionalStateBits);
   if (item.mIsGeneratedContent) {
     // Ensure that frames created here are all tagged with
     // NS_FRAME_GENERATED_CONTENT.
     aState.mAdditionalStateBits |= NS_FRAME_GENERATED_CONTENT;
   }
 
   // XXXbz maybe just inline ConstructFrameFromItemInternal here or something?
   ConstructFrameFromItemInternal(item, aState, adjParentFrame, aFrameItems);
@@ -5957,18 +5957,16 @@ nsCSSFrameConstructor::ConstructFramesFr
     // This corresponds to the AddRef in AddFrameConstructionItemsInternal.
     // The frame owns the generated content now.
     item.mContent->Release();
 
     // Now that we've passed ownership of item.mContent to the frame, unset
     // our generated content flag so we don't release or unbind it ourselves.
     item.mIsGeneratedContent = false;
   }
-
-  aState.mAdditionalStateBits = savedStateBits;
 }
 
 
 inline bool
 IsRootBoxFrame(nsIFrame *aFrame)
 {
   return (aFrame->IsRootFrame());
 }