2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-18 14:30:37 +00:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1999-04-20 21:39:52 +00:00
|
|
|
*
|
2004-04-18 14:30:37 +00:00
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
1999-04-20 21:39:52 +00:00
|
|
|
*
|
2001-09-28 20:14:13 +00:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1999-04-20 21:39:52 +00:00
|
|
|
*
|
1999-06-15 04:02:43 +00:00
|
|
|
* The Original Code is Mozilla Communicator client code.
|
|
|
|
*
|
2004-04-18 14:30:37 +00:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-28 20:14:13 +00:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
2000-06-03 02:12:19 +00:00
|
|
|
*
|
2001-07-15 00:05:20 +00:00
|
|
|
* Contributor(s):
|
2004-04-18 14:30:37 +00:00
|
|
|
* Dean Tessman <dean_tessman@hotmail.com>
|
2008-02-14 21:45:47 +00:00
|
|
|
* Stan Shebs <stanshebs@earthlink.net>
|
2001-09-28 20:14:13 +00:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-18 14:30:37 +00:00
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
2001-09-28 20:14:13 +00:00
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
2004-04-18 14:30:37 +00:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-28 20:14:13 +00:00
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
2004-04-18 14:30:37 +00:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-28 20:14:13 +00:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1999-04-20 21:39:52 +00:00
|
|
|
|
1999-06-15 04:02:43 +00:00
|
|
|
//
|
|
|
|
// Eric Vaughan
|
|
|
|
// Netscape Communications
|
|
|
|
//
|
|
|
|
// See documentation in associated header file
|
|
|
|
//
|
1999-04-20 21:39:52 +00:00
|
|
|
|
1999-04-20 21:43:09 +00:00
|
|
|
#include "nsSliderFrame.h"
|
2003-02-22 00:32:13 +00:00
|
|
|
#include "nsStyleContext.h"
|
2004-07-31 23:15:21 +00:00
|
|
|
#include "nsPresContext.h"
|
1999-06-15 04:02:43 +00:00
|
|
|
#include "nsIContent.h"
|
|
|
|
#include "nsCOMPtr.h"
|
1999-04-20 21:39:52 +00:00
|
|
|
#include "nsINameSpaceManager.h"
|
2006-12-26 17:47:52 +00:00
|
|
|
#include "nsGkAtoms.h"
|
1999-06-15 04:02:43 +00:00
|
|
|
#include "nsHTMLParts.h"
|
|
|
|
#include "nsIPresShell.h"
|
|
|
|
#include "nsCSSRendering.h"
|
2007-05-14 09:11:38 +00:00
|
|
|
#include "nsIDOMEventTarget.h"
|
1999-06-15 04:02:43 +00:00
|
|
|
#include "nsIViewManager.h"
|
1999-11-03 07:11:45 +00:00
|
|
|
#include "nsIDOMMouseEvent.h"
|
2000-12-30 19:22:22 +00:00
|
|
|
#include "nsIDocument.h"
|
1999-06-15 04:02:43 +00:00
|
|
|
#include "nsScrollbarButtonFrame.h"
|
2009-01-14 18:21:58 +00:00
|
|
|
#include "nsISliderListener.h"
|
2000-06-06 23:13:05 +00:00
|
|
|
#include "nsIScrollbarMediator.h"
|
|
|
|
#include "nsIScrollbarFrame.h"
|
2007-04-12 00:36:40 +00:00
|
|
|
#include "nsILookAndFeel.h"
|
1999-08-19 22:16:23 +00:00
|
|
|
#include "nsRepeatService.h"
|
2000-03-31 07:02:06 +00:00
|
|
|
#include "nsBoxLayoutState.h"
|
2000-05-22 23:23:04 +00:00
|
|
|
#include "nsSprocketLayout.h"
|
2000-06-03 02:07:52 +00:00
|
|
|
#include "nsIServiceManager.h"
|
2001-07-16 02:40:48 +00:00
|
|
|
#include "nsGUIEvent.h"
|
2004-04-29 23:34:19 +00:00
|
|
|
#include "nsContentUtils.h"
|
2005-08-23 03:57:07 +00:00
|
|
|
#include "nsLayoutUtils.h"
|
2006-01-26 02:29:17 +00:00
|
|
|
#include "nsDisplayList.h"
|
1999-08-19 22:16:23 +00:00
|
|
|
|
2004-01-27 05:19:57 +00:00
|
|
|
PRBool nsSliderFrame::gMiddlePref = PR_FALSE;
|
2006-12-20 22:49:59 +00:00
|
|
|
PRInt32 nsSliderFrame::gSnapMultiplier;
|
2004-01-27 05:19:57 +00:00
|
|
|
|
2002-11-26 21:38:18 +00:00
|
|
|
// Turn this on if you want to debug slider frames.
|
|
|
|
#undef DEBUG_SLIDER
|
1999-10-12 00:16:06 +00:00
|
|
|
|
2003-06-02 02:39:26 +00:00
|
|
|
static already_AddRefed<nsIContent>
|
|
|
|
GetContentOfBox(nsIBox *aBox)
|
|
|
|
{
|
2004-09-28 18:37:50 +00:00
|
|
|
nsIContent* content = aBox->GetContent();
|
2003-08-04 12:39:51 +00:00
|
|
|
NS_IF_ADDREF(content);
|
2003-06-02 02:39:26 +00:00
|
|
|
return content;
|
|
|
|
}
|
|
|
|
|
2005-10-26 21:46:39 +00:00
|
|
|
nsIFrame*
|
2006-03-26 21:30:36 +00:00
|
|
|
NS_NewSliderFrame (nsIPresShell* aPresShell, nsStyleContext* aContext)
|
1999-04-20 21:39:52 +00:00
|
|
|
{
|
2006-03-26 21:30:36 +00:00
|
|
|
return new (aPresShell) nsSliderFrame(aPresShell, aContext);
|
1999-06-15 04:02:43 +00:00
|
|
|
} // NS_NewSliderFrame
|
1999-04-20 21:39:52 +00:00
|
|
|
|
2006-03-26 21:30:36 +00:00
|
|
|
nsSliderFrame::nsSliderFrame(nsIPresShell* aPresShell, nsStyleContext* aContext):
|
|
|
|
nsBoxFrame(aPresShell, aContext),
|
|
|
|
mCurPos(0),
|
2009-01-14 18:21:58 +00:00
|
|
|
mChange(0),
|
|
|
|
mUserChanged(PR_FALSE)
|
1999-04-20 21:39:52 +00:00
|
|
|
{
|
1999-06-15 04:02:43 +00:00
|
|
|
}
|
1999-04-20 21:39:52 +00:00
|
|
|
|
1999-08-19 22:16:23 +00:00
|
|
|
// stop timer
|
|
|
|
nsSliderFrame::~nsSliderFrame()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
1999-06-15 04:02:43 +00:00
|
|
|
NS_IMETHODIMP
|
2006-03-09 18:55:21 +00:00
|
|
|
nsSliderFrame::Init(nsIContent* aContent,
|
2004-04-29 23:34:19 +00:00
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow)
|
1999-04-20 21:39:52 +00:00
|
|
|
{
|
2006-03-26 21:30:36 +00:00
|
|
|
nsresult rv = nsBoxFrame::Init(aContent, aParent, aPrevInFlow);
|
2001-07-15 00:05:20 +00:00
|
|
|
|
2004-01-27 05:19:57 +00:00
|
|
|
static PRBool gotPrefs = PR_FALSE;
|
|
|
|
if (!gotPrefs) {
|
|
|
|
gotPrefs = PR_TRUE;
|
2004-04-29 23:34:19 +00:00
|
|
|
|
|
|
|
gMiddlePref = nsContentUtils::GetBoolPref("middlemouse.scrollbarPosition");
|
|
|
|
gSnapMultiplier = nsContentUtils::GetIntPref("slider.snapMultiplier");
|
2001-07-18 23:19:42 +00:00
|
|
|
}
|
2000-06-03 02:07:52 +00:00
|
|
|
|
2009-05-04 14:55:41 +00:00
|
|
|
mCurPos = GetCurrentPosition(aContent);
|
|
|
|
|
2007-03-30 21:11:41 +00:00
|
|
|
CreateViewForFrame(PresContext(), this, GetStyleContext(), PR_TRUE);
|
1999-06-15 04:02:43 +00:00
|
|
|
return rv;
|
1999-04-20 21:39:52 +00:00
|
|
|
}
|
|
|
|
|
2001-01-11 01:56:27 +00:00
|
|
|
NS_IMETHODIMP
|
2005-02-07 01:58:25 +00:00
|
|
|
nsSliderFrame::RemoveFrame(nsIAtom* aListName,
|
|
|
|
nsIFrame* aOldFrame)
|
2001-01-11 01:56:27 +00:00
|
|
|
{
|
2005-02-07 01:58:25 +00:00
|
|
|
nsresult rv = nsBoxFrame::RemoveFrame(aListName, aOldFrame);
|
2007-05-23 03:48:43 +00:00
|
|
|
if (mFrames.IsEmpty())
|
2001-01-11 01:56:27 +00:00
|
|
|
RemoveListener();
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2005-02-07 01:58:25 +00:00
|
|
|
nsSliderFrame::InsertFrames(nsIAtom* aListName,
|
|
|
|
nsIFrame* aPrevFrame,
|
|
|
|
nsIFrame* aFrameList)
|
2001-01-11 01:56:27 +00:00
|
|
|
{
|
2007-05-23 03:48:43 +00:00
|
|
|
PRBool wasEmpty = mFrames.IsEmpty();
|
2005-02-07 01:58:25 +00:00
|
|
|
nsresult rv = nsBoxFrame::InsertFrames(aListName, aPrevFrame, aFrameList);
|
2007-05-23 03:48:43 +00:00
|
|
|
if (wasEmpty)
|
2001-01-11 01:56:27 +00:00
|
|
|
AddListener();
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2005-02-07 01:58:25 +00:00
|
|
|
nsSliderFrame::AppendFrames(nsIAtom* aListName,
|
|
|
|
nsIFrame* aFrameList)
|
2001-01-11 01:56:27 +00:00
|
|
|
{
|
|
|
|
// if we have no children and on was added then make sure we add the
|
|
|
|
// listener
|
2007-05-23 03:48:43 +00:00
|
|
|
PRBool wasEmpty = mFrames.IsEmpty();
|
2005-02-07 01:58:25 +00:00
|
|
|
nsresult rv = nsBoxFrame::AppendFrames(aListName, aFrameList);
|
2007-05-23 03:48:43 +00:00
|
|
|
if (wasEmpty)
|
2001-01-11 01:56:27 +00:00
|
|
|
AddListener();
|
|
|
|
|
|
|
|
return rv;
|
2001-07-15 00:05:20 +00:00
|
|
|
}
|
2001-01-11 01:56:27 +00:00
|
|
|
|
1999-06-15 04:02:43 +00:00
|
|
|
PRInt32
|
|
|
|
nsSliderFrame::GetCurrentPosition(nsIContent* content)
|
|
|
|
{
|
2006-12-26 17:47:52 +00:00
|
|
|
return GetIntegerAttribute(content, nsGkAtoms::curpos, 0);
|
1999-06-15 04:02:43 +00:00
|
|
|
}
|
|
|
|
|
2006-05-30 13:50:48 +00:00
|
|
|
PRInt32
|
|
|
|
nsSliderFrame::GetMinPosition(nsIContent* content)
|
|
|
|
{
|
2006-12-26 17:47:52 +00:00
|
|
|
return GetIntegerAttribute(content, nsGkAtoms::minpos, 0);
|
2006-05-30 13:50:48 +00:00
|
|
|
}
|
|
|
|
|
1999-06-15 04:02:43 +00:00
|
|
|
PRInt32
|
|
|
|
nsSliderFrame::GetMaxPosition(nsIContent* content)
|
|
|
|
{
|
2006-12-26 17:47:52 +00:00
|
|
|
return GetIntegerAttribute(content, nsGkAtoms::maxpos, 100);
|
1999-06-15 04:02:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PRInt32
|
|
|
|
nsSliderFrame::GetIncrement(nsIContent* content)
|
|
|
|
{
|
2006-12-26 17:47:52 +00:00
|
|
|
return GetIntegerAttribute(content, nsGkAtoms::increment, 1);
|
1999-06-15 04:02:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PRInt32
|
|
|
|
nsSliderFrame::GetPageIncrement(nsIContent* content)
|
|
|
|
{
|
2006-12-26 17:47:52 +00:00
|
|
|
return GetIntegerAttribute(content, nsGkAtoms::pageincrement, 10);
|
1999-06-15 04:02:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PRInt32
|
|
|
|
nsSliderFrame::GetIntegerAttribute(nsIContent* content, nsIAtom* atom, PRInt32 defaultValue)
|
|
|
|
{
|
Landing changes Vidur made while the tree was closed for beta1 work, here's a list of the changes. r=me
[1] Cutting down the size of content. Made nsIJSScriptObject inherit from nsIScriptObjectOwner
[2] Cutting down the size of content. Made nsITextContent inherit from nsIContent.
[3] Cutting down the size of content. Moved implementation of nsIDOMReceiver to nsListenerManager. This is not true aggregation since it isn't transitive, but it's OK for now. It will be necessary for nsListenerManager to have a reference to its content in the future anyway, so the transitivity could be done.
dom/public/nsDOMPropEnums.h,v - bug 12559
dom/public/nsIJSScriptObject.h,v - [1]
dom/public/html/MANIFEST,v - bug 12559
dom/public/html/Makefile.in,v - bug 12559
dom/public/html/makefile.win,v - bug 12559
dom/public/html/nsIDOMHTMLInputElement.h,v - bug 17544
dom/public/idl/html/HTMLAnchorElement.idl,v - bug 12559
dom/public/idl/html/HTMLAreaElement.idl,v - bug 12559
dom/public/idl/html/HTMLInputElement.idl,v - bug 17544
dom/src/base/nsGlobalWindow.cpp,v - bug 30700
dom/src/base/nsGlobalWindow.h,v - [1]
dom/src/base/nsLocation.cpp,v - [1]
dom/src/html/nsJSHTMLAnchorElement.cpp,v - bug 12559
dom/src/html/nsJSHTMLAreaElement.cpp,v - bug 12559
dom/src/html/nsJSHTMLInputElement.cpp,v - bug 17544
layout/base/public/nsIDocument.h,v - bug 27953
layout/base/public/nsITextContent.h,v - [2]
layout/base/src/nsCommentNode.cpp,v - [2]
layout/base/src/nsDocument.cpp,v - bug 27953
layout/base/src/nsDocument.h,v - bug 27953
layout/base/src/nsDocumentViewer.cpp,v - bug 27953
layout/base/src/nsGenericDOMDataNode.cpp,v - [3]
layout/base/src/nsGenericDOMDataNode.h,v - [3]
layout/base/src/nsGenericElement.cpp,v - [3]
layout/base/src/nsGenericElement.h,v - [3]
layout/base/src/nsNameSpaceManager.cpp,v - bug 7834
layout/base/src/nsStyleContext.cpp,v - outline property shouldn't reflow
layout/base/src/nsTextNode.cpp,v - [2]
layout/events/src/nsEventListenerManager.cpp,v - [3]
layout/events/src/nsEventListenerManager.h,v - [3]
layout/html/base/src/nsGfxScrollFrame.cpp,v - nsString->nsAutoString
layout/html/content/src/nsAttributeContent.cpp,v - [2]
layout/html/content/src/nsHTMLAnchorElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLAppletElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLAreaElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLBRElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLBaseElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLBaseFontElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLBodyElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLButtonElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLDListElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLDelElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLDirectoryElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLDivElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLEmbedElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFieldSetElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFontElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFormElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFrameElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFrameSetElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLHRElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLHeadElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLHeadingElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLHtmlElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLIFrameElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLImageElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLInputElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLInsElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLIsIndexElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLIElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLabelElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLayerElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLegendElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLinkElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLMapElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLMenuElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLMetaElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLModElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLOListElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLObjectElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLOptGroupElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLOptionElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLParagraphElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLParamElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLPreElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLQuoteElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLScriptElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLSelectElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLSpacerElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLSpanElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLStyleElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableCaptionElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableCellElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableColElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableColGroupElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableRowElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableSectionElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTextAreaElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTitleElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLUListElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLWBRElement.cpp,v - [1][3]
layout/html/document/src/nsHTMLDocument.cpp,v - bug 27953
layout/html/document/src/nsHTMLDocument.h,v - bug 27953
layout/xml/content/src/nsXMLCDATASection.cpp,v - [1][2]
layout/xml/content/src/nsXMLDocumentType.cpp,v - [1][2]
layout/xml/content/src/nsXMLElement.h,v - [1][2]
layout/xml/content/src/nsXMLEntity.cpp,v - [1][2]
layout/xml/content/src/nsXMLNotation.cpp,v - [1][2]
layout/xml/content/src/nsXMLProcessingInstruction.cpp,v - [1][2]
layout/xul/base/src/nsBoxFrame.cpp,v - nsString->nsAutoString
layout/xul/base/src/nsSliderFrame.cpp,v - nsString->nsAutoString
netwerk/protocol/http/src/nsHTTPRequest.cpp,v - nsString->nsAutoString
rdf/content/src/nsXULDocument.cpp,v - bug 27953
rdf/content/src/nsXULDocument.h,v - bug 27953
rdf/content/src/nsXULElement.h,v - [1]
xpcom/base/IIDS.h,v - bug 12559
2000-03-17 13:27:00 +00:00
|
|
|
nsAutoString value;
|
2005-10-28 11:25:24 +00:00
|
|
|
content->GetAttr(kNameSpaceID_None, atom, value);
|
|
|
|
if (!value.IsEmpty()) {
|
1999-06-15 04:02:43 +00:00
|
|
|
PRInt32 error;
|
|
|
|
|
|
|
|
// convert it to an integer
|
|
|
|
defaultValue = value.ToInteger(&error);
|
|
|
|
}
|
|
|
|
|
|
|
|
return defaultValue;
|
|
|
|
}
|
|
|
|
|
2009-01-14 18:21:58 +00:00
|
|
|
class nsValueChangedRunnable : public nsRunnable
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsValueChangedRunnable(nsISliderListener* aListener,
|
|
|
|
nsIAtom* aWhich,
|
|
|
|
PRInt32 aValue,
|
|
|
|
PRBool aUserChanged)
|
|
|
|
: mListener(aListener), mWhich(aWhich),
|
|
|
|
mValue(aValue), mUserChanged(aUserChanged)
|
|
|
|
{}
|
|
|
|
|
|
|
|
NS_IMETHODIMP Run()
|
|
|
|
{
|
|
|
|
nsAutoString which;
|
2009-01-14 18:56:07 +00:00
|
|
|
mWhich->ToString(which);
|
2009-01-14 18:21:58 +00:00
|
|
|
return mListener->ValueChanged(which, mValue, mUserChanged);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsCOMPtr<nsISliderListener> mListener;
|
|
|
|
nsCOMPtr<nsIAtom> mWhich;
|
|
|
|
PRInt32 mValue;
|
|
|
|
PRBool mUserChanged;
|
|
|
|
};
|
|
|
|
|
2009-05-21 05:27:01 +00:00
|
|
|
class nsDragStateChangedRunnable : public nsRunnable
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsDragStateChangedRunnable(nsISliderListener* aListener,
|
|
|
|
PRBool aDragBeginning)
|
|
|
|
: mListener(aListener),
|
|
|
|
mDragBeginning(aDragBeginning)
|
|
|
|
{}
|
|
|
|
|
|
|
|
NS_IMETHODIMP Run()
|
|
|
|
{
|
|
|
|
return mListener->DragStateChanged(mDragBeginning);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsCOMPtr<nsISliderListener> mListener;
|
|
|
|
PRBool mDragBeginning;
|
|
|
|
};
|
|
|
|
|
1999-06-15 04:02:43 +00:00
|
|
|
NS_IMETHODIMP
|
2005-09-07 16:49:21 +00:00
|
|
|
nsSliderFrame::AttributeChanged(PRInt32 aNameSpaceID,
|
2004-12-31 01:13:27 +00:00
|
|
|
nsIAtom* aAttribute,
|
|
|
|
PRInt32 aModType)
|
1999-06-15 04:02:43 +00:00
|
|
|
{
|
2005-09-07 16:49:21 +00:00
|
|
|
nsresult rv = nsBoxFrame::AttributeChanged(aNameSpaceID, aAttribute,
|
|
|
|
aModType);
|
1999-06-15 04:02:43 +00:00
|
|
|
// if the current position changes
|
2006-12-26 17:47:52 +00:00
|
|
|
if (aAttribute == nsGkAtoms::curpos) {
|
2007-05-25 10:09:29 +00:00
|
|
|
rv = CurrentPositionChanged(PresContext(), PR_FALSE);
|
1999-10-20 00:46:21 +00:00
|
|
|
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to change position");
|
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return rv;
|
2006-12-26 17:47:52 +00:00
|
|
|
} else if (aAttribute == nsGkAtoms::minpos ||
|
|
|
|
aAttribute == nsGkAtoms::maxpos) {
|
1999-10-12 00:16:06 +00:00
|
|
|
// bounds check it.
|
|
|
|
|
2000-03-31 07:02:06 +00:00
|
|
|
nsIBox* scrollbarBox = GetScrollbar();
|
2000-04-03 03:55:38 +00:00
|
|
|
nsCOMPtr<nsIContent> scrollbar;
|
2003-06-02 02:39:26 +00:00
|
|
|
scrollbar = GetContentOfBox(scrollbarBox);
|
2001-07-15 00:05:20 +00:00
|
|
|
PRInt32 current = GetCurrentPosition(scrollbar);
|
2006-05-30 13:50:48 +00:00
|
|
|
PRInt32 min = GetMinPosition(scrollbar);
|
1999-10-12 00:16:06 +00:00
|
|
|
PRInt32 max = GetMaxPosition(scrollbar);
|
2009-01-14 18:21:58 +00:00
|
|
|
|
|
|
|
// inform the parent <scale> that the minimum or maximum changed
|
|
|
|
nsIFrame* parent = GetParent();
|
|
|
|
if (parent) {
|
|
|
|
nsCOMPtr<nsISliderListener> sliderListener = do_QueryInterface(parent->GetContent());
|
|
|
|
if (sliderListener) {
|
|
|
|
nsContentUtils::AddScriptRunner(
|
|
|
|
new nsValueChangedRunnable(sliderListener, aAttribute,
|
|
|
|
aAttribute == nsGkAtoms::minpos ? min : max, PR_FALSE));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-30 13:50:48 +00:00
|
|
|
if (current < min || current > max)
|
1999-10-12 00:16:06 +00:00
|
|
|
{
|
2006-05-30 13:50:48 +00:00
|
|
|
if (current < min || max < min)
|
|
|
|
current = min;
|
2001-07-15 00:05:20 +00:00
|
|
|
else if (current > max)
|
2000-08-29 02:03:59 +00:00
|
|
|
current = max;
|
|
|
|
|
2003-04-14 14:34:45 +00:00
|
|
|
// set the new position and notify observers
|
2009-01-12 19:20:59 +00:00
|
|
|
nsIScrollbarFrame* scrollbarFrame = do_QueryFrame(scrollbarBox);
|
2000-08-29 02:03:59 +00:00
|
|
|
if (scrollbarFrame) {
|
2006-12-07 19:53:41 +00:00
|
|
|
nsIScrollbarMediator* mediator = scrollbarFrame->GetScrollbarMediator();
|
2000-08-29 02:03:59 +00:00
|
|
|
if (mediator) {
|
2004-05-29 00:09:05 +00:00
|
|
|
mediator->PositionChanged(scrollbarFrame, GetCurrentPosition(scrollbar), current);
|
2000-08-29 02:03:59 +00:00
|
|
|
}
|
|
|
|
}
|
2001-07-15 00:05:20 +00:00
|
|
|
|
2002-12-31 12:50:10 +00:00
|
|
|
nsAutoString currentStr;
|
|
|
|
currentStr.AppendInt(current);
|
2008-04-14 23:59:21 +00:00
|
|
|
nsContentUtils::AddScriptRunner(
|
|
|
|
new nsSetAttrRunnable(scrollbar, nsGkAtoms::curpos, currentStr));
|
1999-10-12 00:16:06 +00:00
|
|
|
}
|
|
|
|
}
|
2001-07-15 00:05:20 +00:00
|
|
|
|
2006-12-26 17:47:52 +00:00
|
|
|
if (aAttribute == nsGkAtoms::minpos ||
|
|
|
|
aAttribute == nsGkAtoms::maxpos ||
|
|
|
|
aAttribute == nsGkAtoms::pageincrement ||
|
|
|
|
aAttribute == nsGkAtoms::increment) {
|
2001-07-15 00:05:20 +00:00
|
|
|
|
2007-03-30 21:11:41 +00:00
|
|
|
PresContext()->PresShell()->
|
2007-05-06 19:16:51 +00:00
|
|
|
FrameNeedsReflow(this, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY);
|
1999-06-15 04:02:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2006-01-26 02:29:17 +00:00
|
|
|
nsSliderFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists)
|
|
|
|
{
|
|
|
|
if (aBuilder->IsForEventDelivery() && isDraggingThumb()) {
|
|
|
|
// This is EVIL, we shouldn't be messing with event delivery just to get
|
|
|
|
// thumb mouse drag events to arrive at the slider!
|
|
|
|
return aLists.Outlines()->AppendNewToTop(new (aBuilder)
|
|
|
|
nsDisplayEventReceiver(this));
|
|
|
|
}
|
|
|
|
|
|
|
|
return nsBoxFrame::BuildDisplayList(aBuilder, aDirtyRect, aLists);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSliderFrame::BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists)
|
1999-06-15 04:02:43 +00:00
|
|
|
{
|
1999-08-19 22:16:23 +00:00
|
|
|
// if we are too small to have a thumb don't paint it.
|
2007-02-22 18:05:14 +00:00
|
|
|
nsIBox* thumb = GetChildBox();
|
2000-03-31 07:02:06 +00:00
|
|
|
|
2001-01-11 01:56:27 +00:00
|
|
|
if (thumb) {
|
2004-09-28 18:37:50 +00:00
|
|
|
nsRect thumbRect(thumb->GetRect());
|
2001-01-11 01:56:27 +00:00
|
|
|
nsMargin m;
|
|
|
|
thumb->GetMargin(m);
|
|
|
|
thumbRect.Inflate(m);
|
2000-03-31 07:02:06 +00:00
|
|
|
|
2001-01-11 01:56:27 +00:00
|
|
|
nsRect crect;
|
|
|
|
GetClientRect(crect);
|
1999-08-19 22:16:23 +00:00
|
|
|
|
2001-01-11 01:56:27 +00:00
|
|
|
if (crect.width < thumbRect.width || crect.height < thumbRect.height)
|
|
|
|
return NS_OK;
|
1999-08-19 22:16:23 +00:00
|
|
|
}
|
2006-01-26 02:29:17 +00:00
|
|
|
|
|
|
|
return nsBoxFrame::BuildDisplayListForChildren(aBuilder, aDirtyRect, aLists);
|
1999-06-15 04:02:43 +00:00
|
|
|
}
|
1999-04-20 21:39:52 +00:00
|
|
|
|
2000-03-31 07:02:06 +00:00
|
|
|
NS_IMETHODIMP
|
2000-07-07 22:24:06 +00:00
|
|
|
nsSliderFrame::DoLayout(nsBoxLayoutState& aState)
|
1999-06-15 04:02:43 +00:00
|
|
|
{
|
2001-01-11 01:56:27 +00:00
|
|
|
// get the thumb should be our only child
|
2007-02-22 18:05:14 +00:00
|
|
|
nsIBox* thumbBox = GetChildBox();
|
2001-01-11 01:56:27 +00:00
|
|
|
|
|
|
|
if (!thumbBox) {
|
|
|
|
SyncLayout(aState);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2000-03-31 07:02:06 +00:00
|
|
|
EnsureOrient();
|
|
|
|
|
2004-06-19 09:07:47 +00:00
|
|
|
#ifdef DEBUG_LAYOUT
|
2000-03-31 07:02:06 +00:00
|
|
|
if (mState & NS_STATE_DEBUG_WAS_SET) {
|
|
|
|
if (mState & NS_STATE_SET_TO_DEBUG)
|
2000-04-25 07:10:48 +00:00
|
|
|
SetDebug(aState, PR_TRUE);
|
2000-03-31 07:02:06 +00:00
|
|
|
else
|
2000-04-25 07:10:48 +00:00
|
|
|
SetDebug(aState, PR_FALSE);
|
1999-04-20 21:39:52 +00:00
|
|
|
}
|
2004-06-19 09:07:47 +00:00
|
|
|
#endif
|
1999-06-15 04:02:43 +00:00
|
|
|
|
2000-03-31 07:02:06 +00:00
|
|
|
// get the content area inside our borders
|
|
|
|
nsRect clientRect(0,0,0,0);
|
|
|
|
GetClientRect(clientRect);
|
1999-06-15 04:02:43 +00:00
|
|
|
|
2000-03-31 07:02:06 +00:00
|
|
|
// get the scrollbar
|
|
|
|
nsIBox* scrollbarBox = GetScrollbar();
|
2000-04-03 03:55:38 +00:00
|
|
|
nsCOMPtr<nsIContent> scrollbar;
|
2003-06-02 02:39:26 +00:00
|
|
|
scrollbar = GetContentOfBox(scrollbarBox);
|
2000-03-31 07:02:06 +00:00
|
|
|
PRBool isHorizontal = IsHorizontal();
|
1999-06-15 04:02:43 +00:00
|
|
|
|
2000-03-31 07:02:06 +00:00
|
|
|
// get the thumb's pref size
|
2007-01-08 02:57:59 +00:00
|
|
|
nsSize thumbSize = thumbBox->GetPrefSize(aState);
|
2000-03-31 07:02:06 +00:00
|
|
|
|
|
|
|
if (isHorizontal)
|
|
|
|
thumbSize.height = clientRect.height;
|
|
|
|
else
|
|
|
|
thumbSize.width = clientRect.width;
|
1999-06-15 04:02:43 +00:00
|
|
|
|
|
|
|
// get our current position and max position from our content node
|
1999-08-19 22:16:23 +00:00
|
|
|
PRInt32 curpospx = GetCurrentPosition(scrollbar);
|
2006-05-30 13:50:48 +00:00
|
|
|
PRInt32 minpospx = GetMinPosition(scrollbar);
|
1999-08-19 22:16:23 +00:00
|
|
|
PRInt32 maxpospx = GetMaxPosition(scrollbar);
|
2004-03-05 16:29:23 +00:00
|
|
|
PRInt32 pageIncrement = GetPageIncrement(scrollbar);
|
1999-06-15 04:02:43 +00:00
|
|
|
|
2006-05-30 13:50:48 +00:00
|
|
|
if (maxpospx < minpospx)
|
|
|
|
maxpospx = minpospx;
|
|
|
|
|
|
|
|
if (curpospx < minpospx)
|
|
|
|
curpospx = minpospx;
|
1999-08-19 22:16:23 +00:00
|
|
|
else if (curpospx > maxpospx)
|
|
|
|
curpospx = maxpospx;
|
1999-06-15 04:02:43 +00:00
|
|
|
|
2007-02-07 07:46:44 +00:00
|
|
|
nscoord onePixel = nsPresContext::CSSPixelsToAppUnits(1);
|
1999-06-15 04:02:43 +00:00
|
|
|
|
1999-08-19 22:16:23 +00:00
|
|
|
// get max pos in twips
|
2006-05-30 13:50:48 +00:00
|
|
|
nscoord maxpos = (maxpospx - minpospx) * onePixel;
|
1999-06-15 04:02:43 +00:00
|
|
|
|
1999-08-19 22:16:23 +00:00
|
|
|
// get our maxpos in twips. This is the space we have left over in the scrollbar
|
1999-06-15 04:02:43 +00:00
|
|
|
// after the height of the thumb has been removed
|
2000-03-31 07:02:06 +00:00
|
|
|
nscoord& desiredcoord = isHorizontal ? clientRect.width : clientRect.height;
|
1999-06-15 04:02:43 +00:00
|
|
|
nscoord& thumbcoord = isHorizontal ? thumbSize.width : thumbSize.height;
|
|
|
|
|
2001-07-15 00:05:20 +00:00
|
|
|
nscoord ourmaxpos = desiredcoord;
|
1999-08-19 22:16:23 +00:00
|
|
|
|
2001-08-31 20:37:56 +00:00
|
|
|
mRatio = 1;
|
|
|
|
|
2006-05-30 13:50:48 +00:00
|
|
|
if ((pageIncrement + maxpospx - minpospx) > 0)
|
2000-12-12 01:52:45 +00:00
|
|
|
{
|
2004-03-05 16:29:23 +00:00
|
|
|
// if the thumb is flexible make the thumb bigger.
|
2007-01-31 16:02:42 +00:00
|
|
|
if (thumbBox->GetFlex(aState) > 0)
|
2000-12-12 01:52:45 +00:00
|
|
|
{
|
2006-05-30 13:50:48 +00:00
|
|
|
mRatio = float(pageIncrement) / float(maxpospx - minpospx + pageIncrement);
|
2004-03-05 16:29:23 +00:00
|
|
|
nscoord thumbsize = NSToCoordRound(ourmaxpos * mRatio);
|
|
|
|
|
|
|
|
// if there is more room than the thumb needs stretch the thumb
|
|
|
|
if (thumbsize > thumbcoord)
|
|
|
|
thumbcoord = thumbsize;
|
2000-12-12 01:52:45 +00:00
|
|
|
}
|
1999-04-20 21:39:52 +00:00
|
|
|
}
|
2004-03-05 16:29:23 +00:00
|
|
|
|
|
|
|
ourmaxpos -= thumbcoord;
|
|
|
|
if (float(maxpos) != 0)
|
2006-05-30 13:50:48 +00:00
|
|
|
mRatio = float(ourmaxpos) / float(maxpos);
|
2004-03-05 16:29:23 +00:00
|
|
|
|
2007-04-09 22:39:57 +00:00
|
|
|
// in reverse mode, curpos is reversed such that lower values are to the
|
|
|
|
// right or bottom and increase leftwards or upwards. In this case, use the
|
|
|
|
// offset from the end instead of the beginning.
|
|
|
|
PRBool reverse = mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::dir,
|
|
|
|
nsGkAtoms::reverse, eCaseMatters);
|
|
|
|
nscoord pos = reverse ? (maxpospx - curpospx) : (curpospx - minpospx);
|
|
|
|
|
|
|
|
// set the thumb's coord to be the current pos * the ratio.
|
2000-03-31 07:02:06 +00:00
|
|
|
nsRect thumbRect(clientRect.x, clientRect.y, thumbSize.width, thumbSize.height);
|
1999-06-15 04:02:43 +00:00
|
|
|
if (isHorizontal)
|
2007-04-09 22:39:57 +00:00
|
|
|
thumbRect.x += nscoord(float(pos * onePixel) * mRatio);
|
1999-06-15 04:02:43 +00:00
|
|
|
else
|
2007-04-09 22:39:57 +00:00
|
|
|
thumbRect.y += nscoord(float(pos * onePixel) * mRatio);
|
1999-06-15 04:02:43 +00:00
|
|
|
|
2004-09-28 18:37:50 +00:00
|
|
|
nsRect oldThumbRect(thumbBox->GetRect());
|
2000-04-25 07:10:48 +00:00
|
|
|
LayoutChildAt(aState, thumbBox, thumbRect);
|
|
|
|
|
|
|
|
SyncLayout(aState);
|
1999-10-12 00:16:06 +00:00
|
|
|
|
2002-11-26 21:38:18 +00:00
|
|
|
#ifdef DEBUG_SLIDER
|
|
|
|
PRInt32 c = GetCurrentPosition(scrollbar);
|
2006-05-30 13:50:48 +00:00
|
|
|
PRInt32 min = GetMinPosition(scrollbar);
|
|
|
|
PRInt32 max = GetMaxPosition(scrollbar);
|
|
|
|
printf("Current=%d, min=%d, max=%d\n", c, min, max);
|
2002-11-26 21:38:18 +00:00
|
|
|
#endif
|
2001-07-15 00:05:20 +00:00
|
|
|
|
2000-05-15 04:12:31 +00:00
|
|
|
// redraw only if thumb changed size.
|
|
|
|
if (oldThumbRect != thumbRect)
|
|
|
|
Redraw(aState);
|
|
|
|
|
1999-06-15 04:02:43 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2004-07-31 23:15:21 +00:00
|
|
|
nsSliderFrame::HandleEvent(nsPresContext* aPresContext,
|
1999-06-15 04:02:43 +00:00
|
|
|
nsGUIEvent* aEvent,
|
1999-11-24 06:03:41 +00:00
|
|
|
nsEventStatus* aEventStatus)
|
1999-06-15 04:02:43 +00:00
|
|
|
{
|
2009-02-27 10:48:25 +00:00
|
|
|
NS_ENSURE_ARG_POINTER(aEventStatus);
|
|
|
|
if (nsEventStatus_eConsumeNoDefault == *aEventStatus) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2000-03-31 07:02:06 +00:00
|
|
|
nsIBox* scrollbarBox = GetScrollbar();
|
2000-04-03 03:55:38 +00:00
|
|
|
nsCOMPtr<nsIContent> scrollbar;
|
2003-06-02 02:39:26 +00:00
|
|
|
scrollbar = GetContentOfBox(scrollbarBox);
|
2000-03-31 07:02:06 +00:00
|
|
|
PRBool isHorizontal = IsHorizontal();
|
1999-06-15 04:02:43 +00:00
|
|
|
|
2003-09-14 01:25:04 +00:00
|
|
|
if (isDraggingThumb())
|
1999-06-15 04:02:43 +00:00
|
|
|
{
|
|
|
|
switch (aEvent->message) {
|
|
|
|
case NS_MOUSE_MOVE: {
|
2005-08-23 03:57:07 +00:00
|
|
|
nsPoint eventPoint = nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent,
|
|
|
|
this);
|
2005-02-16 09:22:00 +00:00
|
|
|
if (mChange) {
|
|
|
|
// We're in the process of moving the thumb to the mouse,
|
|
|
|
// but the mouse just moved. Make sure to update our
|
|
|
|
// destination point.
|
2005-08-23 03:57:07 +00:00
|
|
|
mDestinationPoint = eventPoint;
|
2008-02-15 02:04:34 +00:00
|
|
|
StopRepeat();
|
|
|
|
StartRepeat();
|
2005-02-16 09:22:00 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-02-07 05:28:15 +00:00
|
|
|
nscoord pos = isHorizontal ? eventPoint.x : eventPoint.y;
|
|
|
|
|
|
|
|
nsIFrame* thumbFrame = mFrames.FirstChild();
|
|
|
|
if (!thumbFrame) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
// take our current position and subtract the start location
|
|
|
|
pos -= mDragStart;
|
|
|
|
PRBool isMouseOutsideThumb = PR_FALSE;
|
|
|
|
if (gSnapMultiplier) {
|
|
|
|
nsSize thumbSize = thumbFrame->GetSize();
|
|
|
|
if (isHorizontal) {
|
|
|
|
// horizontal scrollbar - check if mouse is above or below thumb
|
|
|
|
// XXXbz what about looking at the .y of the thumb's rect? Is that
|
|
|
|
// always zero here?
|
|
|
|
if (eventPoint.y < -gSnapMultiplier * thumbSize.height ||
|
|
|
|
eventPoint.y > thumbSize.height +
|
|
|
|
gSnapMultiplier * thumbSize.height)
|
|
|
|
isMouseOutsideThumb = PR_TRUE;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
// vertical scrollbar - check if mouse is left or right of thumb
|
|
|
|
if (eventPoint.x < -gSnapMultiplier * thumbSize.width ||
|
|
|
|
eventPoint.x > thumbSize.width +
|
|
|
|
gSnapMultiplier * thumbSize.width)
|
|
|
|
isMouseOutsideThumb = PR_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (isMouseOutsideThumb)
|
|
|
|
{
|
|
|
|
SetCurrentThumbPosition(scrollbar, mThumbStart, PR_FALSE, PR_TRUE, PR_FALSE);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
// set it
|
|
|
|
SetCurrentThumbPosition(scrollbar, pos, PR_FALSE, PR_TRUE, PR_TRUE); // with snapping
|
2001-07-15 00:05:20 +00:00
|
|
|
}
|
1999-06-15 04:02:43 +00:00
|
|
|
break;
|
|
|
|
|
2006-11-16 21:35:39 +00:00
|
|
|
case NS_MOUSE_BUTTON_UP:
|
2007-07-08 07:08:04 +00:00
|
|
|
if (static_cast<nsMouseEvent*>(aEvent)->button == nsMouseEvent::eLeftButton ||
|
|
|
|
(static_cast<nsMouseEvent*>(aEvent)->button == nsMouseEvent::eMiddleButton &&
|
2006-12-18 22:45:07 +00:00
|
|
|
gMiddlePref)) {
|
|
|
|
// stop capturing
|
2006-11-16 21:35:39 +00:00
|
|
|
AddListener();
|
|
|
|
DragThumb(PR_FALSE);
|
|
|
|
if (mChange) {
|
2008-02-15 02:04:34 +00:00
|
|
|
StopRepeat();
|
2006-11-16 21:35:39 +00:00
|
|
|
mChange = 0;
|
|
|
|
}
|
2007-05-25 10:09:29 +00:00
|
|
|
//we MUST call nsFrame HandleEvent for mouse ups to maintain the selection state and capture state.
|
2006-11-16 21:35:39 +00:00
|
|
|
return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
2005-02-16 09:22:00 +00:00
|
|
|
}
|
1999-06-15 04:02:43 +00:00
|
|
|
}
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-09 22:02:40 +00:00
|
|
|
|
1999-08-19 22:16:23 +00:00
|
|
|
//return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
|
|
|
return NS_OK;
|
2006-11-16 21:35:39 +00:00
|
|
|
} else if ((aEvent->message == NS_MOUSE_BUTTON_DOWN &&
|
2007-07-08 07:08:04 +00:00
|
|
|
static_cast<nsMouseEvent*>(aEvent)->button ==
|
2006-11-16 21:35:39 +00:00
|
|
|
nsMouseEvent::eLeftButton &&
|
2008-02-14 21:45:47 +00:00
|
|
|
#ifdef XP_MACOSX
|
|
|
|
// On Mac the option key inverts the scroll-to-here preference.
|
|
|
|
(static_cast<nsMouseEvent*>(aEvent)->isAlt != GetScrollToClick())) ||
|
|
|
|
#else
|
2009-03-31 18:11:35 +00:00
|
|
|
(static_cast<nsMouseEvent*>(aEvent)->isShift != GetScrollToClick())) ||
|
2008-02-14 21:45:47 +00:00
|
|
|
#endif
|
2006-11-16 21:35:39 +00:00
|
|
|
(gMiddlePref && aEvent->message == NS_MOUSE_BUTTON_DOWN &&
|
2007-07-08 07:08:04 +00:00
|
|
|
static_cast<nsMouseEvent*>(aEvent)->button ==
|
2006-11-16 21:35:39 +00:00
|
|
|
nsMouseEvent::eMiddleButton)) {
|
2008-02-07 05:28:15 +00:00
|
|
|
|
2005-08-23 03:57:07 +00:00
|
|
|
nsPoint eventPoint = nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent,
|
|
|
|
this);
|
2005-04-18 05:20:32 +00:00
|
|
|
nscoord pos = isHorizontal ? eventPoint.x : eventPoint.y;
|
|
|
|
|
2008-02-07 05:28:15 +00:00
|
|
|
// adjust so that the middle of the thumb is placed under the click
|
2000-06-03 02:07:52 +00:00
|
|
|
nsIFrame* thumbFrame = mFrames.FirstChild();
|
2006-12-21 21:44:10 +00:00
|
|
|
if (!thumbFrame) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2003-08-04 12:39:51 +00:00
|
|
|
nsSize thumbSize = thumbFrame->GetSize();
|
2000-06-03 02:07:52 +00:00
|
|
|
nscoord thumbLength = isHorizontal ? thumbSize.width : thumbSize.height;
|
|
|
|
|
|
|
|
// set it
|
2007-05-25 10:09:29 +00:00
|
|
|
nsWeakFrame weakFrame(this);
|
2008-02-07 05:28:15 +00:00
|
|
|
// should aMaySnap be PR_TRUE here?
|
|
|
|
SetCurrentThumbPosition(scrollbar, pos - thumbLength/2, PR_FALSE, PR_FALSE, PR_FALSE);
|
2007-05-25 10:09:29 +00:00
|
|
|
NS_ENSURE_TRUE(weakFrame.IsAlive(), NS_OK);
|
2000-06-03 02:07:52 +00:00
|
|
|
|
2003-09-14 01:25:04 +00:00
|
|
|
DragThumb(PR_TRUE);
|
2001-07-15 00:05:20 +00:00
|
|
|
|
2000-06-03 02:07:52 +00:00
|
|
|
if (isHorizontal)
|
2003-08-04 12:39:51 +00:00
|
|
|
mThumbStart = thumbFrame->GetPosition().x;
|
2000-06-03 02:07:52 +00:00
|
|
|
else
|
2003-08-04 12:39:51 +00:00
|
|
|
mThumbStart = thumbFrame->GetPosition().y;
|
2000-06-03 02:07:52 +00:00
|
|
|
|
2004-08-28 11:41:02 +00:00
|
|
|
mDragStart = pos - mThumbStart;
|
2000-06-03 02:07:52 +00:00
|
|
|
}
|
1999-06-15 04:02:43 +00:00
|
|
|
|
1999-08-19 22:16:23 +00:00
|
|
|
// XXX hack until handle release is actually called in nsframe.
|
2000-04-26 04:00:29 +00:00
|
|
|
// if (aEvent->message == NS_MOUSE_EXIT_SYNTH || aEvent->message == NS_MOUSE_RIGHT_BUTTON_UP || aEvent->message == NS_MOUSE_LEFT_BUTTON_UP)
|
|
|
|
// HandleRelease(aPresContext, aEvent, aEventStatus);
|
|
|
|
|
2005-02-16 09:22:00 +00:00
|
|
|
if (aEvent->message == NS_MOUSE_EXIT_SYNTH && mChange)
|
1999-08-19 22:16:23 +00:00
|
|
|
HandleRelease(aPresContext, aEvent, aEventStatus);
|
1999-06-15 04:02:43 +00:00
|
|
|
|
1999-08-19 22:16:23 +00:00
|
|
|
return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
1999-06-15 04:02:43 +00:00
|
|
|
}
|
|
|
|
|
2009-03-31 18:11:35 +00:00
|
|
|
// Helper function to collect the "scroll to click" metric. Beware of
|
|
|
|
// caching this, users expect to be able to change the system preference
|
|
|
|
// and see the browser change its behavior immediately.
|
|
|
|
PRBool
|
|
|
|
nsSliderFrame::GetScrollToClick()
|
|
|
|
{
|
|
|
|
// if there is no parent scrollbar, check the movetoclick attribute. If set
|
|
|
|
// to true, always scroll to the click point. If false, never do this.
|
|
|
|
// Otherwise, the default is true on Mac and false on other platforms.
|
|
|
|
if (GetScrollbar() == this)
|
|
|
|
#ifdef XP_MACOSX
|
|
|
|
return !mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::movetoclick,
|
|
|
|
nsGkAtoms::_false, eCaseMatters);
|
|
|
|
|
|
|
|
// if there was no scrollbar, always scroll on click
|
|
|
|
PRBool scrollToClick = PR_FALSE;
|
|
|
|
nsresult rv;
|
|
|
|
nsCOMPtr<nsILookAndFeel> lookNFeel =
|
|
|
|
do_GetService("@mozilla.org/widget/lookandfeel;1", &rv);
|
|
|
|
if (NS_SUCCEEDED(rv)) {
|
|
|
|
PRInt32 scrollToClickMetric;
|
|
|
|
rv = lookNFeel->GetMetric(nsILookAndFeel::eMetric_ScrollToClick,
|
|
|
|
scrollToClickMetric);
|
|
|
|
if (NS_SUCCEEDED(rv) && scrollToClickMetric == 1)
|
|
|
|
scrollToClick = PR_TRUE;
|
|
|
|
}
|
|
|
|
return scrollToClick;
|
1999-08-19 22:16:23 +00:00
|
|
|
|
2009-03-31 18:11:35 +00:00
|
|
|
#else
|
|
|
|
return mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::movetoclick,
|
|
|
|
nsGkAtoms::_true, eCaseMatters);
|
|
|
|
return PR_FALSE;
|
|
|
|
#endif
|
|
|
|
}
|
1999-06-15 04:02:43 +00:00
|
|
|
|
2000-03-31 07:02:06 +00:00
|
|
|
nsIBox*
|
|
|
|
nsSliderFrame::GetScrollbar()
|
1999-06-15 04:02:43 +00:00
|
|
|
{
|
|
|
|
// if we are in a scrollbar then return the scrollbar's content node
|
|
|
|
// if we are not then return ours.
|
|
|
|
nsIFrame* scrollbar;
|
2006-12-26 17:47:52 +00:00
|
|
|
nsScrollbarButtonFrame::GetParentWithTag(nsGkAtoms::scrollbar, this, scrollbar);
|
1999-06-15 04:02:43 +00:00
|
|
|
|
|
|
|
if (scrollbar == nsnull)
|
2000-03-31 07:02:06 +00:00
|
|
|
return this;
|
|
|
|
|
2004-09-28 18:37:50 +00:00
|
|
|
return scrollbar->IsBoxFrame() ? scrollbar : this;
|
2000-03-31 07:02:06 +00:00
|
|
|
}
|
1999-06-15 04:02:43 +00:00
|
|
|
|
|
|
|
void
|
2007-04-09 22:39:57 +00:00
|
|
|
nsSliderFrame::PageUpDown(nscoord change)
|
2001-07-15 00:05:20 +00:00
|
|
|
{
|
1999-06-15 04:02:43 +00:00
|
|
|
// on a page up or down get our page increment. We get this by getting the scrollbar we are in and
|
|
|
|
// asking it for the current position and the page increment. If we are not in a scrollbar we will
|
|
|
|
// get the values from our own node.
|
2000-03-31 07:02:06 +00:00
|
|
|
nsIBox* scrollbarBox = GetScrollbar();
|
2000-04-03 03:55:38 +00:00
|
|
|
nsCOMPtr<nsIContent> scrollbar;
|
2003-06-02 02:39:26 +00:00
|
|
|
scrollbar = GetContentOfBox(scrollbarBox);
|
2001-07-15 00:05:20 +00:00
|
|
|
|
2007-04-09 22:39:57 +00:00
|
|
|
if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::dir,
|
|
|
|
nsGkAtoms::reverse, eCaseMatters))
|
|
|
|
change = -change;
|
|
|
|
|
1999-06-15 04:02:43 +00:00
|
|
|
nscoord pageIncrement = GetPageIncrement(scrollbar);
|
|
|
|
PRInt32 curpos = GetCurrentPosition(scrollbar);
|
2006-05-30 13:50:48 +00:00
|
|
|
PRInt32 minpos = GetMinPosition(scrollbar);
|
2007-04-09 22:39:57 +00:00
|
|
|
PRInt32 maxpos = GetMaxPosition(scrollbar);
|
|
|
|
|
|
|
|
// get the new position and make sure it is in bounds
|
2007-08-10 12:45:20 +00:00
|
|
|
PRInt32 newpos = curpos + change * pageIncrement;
|
2007-04-09 22:39:57 +00:00
|
|
|
if (newpos < minpos || maxpos < minpos)
|
|
|
|
newpos = minpos;
|
|
|
|
else if (newpos > maxpos)
|
|
|
|
newpos = maxpos;
|
|
|
|
|
2007-05-25 10:09:29 +00:00
|
|
|
SetCurrentPositionInternal(scrollbar, newpos, PR_TRUE, PR_FALSE);
|
1999-06-15 04:02:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// called when the current position changed and we need to update the thumb's location
|
1999-10-20 00:46:21 +00:00
|
|
|
nsresult
|
2007-05-25 10:09:29 +00:00
|
|
|
nsSliderFrame::CurrentPositionChanged(nsPresContext* aPresContext,
|
|
|
|
PRBool aImmediateRedraw)
|
1999-06-15 04:02:43 +00:00
|
|
|
{
|
2000-03-31 07:02:06 +00:00
|
|
|
nsIBox* scrollbarBox = GetScrollbar();
|
2000-04-03 03:55:38 +00:00
|
|
|
nsCOMPtr<nsIContent> scrollbar;
|
2003-06-02 02:39:26 +00:00
|
|
|
scrollbar = GetContentOfBox(scrollbarBox);
|
1999-06-15 04:02:43 +00:00
|
|
|
|
2000-03-31 07:02:06 +00:00
|
|
|
PRBool isHorizontal = IsHorizontal();
|
1999-06-15 04:02:43 +00:00
|
|
|
|
2007-04-09 22:39:57 +00:00
|
|
|
// get the current position
|
|
|
|
PRInt32 curpospx = GetCurrentPosition(scrollbar);
|
1999-06-15 04:02:43 +00:00
|
|
|
|
2007-04-09 22:39:57 +00:00
|
|
|
// do nothing if the position did not change
|
|
|
|
if (mCurPos == curpospx)
|
|
|
|
return NS_OK;
|
1999-10-12 00:16:06 +00:00
|
|
|
|
2007-04-09 22:39:57 +00:00
|
|
|
// get our current min and max position from our content node
|
|
|
|
PRInt32 minpospx = GetMinPosition(scrollbar);
|
|
|
|
PRInt32 maxpospx = GetMaxPosition(scrollbar);
|
1999-06-15 04:02:43 +00:00
|
|
|
|
2007-04-09 22:39:57 +00:00
|
|
|
if (curpospx < minpospx || maxpospx < minpospx)
|
|
|
|
curpospx = minpospx;
|
|
|
|
else if (curpospx > maxpospx)
|
|
|
|
curpospx = maxpospx;
|
1999-06-15 04:02:43 +00:00
|
|
|
|
2007-04-09 22:39:57 +00:00
|
|
|
// get the thumb's rect
|
|
|
|
nsIFrame* thumbFrame = mFrames.FirstChild();
|
|
|
|
if (!thumbFrame)
|
|
|
|
return NS_OK; // The thumb may stream in asynchronously via XBL.
|
1999-06-15 04:02:43 +00:00
|
|
|
|
2007-04-09 22:39:57 +00:00
|
|
|
nsRect thumbRect = thumbFrame->GetRect();
|
2001-06-01 22:48:05 +00:00
|
|
|
|
2007-04-09 22:39:57 +00:00
|
|
|
nsRect clientRect;
|
|
|
|
GetClientRect(clientRect);
|
1999-06-15 04:02:43 +00:00
|
|
|
|
2007-04-09 22:39:57 +00:00
|
|
|
// figure out the new rect
|
|
|
|
nsRect newThumbRect(thumbRect);
|
2001-07-15 00:05:20 +00:00
|
|
|
|
2007-04-09 22:39:57 +00:00
|
|
|
PRBool reverse = mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::dir,
|
|
|
|
nsGkAtoms::reverse, eCaseMatters);
|
|
|
|
nscoord pos = reverse ? (maxpospx - curpospx) : (curpospx - minpospx);
|
1999-06-15 04:02:43 +00:00
|
|
|
|
2007-04-09 22:39:57 +00:00
|
|
|
// convert to pixels
|
|
|
|
nscoord onePixel = nsPresContext::CSSPixelsToAppUnits(1);
|
|
|
|
if (isHorizontal)
|
|
|
|
newThumbRect.x = clientRect.x + nscoord(float(pos * onePixel) * mRatio);
|
|
|
|
else
|
|
|
|
newThumbRect.y = clientRect.y + nscoord(float(pos * onePixel) * mRatio);
|
1999-06-15 04:02:43 +00:00
|
|
|
|
2007-04-09 22:39:57 +00:00
|
|
|
// set the rect
|
|
|
|
thumbFrame->SetRect(newThumbRect);
|
2001-07-15 00:05:20 +00:00
|
|
|
|
2008-02-07 08:56:38 +00:00
|
|
|
// Redraw the scrollbar
|
2008-09-18 09:47:21 +00:00
|
|
|
InvalidateWithFlags(clientRect, aImmediateRedraw ? INVALIDATE_IMMEDIATE : 0);
|
2008-02-07 08:56:38 +00:00
|
|
|
|
2007-04-09 22:39:57 +00:00
|
|
|
mCurPos = curpospx;
|
1999-06-23 17:00:17 +00:00
|
|
|
|
2009-01-14 18:21:58 +00:00
|
|
|
// inform the parent <scale> if it exists that the value changed
|
|
|
|
nsIFrame* parent = GetParent();
|
|
|
|
if (parent) {
|
|
|
|
nsCOMPtr<nsISliderListener> sliderListener = do_QueryInterface(parent->GetContent());
|
|
|
|
if (sliderListener) {
|
|
|
|
nsContentUtils::AddScriptRunner(
|
|
|
|
new nsValueChangedRunnable(sliderListener, nsGkAtoms::curpos, mCurPos, mUserChanged));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-04-09 22:39:57 +00:00
|
|
|
return NS_OK;
|
1999-06-15 04:02:43 +00:00
|
|
|
}
|
|
|
|
|
2003-03-24 05:29:45 +00:00
|
|
|
static void UpdateAttribute(nsIContent* aScrollbar, nscoord aNewPos, PRBool aNotify, PRBool aIsSmooth) {
|
|
|
|
nsAutoString str;
|
|
|
|
str.AppendInt(aNewPos);
|
|
|
|
|
|
|
|
if (aIsSmooth) {
|
2006-12-26 17:47:52 +00:00
|
|
|
aScrollbar->SetAttr(kNameSpaceID_None, nsGkAtoms::smooth, NS_LITERAL_STRING("true"), PR_FALSE);
|
2003-03-24 05:29:45 +00:00
|
|
|
}
|
2006-12-26 17:47:52 +00:00
|
|
|
aScrollbar->SetAttr(kNameSpaceID_None, nsGkAtoms::curpos, str, aNotify);
|
2003-03-24 05:29:45 +00:00
|
|
|
if (aIsSmooth) {
|
2006-12-26 17:47:52 +00:00
|
|
|
aScrollbar->UnsetAttr(kNameSpaceID_None, nsGkAtoms::smooth, PR_FALSE);
|
2003-03-24 05:29:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-02-07 05:28:15 +00:00
|
|
|
// Use this function when you want to set the scroll position via the position
|
|
|
|
// of the scrollbar thumb, e.g. when dragging the slider. This function scrolls
|
|
|
|
// the content in such a way that thumbRect.x/.y becomes aNewPos.
|
|
|
|
// aNewPos is measured in AppUnits.
|
|
|
|
void
|
|
|
|
nsSliderFrame::SetCurrentThumbPosition(nsIContent* aScrollbar, nscoord aNewPos,
|
|
|
|
PRBool aIsSmooth, PRBool aImmediateRedraw, PRBool aMaySnap)
|
|
|
|
{
|
|
|
|
nsRect crect;
|
|
|
|
GetClientRect(crect);
|
|
|
|
nscoord offset = IsHorizontal() ? crect.x : crect.y;
|
|
|
|
float realpos = nsPresContext::AppUnitsToFloatCSSPixels(aNewPos - offset);
|
|
|
|
|
|
|
|
if (aMaySnap && mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::snap,
|
|
|
|
nsGkAtoms::_true, eCaseMatters)) {
|
|
|
|
// If snap="true", then the slider may only be set to min + (increment * x).
|
|
|
|
// Otherwise, the slider may be set to any positive integer.
|
|
|
|
PRInt32 increment = GetIncrement(aScrollbar);
|
|
|
|
realpos = NSToCoordRound(realpos / float(increment)) * increment;
|
|
|
|
}
|
|
|
|
|
|
|
|
SetCurrentPosition(aScrollbar, NSToIntRound(realpos / mRatio), aIsSmooth, aImmediateRedraw);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Use this function when you know the target scroll position of the scrolled content.
|
|
|
|
// aNewPos should be passed to this function as a position as if the minpos is 0.
|
2007-04-09 22:39:57 +00:00
|
|
|
// That is, the minpos will be added to the position by this function. In a reverse
|
|
|
|
// direction slider, the newpos should be the distance from the end.
|
1999-06-15 04:02:43 +00:00
|
|
|
void
|
2008-02-07 05:28:15 +00:00
|
|
|
nsSliderFrame::SetCurrentPosition(nsIContent* aScrollbar, PRInt32 aNewPos,
|
2007-05-25 10:09:29 +00:00
|
|
|
PRBool aIsSmooth, PRBool aImmediateRedraw)
|
1999-06-15 04:02:43 +00:00
|
|
|
{
|
2007-04-09 22:39:57 +00:00
|
|
|
// get min and max position from our content node
|
2008-02-07 05:28:15 +00:00
|
|
|
PRInt32 minpos = GetMinPosition(aScrollbar);
|
|
|
|
PRInt32 maxpos = GetMaxPosition(aScrollbar);
|
1999-06-15 04:02:43 +00:00
|
|
|
|
2007-04-09 22:39:57 +00:00
|
|
|
// in reverse direction sliders, flip the value so that it goes from
|
|
|
|
// right to left, or bottom to top.
|
|
|
|
if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::dir,
|
|
|
|
nsGkAtoms::reverse, eCaseMatters))
|
2008-02-07 05:28:15 +00:00
|
|
|
aNewPos = maxpos - aNewPos;
|
2007-04-09 22:39:57 +00:00
|
|
|
else
|
2008-02-07 05:28:15 +00:00
|
|
|
aNewPos += minpos;
|
2006-05-30 13:50:48 +00:00
|
|
|
|
1999-06-15 04:02:43 +00:00
|
|
|
// get the new position and make sure it is in bounds
|
2008-02-07 05:28:15 +00:00
|
|
|
if (aNewPos < minpos || maxpos < minpos)
|
|
|
|
aNewPos = minpos;
|
|
|
|
else if (aNewPos > maxpos)
|
|
|
|
aNewPos = maxpos;
|
2007-04-09 22:39:57 +00:00
|
|
|
|
2008-02-07 05:28:15 +00:00
|
|
|
SetCurrentPositionInternal(aScrollbar, aNewPos, aIsSmooth, aImmediateRedraw);
|
2007-04-09 22:39:57 +00:00
|
|
|
}
|
1999-06-15 04:02:43 +00:00
|
|
|
|
2007-04-09 22:39:57 +00:00
|
|
|
void
|
2008-02-07 05:28:15 +00:00
|
|
|
nsSliderFrame::SetCurrentPositionInternal(nsIContent* aScrollbar, PRInt32 aNewPos,
|
2007-05-25 10:09:29 +00:00
|
|
|
PRBool aIsSmooth,
|
|
|
|
PRBool aImmediateRedraw)
|
2007-04-09 22:39:57 +00:00
|
|
|
{
|
2007-05-25 10:09:29 +00:00
|
|
|
nsCOMPtr<nsIContent> scrollbar = aScrollbar;
|
2000-06-06 23:13:05 +00:00
|
|
|
nsIBox* scrollbarBox = GetScrollbar();
|
2009-01-14 18:21:58 +00:00
|
|
|
|
|
|
|
mUserChanged = PR_TRUE;
|
|
|
|
|
2009-01-12 19:20:59 +00:00
|
|
|
nsIScrollbarFrame* scrollbarFrame = do_QueryFrame(scrollbarBox);
|
2000-06-06 23:13:05 +00:00
|
|
|
if (scrollbarFrame) {
|
|
|
|
// See if we have a mediator.
|
2006-12-07 19:53:41 +00:00
|
|
|
nsIScrollbarMediator* mediator = scrollbarFrame->GetScrollbarMediator();
|
2000-06-06 23:13:05 +00:00
|
|
|
if (mediator) {
|
2007-05-25 10:09:29 +00:00
|
|
|
nsRefPtr<nsPresContext> context = PresContext();
|
|
|
|
nsCOMPtr<nsIContent> content = GetContent();
|
2008-02-07 05:28:15 +00:00
|
|
|
mediator->PositionChanged(scrollbarFrame, GetCurrentPosition(scrollbar), aNewPos);
|
2006-12-07 19:53:41 +00:00
|
|
|
// 'mediator' might be dangling now...
|
2008-02-07 05:28:15 +00:00
|
|
|
UpdateAttribute(scrollbar, aNewPos, PR_FALSE, aIsSmooth);
|
2007-05-25 10:09:29 +00:00
|
|
|
nsIPresShell* shell = context->GetPresShell();
|
|
|
|
if (shell) {
|
|
|
|
nsIFrame* frame = shell->GetPrimaryFrameFor(content);
|
|
|
|
if (frame && frame->GetType() == nsGkAtoms::sliderFrame) {
|
2007-07-08 07:08:04 +00:00
|
|
|
static_cast<nsSliderFrame*>(frame)->
|
2007-05-25 10:09:29 +00:00
|
|
|
CurrentPositionChanged(frame->PresContext(), aImmediateRedraw);
|
|
|
|
}
|
|
|
|
}
|
2009-01-14 18:21:58 +00:00
|
|
|
mUserChanged = PR_FALSE;
|
2000-06-06 23:13:05 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-02-07 05:28:15 +00:00
|
|
|
UpdateAttribute(scrollbar, aNewPos, PR_TRUE, aIsSmooth);
|
2009-01-14 18:21:58 +00:00
|
|
|
mUserChanged = PR_FALSE;
|
1999-06-15 04:02:43 +00:00
|
|
|
|
2002-11-26 21:38:18 +00:00
|
|
|
#ifdef DEBUG_SLIDER
|
2008-02-07 05:28:15 +00:00
|
|
|
printf("Current Pos=%d\n",aNewPos);
|
2002-11-26 21:38:18 +00:00
|
|
|
#endif
|
2001-07-15 00:05:20 +00:00
|
|
|
|
1999-06-15 04:02:43 +00:00
|
|
|
}
|
|
|
|
|
2007-05-25 10:09:29 +00:00
|
|
|
nsIAtom*
|
|
|
|
nsSliderFrame::GetType() const
|
|
|
|
{
|
|
|
|
return nsGkAtoms::sliderFrame;
|
|
|
|
}
|
|
|
|
|
1999-06-15 04:02:43 +00:00
|
|
|
NS_IMETHODIMP
|
2006-04-10 00:16:29 +00:00
|
|
|
nsSliderFrame::SetInitialChildList(nsIAtom* aListName,
|
2009-07-28 12:53:20 +00:00
|
|
|
nsFrameList& aChildList)
|
1999-06-15 04:02:43 +00:00
|
|
|
{
|
2006-04-10 00:16:29 +00:00
|
|
|
nsresult r = nsBoxFrame::SetInitialChildList(aListName, aChildList);
|
1999-06-15 04:02:43 +00:00
|
|
|
|
|
|
|
AddListener();
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2000-04-26 04:00:29 +00:00
|
|
|
nsresult
|
|
|
|
nsSliderMediator::MouseDown(nsIDOMEvent* aMouseEvent)
|
|
|
|
{
|
2003-09-14 01:25:04 +00:00
|
|
|
// Only process the event if the thumb is not being dragged.
|
|
|
|
if (mSlider && !mSlider->isDraggingThumb())
|
2001-07-15 00:05:20 +00:00
|
|
|
return mSlider->MouseDown(aMouseEvent);
|
2003-09-14 01:25:04 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
2000-04-26 04:00:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsSliderMediator::MouseUp(nsIDOMEvent* aMouseEvent)
|
|
|
|
{
|
2003-09-14 01:25:04 +00:00
|
|
|
// Only process the event if the thumb is not being dragged.
|
|
|
|
if (mSlider && !mSlider->isDraggingThumb())
|
2001-07-15 00:05:20 +00:00
|
|
|
return mSlider->MouseUp(aMouseEvent);
|
2003-09-14 01:25:04 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
2000-04-26 04:00:29 +00:00
|
|
|
}
|
|
|
|
|
1999-06-15 04:02:43 +00:00
|
|
|
nsresult
|
|
|
|
nsSliderFrame::MouseDown(nsIDOMEvent* aMouseEvent)
|
|
|
|
{
|
2008-02-07 05:28:15 +00:00
|
|
|
#ifdef DEBUG_SLIDER
|
|
|
|
printf("Begin dragging\n");
|
|
|
|
#endif
|
2001-07-15 00:05:20 +00:00
|
|
|
|
2006-12-26 17:47:52 +00:00
|
|
|
if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::disabled,
|
|
|
|
nsGkAtoms::_true, eCaseMatters))
|
2006-05-30 13:50:48 +00:00
|
|
|
return NS_OK;
|
|
|
|
|
1999-11-03 07:11:45 +00:00
|
|
|
nsCOMPtr<nsIDOMMouseEvent> mouseEvent(do_QueryInterface(aMouseEvent));
|
2008-04-25 00:25:15 +00:00
|
|
|
PRUint16 button = 0;
|
|
|
|
mouseEvent->GetButton(&button);
|
|
|
|
if (!(button == 0 || (button == 1 && gMiddlePref)))
|
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
PRBool isHorizontal = IsHorizontal();
|
1999-06-15 04:02:43 +00:00
|
|
|
|
2003-11-24 23:52:49 +00:00
|
|
|
PRBool scrollToClick = PR_FALSE;
|
2008-04-25 00:25:15 +00:00
|
|
|
#ifndef XP_MACOSX
|
|
|
|
// On Mac there's no scroll-to-here when clicking the thumb
|
2003-11-24 23:52:49 +00:00
|
|
|
mouseEvent->GetShiftKey(&scrollToClick);
|
|
|
|
if (button != 0) {
|
|
|
|
scrollToClick = PR_TRUE;
|
|
|
|
}
|
2008-02-14 21:45:47 +00:00
|
|
|
#endif
|
2007-04-12 00:36:40 +00:00
|
|
|
|
2007-08-03 01:17:24 +00:00
|
|
|
nsPoint pt = nsLayoutUtils::GetDOMEventCoordinatesRelativeTo(mouseEvent,
|
|
|
|
this);
|
|
|
|
nscoord pos = isHorizontal ? pt.x : pt.y;
|
2005-04-18 05:20:32 +00:00
|
|
|
|
2003-11-24 23:52:49 +00:00
|
|
|
// If shift click or middle button, first
|
|
|
|
// place the middle of the slider thumb under the click
|
2007-05-25 10:09:29 +00:00
|
|
|
nsCOMPtr<nsIContent> scrollbar;
|
2008-02-07 05:28:15 +00:00
|
|
|
nscoord newpos = pos;
|
2003-11-24 23:52:49 +00:00
|
|
|
if (scrollToClick) {
|
2000-06-03 02:07:52 +00:00
|
|
|
// adjust so that the middle of the thumb is placed under the click
|
|
|
|
nsIFrame* thumbFrame = mFrames.FirstChild();
|
2006-12-21 21:44:10 +00:00
|
|
|
if (!thumbFrame) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2003-08-04 12:39:51 +00:00
|
|
|
nsSize thumbSize = thumbFrame->GetSize();
|
2000-06-03 02:07:52 +00:00
|
|
|
nscoord thumbLength = isHorizontal ? thumbSize.width : thumbSize.height;
|
|
|
|
|
2008-02-07 05:28:15 +00:00
|
|
|
newpos -= (thumbLength/2);
|
2000-06-03 02:07:52 +00:00
|
|
|
|
|
|
|
nsIBox* scrollbarBox = GetScrollbar();
|
2003-06-02 02:39:26 +00:00
|
|
|
scrollbar = GetContentOfBox(scrollbarBox);
|
2000-06-03 02:07:52 +00:00
|
|
|
}
|
2000-04-26 04:00:29 +00:00
|
|
|
|
2003-09-14 01:25:04 +00:00
|
|
|
DragThumb(PR_TRUE);
|
1999-06-15 04:02:43 +00:00
|
|
|
|
2008-04-25 00:25:15 +00:00
|
|
|
if (scrollToClick) {
|
|
|
|
// should aMaySnap be PR_TRUE here?
|
|
|
|
SetCurrentThumbPosition(scrollbar, newpos, PR_FALSE, PR_FALSE, PR_FALSE);
|
|
|
|
}
|
|
|
|
|
1999-06-15 04:02:43 +00:00
|
|
|
nsIFrame* thumbFrame = mFrames.FirstChild();
|
2006-12-21 21:44:10 +00:00
|
|
|
if (!thumbFrame) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
1999-06-15 04:02:43 +00:00
|
|
|
|
|
|
|
if (isHorizontal)
|
2008-04-25 00:25:15 +00:00
|
|
|
mThumbStart = thumbFrame->GetPosition().x;
|
1999-06-15 04:02:43 +00:00
|
|
|
else
|
2008-04-25 00:25:15 +00:00
|
|
|
mThumbStart = thumbFrame->GetPosition().y;
|
2001-07-15 00:05:20 +00:00
|
|
|
|
2004-08-28 11:41:02 +00:00
|
|
|
mDragStart = pos - mThumbStart;
|
2008-02-07 05:28:15 +00:00
|
|
|
|
|
|
|
#ifdef DEBUG_SLIDER
|
|
|
|
printf("Pressed mDragStart=%d\n",mDragStart);
|
|
|
|
#endif
|
2001-07-15 00:05:20 +00:00
|
|
|
|
1999-06-15 04:02:43 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsSliderFrame::MouseUp(nsIDOMEvent* aMouseEvent)
|
|
|
|
{
|
2008-02-07 05:28:15 +00:00
|
|
|
#ifdef DEBUG_SLIDER
|
|
|
|
printf("Finish dragging\n");
|
|
|
|
#endif
|
1999-08-19 22:16:23 +00:00
|
|
|
|
1999-06-15 04:02:43 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2003-09-14 01:25:04 +00:00
|
|
|
void
|
|
|
|
nsSliderFrame::DragThumb(PRBool aGrabMouseEvents)
|
1999-06-15 04:02:43 +00:00
|
|
|
{
|
2009-05-21 05:27:01 +00:00
|
|
|
// inform the parent <scale> that a drag is beginning or ending
|
|
|
|
nsIFrame* parent = GetParent();
|
|
|
|
if (parent) {
|
|
|
|
nsCOMPtr<nsISliderListener> sliderListener = do_QueryInterface(parent->GetContent());
|
|
|
|
if (sliderListener) {
|
|
|
|
nsContentUtils::AddScriptRunner(
|
|
|
|
new nsDragStateChangedRunnable(sliderListener, aGrabMouseEvents));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-02-07 05:28:15 +00:00
|
|
|
// get its view
|
2003-08-04 12:39:51 +00:00
|
|
|
nsIView* view = GetView();
|
1999-06-15 04:02:43 +00:00
|
|
|
|
|
|
|
if (view) {
|
2003-08-04 12:39:51 +00:00
|
|
|
nsIViewManager* viewMan = view->GetViewManager();
|
1999-06-15 04:02:43 +00:00
|
|
|
|
|
|
|
if (viewMan) {
|
2003-08-04 12:39:51 +00:00
|
|
|
PRBool result;
|
|
|
|
|
1999-06-15 04:02:43 +00:00
|
|
|
if (aGrabMouseEvents) {
|
|
|
|
viewMan->GrabMouseEvents(view,result);
|
|
|
|
} else {
|
|
|
|
viewMan->GrabMouseEvents(nsnull,result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool
|
2003-09-14 01:25:04 +00:00
|
|
|
nsSliderFrame::isDraggingThumb()
|
1999-06-15 04:02:43 +00:00
|
|
|
{
|
2008-02-07 05:28:15 +00:00
|
|
|
// get its view
|
2003-08-04 12:39:51 +00:00
|
|
|
nsIView* view = GetView();
|
2001-07-15 00:05:20 +00:00
|
|
|
|
1999-06-15 04:02:43 +00:00
|
|
|
if (view) {
|
2003-08-04 12:39:51 +00:00
|
|
|
nsIViewManager* viewMan = view->GetViewManager();
|
1999-06-15 04:02:43 +00:00
|
|
|
|
|
|
|
if (viewMan) {
|
|
|
|
nsIView* grabbingView;
|
|
|
|
viewMan->GetMouseEventGrabber(grabbingView);
|
|
|
|
if (grabbingView == view)
|
|
|
|
return PR_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsSliderFrame::AddListener()
|
|
|
|
{
|
2000-04-26 04:00:29 +00:00
|
|
|
if (!mMediator) {
|
|
|
|
mMediator = new nsSliderMediator(this);
|
|
|
|
}
|
|
|
|
|
1999-06-15 04:02:43 +00:00
|
|
|
nsIFrame* thumbFrame = mFrames.FirstChild();
|
2001-01-11 01:56:27 +00:00
|
|
|
if (thumbFrame) {
|
2007-05-14 09:11:38 +00:00
|
|
|
thumbFrame->GetContent()->
|
|
|
|
AddEventListenerByIID(mMediator, NS_GET_IID(nsIDOMMouseListener));
|
2001-01-11 01:56:27 +00:00
|
|
|
}
|
1999-06-15 04:02:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsSliderFrame::RemoveListener()
|
|
|
|
{
|
2000-04-26 04:00:29 +00:00
|
|
|
NS_ASSERTION(mMediator, "No listener was ever added!!");
|
|
|
|
|
1999-06-15 04:02:43 +00:00
|
|
|
nsIFrame* thumbFrame = mFrames.FirstChild();
|
2001-12-17 22:51:39 +00:00
|
|
|
if (!thumbFrame)
|
|
|
|
return;
|
|
|
|
|
2007-05-14 09:11:38 +00:00
|
|
|
thumbFrame->GetContent()->
|
|
|
|
RemoveEventListenerByIID(mMediator, NS_GET_IID(nsIDOMMouseListener));
|
1999-06-15 04:02:43 +00:00
|
|
|
}
|
1999-06-23 17:00:17 +00:00
|
|
|
|
1999-08-19 22:16:23 +00:00
|
|
|
NS_IMETHODIMP
|
2004-07-31 23:15:21 +00:00
|
|
|
nsSliderFrame::HandlePress(nsPresContext* aPresContext,
|
2002-11-23 05:20:05 +00:00
|
|
|
nsGUIEvent* aEvent,
|
|
|
|
nsEventStatus* aEventStatus)
|
1999-08-19 22:16:23 +00:00
|
|
|
{
|
2008-02-14 21:45:47 +00:00
|
|
|
#ifdef XP_MACOSX
|
|
|
|
// On Mac the option key inverts the scroll-to-here preference.
|
|
|
|
if (((nsMouseEvent *)aEvent)->isAlt != GetScrollToClick())
|
|
|
|
#else
|
2009-03-31 18:11:35 +00:00
|
|
|
if (((nsMouseEvent *)aEvent)->isShift != GetScrollToClick())
|
2008-02-14 21:45:47 +00:00
|
|
|
#endif
|
2003-11-24 23:52:49 +00:00
|
|
|
return NS_OK;
|
|
|
|
|
1999-08-19 22:16:23 +00:00
|
|
|
nsIFrame* thumbFrame = mFrames.FirstChild();
|
2002-11-23 05:20:05 +00:00
|
|
|
if (!thumbFrame) // display:none?
|
|
|
|
return NS_OK;
|
2006-05-30 13:50:48 +00:00
|
|
|
|
2006-12-26 17:47:52 +00:00
|
|
|
if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::disabled,
|
|
|
|
nsGkAtoms::_true, eCaseMatters))
|
2006-05-30 13:50:48 +00:00
|
|
|
return NS_OK;
|
2002-11-23 05:20:05 +00:00
|
|
|
|
2003-08-04 12:39:51 +00:00
|
|
|
nsRect thumbRect = thumbFrame->GetRect();
|
2002-11-23 05:20:05 +00:00
|
|
|
|
|
|
|
nscoord change = 1;
|
2005-08-23 03:57:07 +00:00
|
|
|
nsPoint eventPoint = nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent,
|
|
|
|
this);
|
2005-04-18 05:20:32 +00:00
|
|
|
if (IsHorizontal() ? eventPoint.x < thumbRect.x
|
|
|
|
: eventPoint.y < thumbRect.y)
|
2002-11-23 05:20:05 +00:00
|
|
|
change = -1;
|
|
|
|
|
|
|
|
mChange = change;
|
2005-02-16 09:22:00 +00:00
|
|
|
DragThumb(PR_TRUE);
|
2005-04-18 05:20:32 +00:00
|
|
|
mDestinationPoint = eventPoint;
|
2008-02-15 02:04:34 +00:00
|
|
|
StartRepeat();
|
2007-05-25 10:09:29 +00:00
|
|
|
PageUpDown(change);
|
1999-08-19 22:16:23 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2001-07-15 00:05:20 +00:00
|
|
|
NS_IMETHODIMP
|
2004-07-31 23:15:21 +00:00
|
|
|
nsSliderFrame::HandleRelease(nsPresContext* aPresContext,
|
1999-08-19 22:16:23 +00:00
|
|
|
nsGUIEvent* aEvent,
|
1999-11-24 06:03:41 +00:00
|
|
|
nsEventStatus* aEventStatus)
|
1999-08-19 22:16:23 +00:00
|
|
|
{
|
2008-02-15 02:04:34 +00:00
|
|
|
StopRepeat();
|
1999-08-19 22:16:23 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2006-04-10 00:16:29 +00:00
|
|
|
void
|
|
|
|
nsSliderFrame::Destroy()
|
1999-08-29 10:51:15 +00:00
|
|
|
{
|
2000-04-26 04:00:29 +00:00
|
|
|
// tell our mediator if we have one we are gone.
|
|
|
|
if (mMediator) {
|
|
|
|
mMediator->SetSlider(nsnull);
|
|
|
|
mMediator = nsnull;
|
|
|
|
}
|
2008-02-15 02:04:34 +00:00
|
|
|
StopRepeat();
|
2000-04-26 04:00:29 +00:00
|
|
|
|
1999-12-13 23:33:17 +00:00
|
|
|
// call base class Destroy()
|
2006-04-10 00:16:29 +00:00
|
|
|
nsBoxFrame::Destroy();
|
2000-03-31 07:02:06 +00:00
|
|
|
}
|
|
|
|
|
2007-01-08 02:57:59 +00:00
|
|
|
nsSize
|
|
|
|
nsSliderFrame::GetPrefSize(nsBoxLayoutState& aState)
|
2000-03-31 07:02:06 +00:00
|
|
|
{
|
|
|
|
EnsureOrient();
|
2007-01-08 02:57:59 +00:00
|
|
|
return nsBoxFrame::GetPrefSize(aState);
|
2000-03-31 07:02:06 +00:00
|
|
|
}
|
|
|
|
|
2007-01-08 02:57:59 +00:00
|
|
|
nsSize
|
|
|
|
nsSliderFrame::GetMinSize(nsBoxLayoutState& aState)
|
2000-03-31 07:02:06 +00:00
|
|
|
{
|
|
|
|
EnsureOrient();
|
|
|
|
|
|
|
|
// our min size is just our borders and padding
|
2007-01-08 02:57:59 +00:00
|
|
|
return nsBox::GetMinSize(aState);
|
2000-03-31 07:02:06 +00:00
|
|
|
}
|
|
|
|
|
2007-01-08 02:57:59 +00:00
|
|
|
nsSize
|
|
|
|
nsSliderFrame::GetMaxSize(nsBoxLayoutState& aState)
|
2000-03-31 07:02:06 +00:00
|
|
|
{
|
|
|
|
EnsureOrient();
|
2007-01-08 02:57:59 +00:00
|
|
|
return nsBoxFrame::GetMaxSize(aState);
|
2000-03-31 07:02:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsSliderFrame::EnsureOrient()
|
|
|
|
{
|
|
|
|
nsIBox* scrollbarBox = GetScrollbar();
|
|
|
|
|
2004-09-28 18:37:50 +00:00
|
|
|
PRBool isHorizontal = (scrollbarBox->GetStateBits() & NS_STATE_IS_HORIZONTAL) != 0;
|
2000-03-31 07:02:06 +00:00
|
|
|
if (isHorizontal)
|
|
|
|
mState |= NS_STATE_IS_HORIZONTAL;
|
|
|
|
else
|
|
|
|
mState &= ~NS_STATE_IS_HORIZONTAL;
|
1999-08-29 10:51:15 +00:00
|
|
|
}
|
|
|
|
|
1999-08-19 22:16:23 +00:00
|
|
|
|
2008-02-15 02:04:34 +00:00
|
|
|
void nsSliderFrame::Notify(void)
|
2001-07-15 00:05:20 +00:00
|
|
|
{
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-09 22:02:40 +00:00
|
|
|
PRBool stop = PR_FALSE;
|
|
|
|
|
|
|
|
nsIFrame* thumbFrame = mFrames.FirstChild();
|
2006-12-21 21:44:10 +00:00
|
|
|
if (!thumbFrame) {
|
2008-02-15 02:04:34 +00:00
|
|
|
StopRepeat();
|
2006-12-21 21:44:10 +00:00
|
|
|
return;
|
|
|
|
}
|
2003-08-04 12:39:51 +00:00
|
|
|
nsRect thumbRect = thumbFrame->GetRect();
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-09 22:02:40 +00:00
|
|
|
|
2000-03-31 07:02:06 +00:00
|
|
|
PRBool isHorizontal = IsHorizontal();
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-09 22:02:40 +00:00
|
|
|
|
2004-01-27 05:19:57 +00:00
|
|
|
// See if the thumb has moved past our destination point.
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-09 22:02:40 +00:00
|
|
|
// if it has we want to stop.
|
|
|
|
if (isHorizontal) {
|
|
|
|
if (mChange < 0) {
|
2004-01-27 05:19:57 +00:00
|
|
|
if (thumbRect.x < mDestinationPoint.x)
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-09 22:02:40 +00:00
|
|
|
stop = PR_TRUE;
|
|
|
|
} else {
|
2004-01-27 05:19:57 +00:00
|
|
|
if (thumbRect.x + thumbRect.width > mDestinationPoint.x)
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-09 22:02:40 +00:00
|
|
|
stop = PR_TRUE;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (mChange < 0) {
|
2004-01-27 05:19:57 +00:00
|
|
|
if (thumbRect.y < mDestinationPoint.y)
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-09 22:02:40 +00:00
|
|
|
stop = PR_TRUE;
|
|
|
|
} else {
|
2004-01-27 05:19:57 +00:00
|
|
|
if (thumbRect.y + thumbRect.height > mDestinationPoint.y)
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-09 22:02:40 +00:00
|
|
|
stop = PR_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (stop) {
|
2008-02-15 02:04:34 +00:00
|
|
|
StopRepeat();
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-09 22:02:40 +00:00
|
|
|
} else {
|
2007-04-09 22:39:57 +00:00
|
|
|
PageUpDown(mChange);
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-09 22:02:40 +00:00
|
|
|
}
|
1999-08-19 22:16:23 +00:00
|
|
|
}
|
2000-03-31 07:02:06 +00:00
|
|
|
|
2008-04-06 12:28:34 +00:00
|
|
|
NS_IMPL_ISUPPORTS2(nsSliderMediator,
|
|
|
|
nsIDOMMouseListener,
|
|
|
|
nsIDOMEventListener)
|