From 5f095f2ba082f49a2b9c8d8e76ab0bfcc9244d96 Mon Sep 17 00:00:00 2001 From: "rods%netscape.com" Date: Fri, 10 Sep 1999 22:56:23 +0000 Subject: [PATCH] When asked for the selected item string it return first the value, then the label then the content in that order if any are empty git-svn-id: svn://10.0.0.236/trunk@46859 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/forms/nsListControlFrame.cpp | 21 +++++++++++++++++-- .../html/forms/src/nsListControlFrame.cpp | 21 +++++++++++++++++-- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/mozilla/layout/forms/nsListControlFrame.cpp b/mozilla/layout/forms/nsListControlFrame.cpp index 3d00cf8e507..e61a6fa00e4 100644 --- a/mozilla/layout/forms/nsListControlFrame.cpp +++ b/mozilla/layout/forms/nsListControlFrame.cpp @@ -973,6 +973,17 @@ nsListControlFrame::Init(nsIPresContext& aPresContext, reciever->AddEventListenerByIID((nsIDOMMouseMotionListener *)this, kIDOMMouseMotionListenerIID); reciever->AddEventListenerByIID((nsIDOMKeyListener *)this, kIDOMKeyListenerIID); +#if 0 + nsIFrame* parent; + GetParentWithView(&parent); + NS_ASSERTION(parent, "GetParentWithView failed"); + + // Get parent view + nsIView* parentView = nsnull; + while (1) { + parent->GetView(&parentView); + } +#endif return result; } @@ -1449,10 +1460,16 @@ nsListControlFrame::GetSelectedItem(nsString & aStr) nsIDOMHTMLOptionElement* optionElement = GetOption(*options, selectedIndex); if (nsnull != optionElement) { nsAutoString text; - if (NS_CONTENT_ATTR_HAS_VALUE == optionElement->GetText(text)) { + rv = optionElement->GetLabel(text); + if (NS_CONTENT_ATTR_HAS_VALUE != rv || 0 == text.Length()) { + if (NS_CONTENT_ATTR_HAS_VALUE == optionElement->GetText(text)) { + aStr = text; + rv = NS_OK; + } + } else { aStr = text; rv = NS_OK; - } + } NS_RELEASE(optionElement); } } diff --git a/mozilla/layout/html/forms/src/nsListControlFrame.cpp b/mozilla/layout/html/forms/src/nsListControlFrame.cpp index 3d00cf8e507..e61a6fa00e4 100644 --- a/mozilla/layout/html/forms/src/nsListControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsListControlFrame.cpp @@ -973,6 +973,17 @@ nsListControlFrame::Init(nsIPresContext& aPresContext, reciever->AddEventListenerByIID((nsIDOMMouseMotionListener *)this, kIDOMMouseMotionListenerIID); reciever->AddEventListenerByIID((nsIDOMKeyListener *)this, kIDOMKeyListenerIID); +#if 0 + nsIFrame* parent; + GetParentWithView(&parent); + NS_ASSERTION(parent, "GetParentWithView failed"); + + // Get parent view + nsIView* parentView = nsnull; + while (1) { + parent->GetView(&parentView); + } +#endif return result; } @@ -1449,10 +1460,16 @@ nsListControlFrame::GetSelectedItem(nsString & aStr) nsIDOMHTMLOptionElement* optionElement = GetOption(*options, selectedIndex); if (nsnull != optionElement) { nsAutoString text; - if (NS_CONTENT_ATTR_HAS_VALUE == optionElement->GetText(text)) { + rv = optionElement->GetLabel(text); + if (NS_CONTENT_ATTR_HAS_VALUE != rv || 0 == text.Length()) { + if (NS_CONTENT_ATTR_HAS_VALUE == optionElement->GetText(text)) { + aStr = text; + rv = NS_OK; + } + } else { aStr = text; rv = NS_OK; - } + } NS_RELEASE(optionElement); } }