mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 899931 - Part c: Cleanup nsListControlFrame::GetOptionText; r=dzbarsky
This commit is contained in:
parent
f3cc54f5fb
commit
41e28f3bfe
@ -29,7 +29,7 @@ public:
|
||||
/**
|
||||
* Get the display string for an item
|
||||
*/
|
||||
virtual void GetOptionText(int32_t aIndex, nsAString & aStr) = 0;
|
||||
virtual void GetOptionText(uint32_t aIndex, nsAString& aStr) = 0;
|
||||
|
||||
/**
|
||||
* Get the Selected Item's index
|
||||
|
@ -1158,43 +1158,11 @@ nsListControlFrame::SetComboboxFrame(nsIFrame* aComboboxFrame)
|
||||
}
|
||||
|
||||
void
|
||||
nsListControlFrame::GetOptionText(int32_t aIndex, nsAString & aStr)
|
||||
nsListControlFrame::GetOptionText(uint32_t aIndex, nsAString& aStr)
|
||||
{
|
||||
aStr.SetLength(0);
|
||||
nsCOMPtr<nsIDOMHTMLOptionsCollection> options = GetOptions(mContent);
|
||||
|
||||
if (options) {
|
||||
uint32_t numOptions;
|
||||
options->GetLength(&numOptions);
|
||||
|
||||
if (numOptions != 0) {
|
||||
nsCOMPtr<nsIDOMHTMLOptionElement> optionElement =
|
||||
GetOption(options, aIndex);
|
||||
if (optionElement) {
|
||||
#if 0 // This is for turning off labels Bug 4050
|
||||
nsAutoString text;
|
||||
optionElement->GetLabel(text);
|
||||
// the return value is always NS_OK from DOMElements
|
||||
// it is meaningless to check for it
|
||||
if (!text.IsEmpty()) {
|
||||
nsAutoString compressText = text;
|
||||
compressText.CompressWhitespace(true, true);
|
||||
if (!compressText.IsEmpty()) {
|
||||
text = compressText;
|
||||
}
|
||||
}
|
||||
|
||||
if (text.IsEmpty()) {
|
||||
// the return value is always NS_OK from DOMElements
|
||||
// it is meaningless to check for it
|
||||
optionElement->GetText(text);
|
||||
}
|
||||
aStr = text;
|
||||
#else
|
||||
optionElement->GetText(aStr);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
aStr.Truncate();
|
||||
if (dom::HTMLOptionElement* optionElement = GetOption(aIndex)) {
|
||||
optionElement->GetText(aStr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ public:
|
||||
* If the there are zero items then an empty string is returned
|
||||
* If there is nothing selected, then the 0th item's text is returned.
|
||||
*/
|
||||
virtual void GetOptionText(int32_t aIndex, nsAString & aStr) MOZ_OVERRIDE;
|
||||
virtual void GetOptionText(uint32_t aIndex, nsAString& aStr) MOZ_OVERRIDE;
|
||||
|
||||
virtual void CaptureMouseEvents(bool aGrabMouseEvents) MOZ_OVERRIDE;
|
||||
virtual nscoord GetHeightOfARow() MOZ_OVERRIDE;
|
||||
|
Loading…
Reference in New Issue
Block a user