From 96795774f2b4a14dcdcb06aeda806763f155e014 Mon Sep 17 00:00:00 2001 From: "pollmann%netscape.com" Date: Fri, 28 May 1999 01:06:42 +0000 Subject: [PATCH] Bug 3322: nsSelectControlFrames's ControlChanged does what MouseClicked used to - checks for selection changes and sends out onChange DOM events. git-svn-id: svn://10.0.0.236/trunk@33072 18797224-902f-48f8-a5cc-f745e15eee43 --- .../html/forms/src/nsSelectControlFrame.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/mozilla/layout/html/forms/src/nsSelectControlFrame.cpp b/mozilla/layout/html/forms/src/nsSelectControlFrame.cpp index b498688250a..f2502717723 100644 --- a/mozilla/layout/html/forms/src/nsSelectControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsSelectControlFrame.cpp @@ -120,6 +120,7 @@ public: ///XXX: End o the temporary methods virtual void MouseClicked(nsIPresContext* aPresContext); + virtual void ControlChanged(nsIPresContext* aPresContext); // nsIFormControLFrame NS_IMETHOD SetProperty(nsIAtom* aName, const nsString& aValue); @@ -1022,13 +1023,18 @@ nsSelectControlFrame::Paint(nsIPresContext& aPresContext, return NS_OK; } -// Update the locally cached selection array. -// XXX Note, this is not sufficient. The selected state of the widget can change -// with mouse clicks, key presses, and focus changes. This problem is particularly -// evident for combo boxes, which don't reliably receive mouseup (therefore click) -// We need to register this method as a "selection changed" callback. +// Forward this on as a control changed event - this enables onChange for +// list boxes as ControlChanged is currently only sent for combos void nsSelectControlFrame::MouseClicked(nsIPresContext* aPresContext) +{ + ControlChanged(aPresContext); +} + +// Update the locally cached selection array. +// If different option(s) are selected, send a DOM onChange event. +void +nsSelectControlFrame::ControlChanged(nsIPresContext* aPresContext) { if (!nsFormFrame::GetDisabled(this)) {