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 488658 c673b6f64457db9dba65a2cc235b6a38f29aef14
parent 488657 70f6cffb8052574210987ad09ffb3da98fadf548
child 488663 edb57a49546ffb8911e718059e991342d3fd74be
push id9734
push usershindli@mozilla.com
push dateThu, 30 Aug 2018 12:18:07 +0000
treeherdermozilla-beta@71c71ab3afae [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1485495
milestone63.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 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());
 }