47302 - moved the RegUnRegAccessKey to the Destroy Method

44788 - Comboboxes do not obey style height
42661 - javascript "selected = true" doesn't inform onChange of
b=47302, 44788, 42661 r=kmclusk
This commit is contained in:
rods%netscape.com 2000-08-03 14:13:40 +00:00
Родитель 8b78e94177
Коммит 62fe8fbb52
6 изменённых файлов: 48 добавлений и 22 удалений

Просмотреть файл

@ -267,7 +267,6 @@ nsComboboxControlFrame::~nsComboboxControlFrame()
}
NS_IF_RELEASE(mButtonContent);
nsFormControlFrame::RegUnRegAccessKey(mPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_FALSE);
NS_IF_RELEASE(mPresContext);
}
@ -347,6 +346,8 @@ nsComboboxControlFrame::IsSuccessful(nsIFormControlFrame* aSubmitter)
NS_IMETHODIMP
nsComboboxControlFrame::MakeSureSomethingIsSelected(nsIPresContext* aPresContext)
{
REFLOW_DEBUG_MSG("CBX::MakeSureSomethingIsSelected\n");
nsIFormControlFrame* fcFrame = nsnull;
nsIFrame* dropdownFrame = GetDropdownFrame();
nsresult rv = dropdownFrame->QueryInterface(kIFormControlFrameIID, (void**)&fcFrame);
@ -1517,6 +1518,13 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext,
REFLOW_DEBUG_MSG4("firstPassState.mComputedWidth %d - size.width %d dspBorderPadding.right %d\n", PX(firstPassState.mComputedWidth), PX(size.width), PX(dspBorderPadding.right));
}
}
// Fix for Bug 44788 (remove this comment later)
if (firstPassState.mComputedHeight > 0 && NS_UNCONSTRAINEDSIZE != firstPassState.mComputedHeight) {
size.height = firstPassState.mComputedHeight;
}
// this reflows and makes and last minute adjustments
ReflowCombobox(aPresContext, firstPassState, aDesiredSize, aStatus,
mDisplayFrame, buttonFrame, mItemDisplayWidth, scrollbarWidth,
@ -1806,7 +1814,7 @@ nsComboboxControlFrame::GetDropDown(nsIFrame** aDropDownFrame)
}
NS_IMETHODIMP
nsComboboxControlFrame::ListWasSelected(nsIPresContext* aPresContext)
nsComboboxControlFrame::ListWasSelected(nsIPresContext* aPresContext, PRBool aForceUpdate) // Added "aForceUpdate" for Bug 42661
{
if (aPresContext == nsnull) {
aPresContext = mPresContext;
@ -1817,7 +1825,7 @@ nsComboboxControlFrame::ListWasSelected(nsIPresContext* aPresContext)
PRInt32 indx;
mListControlFrame->GetSelectedIndex(&indx);
UpdateSelection(PR_TRUE, PR_FALSE, indx);
UpdateSelection(PR_TRUE, aForceUpdate, indx); // Added "aForceUpdate" for Bug 42661
return NS_OK;
}
@ -1838,16 +1846,19 @@ nsComboboxControlFrame::UpdateSelection(PRBool aDoDispatchEvent, PRBool aForceUp
if (mListControlFrame) {
// Check to see if the selection changed
if (mSelectedIndex != aNewIndex || aForceUpdate) {
//???if (mSelectedIndex != aNewIndex || (aForceUpdate && aNewIndex != kSizeNotSet)) {
mListControlFrame->GetSelectedItem(mTextStr); // Update text box
// Fix for Bug 42661 (remove comment later)
#ifdef DO_REFLOW_DEBUG
char * str = mTextStr.ToNewCString();
REFLOW_DEBUG_MSG2("UpdateSelection %s\n", str);
delete [] str;
REFLOW_DEBUG_MSG2("UpdateSelection %s\n", str);
delete [] str;
#endif
mSelectedIndex = aNewIndex;
mListControlFrame->UpdateSelection(aDoDispatchEvent, aForceUpdate, mContent);
} else {
mSelectedIndex = aNewIndex;
}
mSelectedIndex = aNewIndex;
}
return NS_OK;
@ -1897,7 +1908,7 @@ nsComboboxControlFrame::SelectionChanged()
shouldSetValue = PR_TRUE;
} else {
shouldSetValue = value != mTextStr;
REFLOW_DEBUG_MSG3("**** SelectionChanged Old[%s] New[%s]\n", value.ToNewCString(), mTextStr.ToNewCString());
REFLOW_DEBUG_MSG3("**** CBX::SelectionChanged Old[%s] New[%s]\n", value.ToNewCString(), mTextStr.ToNewCString());
}
if (shouldSetValue) {
if (mTextStr.Length() == 0) {
@ -2287,6 +2298,8 @@ nsComboboxControlFrame::SetSuggestedSize(nscoord aWidth, nscoord aHeight)
NS_IMETHODIMP
nsComboboxControlFrame::Destroy(nsIPresContext* aPresContext)
{
nsFormControlFrame::RegUnRegAccessKey(mPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_FALSE);
if (mDroppedDown) {
nsCOMPtr<nsIWidget> widget;
// Get parent view
@ -2356,7 +2369,7 @@ nsComboboxControlFrame::SetInitialChildList(nsIPresContext* aPresContext,
nsIFrame * child = aChildList;
while (child != nsnull) {
nsIFormControlFrame* fcFrame = nsnull;
nsresult rv = child->QueryInterface(kIFormControlFrameIID, (void**)&fcFrame);
rv = child->QueryInterface(kIFormControlFrameIID, (void**)&fcFrame);
if (NS_FAILED(rv) && fcFrame == nsnull) {
mDisplayFrame = child;
break;

Просмотреть файл

@ -159,7 +159,7 @@ public:
NS_IMETHOD ShowDropDown(PRBool aDoDropDown);
NS_IMETHOD GetDropDown(nsIFrame** aDropDownFrame);
NS_IMETHOD SetDropDown(nsIFrame* aDropDownFrame);
NS_IMETHOD ListWasSelected(nsIPresContext* aPresContext);
NS_IMETHOD ListWasSelected(nsIPresContext* aPresContext, PRBool aForceUpdate);
NS_IMETHOD UpdateSelection(PRBool aDoDispatchEvent, PRBool aForceUpdate, PRInt32 aNewIndex);
NS_IMETHOD AbsolutelyPositionDropDown();
NS_IMETHOD GetAbsoluteRect(nsRect* aRect);

Просмотреть файл

@ -77,7 +77,7 @@ public:
* Notifies the Combobox the List was selected
*
*/
NS_IMETHOD ListWasSelected(nsIPresContext* aPresContext) = 0;
NS_IMETHOD ListWasSelected(nsIPresContext* aPresContext, PRBool aForceUpdate) = 0;
/**
* Asks the Combobox to update the display frame

Просмотреть файл

@ -77,7 +77,7 @@ public:
* Notifies the Combobox the List was selected
*
*/
NS_IMETHOD ListWasSelected(nsIPresContext* aPresContext) = 0;
NS_IMETHOD ListWasSelected(nsIPresContext* aPresContext, PRBool aForceUpdate) = 0;
/**
* Asks the Combobox to update the display frame

Просмотреть файл

@ -267,7 +267,6 @@ nsComboboxControlFrame::~nsComboboxControlFrame()
}
NS_IF_RELEASE(mButtonContent);
nsFormControlFrame::RegUnRegAccessKey(mPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_FALSE);
NS_IF_RELEASE(mPresContext);
}
@ -347,6 +346,8 @@ nsComboboxControlFrame::IsSuccessful(nsIFormControlFrame* aSubmitter)
NS_IMETHODIMP
nsComboboxControlFrame::MakeSureSomethingIsSelected(nsIPresContext* aPresContext)
{
REFLOW_DEBUG_MSG("CBX::MakeSureSomethingIsSelected\n");
nsIFormControlFrame* fcFrame = nsnull;
nsIFrame* dropdownFrame = GetDropdownFrame();
nsresult rv = dropdownFrame->QueryInterface(kIFormControlFrameIID, (void**)&fcFrame);
@ -1517,6 +1518,13 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext,
REFLOW_DEBUG_MSG4("firstPassState.mComputedWidth %d - size.width %d dspBorderPadding.right %d\n", PX(firstPassState.mComputedWidth), PX(size.width), PX(dspBorderPadding.right));
}
}
// Fix for Bug 44788 (remove this comment later)
if (firstPassState.mComputedHeight > 0 && NS_UNCONSTRAINEDSIZE != firstPassState.mComputedHeight) {
size.height = firstPassState.mComputedHeight;
}
// this reflows and makes and last minute adjustments
ReflowCombobox(aPresContext, firstPassState, aDesiredSize, aStatus,
mDisplayFrame, buttonFrame, mItemDisplayWidth, scrollbarWidth,
@ -1806,7 +1814,7 @@ nsComboboxControlFrame::GetDropDown(nsIFrame** aDropDownFrame)
}
NS_IMETHODIMP
nsComboboxControlFrame::ListWasSelected(nsIPresContext* aPresContext)
nsComboboxControlFrame::ListWasSelected(nsIPresContext* aPresContext, PRBool aForceUpdate) // Added "aForceUpdate" for Bug 42661
{
if (aPresContext == nsnull) {
aPresContext = mPresContext;
@ -1817,7 +1825,7 @@ nsComboboxControlFrame::ListWasSelected(nsIPresContext* aPresContext)
PRInt32 indx;
mListControlFrame->GetSelectedIndex(&indx);
UpdateSelection(PR_TRUE, PR_FALSE, indx);
UpdateSelection(PR_TRUE, aForceUpdate, indx); // Added "aForceUpdate" for Bug 42661
return NS_OK;
}
@ -1838,16 +1846,19 @@ nsComboboxControlFrame::UpdateSelection(PRBool aDoDispatchEvent, PRBool aForceUp
if (mListControlFrame) {
// Check to see if the selection changed
if (mSelectedIndex != aNewIndex || aForceUpdate) {
//???if (mSelectedIndex != aNewIndex || (aForceUpdate && aNewIndex != kSizeNotSet)) {
mListControlFrame->GetSelectedItem(mTextStr); // Update text box
// Fix for Bug 42661 (remove comment later)
#ifdef DO_REFLOW_DEBUG
char * str = mTextStr.ToNewCString();
REFLOW_DEBUG_MSG2("UpdateSelection %s\n", str);
delete [] str;
REFLOW_DEBUG_MSG2("UpdateSelection %s\n", str);
delete [] str;
#endif
mSelectedIndex = aNewIndex;
mListControlFrame->UpdateSelection(aDoDispatchEvent, aForceUpdate, mContent);
} else {
mSelectedIndex = aNewIndex;
}
mSelectedIndex = aNewIndex;
}
return NS_OK;
@ -1897,7 +1908,7 @@ nsComboboxControlFrame::SelectionChanged()
shouldSetValue = PR_TRUE;
} else {
shouldSetValue = value != mTextStr;
REFLOW_DEBUG_MSG3("**** SelectionChanged Old[%s] New[%s]\n", value.ToNewCString(), mTextStr.ToNewCString());
REFLOW_DEBUG_MSG3("**** CBX::SelectionChanged Old[%s] New[%s]\n", value.ToNewCString(), mTextStr.ToNewCString());
}
if (shouldSetValue) {
if (mTextStr.Length() == 0) {
@ -2287,6 +2298,8 @@ nsComboboxControlFrame::SetSuggestedSize(nscoord aWidth, nscoord aHeight)
NS_IMETHODIMP
nsComboboxControlFrame::Destroy(nsIPresContext* aPresContext)
{
nsFormControlFrame::RegUnRegAccessKey(mPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_FALSE);
if (mDroppedDown) {
nsCOMPtr<nsIWidget> widget;
// Get parent view
@ -2356,7 +2369,7 @@ nsComboboxControlFrame::SetInitialChildList(nsIPresContext* aPresContext,
nsIFrame * child = aChildList;
while (child != nsnull) {
nsIFormControlFrame* fcFrame = nsnull;
nsresult rv = child->QueryInterface(kIFormControlFrameIID, (void**)&fcFrame);
rv = child->QueryInterface(kIFormControlFrameIID, (void**)&fcFrame);
if (NS_FAILED(rv) && fcFrame == nsnull) {
mDisplayFrame = child;
break;

Просмотреть файл

@ -159,7 +159,7 @@ public:
NS_IMETHOD ShowDropDown(PRBool aDoDropDown);
NS_IMETHOD GetDropDown(nsIFrame** aDropDownFrame);
NS_IMETHOD SetDropDown(nsIFrame* aDropDownFrame);
NS_IMETHOD ListWasSelected(nsIPresContext* aPresContext);
NS_IMETHOD ListWasSelected(nsIPresContext* aPresContext, PRBool aForceUpdate);
NS_IMETHOD UpdateSelection(PRBool aDoDispatchEvent, PRBool aForceUpdate, PRInt32 aNewIndex);
NS_IMETHOD AbsolutelyPositionDropDown();
NS_IMETHOD GetAbsoluteRect(nsRect* aRect);