From 2a1c8d35942cdff349b8fa156615a8262fa885a1 Mon Sep 17 00:00:00 2001 From: "bryner%brianryner.com" Date: Tue, 22 Jun 2004 02:55:04 +0000 Subject: [PATCH] deCOMtaminate nsBoxLayoutState. Bug 247766, r+sr=roc. git-svn-id: svn://10.0.0.236/trunk@158283 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/forms/nsTextControlFrame.cpp | 2 +- mozilla/layout/generic/nsGfxScrollFrame.cpp | 38 ++++----- .../layout/html/base/src/nsGfxScrollFrame.cpp | 38 ++++----- .../html/forms/src/nsTextControlFrame.cpp | 2 +- mozilla/layout/xul/base/src/nsBox.cpp | 56 +++++-------- mozilla/layout/xul/base/src/nsBoxFrame.cpp | 4 +- .../layout/xul/base/src/nsBoxLayoutState.cpp | 79 +------------------ .../layout/xul/base/src/nsBoxLayoutState.h | 62 ++++++++------- .../xul/base/src/nsBoxToBlockAdaptor.cpp | 13 ++- .../layout/xul/base/src/nsContainerBox.cpp | 16 ++-- mozilla/layout/xul/base/src/nsDeckFrame.cpp | 9 +-- .../xul/base/src/nsListBoxBodyFrame.cpp | 12 +-- .../layout/xul/base/src/nsListBoxLayout.cpp | 2 +- mozilla/layout/xul/base/src/nsMenuFrame.cpp | 4 +- .../layout/xul/base/src/nsMenuPopupFrame.cpp | 8 +- .../xul/base/src/nsNativeScrollbarFrame.cpp | 2 +- .../layout/xul/base/src/nsPopupSetFrame.cpp | 4 +- .../layout/xul/base/src/nsScrollBoxFrame.cpp | 8 +- mozilla/layout/xul/base/src/nsSliderFrame.cpp | 2 +- .../layout/xul/base/src/nsSprocketLayout.cpp | 4 +- mozilla/layout/xul/base/src/nsStackLayout.cpp | 2 +- .../layout/xul/base/src/nsTextBoxFrame.cpp | 2 +- 22 files changed, 131 insertions(+), 238 deletions(-) diff --git a/mozilla/layout/forms/nsTextControlFrame.cpp b/mozilla/layout/forms/nsTextControlFrame.cpp index f6e4c1b9c8e..cc6e9b4e4ca 100644 --- a/mozilla/layout/forms/nsTextControlFrame.cpp +++ b/mozilla/layout/forms/nsTextControlFrame.cpp @@ -1985,7 +1985,7 @@ nsTextControlFrame::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize) if (collapsed) return NS_OK; - nsIPresContext* presContext = aState.GetPresContext(); + nsIPresContext* presContext = aState.PresContext(); const nsHTMLReflowState* reflowState = aState.GetReflowState(); nsSize styleSize(CSS_NOTSET,CSS_NOTSET); nsFormControlFrame::GetStyleSize(presContext, *reflowState, styleSize); diff --git a/mozilla/layout/generic/nsGfxScrollFrame.cpp b/mozilla/layout/generic/nsGfxScrollFrame.cpp index c9db6d0cca9..aa15d914b19 100644 --- a/mozilla/layout/generic/nsGfxScrollFrame.cpp +++ b/mozilla/layout/generic/nsGfxScrollFrame.cpp @@ -392,8 +392,7 @@ nsHTMLScrollFrame::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize) // should not affect sizing... // Push current constraint. We'll restore it when we're done. - nsSize oldConstrainedSize; - aState.GetScrolledBlockSizeConstraint(oldConstrainedSize); + nsSize oldConstrainedSize = aState.ScrolledBlockSizeConstraint(); const nsHTMLReflowState* HTMLState = aState.GetReflowState(); // This stores the computed width and height, if available. @@ -588,13 +587,12 @@ nsHTMLScrollFrame::CurPosAttributeChanged(nsIPresContext* aPresContext, NS_IMETHODIMP nsHTMLScrollFrame::DoLayout(nsBoxLayoutState& aState) { - PRUint32 flags = 0; - aState.GetLayoutFlags(flags); - nsresult rv = mInner.Layout(aState); - aState.SetLayoutFlags(flags); + PRUint32 flags = aState.LayoutFlags(); + nsresult rv = mInner.Layout(aState); + aState.SetLayoutFlags(flags); - nsBox::DoLayout(aState); - return rv; + nsBox::DoLayout(aState); + return rv; } @@ -936,8 +934,7 @@ nsXULScrollFrame::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize) // should not affect sizing... // Push current constraint. We'll restore it when we're done. - nsSize oldConstrainedSize; - aState.GetScrolledBlockSizeConstraint(oldConstrainedSize); + nsSize oldConstrainedSize = aState.ScrolledBlockSizeConstraint(); const nsHTMLReflowState* HTMLState = aState.GetReflowState(); // This stores the computed width and height, if available. @@ -1132,13 +1129,12 @@ nsXULScrollFrame::CurPosAttributeChanged(nsIPresContext* aPresContext, NS_IMETHODIMP nsXULScrollFrame::DoLayout(nsBoxLayoutState& aState) { - PRUint32 flags = 0; - aState.GetLayoutFlags(flags); - nsresult rv = mInner.Layout(aState); - aState.SetLayoutFlags(flags); + PRUint32 flags = aState.LayoutFlags(); + nsresult rv = mInner.Layout(aState); + aState.SetLayoutFlags(flags); - nsBox::DoLayout(aState); - return rv; + nsBox::DoLayout(aState); + return rv; } @@ -1843,7 +1839,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState) // if we have 'auto' scrollbars look at the vertical case if (styles.mVertical != NS_STYLE_OVERFLOW_SCROLL) { // get the area frame is the scrollarea - GetScrolledSize(aState.GetPresContext(),&scrolledContentSize.width, &scrolledContentSize.height); + GetScrolledSize(aState.PresContext(),&scrolledContentSize.width, &scrolledContentSize.height); // There are two cases to consider if (scrolledContentSize.height <= scrollAreaRect.height @@ -1881,7 +1877,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState) if (styles.mHorizontal != NS_STYLE_OVERFLOW_SCROLL) { // get the area frame is the scrollarea - GetScrolledSize(aState.GetPresContext(),&scrolledContentSize.width, &scrolledContentSize.height); + GetScrolledSize(aState.PresContext(),&scrolledContentSize.width, &scrolledContentSize.height); // if the child is wider that the scroll area // and we don't have a scrollbar add one. @@ -1939,9 +1935,9 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState) #endif // IBMBIDI } - GetScrolledSize(aState.GetPresContext(),&scrolledContentSize.width, &scrolledContentSize.height); + GetScrolledSize(aState.PresContext(),&scrolledContentSize.width, &scrolledContentSize.height); - nsIPresContext* presContext = aState.GetPresContext(); + nsIPresContext* presContext = aState.PresContext(); float p2t; presContext->GetScaledPixelsToTwips(&p2t); mOnePixel = NSIntPixelsToTwips(1, p2t); @@ -2076,7 +2072,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState) // be re-laid out anyway) if ((oldScrollAreaBounds.width != scrollAreaRect.width || oldScrollAreaBounds.height != scrollAreaRect.height) - && nsBoxLayoutState::Dirty == aState.GetLayoutReason()) { + && nsBoxLayoutState::Dirty == aState.LayoutReason()) { nsIFrame* parentFrame = mOuter->GetParent(); if (parentFrame) { if (parentFrame->GetType() == nsLayoutAtoms::viewportFrame) { diff --git a/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp b/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp index c9db6d0cca9..aa15d914b19 100644 --- a/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp +++ b/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp @@ -392,8 +392,7 @@ nsHTMLScrollFrame::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize) // should not affect sizing... // Push current constraint. We'll restore it when we're done. - nsSize oldConstrainedSize; - aState.GetScrolledBlockSizeConstraint(oldConstrainedSize); + nsSize oldConstrainedSize = aState.ScrolledBlockSizeConstraint(); const nsHTMLReflowState* HTMLState = aState.GetReflowState(); // This stores the computed width and height, if available. @@ -588,13 +587,12 @@ nsHTMLScrollFrame::CurPosAttributeChanged(nsIPresContext* aPresContext, NS_IMETHODIMP nsHTMLScrollFrame::DoLayout(nsBoxLayoutState& aState) { - PRUint32 flags = 0; - aState.GetLayoutFlags(flags); - nsresult rv = mInner.Layout(aState); - aState.SetLayoutFlags(flags); + PRUint32 flags = aState.LayoutFlags(); + nsresult rv = mInner.Layout(aState); + aState.SetLayoutFlags(flags); - nsBox::DoLayout(aState); - return rv; + nsBox::DoLayout(aState); + return rv; } @@ -936,8 +934,7 @@ nsXULScrollFrame::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize) // should not affect sizing... // Push current constraint. We'll restore it when we're done. - nsSize oldConstrainedSize; - aState.GetScrolledBlockSizeConstraint(oldConstrainedSize); + nsSize oldConstrainedSize = aState.ScrolledBlockSizeConstraint(); const nsHTMLReflowState* HTMLState = aState.GetReflowState(); // This stores the computed width and height, if available. @@ -1132,13 +1129,12 @@ nsXULScrollFrame::CurPosAttributeChanged(nsIPresContext* aPresContext, NS_IMETHODIMP nsXULScrollFrame::DoLayout(nsBoxLayoutState& aState) { - PRUint32 flags = 0; - aState.GetLayoutFlags(flags); - nsresult rv = mInner.Layout(aState); - aState.SetLayoutFlags(flags); + PRUint32 flags = aState.LayoutFlags(); + nsresult rv = mInner.Layout(aState); + aState.SetLayoutFlags(flags); - nsBox::DoLayout(aState); - return rv; + nsBox::DoLayout(aState); + return rv; } @@ -1843,7 +1839,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState) // if we have 'auto' scrollbars look at the vertical case if (styles.mVertical != NS_STYLE_OVERFLOW_SCROLL) { // get the area frame is the scrollarea - GetScrolledSize(aState.GetPresContext(),&scrolledContentSize.width, &scrolledContentSize.height); + GetScrolledSize(aState.PresContext(),&scrolledContentSize.width, &scrolledContentSize.height); // There are two cases to consider if (scrolledContentSize.height <= scrollAreaRect.height @@ -1881,7 +1877,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState) if (styles.mHorizontal != NS_STYLE_OVERFLOW_SCROLL) { // get the area frame is the scrollarea - GetScrolledSize(aState.GetPresContext(),&scrolledContentSize.width, &scrolledContentSize.height); + GetScrolledSize(aState.PresContext(),&scrolledContentSize.width, &scrolledContentSize.height); // if the child is wider that the scroll area // and we don't have a scrollbar add one. @@ -1939,9 +1935,9 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState) #endif // IBMBIDI } - GetScrolledSize(aState.GetPresContext(),&scrolledContentSize.width, &scrolledContentSize.height); + GetScrolledSize(aState.PresContext(),&scrolledContentSize.width, &scrolledContentSize.height); - nsIPresContext* presContext = aState.GetPresContext(); + nsIPresContext* presContext = aState.PresContext(); float p2t; presContext->GetScaledPixelsToTwips(&p2t); mOnePixel = NSIntPixelsToTwips(1, p2t); @@ -2076,7 +2072,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState) // be re-laid out anyway) if ((oldScrollAreaBounds.width != scrollAreaRect.width || oldScrollAreaBounds.height != scrollAreaRect.height) - && nsBoxLayoutState::Dirty == aState.GetLayoutReason()) { + && nsBoxLayoutState::Dirty == aState.LayoutReason()) { nsIFrame* parentFrame = mOuter->GetParent(); if (parentFrame) { if (parentFrame->GetType() == nsLayoutAtoms::viewportFrame) { diff --git a/mozilla/layout/html/forms/src/nsTextControlFrame.cpp b/mozilla/layout/html/forms/src/nsTextControlFrame.cpp index f6e4c1b9c8e..cc6e9b4e4ca 100644 --- a/mozilla/layout/html/forms/src/nsTextControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsTextControlFrame.cpp @@ -1985,7 +1985,7 @@ nsTextControlFrame::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize) if (collapsed) return NS_OK; - nsIPresContext* presContext = aState.GetPresContext(); + nsIPresContext* presContext = aState.PresContext(); const nsHTMLReflowState* reflowState = aState.GetReflowState(); nsSize styleSize(CSS_NOTSET,CSS_NOTSET); nsFormControlFrame::GetStyleSize(presContext, *reflowState, styleSize); diff --git a/mozilla/layout/xul/base/src/nsBox.cpp b/mozilla/layout/xul/base/src/nsBox.cpp index 214ceb914b9..025ea04cdf1 100644 --- a/mozilla/layout/xul/base/src/nsBox.cpp +++ b/mozilla/layout/xul/base/src/nsBox.cpp @@ -164,7 +164,7 @@ nsBox::BeginLayout(nsBoxLayoutState& aState) nsBoxAddIndents(); nsAutoString reason; - switch(aState.GetLayoutReason()) + switch(aState.LayoutReason()) { case nsBoxLayoutState::Dirty: reason.AssignLiteral("Dirty"); @@ -306,9 +306,7 @@ nsBox::MarkDirty(nsBoxLayoutState& aState) if (parent) return parent->RelayoutDirtyChild(aState, this); else { - nsCOMPtr shell; - aState.GetPresShell(getter_AddRefs(shell)); - return frame->GetParent()->ReflowDirtyChild(shell, frame); + return frame->GetParent()->ReflowDirtyChild(aState.PresShell(), frame); } } @@ -340,19 +338,15 @@ nsBox::MarkStyleChange(nsBoxLayoutState& aState) return parent->RelayoutDirtyChild(aState, this); else { /* - nsCOMPtr shell; - aState.GetPresShell(getter_AddRefs(shell)); nsIFrame* frame = nsnull; GetFrame(&frame); - nsFrame::CreateAndPostReflowCommand(shell, frame, + nsFrame::CreateAndPostReflowCommand(aState.PresShell(), frame, nsHTMLReflowCommand::StyleChange, nsnull, nsnull, nsnull); return NS_OK; */ nsIFrame* frame = nsnull; GetFrame(&frame); - nsCOMPtr shell; - aState.GetPresShell(getter_AddRefs(shell)); - return frame->GetParent()->ReflowDirtyChild(shell, frame); + return frame->GetParent()->ReflowDirtyChild(aState.PresShell(), frame); } return NS_OK; @@ -424,11 +418,9 @@ nsBox::RelayoutStyleChange(nsBoxLayoutState& aState, nsIBox* aChild) if (parent) return parent->RelayoutStyleChange(aState, this); else { - nsCOMPtr shell; - aState.GetPresShell(getter_AddRefs(shell)); nsIFrame* frame = nsnull; aChild->GetFrame(&frame); - nsFrame::CreateAndPostReflowCommand(shell, frame, + nsFrame::CreateAndPostReflowCommand(aState.PresShell(), frame, eReflowType_StyleChanged, nsnull, nsnull, nsnull); return NS_OK; } @@ -461,9 +453,7 @@ nsBox::RelayoutDirtyChild(nsBoxLayoutState& aState, nsIBox* aChild) frame->AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN); if (frame->GetStateBits() & NS_FRAME_REFLOW_ROOT) { - nsCOMPtr shell; - aState.GetPresShell(getter_AddRefs(shell)); - nsFrame::CreateAndPostReflowCommand(shell, frame, + nsFrame::CreateAndPostReflowCommand(aState.PresShell(), frame, eReflowType_ReflowDirty, nsnull, nsnull, nsnull); return NS_OK; @@ -475,9 +465,7 @@ nsBox::RelayoutDirtyChild(nsBoxLayoutState& aState, nsIBox* aChild) GetParentBox(&parentBox); if (parentBox) return parentBox->RelayoutDirtyChild(aState, this); - nsCOMPtr shell; - aState.GetPresShell(getter_AddRefs(shell)); - return frame->GetParent()->ReflowDirtyChild(shell, frame); + return frame->GetParent()->ReflowDirtyChild(aState.PresShell(), frame); } else { #ifdef DEBUG_COELESCED Coelesced(); @@ -562,13 +550,12 @@ nsBox::SetBounds(nsBoxLayoutState& aState, const nsRect& aRect) nsIFrame* frame = nsnull; GetFrame(&frame); - nsIPresContext* presContext = aState.GetPresContext(); + nsIPresContext* presContext = aState.PresContext(); PRUint32 flags = 0; GetLayoutFlags(flags); - PRUint32 stateFlags = 0; - aState.GetLayoutFlags(stateFlags); + PRUint32 stateFlags = aState.LayoutFlags(); flags |= stateFlags; @@ -794,7 +781,7 @@ nsBox::Collapse(nsBoxLayoutState& aState) nsresult nsBox::CollapseChild(nsBoxLayoutState& aState, nsIFrame* aFrame, PRBool aHide) { - nsIPresContext* presContext = aState.GetPresContext(); + nsIPresContext* presContext = aState.PresContext(); // shrink the view nsIView* view = aFrame->GetView(); @@ -1029,7 +1016,7 @@ nsBox::SyncLayout(nsBoxLayoutState& aState) PRBool dirty = PR_FALSE; IsDirty(dirty); - if (dirty || aState.GetLayoutReason() == nsBoxLayoutState::Initial) + if (dirty || aState.LayoutReason() == nsBoxLayoutState::Initial) Redraw(aState); nsIFrame* frame; @@ -1037,15 +1024,14 @@ nsBox::SyncLayout(nsBoxLayoutState& aState) frame->RemoveStateBits(NS_FRAME_HAS_DIRTY_CHILDREN | NS_FRAME_IS_DIRTY | NS_FRAME_FIRST_REFLOW | NS_FRAME_IN_REFLOW); - nsIPresContext* presContext = aState.GetPresContext(); + nsIPresContext* presContext = aState.PresContext(); nsRect rect(0,0,0,0); GetBounds(rect); PRUint32 flags = 0; GetLayoutFlags(flags); - PRUint32 stateFlags = 0; - aState.GetLayoutFlags(stateFlags); + PRUint32 stateFlags = aState.LayoutFlags(); flags |= stateFlags; @@ -1083,10 +1069,10 @@ nsBox::Redraw(nsBoxLayoutState& aState, const nsRect* aDamageRect, PRBool aImmediate) { - if (aState.GetDisablePainting()) + if (aState.PaintingDisabled()) return NS_OK; - nsIPresContext* presContext = aState.GetPresContext(); + nsIPresContext* presContext = aState.PresContext(); const nsHTMLReflowState* s = aState.GetReflowState(); if (s) { if (s->reason != eReflowReason_Incremental) @@ -1144,7 +1130,7 @@ nsIBox::AddCSSPrefSize(nsBoxLayoutState& aState, nsIBox* aBox, nsSize& aSize) // For example, we might be magic XUL frames whose primary content is an HTML //