null-check fix for bug 181463 'Clicking on slider with hidden thumb crashes browser' [plus a little bit of whitespace cleanup], r=varga, sr=brendan

git-svn-id: svn://10.0.0.236/trunk@134359 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
jrgm%netscape.com
2002-11-23 05:20:05 +00:00
parent 710d7daa68
commit 1851e5c13a

View File

@@ -1152,26 +1152,27 @@ nsSliderFrame::RemoveListener()
NS_IMETHODIMP
nsSliderFrame::HandlePress(nsIPresContext* aPresContext,
nsGUIEvent* aEvent,
nsEventStatus* aEventStatus)
nsGUIEvent* aEvent,
nsEventStatus* aEventStatus)
{
PRBool isHorizontal = IsHorizontal();
nsIFrame* thumbFrame = mFrames.FirstChild();
if (!thumbFrame) // display:none?
return NS_OK;
nsRect thumbRect;
thumbFrame->GetRect(thumbRect);
nscoord change = 1;
if (IsHorizontal() ? aEvent->point.x < thumbRect.x
: aEvent->point.y < thumbRect.y)
change = -1;
nscoord change = 1;
if ((isHorizontal && aEvent->point.x < thumbRect.x) || (!isHorizontal && aEvent->point.y < thumbRect.y))
change = -1;
mChange = change;
mClickPoint = aEvent->point;
PageUpDown(thumbFrame, change);
nsRepeatService::GetInstance()->Start(mMediator);
mChange = change;
mClickPoint = aEvent->point;
PageUpDown(thumbFrame, change);
nsRepeatService::GetInstance()->Start(mMediator);
return NS_OK;
}