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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user