Bug 253889: DeCOMtaminate nsIPresShell - IsReflowLocked(). r=roc
authorCraig Topper <craig.topper@gmail.com>
Wed, 31 Mar 2010 08:43:27 -0400
changeset 40048 690ed9c17c5eaa00288ad17a394648946326dad5
parent 40047 f7195dc9a66cae0d1e22325dc02f8e881787e6aa
child 40049 7ed352935dda507d52e9348eed12e289bd4c2ee8
push idunknown
push userunknown
push dateunknown
reviewersroc
bugs253889
milestone1.9.3a4pre
Bug 253889: DeCOMtaminate nsIPresShell - IsReflowLocked(). r=roc
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsIPresShell.h
layout/base/nsPresContext.cpp
layout/base/nsPresShell.cpp
layout/svg/base/src/nsSVGForeignObjectFrame.cpp
layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -10734,19 +10734,17 @@ nsCSSFrameConstructor::ReframeContaining
   if (gNoisyContentUpdates) {
     printf("nsCSSFrameConstructor::ReframeContainingBlock frame=%p\n",
            static_cast<void*>(aFrame));
   }
 #endif
 
   // XXXbz how exactly would we get here while isReflowing anyway?  Should this
   // whole test be ifdef DEBUG?
-  PRBool isReflowing;
-  mPresShell->IsReflowLocked(&isReflowing);
-  if(isReflowing) {
+  if (mPresShell->IsReflowLocked()) {
     // don't ReframeContainingBlock, this will result in a crash
     // if we remove a tree that's in reflow - see bug 121368 for testcase
     NS_ERROR("Atemptted to nsCSSFrameConstructor::ReframeContainingBlock during a Reflow!!!");
     return NS_OK;
   }
 
   // Get the first "normal" ancestor of the target frame.
   nsIFrame* containingBlock = GetIBContainingBlockFor(aFrame);
--- a/layout/base/nsIPresShell.h
+++ b/layout/base/nsIPresShell.h
@@ -664,17 +664,17 @@ public:
    */
 
   virtual NS_HIDDEN_(nsresult) CaptureHistoryState(nsILayoutHistoryState** aLayoutHistoryState, PRBool aLeavingPage = PR_FALSE) = 0;
 
   /**
    * Determine if reflow is currently locked
    * @param aIsReflowLocked returns PR_TRUE if reflow is locked, PR_FALSE otherwise
    */
-  NS_IMETHOD IsReflowLocked(PRBool* aIsLocked) = 0;  
+  virtual NS_HIDDEN_(PRBool) IsReflowLocked() const = 0;
 
   /**
    * Called to find out if painting is suppressed for this presshell.  If it is suppressd,
    * we don't allow the painting of any layer but the background, and we don't
    * recur into our children.
    */
   NS_IMETHOD IsPaintingSuppressed(PRBool* aResult)=0;
 
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -1841,19 +1841,17 @@ nsPresContext::GetUserFontSetInternal()
     // @font-face rules, then we will call StyleChangeReflow in
     // FlushUserFontSet.  If we're in the middle of reflow,
     // that's a bad thing to do, and the caller was responsible for
     // flushing first.  If we're not (e.g., in frame construction), it's
     // ok.
 #ifdef DEBUG
     {
       PRBool inReflow;
-      NS_ASSERTION(!userFontSetGottenBefore ||
-                   (NS_SUCCEEDED(mShell->IsReflowLocked(&inReflow)) &&
-                    !inReflow),
+      NS_ASSERTION(!userFontSetGottenBefore || !mShell->IsReflowLocked(),
                    "FlushUserFontSet should have been called first");
     }
 #endif
     FlushUserFontSet();
   }
 
   return mUserFontSet;
 }
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -754,17 +754,17 @@ public:
   virtual nsresult RemoveOverrideStyleSheet(nsIStyleSheet *aSheet);
 
   NS_IMETHOD HandleEventWithTarget(nsEvent* aEvent, nsIFrame* aFrame,
                                    nsIContent* aContent,
                                    nsEventStatus* aStatus);
   virtual NS_HIDDEN_(nsIFrame*) GetEventTargetFrame();
   virtual NS_HIDDEN_(already_AddRefed<nsIContent>) GetEventTargetContent(nsEvent* aEvent);
 
