From c4e4448cdbaab9cce19fbe918a17436d5c6f2c2b Mon Sep 17 00:00:00 2001 From: "rods%netscape.com" Date: Sun, 5 Dec 1999 20:43:18 +0000 Subject: [PATCH] Added a "flags" variable for combobox creation also fixed a a small problem with border padding being added in for fixed size comboboxes r=self, bug 19382 git-svn-id: svn://10.0.0.236/trunk@55379 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/forms/nsComboboxControlFrame.cpp | 9 ++++++--- mozilla/layout/forms/nsComboboxControlFrame.h | 2 ++ mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp | 9 ++++++--- mozilla/layout/html/forms/src/nsComboboxControlFrame.h | 2 ++ 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/mozilla/layout/forms/nsComboboxControlFrame.cpp b/mozilla/layout/forms/nsComboboxControlFrame.cpp index 329aefa15d7..d08bfe567fa 100644 --- a/mozilla/layout/forms/nsComboboxControlFrame.cpp +++ b/mozilla/layout/forms/nsComboboxControlFrame.cpp @@ -78,7 +78,7 @@ static NS_DEFINE_IID(kIPrivateDOMEventIID, NS_IPRIVATEDOMEVENT_IID); const char * kMozDropdownActive = "-moz-dropdown-active"; nsresult -NS_NewComboboxControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) +NS_NewComboboxControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRUint32 aFlags) { NS_PRECONDITION(aNewFrame, "null OUT ptr"); if (nsnull == aNewFrame) { @@ -88,6 +88,7 @@ NS_NewComboboxControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) if (!it) { return NS_ERROR_OUT_OF_MEMORY; } + it->SetFlags(aFlags); *aNewFrame = it; return NS_OK; } @@ -109,7 +110,7 @@ nsComboboxControlFrame::nsComboboxControlFrame() mSelectedIndex = -1; //Shrink the area around it's contents - SetFlags(NS_BLOCK_SHRINK_WRAP); + //SetFlags(NS_BLOCK_SHRINK_WRAP); } //-------------------------------------------------------------- @@ -730,6 +731,7 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext, //nsRect absolutePixels; //GetAbsoluteFramePosition(aPresContext, displayFrame, absoluteTwips, absolutePixels); //PositionDropdown(aPresContext, displayRect.height, absoluteTwips, absolutePixels); + aStatus = NS_FRAME_COMPLETE; return rv; } } @@ -810,7 +812,8 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext, // Reflow again with the width of the display frame set. nsAreaFrame::Reflow(aPresContext, aDesiredSize, firstPassState, aStatus); // nsAreaFrame::Reflow adds in the border and padding so we need to remove it - aDesiredSize.width -= borderPadding.left + borderPadding.right; + // XXX rods - this hould not be subtracted in + //aDesiredSize.width -= borderPadding.left + borderPadding.right; // Reflow the dropdown list to match the width of the display + button ReflowComboChildFrame(dropdownFrame, aPresContext, dropdownDesiredSize, firstPassState, aStatus, aDesiredSize.width, NS_UNCONSTRAINEDSIZE); diff --git a/mozilla/layout/forms/nsComboboxControlFrame.h b/mozilla/layout/forms/nsComboboxControlFrame.h index 7f15a219f48..7ac651d1810 100644 --- a/mozilla/layout/forms/nsComboboxControlFrame.h +++ b/mozilla/layout/forms/nsComboboxControlFrame.h @@ -58,6 +58,8 @@ class nsComboboxControlFrame : public nsAreaFrame, public nsIRollupListener { public: + friend nsresult NS_NewComboboxControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRUint32 aFlags); + nsComboboxControlFrame(); ~nsComboboxControlFrame(); diff --git a/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp b/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp index 329aefa15d7..d08bfe567fa 100644 --- a/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp @@ -78,7 +78,7 @@ static NS_DEFINE_IID(kIPrivateDOMEventIID, NS_IPRIVATEDOMEVENT_IID); const char * kMozDropdownActive = "-moz-dropdown-active"; nsresult -NS_NewComboboxControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) +NS_NewComboboxControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRUint32 aFlags) { NS_PRECONDITION(aNewFrame, "null OUT ptr"); if (nsnull == aNewFrame) { @@ -88,6 +88,7 @@ NS_NewComboboxControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) if (!it) { return NS_ERROR_OUT_OF_MEMORY; } + it->SetFlags(aFlags); *aNewFrame = it; return NS_OK; } @@ -109,7 +110,7 @@ nsComboboxControlFrame::nsComboboxControlFrame() mSelectedIndex = -1; //Shrink the area around it's contents - SetFlags(NS_BLOCK_SHRINK_WRAP); + //SetFlags(NS_BLOCK_SHRINK_WRAP); } //-------------------------------------------------------------- @@ -730,6 +731,7 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext, //nsRect absolutePixels; //GetAbsoluteFramePosition(aPresContext, displayFrame, absoluteTwips, absolutePixels); //PositionDropdown(aPresContext, displayRect.height, absoluteTwips, absolutePixels); + aStatus = NS_FRAME_COMPLETE; return rv; } } @@ -810,7 +812,8 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext, // Reflow again with the width of the display frame set. nsAreaFrame::Reflow(aPresContext, aDesiredSize, firstPassState, aStatus); // nsAreaFrame::Reflow adds in the border and padding so we need to remove it - aDesiredSize.width -= borderPadding.left + borderPadding.right; + // XXX rods - this hould not be subtracted in + //aDesiredSize.width -= borderPadding.left + borderPadding.right; // Reflow the dropdown list to match the width of the display + button ReflowComboChildFrame(dropdownFrame, aPresContext, dropdownDesiredSize, firstPassState, aStatus, aDesiredSize.width, NS_UNCONSTRAINEDSIZE); diff --git a/mozilla/layout/html/forms/src/nsComboboxControlFrame.h b/mozilla/layout/html/forms/src/nsComboboxControlFrame.h index 7f15a219f48..7ac651d1810 100644 --- a/mozilla/layout/html/forms/src/nsComboboxControlFrame.h +++ b/mozilla/layout/html/forms/src/nsComboboxControlFrame.h @@ -58,6 +58,8 @@ class nsComboboxControlFrame : public nsAreaFrame, public nsIRollupListener { public: + friend nsresult NS_NewComboboxControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRUint32 aFlags); + nsComboboxControlFrame(); ~nsComboboxControlFrame();