-  NS_IMETHOD IsReflowLocked(PRBool* aIsLocked);  
+  virtual NS_HIDDEN_(PRBool) IsReflowLocked() const;
 
   virtual nsresult ReconstructFrames(void);
   virtual void Freeze();
   virtual void Thaw();
   virtual void FireOrClearDelayedEvents(PRBool aFireEvents);
 
   virtual nsIFrame* GetFrameForPoint(nsIFrame* aFrame, nsPoint aPt);
 
@@ -4692,21 +4692,20 @@ PresShell::FlushPendingNotifications(moz
       // from possibly flushing out reflows due to invalidates being processed
       // at the end of this view batch.
       updateFlags = NS_VMREFRESH_DEFERRED;
     }
     batch.EndUpdateViewBatch(updateFlags);
   }
 }
 
-NS_IMETHODIMP
-PresShell::IsReflowLocked(PRBool* aIsReflowLocked) 
-{
-  *aIsReflowLocked = mIsReflowing;
-  return NS_OK;
+PRBool
+PresShell::IsReflowLocked() const
+{
+  return mIsReflowing;
 }
 
 void
 PresShell::CharacterDataChanged(nsIDocument *aDocument,
                                 nsIContent*  aContent,
                                 CharacterDataChangeInfo* aInfo)
 {
   NS_PRECONDITION(!mIsDocumentGone, "Unexpected CharacterDataChanged");
--- a/layout/svg/base/src/nsSVGForeignObjectFrame.cpp
+++ b/layout/svg/base/src/nsSVGForeignObjectFrame.cpp
@@ -395,19 +395,17 @@ nsSVGForeignObjectFrame::NotifySVGChange
   if (reflow) {
     // If we're called while the PresShell is handling reflow events then we
     // must have been called as a result of the NotifyViewportChange() call in
     // our nsSVGOuterSVGFrame's Reflow() method. We must not call RequestReflow
     // at this point (i.e. during reflow) because it could confuse the
     // PresShell and prevent it from reflowing us properly in future. Besides
     // that, nsSVGOuterSVGFrame::DidReflow will take care of reflowing us
     // synchronously, so there's no need.
-    PRBool reflowing;
-    PresContext()->PresShell()->IsReflowLocked(&reflowing);
-    if (!reflowing) {
+    if (!PresContext()->PresShell()->IsReflowLocked()) {
       UpdateGraphic(); // update mRect before requesting reflow
       RequestReflow(nsIPresShell::eResize);
     }
   }
 }
 
 NS_IMETHODIMP
 nsSVGForeignObjectFrame::NotifyRedrawSuspended()
--- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
+++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
@@ -365,19 +365,17 @@ nsTreeBodyFrame::EnsureBoxObject()
     }
   }
 }
 
 void
 nsTreeBodyFrame::EnsureView()
 {
   if (!mView) {
-    PRBool isInReflow;
-    PresContext()->PresShell()->IsReflowLocked(&isInReflow);
-    if (isInReflow) {
+    if (PresContext()->PresShell()->IsReflowLocked()) {
       if (!mReflowCallbackPosted) {
         mReflowCallbackPosted = PR_TRUE;
         PresContext()->PresShell()->PostReflowCallback(this);
       }
       return;
     }
     nsCOMPtr<nsIBoxObject> box = do_QueryInterface(mTreeBoxObject);
     if (box) {
@@ -527,19 +525,17 @@ nsTreeBodyFrame::SetView(nsITreeView * a
     }
 
     // View, meet the tree.
     nsWeakFrame weakFrame(this);
     mView->SetTree(mTreeBoxObject);
     NS_ENSURE_STATE(weakFrame.IsAlive());
     mView->GetRowCount(&mRowCount);
  
-    PRBool isInReflow;
-    PresContext()->PresShell()->IsReflowLocked(&isInReflow);
-    if (!isInReflow) {
+    if (!PresContext()->PresShell()->IsReflowLocked()) {
       // The scrollbar will need to be updated.
       FullScrollbarsUpdate(PR_FALSE);
     } else if (!mReflowCallbackPosted) {
       mReflowCallbackPosted = PR_TRUE;
       PresContext()->PresShell()->PostReflowCallback(this);
     }
   }