1999-04-20 21:39:52 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
1999-11-06 03:40:37 +00:00
|
|
|
* The contents of this file are subject to the Netscape 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/NPL/
|
1999-04-20 21:39:52 +00:00
|
|
|
*
|
1999-11-06 03:40:37 +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.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape Communications
|
1999-11-06 03:40:37 +00:00
|
|
|
* Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
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"
|
1999-04-20 21:39:52 +00:00
|
|
|
#include "nsIStyleContext.h"
|
1999-06-15 04:02:43 +00:00
|
|
|
#include "nsIPresContext.h"
|
|
|
|
#include "nsIContent.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsHTMLIIDs.h"
|
|
|
|
#include "nsUnitConversion.h"
|
1999-04-20 21:39:52 +00:00
|
|
|
#include "nsINameSpaceManager.h"
|
1999-06-15 04:02:43 +00:00
|
|
|
#include "nsXULAtoms.h"
|
|
|
|
#include "nsHTMLAtoms.h"
|
|
|
|
#include "nsIReflowCommand.h"
|
|
|
|
#include "nsHTMLParts.h"
|
|
|
|
#include "nsIPresShell.h"
|
|
|
|
#include "nsStyleChangeList.h"
|
|
|
|
#include "nsCSSRendering.h"
|
|
|
|
#include "nsHTMLAtoms.h"
|
|
|
|
#include "nsIDOMEventReceiver.h"
|
|
|
|
#include "nsIViewManager.h"
|
1999-11-03 07:11:45 +00:00
|
|
|
#include "nsIDOMMouseEvent.h"
|
1999-06-15 04:02:43 +00:00
|
|
|
#include "nsDocument.h"
|
|
|
|
#include "nsTitledButtonFrame.h"
|
|
|
|
#include "nsScrollbarButtonFrame.h"
|
1999-06-23 17:00:17 +00:00
|
|
|
#include "nsIScrollbarListener.h"
|
1999-06-30 22:17:43 +00:00
|
|
|
#include "nsISupportsArray.h"
|
1999-08-19 22:16:23 +00:00
|
|
|
#include "nsIXMLContent.h"
|
|
|
|
#include "nsXULAtoms.h"
|
|
|
|
#include "nsHTMLAtoms.h"
|
|
|
|
#include "nsINameSpaceManager.h"
|
|
|
|
#include "nsIScrollableView.h"
|
|
|
|
#include "nsRepeatService.h"
|
|
|
|
|
1999-10-12 00:16:06 +00:00
|
|
|
#define DEBUG_SLIDER PR_FALSE
|
|
|
|
|
1999-04-20 21:39:52 +00:00
|
|
|
|
|
|
|
nsresult
|
1999-12-04 23:49:50 +00:00
|
|
|
NS_NewSliderFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
1999-04-20 21:39:52 +00:00
|
|
|
{
|
1999-05-11 22:03:29 +00:00
|
|
|
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
|
|
|
if (nsnull == aNewFrame) {
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
}
|
1999-12-04 23:49:50 +00:00
|
|
|
nsSliderFrame* it = new (aPresShell) nsSliderFrame();
|
1999-06-15 04:02:43 +00:00
|
|
|
if (nsnull == it)
|
1999-04-20 21:39:52 +00:00
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
1999-06-15 04:02:43 +00:00
|
|
|
|
1999-05-11 22:03:29 +00:00
|
|
|
*aNewFrame = it;
|
1999-04-20 21:39:52 +00:00
|
|
|
return NS_OK;
|
1999-06-15 04:02:43 +00:00
|
|
|
|
|
|
|
} // NS_NewSliderFrame
|
1999-04-20 21:39:52 +00:00
|
|
|
|
1999-04-20 21:43:09 +00:00
|
|
|
nsSliderFrame::nsSliderFrame()
|
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
|
|
|
: mCurPos(0), mScrollbarListener(nsnull),mChange(0)
|
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()
|
|
|
|
{
|
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
|
|
|
mRedrawImmediate = PR_FALSE;
|
1999-08-19 22:16:23 +00:00
|
|
|
}
|
|
|
|
|
1999-06-15 04:02:43 +00:00
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsSliderFrame::Init(nsIPresContext* aPresContext,
|
1999-06-15 04:02:43 +00:00
|
|
|
nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIStyleContext* aContext,
|
|
|
|
nsIFrame* aPrevInFlow)
|
1999-04-20 21:39:52 +00:00
|
|
|
{
|
1999-06-15 04:02:43 +00:00
|
|
|
nsresult rv = nsHTMLContainerFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
|
|
|
|
CreateViewForFrame(aPresContext,this,aContext,PR_TRUE);
|
1999-08-19 22:16:23 +00:00
|
|
|
nsIView* view;
|
1999-11-24 06:03:41 +00:00
|
|
|
GetView(aPresContext, &view);
|
1999-08-19 22:16:23 +00:00
|
|
|
view->SetContentTransparency(PR_TRUE);
|
1999-10-26 04:44:41 +00:00
|
|
|
// XXX Hack
|
1999-11-24 06:03:41 +00:00
|
|
|
mPresContext = aPresContext;
|
1999-06-15 04:02:43 +00:00
|
|
|
return rv;
|
1999-04-20 21:39:52 +00:00
|
|
|
}
|
|
|
|
|
1999-06-15 04:02:43 +00:00
|
|
|
PRInt32
|
|
|
|
nsSliderFrame::GetCurrentPosition(nsIContent* content)
|
|
|
|
{
|
|
|
|
return GetIntegerAttribute(content, nsXULAtoms::curpos, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
PRInt32
|
|
|
|
nsSliderFrame::GetMaxPosition(nsIContent* content)
|
|
|
|
{
|
|
|
|
return GetIntegerAttribute(content, nsXULAtoms::maxpos, 100);
|
|
|
|
}
|
|
|
|
|
|
|
|
PRInt32
|
|
|
|
nsSliderFrame::GetIncrement(nsIContent* content)
|
|
|
|
{
|
|
|
|
return GetIntegerAttribute(content, nsXULAtoms::increment, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PRInt32
|
|
|
|
nsSliderFrame::GetPageIncrement(nsIContent* content)
|
|
|
|
{
|
|
|
|
return GetIntegerAttribute(content, nsXULAtoms::pageincrement, 10);
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
1999-06-15 04:02:43 +00:00
|
|
|
if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttribute(kNameSpaceID_None, atom, value))
|
|
|
|
{
|
|
|
|
PRInt32 error;
|
|
|
|
|
|
|
|
// convert it to an integer
|
|
|
|
defaultValue = value.ToInteger(&error);
|
|
|
|
}
|
|
|
|
|
|
|
|
return defaultValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSliderFrame::AttributeChanged(nsIPresContext* aPresContext,
|
|
|
|
nsIContent* aChild,
|
1999-10-15 23:16:45 +00:00
|
|
|
PRInt32 aNameSpaceID,
|
1999-06-15 04:02:43 +00:00
|
|
|
nsIAtom* aAttribute,
|
|
|
|
PRInt32 aHint)
|
|
|
|
{
|
|
|
|
nsresult rv = nsHTMLContainerFrame::AttributeChanged(aPresContext, aChild,
|
1999-10-15 23:16:45 +00:00
|
|
|
aNameSpaceID, aAttribute, aHint);
|
1999-06-15 04:02:43 +00:00
|
|
|
// if the current position changes
|
|
|
|
if (aAttribute == nsXULAtoms::curpos) {
|
1999-10-20 00:46:21 +00:00
|
|
|
rv = CurrentPositionChanged(aPresContext);
|
|
|
|
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to change position");
|
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return rv;
|
1999-10-12 00:16:06 +00:00
|
|
|
} else if (aAttribute == nsXULAtoms::maxpos) {
|
|
|
|
// bounds check it.
|
|
|
|
|
|
|
|
nsIContent* scrollbar = GetScrollBar();
|
|
|
|
PRInt32 current = GetCurrentPosition(scrollbar);
|
|
|
|
PRInt32 max = GetMaxPosition(scrollbar);
|
|
|
|
if (current < 0 || current > max)
|
|
|
|
{
|
|
|
|
if (current < 0)
|
|
|
|
current = 0;
|
|
|
|
else if (current > max)
|
|
|
|
current = max;
|
|
|
|
|
|
|
|
char ch[100];
|
|
|
|
sprintf(ch,"%d", current);
|
|
|
|
|
|
|
|
// set the new position but don't notify anyone. We already know
|
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
|
|
|
scrollbar->SetAttribute(kNameSpaceID_None, nsXULAtoms::curpos, nsAutoString(ch), PR_FALSE);
|
1999-10-12 00:16:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((aHint != NS_STYLE_HINT_REFLOW) &&
|
1999-09-08 03:51:41 +00:00
|
|
|
(aAttribute == nsXULAtoms::maxpos ||
|
1999-08-19 22:16:23 +00:00
|
|
|
aAttribute == nsXULAtoms::pageincrement ||
|
1999-09-08 03:51:41 +00:00
|
|
|
aAttribute == nsXULAtoms::increment)) {
|
1999-08-19 22:16:23 +00:00
|
|
|
nsCOMPtr<nsIPresShell> shell;
|
|
|
|
aPresContext->GetShell(getter_AddRefs(shell));
|
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
|
|
|
nsCOMPtr<nsIReflowCommand> reflowCmd;
|
1999-09-15 19:17:37 +00:00
|
|
|
rv = NS_NewHTMLReflowCommand(getter_AddRefs(reflowCmd), this,
|
|
|
|
nsIReflowCommand::StyleChanged);
|
1999-08-19 22:16:23 +00:00
|
|
|
if (NS_SUCCEEDED(rv))
|
|
|
|
shell->AppendReflowCommand(reflowCmd);
|
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-10-12 00:16:06 +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
|
|
|
mState |= NS_FRAME_IS_DIRTY;
|
|
|
|
return mParent->ReflowDirtyChild(shell, this);
|
1999-06-15 04:02:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsSliderFrame::Paint(nsIPresContext* aPresContext,
|
1999-06-15 04:02:43 +00:00
|
|
|
nsIRenderingContext& aRenderingContext,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsFramePaintLayer aWhichLayer)
|
|
|
|
{
|
1999-08-19 22:16:23 +00:00
|
|
|
// if we are too small to have a thumb don't paint it.
|
|
|
|
nsIFrame* thumbFrame = mFrames.FirstChild();
|
|
|
|
NS_ASSERTION(thumbFrame,"Slider does not have a thumb!!!!");
|
|
|
|
|
|
|
|
nsSize size(0,0);
|
|
|
|
thumbFrame->GetSize(size);
|
|
|
|
if (mRect.width < size.width || mRect.height < size.height)
|
|
|
|
{
|
|
|
|
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) {
|
|
|
|
const nsStyleDisplay* disp = (const nsStyleDisplay*)
|
|
|
|
mStyleContext->GetStyleData(eStyleStruct_Display);
|
2000-03-17 10:15:13 +00:00
|
|
|
if (disp->IsVisibleOrCollapsed()) {
|
1999-08-19 22:16:23 +00:00
|
|
|
const nsStyleColor* myColor = (const nsStyleColor*)
|
|
|
|
mStyleContext->GetStyleData(eStyleStruct_Color);
|
|
|
|
const nsStyleSpacing* mySpacing = (const nsStyleSpacing*)
|
|
|
|
mStyleContext->GetStyleData(eStyleStruct_Spacing);
|
|
|
|
nsRect rect(0, 0, mRect.width, mRect.height);
|
|
|
|
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
|
|
|
aDirtyRect, rect, *myColor, *mySpacing, 0, 0);
|
|
|
|
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
|
|
|
aDirtyRect, rect, *mySpacing, mStyleContext, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-06-15 04:02:43 +00:00
|
|
|
return nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
|
|
|
|
}
|
1999-04-20 21:39:52 +00:00
|
|
|
|
1999-10-20 00:46:21 +00:00
|
|
|
nsresult
|
1999-11-24 06:03:41 +00:00
|
|
|
nsSliderFrame::ReflowThumb(nsIPresContext* aPresContext,
|
1999-06-15 04:02:43 +00:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus,
|
|
|
|
nsIFrame* thumbFrame,
|
|
|
|
nsSize available,
|
|
|
|
nsSize computed)
|
1999-04-20 21:39:52 +00:00
|
|
|
{
|
1999-06-15 04:02:43 +00:00
|
|
|
nsHTMLReflowState thumbReflowState(aPresContext, aReflowState,
|
|
|
|
thumbFrame, available);
|
|
|
|
|
|
|
|
// always give the thumb as much size as it needs
|
1999-07-20 03:41:03 +00:00
|
|
|
thumbReflowState.mComputedWidth = computed.width;
|
|
|
|
thumbReflowState.mComputedHeight = computed.height;
|
1999-06-15 04:02:43 +00:00
|
|
|
|
|
|
|
// subtract out the childs margin and border if computed
|
|
|
|
const nsStyleSpacing* spacing;
|
|
|
|
nsresult rv = thumbFrame->GetStyleData(eStyleStruct_Spacing,
|
|
|
|
(const nsStyleStruct*&) spacing);
|
|
|
|
|
1999-10-20 00:46:21 +00:00
|
|
|
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get spacing");
|
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return rv;
|
|
|
|
|
|
|
|
|
1999-07-27 19:06:44 +00:00
|
|
|
nsMargin margin(0,0,0,0);
|
1999-06-15 04:02:43 +00:00
|
|
|
spacing->GetMargin(margin);
|
1999-07-27 19:06:44 +00:00
|
|
|
nsMargin border(0,0,0,0);
|
1999-06-15 04:02:43 +00:00
|
|
|
spacing->GetBorderPadding(border);
|
|
|
|
nsMargin total = margin + border;
|
1999-04-20 21:39:52 +00:00
|
|
|
|
1999-07-20 03:41:03 +00:00
|
|
|
if (thumbReflowState.mComputedWidth != NS_INTRINSICSIZE)
|
|
|
|
thumbReflowState.mComputedWidth -= total.left + total.right;
|
1999-06-15 04:02:43 +00:00
|
|
|
|
1999-07-20 03:41:03 +00:00
|
|
|
if (thumbReflowState.mComputedHeight != NS_INTRINSICSIZE)
|
|
|
|
thumbReflowState.mComputedHeight -= total.top + total.bottom;
|
1999-06-15 04:02:43 +00:00
|
|
|
|
1999-11-19 15:33:29 +00:00
|
|
|
ReflowChild(thumbFrame, aPresContext, aDesiredSize, thumbReflowState,
|
|
|
|
0, 0, NS_FRAME_NO_MOVE_FRAME, aStatus);
|
|
|
|
thumbFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
|
1999-06-15 04:02:43 +00:00
|
|
|
|
|
|
|
// add the margin back in
|
|
|
|
aDesiredSize.width += margin.left + margin.right;
|
|
|
|
aDesiredSize.height += margin.top + margin.bottom;
|
1999-10-20 00:46:21 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
1999-06-15 04:02:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PRBool
|
|
|
|
nsSliderFrame::IsHorizontal(nsIContent* scrollbar)
|
|
|
|
{
|
|
|
|
PRBool isHorizontal = PR_TRUE;
|
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;
|
1999-06-15 04:02:43 +00:00
|
|
|
if (NS_CONTENT_ATTR_HAS_VALUE == scrollbar->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, value))
|
|
|
|
{
|
|
|
|
if (value=="vertical")
|
|
|
|
isHorizontal = PR_FALSE;
|
1999-04-20 21:39:52 +00:00
|
|
|
}
|
1999-06-15 04:02:43 +00:00
|
|
|
|
|
|
|
return isHorizontal;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsSliderFrame::Reflow(nsIPresContext* aPresContext,
|
1999-06-15 04:02:43 +00:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus)
|
|
|
|
{
|
|
|
|
nsIContent* scrollbar = GetScrollBar();
|
|
|
|
|
|
|
|
PRBool isHorizontal = IsHorizontal(scrollbar);
|
|
|
|
|
|
|
|
// flow our thumb with our computed width and its intrinsic height
|
|
|
|
nsIFrame* thumbFrame = mFrames.FirstChild();
|
|
|
|
NS_ASSERTION(thumbFrame,"Slider does not have a thumb!!!!");
|
|
|
|
|
|
|
|
nsHTMLReflowMetrics thumbSize(nsnull);
|
|
|
|
|
1999-07-20 03:41:03 +00:00
|
|
|
nsSize availableSize(isHorizontal ? NS_INTRINSICSIZE: aReflowState.mComputedWidth, isHorizontal ? aReflowState.mComputedHeight : NS_INTRINSICSIZE);
|
|
|
|
nsSize computedSize(isHorizontal ? NS_INTRINSICSIZE: aReflowState.mComputedWidth, isHorizontal ? aReflowState.mComputedHeight : NS_INTRINSICSIZE);
|
1999-06-15 04:02:43 +00:00
|
|
|
|
|
|
|
ReflowThumb(aPresContext, thumbSize, aReflowState, aStatus, thumbFrame, availableSize, computedSize);
|
|
|
|
|
|
|
|
// get our current position and max position from our content node
|
1999-08-19 22:16:23 +00:00
|
|
|
PRInt32 curpospx = GetCurrentPosition(scrollbar);
|
|
|
|
PRInt32 maxpospx = GetMaxPosition(scrollbar);
|
1999-06-15 04:02:43 +00:00
|
|
|
|
1999-08-19 22:16:23 +00:00
|
|
|
if (curpospx < 0)
|
|
|
|
curpospx = 0;
|
|
|
|
else if (curpospx > maxpospx)
|
|
|
|
curpospx = maxpospx;
|
1999-06-15 04:02:43 +00:00
|
|
|
|
|
|
|
// if the computed height we are given is intrinsic then set it to some default height
|
|
|
|
float p2t;
|
1999-11-24 06:03:41 +00:00
|
|
|
aPresContext->GetScaledPixelsToTwips(&p2t);
|
1999-06-15 04:02:43 +00:00
|
|
|
nscoord onePixel = NSIntPixelsToTwips(1, p2t);
|
|
|
|
|
1999-07-20 03:41:03 +00:00
|
|
|
if (aReflowState.mComputedHeight == NS_INTRINSICSIZE)
|
1999-06-15 04:02:43 +00:00
|
|
|
aDesiredSize.height = isHorizontal ? thumbSize.height : 200*onePixel;
|
1999-04-20 21:39:52 +00:00
|
|
|
else {
|
1999-07-20 03:41:03 +00:00
|
|
|
aDesiredSize.height = aReflowState.mComputedHeight;
|
1999-08-19 22:16:23 +00:00
|
|
|
// if (aDesiredSize.height < thumbSize.height)
|
|
|
|
// aDesiredSize.height = thumbSize.height;
|
1999-04-20 21:39:52 +00:00
|
|
|
}
|
1999-06-15 04:02:43 +00:00
|
|
|
|
|
|
|
// set the width to the computed or if intrinsic then the width of the thumb.
|
1999-07-20 03:41:03 +00:00
|
|
|
if (aReflowState.mComputedWidth == NS_INTRINSICSIZE)
|
1999-06-15 04:02:43 +00:00
|
|
|
aDesiredSize.width = isHorizontal ? 200*onePixel : thumbSize.width;
|
1999-04-20 21:39:52 +00:00
|
|
|
else {
|
1999-07-20 03:41:03 +00:00
|
|
|
aDesiredSize.width = aReflowState.mComputedWidth;
|
1999-08-19 22:16:23 +00:00
|
|
|
// if (aDesiredSize.width < thumbSize.width)
|
|
|
|
// aDesiredSize.width = thumbSize.width;
|
1999-04-20 21:39:52 +00:00
|
|
|
}
|
|
|
|
|
1999-08-19 22:16:23 +00:00
|
|
|
// get max pos in twips
|
|
|
|
nscoord maxpos = maxpospx*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
|
|
|
|
nscoord& desiredcoord = isHorizontal ? aDesiredSize.width : aDesiredSize.height;
|
|
|
|
nscoord& thumbcoord = isHorizontal ? thumbSize.width : thumbSize.height;
|
|
|
|
|
1999-08-19 22:16:23 +00:00
|
|
|
nscoord ourmaxpos = desiredcoord;
|
|
|
|
|
|
|
|
mRatio = float(ourmaxpos)/float(maxpos + ourmaxpos);
|
|
|
|
|
|
|
|
nscoord thumbsize = nscoord(ourmaxpos * mRatio);
|
|
|
|
// if there is more room than the thumb need stretch the
|
|
|
|
// thumb
|
|
|
|
if (thumbsize > thumbcoord) {
|
1999-06-15 04:02:43 +00:00
|
|
|
// if the thumb is flexible make the thumb bigger.
|
|
|
|
nsCOMPtr<nsIContent> content;
|
|
|
|
thumbFrame->GetContent(getter_AddRefs(content));
|
|
|
|
|
|
|
|
PRInt32 error;
|
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;
|
1999-06-15 04:02:43 +00:00
|
|
|
if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttribute(kNameSpaceID_None, nsXULAtoms::flex, value))
|
|
|
|
{
|
|
|
|
value.Trim("%");
|
|
|
|
// convert to a percent.
|
|
|
|
if (value.ToFloat(&error) > 0.0) {
|
|
|
|
if (isHorizontal)
|
1999-08-19 22:16:23 +00:00
|
|
|
computedSize.width = thumbsize;
|
1999-06-15 04:02:43 +00:00
|
|
|
else
|
1999-08-19 22:16:23 +00:00
|
|
|
computedSize.height = thumbsize;
|
1999-06-15 04:02:43 +00:00
|
|
|
|
|
|
|
ReflowThumb(aPresContext, thumbSize, aReflowState, aStatus, thumbFrame, availableSize, computedSize);
|
|
|
|
}
|
|
|
|
}
|
1999-08-19 22:16:23 +00:00
|
|
|
} else {
|
|
|
|
ourmaxpos -= thumbcoord;
|
|
|
|
mRatio = float(ourmaxpos)/float(maxpos);
|
1999-04-20 21:39:52 +00:00
|
|
|
}
|
|
|
|
|
1999-06-15 04:02:43 +00:00
|
|
|
// get our border
|
|
|
|
const nsMargin& borderPadding = aReflowState.mComputedBorderPadding;
|
|
|
|
|
1999-08-19 22:16:23 +00:00
|
|
|
nscoord curpos = curpospx*onePixel;
|
1999-06-15 04:02:43 +00:00
|
|
|
|
|
|
|
// set the thumbs y coord to be the current pos * the ratio.
|
1999-08-19 22:16:23 +00:00
|
|
|
nscoord pos = nscoord(float(curpos)*mRatio);
|
1999-06-15 04:02:43 +00:00
|
|
|
nsRect thumbRect(borderPadding.left, borderPadding.top, thumbSize.width, thumbSize.height);
|
|
|
|
|
|
|
|
if (isHorizontal)
|
1999-08-19 22:16:23 +00:00
|
|
|
thumbRect.x += pos;
|
1999-06-15 04:02:43 +00:00
|
|
|
else
|
1999-08-19 22:16:23 +00:00
|
|
|
thumbRect.y += pos;
|
1999-06-15 04:02:43 +00:00
|
|
|
|
1999-11-19 15:33:29 +00:00
|
|
|
nsIView* view;
|
1999-11-24 06:03:41 +00:00
|
|
|
thumbFrame->SetRect(aPresContext, thumbRect);
|
|
|
|
thumbFrame->GetView(aPresContext, &view);
|
1999-11-19 15:33:29 +00:00
|
|
|
if (view) {
|
1999-11-24 06:03:41 +00:00
|
|
|
nsContainerFrame::SyncFrameViewAfterReflow(aPresContext, thumbFrame,
|
1999-11-19 15:33:29 +00:00
|
|
|
view, nsnull);
|
|
|
|
}
|
1999-06-15 04:02:43 +00:00
|
|
|
|
|
|
|
// add in our border
|
|
|
|
aDesiredSize.width += borderPadding.left + borderPadding.right;
|
|
|
|
aDesiredSize.height += borderPadding.top + borderPadding.bottom;
|
|
|
|
|
|
|
|
aDesiredSize.ascent = aDesiredSize.height;
|
|
|
|
aDesiredSize.descent = 0;
|
1999-10-12 00:16:06 +00:00
|
|
|
|
|
|
|
if (DEBUG_SLIDER) {
|
|
|
|
PRInt32 c = GetCurrentPosition(scrollbar);
|
|
|
|
PRInt32 m = GetMaxPosition(scrollbar);
|
|
|
|
printf("Current=%d, max=%d\n",c,m);
|
|
|
|
}
|
1999-06-15 04:02:43 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsSliderFrame::HandleEvent(nsIPresContext* 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
|
|
|
{
|
|
|
|
nsIContent* scrollbar = GetScrollBar();
|
|
|
|
|
|
|
|
PRBool isHorizontal = IsHorizontal(scrollbar);
|
|
|
|
|
1999-11-24 06:03:41 +00:00
|
|
|
if (isDraggingThumb(aPresContext))
|
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
|
|
|
// we want to draw immediately if the user doing it directly with the
|
|
|
|
// mouse that makes redrawing much faster.
|
|
|
|
mRedrawImmediate = PR_TRUE;
|
|
|
|
|
1999-06-15 04:02:43 +00:00
|
|
|
switch (aEvent->message) {
|
|
|
|
case NS_MOUSE_MOVE: {
|
|
|
|
// convert coord to pixels
|
|
|
|
nscoord pos = isHorizontal ? aEvent->point.x : aEvent->point.y;
|
|
|
|
|
1999-06-28 19:57:28 +00:00
|
|
|
// mDragStartPx is in pixels and is in our client areas coordinate system.
|
|
|
|
// so we need to first convert it so twips and then get it into our coordinate system.
|
|
|
|
|
1999-06-15 04:02:43 +00:00
|
|
|
// convert start to twips
|
|
|
|
nscoord startpx = mDragStartPx;
|
|
|
|
|
|
|
|
float p2t;
|
1999-11-24 06:03:41 +00:00
|
|
|
aPresContext->GetScaledPixelsToTwips(&p2t);
|
1999-06-15 04:02:43 +00:00
|
|
|
nscoord onePixel = NSIntPixelsToTwips(1, p2t);
|
|
|
|
nscoord start = startpx*onePixel;
|
|
|
|
|
|
|
|
nsIFrame* thumbFrame = mFrames.FirstChild();
|
1999-06-28 19:57:28 +00:00
|
|
|
|
1999-08-19 22:16:23 +00:00
|
|
|
|
1999-06-28 19:57:28 +00:00
|
|
|
// get it into our coordintate system by subtracting our parents offsets.
|
|
|
|
nsIFrame* parent = this;
|
|
|
|
while(parent != nsnull)
|
|
|
|
{
|
1999-08-19 22:16:23 +00:00
|
|
|
// if we hit a scrollable view make sure we take into account
|
|
|
|
// how much we are scrolled.
|
|
|
|
nsIScrollableView* scrollingView;
|
|
|
|
nsIView* view;
|
1999-11-24 06:03:41 +00:00
|
|
|
parent->GetView(aPresContext, &view);
|
1999-08-19 22:16:23 +00:00
|
|
|
if (view) {
|
1999-12-21 19:28:15 +00:00
|
|
|
nsresult result = view->QueryInterface(NS_GET_IID(nsIScrollableView), (void**)&scrollingView);
|
1999-08-19 22:16:23 +00:00
|
|
|
if (NS_SUCCEEDED(result)) {
|
|
|
|
nscoord xoff = 0;
|
|
|
|
nscoord yoff = 0;
|
|
|
|
scrollingView->GetScrollPosition(xoff, yoff);
|
|
|
|
isHorizontal ? start += xoff : start += yoff;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-06-28 19:57:28 +00:00
|
|
|
nsRect r;
|
|
|
|
parent->GetRect(r);
|
|
|
|
isHorizontal ? start -= r.x : start -= r.y;
|
|
|
|
parent->GetParent(&parent);
|
|
|
|
}
|
|
|
|
|
|
|
|
//printf("Translated to start=%d\n",start);
|
|
|
|
|
1999-06-15 04:02:43 +00:00
|
|
|
start -= mThumbStart;
|
|
|
|
|
|
|
|
// take our current position and substract the start location
|
|
|
|
pos -= start;
|
|
|
|
|
|
|
|
// convert to pixels
|
|
|
|
nscoord pospx = pos/onePixel;
|
|
|
|
|
|
|
|
// convert to our internal coordinate system
|
|
|
|
pospx = nscoord(pospx/mRatio);
|
|
|
|
|
|
|
|
// set it
|
1999-08-19 22:16:23 +00:00
|
|
|
SetCurrentPosition(scrollbar, thumbFrame, pospx);
|
|
|
|
|
1999-06-15 04:02:43 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
1999-08-19 22:16:23 +00:00
|
|
|
case NS_MOUSE_RIGHT_BUTTON_UP:
|
1999-06-15 04:02:43 +00:00
|
|
|
case NS_MOUSE_LEFT_BUTTON_UP:
|
|
|
|
// stop capturing
|
|
|
|
//printf("stop capturing\n");
|
|
|
|
AddListener();
|
1999-11-24 06:03:41 +00:00
|
|
|
DragThumb(aPresContext, PR_FALSE);
|
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
|
|
|
|
|
|
|
// we want to draw immediately if the user doing it directly with the
|
|
|
|
// mouse that makes redrawing much faster. Switch it back now.
|
|
|
|
mRedrawImmediate = PR_FALSE;
|
|
|
|
|
1999-08-19 22:16:23 +00:00
|
|
|
//return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
|
|
|
return NS_OK;
|
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.
|
|
|
|
if (aEvent->message == NS_MOUSE_EXIT|| aEvent->message == NS_MOUSE_RIGHT_BUTTON_UP || aEvent->message == NS_MOUSE_LEFT_BUTTON_UP)
|
|
|
|
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
|
|
|
}
|
|
|
|
|
1999-08-19 22:16:23 +00:00
|
|
|
|
1999-06-15 04:02:43 +00:00
|
|
|
|
|
|
|
nsIContent*
|
|
|
|
nsSliderFrame::GetScrollBar()
|
|
|
|
{
|
|
|
|
// if we are in a scrollbar then return the scrollbar's content node
|
|
|
|
// if we are not then return ours.
|
|
|
|
nsIFrame* scrollbar;
|
|
|
|
nsScrollbarButtonFrame::GetParentWithTag(nsXULAtoms::scrollbar, this, scrollbar);
|
|
|
|
|
|
|
|
if (scrollbar == nsnull)
|
|
|
|
scrollbar = this;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIContent> content;
|
|
|
|
scrollbar->GetContent(getter_AddRefs(content));
|
|
|
|
|
|
|
|
return content;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1999-08-19 22:16:23 +00:00
|
|
|
nsSliderFrame::PageUpDown(nsIFrame* aThumbFrame, nscoord change)
|
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.
|
|
|
|
nsIContent* scrollbar = GetScrollBar();
|
1999-06-23 17:00:17 +00:00
|
|
|
|
|
|
|
if (mScrollbarListener)
|
|
|
|
mScrollbarListener->PagedUpDown(); // Let the listener decide our increment.
|
|
|
|
|
1999-06-15 04:02:43 +00:00
|
|
|
nscoord pageIncrement = GetPageIncrement(scrollbar);
|
|
|
|
PRInt32 curpos = GetCurrentPosition(scrollbar);
|
1999-08-19 22:16:23 +00:00
|
|
|
SetCurrentPosition(scrollbar, aThumbFrame, curpos + change*pageIncrement);
|
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
|
1999-06-15 04:02:43 +00:00
|
|
|
nsSliderFrame::CurrentPositionChanged(nsIPresContext* aPresContext)
|
|
|
|
{
|
|
|
|
nsIContent* scrollbar = GetScrollBar();
|
|
|
|
|
|
|
|
PRBool isHorizontal = IsHorizontal(scrollbar);
|
|
|
|
|
|
|
|
// get the current position
|
|
|
|
PRInt32 curpos = GetCurrentPosition(scrollbar);
|
|
|
|
|
1999-10-12 00:16:06 +00:00
|
|
|
// do nothing if the position did not change
|
|
|
|
if (mCurPos == curpos)
|
1999-10-20 00:46:21 +00:00
|
|
|
return NS_OK;
|
1999-10-12 00:16:06 +00:00
|
|
|
|
1999-06-15 04:02:43 +00:00
|
|
|
// get our current position and max position from our content node
|
|
|
|
PRInt32 maxpos = GetMaxPosition(scrollbar);
|
|
|
|
|
|
|
|
if (curpos < 0)
|
|
|
|
curpos = 0;
|
|
|
|
else if (curpos > maxpos)
|
|
|
|
curpos = maxpos;
|
|
|
|
|
|
|
|
// convert to pixels
|
|
|
|
float p2t;
|
|
|
|
aPresContext->GetScaledPixelsToTwips(&p2t);
|
|
|
|
nscoord onePixel = NSIntPixelsToTwips(1, p2t);
|
|
|
|
|
|
|
|
nscoord curpospx = curpos*onePixel;
|
|
|
|
|
|
|
|
// get the thumb's rect
|
|
|
|
nsIFrame* thumbFrame = mFrames.FirstChild();
|
|
|
|
nsRect thumbRect;
|
|
|
|
thumbFrame->GetRect(thumbRect);
|
|
|
|
|
|
|
|
// get our border and padding
|
|
|
|
const nsStyleSpacing* spacing;
|
|
|
|
nsresult rv = GetStyleData(eStyleStruct_Spacing,
|
|
|
|
(const nsStyleStruct*&) spacing);
|
|
|
|
|
1999-10-20 00:46:21 +00:00
|
|
|
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get spacing");
|
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return rv;
|
|
|
|
|
1999-07-27 19:06:44 +00:00
|
|
|
nsMargin borderPadding(0,0,0,0);
|
1999-06-15 04:02:43 +00:00
|
|
|
spacing->GetBorderPadding(borderPadding);
|
|
|
|
|
|
|
|
// figure out the new rect
|
|
|
|
nsRect newThumbRect(thumbRect);
|
|
|
|
|
|
|
|
if (isHorizontal)
|
|
|
|
newThumbRect.x = borderPadding.left + nscoord(float(curpospx)*mRatio);
|
|
|
|
else
|
|
|
|
newThumbRect.y = borderPadding.top + nscoord(float(curpospx)*mRatio);
|
|
|
|
|
|
|
|
// set the rect
|
1999-10-26 04:44:41 +00:00
|
|
|
thumbFrame->SetRect(aPresContext, newThumbRect);
|
1999-06-15 04:02:43 +00:00
|
|
|
|
|
|
|
// figure out the union of the rect so we know what to redraw
|
|
|
|
nsRect changeRect;
|
|
|
|
changeRect.UnionRect(thumbRect, newThumbRect);
|
|
|
|
|
|
|
|
// redraw just the change
|
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
|
|
|
Invalidate(aPresContext, changeRect, mRedrawImmediate);
|
1999-06-23 17:00:17 +00:00
|
|
|
|
|
|
|
if (mScrollbarListener)
|
1999-11-24 06:03:41 +00:00
|
|
|
mScrollbarListener->PositionChanged(aPresContext, mCurPos, curpos);
|
1999-06-23 17:00:17 +00:00
|
|
|
|
|
|
|
mCurPos = curpos;
|
|
|
|
|
1999-10-20 00:46:21 +00:00
|
|
|
return NS_OK;
|
1999-06-15 04:02:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1999-08-19 22:16:23 +00:00
|
|
|
nsSliderFrame::SetCurrentPosition(nsIContent* scrollbar, nsIFrame* aThumbFrame, nscoord newpos)
|
1999-06-15 04:02:43 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
// get our current position and max position from our content node
|
|
|
|
PRInt32 maxpos = GetMaxPosition(scrollbar);
|
|
|
|
|
|
|
|
// get the new position and make sure it is in bounds
|
|
|
|
if (newpos > maxpos)
|
|
|
|
newpos = maxpos;
|
|
|
|
else if (newpos < 0)
|
|
|
|
newpos = 0;
|
|
|
|
|
|
|
|
char ch[100];
|
|
|
|
sprintf(ch,"%d", newpos);
|
|
|
|
|
|
|
|
// set the new position
|
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
|
|
|
scrollbar->SetAttribute(kNameSpaceID_None, nsXULAtoms::curpos, nsAutoString(ch), PR_TRUE);
|
1999-06-15 04:02:43 +00:00
|
|
|
|
1999-10-12 00:16:06 +00:00
|
|
|
if (DEBUG_SLIDER)
|
|
|
|
printf("Current Pos=%s\n",ch);
|
1999-06-15 04:02:43 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
1999-10-26 04:44:41 +00:00
|
|
|
NS_IMETHODIMP nsSliderFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
|
|
|
const nsPoint& aPoint,
|
1999-06-15 04:02:43 +00:00
|
|
|
nsIFrame** aFrame)
|
|
|
|
{
|
1999-10-26 04:44:41 +00:00
|
|
|
if (isDraggingThumb(aPresContext))
|
1999-06-15 04:02:43 +00:00
|
|
|
{
|
|
|
|
*aFrame = this;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsIFrame* thumbFrame = mFrames.FirstChild();
|
|
|
|
nsRect thumbRect;
|
|
|
|
thumbFrame->GetRect(thumbRect);
|
|
|
|
|
|
|
|
if (thumbRect.Contains(aPoint)) {
|
|
|
|
*aFrame = thumbFrame;
|
|
|
|
} else {
|
|
|
|
// always return us
|
|
|
|
*aFrame = this;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
|
1999-10-26 04:44:41 +00:00
|
|
|
//return nsHTMLContainerFrame::GetFrameForPoint(aPresContext, aPoint, aFrame);
|
1999-06-15 04:02:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsSliderFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
1999-06-15 04:02:43 +00:00
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aChildList)
|
|
|
|
{
|
|
|
|
nsresult r = nsHTMLContainerFrame::SetInitialChildList(aPresContext, aListName, aChildList);
|
|
|
|
|
|
|
|
AddListener();
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsSliderFrame::RemoveFrame(nsIPresContext* aPresContext,
|
1999-06-15 04:02:43 +00:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aOldFrame)
|
|
|
|
{
|
|
|
|
// remove the child frame
|
|
|
|
nsresult rv = nsHTMLContainerFrame::RemoveFrame(aPresContext, aPresShell, aListName, aOldFrame);
|
1999-07-22 04:00:57 +00:00
|
|
|
mFrames.DestroyFrame(aPresContext, aOldFrame);
|
1999-06-15 04:02:43 +00:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsSliderFrame::InsertFrames(nsIPresContext* aPresContext,
|
1999-06-15 04:02:43 +00:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aPrevFrame,
|
|
|
|
nsIFrame* aFrameList)
|
|
|
|
{
|
|
|
|
mFrames.InsertFrames(nsnull, aPrevFrame, aFrameList);
|
|
|
|
return nsHTMLContainerFrame::InsertFrames(aPresContext, aPresShell, aListName, aPrevFrame, aFrameList);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsSliderFrame::AppendFrames(nsIPresContext* aPresContext,
|
1999-06-15 04:02:43 +00:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aFrameList)
|
|
|
|
{
|
|
|
|
mFrames.AppendFrames(nsnull, aFrameList);
|
|
|
|
return nsHTMLContainerFrame::AppendFrames(aPresContext, aPresShell, aListName, aFrameList);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsSliderFrame::MouseDown(nsIDOMEvent* aMouseEvent)
|
|
|
|
{
|
|
|
|
//printf("Begin dragging\n");
|
|
|
|
|
|
|
|
nsIContent* scrollbar = GetScrollBar();
|
|
|
|
PRBool isHorizontal = IsHorizontal(scrollbar);
|
|
|
|
|
1999-11-03 07:11:45 +00:00
|
|
|
nsCOMPtr<nsIDOMMouseEvent> mouseEvent(do_QueryInterface(aMouseEvent));
|
1999-06-15 04:02:43 +00:00
|
|
|
|
|
|
|
RemoveListener();
|
1999-10-26 04:44:41 +00:00
|
|
|
DragThumb(mPresContext, PR_TRUE);
|
1999-06-15 04:02:43 +00:00
|
|
|
PRInt32 c = 0;
|
|
|
|
if (isHorizontal)
|
1999-11-03 07:11:45 +00:00
|
|
|
mouseEvent->GetClientX(&c);
|
1999-06-15 04:02:43 +00:00
|
|
|
else
|
1999-11-03 07:11:45 +00:00
|
|
|
mouseEvent->GetClientY(&c);
|
1999-06-15 04:02:43 +00:00
|
|
|
|
|
|
|
mDragStartPx = c;
|
|
|
|
nsIFrame* thumbFrame = mFrames.FirstChild();
|
|
|
|
nsRect thumbRect;
|
|
|
|
thumbFrame->GetRect(thumbRect);
|
|
|
|
|
|
|
|
if (isHorizontal)
|
|
|
|
mThumbStart = thumbRect.x;
|
|
|
|
else
|
|
|
|
mThumbStart = thumbRect.y;
|
|
|
|
|
1999-06-28 19:57:28 +00:00
|
|
|
//printf("Pressed mDragStartPx=%d\n",mDragStartPx);
|
1999-06-15 04:02:43 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsSliderFrame::MouseUp(nsIDOMEvent* aMouseEvent)
|
|
|
|
{
|
|
|
|
// printf("Finish dragging\n");
|
1999-08-19 22:16:23 +00:00
|
|
|
|
1999-06-15 04:02:43 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-10-26 04:44:41 +00:00
|
|
|
nsSliderFrame :: DragThumb(nsIPresContext* aPresContext, PRBool aGrabMouseEvents)
|
1999-06-15 04:02:43 +00:00
|
|
|
{
|
|
|
|
// get its view
|
|
|
|
nsIView* view = nsnull;
|
1999-10-26 04:44:41 +00:00
|
|
|
GetView(aPresContext, &view);
|
1999-06-15 04:02:43 +00:00
|
|
|
nsCOMPtr<nsIViewManager> viewMan;
|
|
|
|
PRBool result;
|
|
|
|
|
|
|
|
if (view) {
|
|
|
|
view->GetViewManager(*getter_AddRefs(viewMan));
|
|
|
|
|
|
|
|
if (viewMan) {
|
|
|
|
if (aGrabMouseEvents) {
|
|
|
|
viewMan->GrabMouseEvents(view,result);
|
|
|
|
} else {
|
|
|
|
viewMan->GrabMouseEvents(nsnull,result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool
|
1999-10-26 04:44:41 +00:00
|
|
|
nsSliderFrame :: isDraggingThumb(nsIPresContext* aPresContext)
|
1999-06-15 04:02:43 +00:00
|
|
|
{
|
|
|
|
// get its view
|
|
|
|
nsIView* view = nsnull;
|
1999-10-26 04:44:41 +00:00
|
|
|
GetView(aPresContext, &view);
|
1999-06-15 04:02:43 +00:00
|
|
|
nsCOMPtr<nsIViewManager> viewMan;
|
|
|
|
|
|
|
|
if (view) {
|
|
|
|
view->GetViewManager(*getter_AddRefs(viewMan));
|
|
|
|
|
|
|
|
if (viewMan) {
|
|
|
|
nsIView* grabbingView;
|
|
|
|
viewMan->GetMouseEventGrabber(grabbingView);
|
|
|
|
if (grabbingView == view)
|
|
|
|
return PR_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsSliderFrame::AddListener()
|
|
|
|
{
|
|
|
|
nsIFrame* thumbFrame = mFrames.FirstChild();
|
|
|
|
nsCOMPtr<nsIContent> content;
|
|
|
|
thumbFrame->GetContent(getter_AddRefs(content));
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMEventReceiver> reciever(do_QueryInterface(content));
|
|
|
|
|
1999-12-21 19:28:15 +00:00
|
|
|
reciever->AddEventListenerByIID(this,NS_GET_IID(nsIDOMMouseListener));
|
1999-06-15 04:02:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsSliderFrame::RemoveListener()
|
|
|
|
{
|
|
|
|
nsIFrame* thumbFrame = mFrames.FirstChild();
|
|
|
|
nsCOMPtr<nsIContent> content;
|
|
|
|
thumbFrame->GetContent(getter_AddRefs(content));
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMEventReceiver> reciever(do_QueryInterface(content));
|
|
|
|
|
1999-12-21 19:28:15 +00:00
|
|
|
reciever->RemoveEventListenerByIID(this,NS_GET_IID(nsIDOMMouseListener));
|
1999-06-15 04:02:43 +00:00
|
|
|
}
|
|
|
|
|
1999-08-19 22:16:23 +00:00
|
|
|
|
1999-12-21 19:28:15 +00:00
|
|
|
NS_INTERFACE_MAP_BEGIN(nsSliderFrame)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIDOMMouseListener)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsITimerCallback)
|
2000-03-11 10:34:29 +00:00
|
|
|
NS_INTERFACE_MAP_END_INHERITING(nsHTMLContainerFrame)
|
1999-06-15 04:02:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP_(nsrefcnt)
|
|
|
|
nsSliderFrame::AddRef(void)
|
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP_(nsrefcnt)
|
|
|
|
nsSliderFrame::Release(void)
|
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
1999-06-23 17:00:17 +00:00
|
|
|
|
1999-08-19 22:16:23 +00:00
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsSliderFrame::HandlePress(nsIPresContext* 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
|
|
|
{
|
|
|
|
nsIContent* scrollbar = GetScrollBar();
|
|
|
|
PRBool isHorizontal = IsHorizontal(scrollbar);
|
|
|
|
|
|
|
|
nsIFrame* thumbFrame = mFrames.FirstChild();
|
|
|
|
nsRect thumbRect;
|
|
|
|
thumbFrame->GetRect(thumbRect);
|
|
|
|
|
|
|
|
nscoord change = 1;
|
|
|
|
|
|
|
|
if ((isHorizontal && aEvent->point.x < thumbRect.x) || (!isHorizontal && aEvent->point.y < thumbRect.y))
|
|
|
|
change = -1;
|
|
|
|
|
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
|
|
|
mChange = change;
|
|
|
|
mClickPoint = aEvent->point;
|
1999-08-19 22:16:23 +00:00
|
|
|
PageUpDown(thumbFrame, change);
|
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
|
|
|
nsRepeatService::GetInstance()->Start(this);
|
1999-08-19 22:16:23 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsSliderFrame::HandleRelease(nsIPresContext* 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
|
|
|
{
|
|
|
|
nsRepeatService::GetInstance()->Stop();
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-08-29 10:51:15 +00:00
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsSliderFrame::Destroy(nsIPresContext* aPresContext)
|
1999-08-29 10:51:15 +00:00
|
|
|
{
|
|
|
|
// Ensure our repeat service isn't going... it's possible that a scrollbar can disappear out
|
|
|
|
// from under you while you're in the process of scrolling.
|
|
|
|
nsRepeatService::GetInstance()->Stop();
|
1999-12-13 23:33:17 +00:00
|
|
|
|
|
|
|
// XXX: HACK! WORKAROUND FOR BUG 21571
|
|
|
|
/*
|
|
|
|
the root cause of the crash is that nsSliderFrame implements nsIDOMEventListener and passes
|
|
|
|
itself to nsEventListenerManager::AddEventListener().
|
|
|
|
nsEventListenerManager::AddEventListener() assumes it is passed an
|
|
|
|
object that is governed by ref-counting. But nsSliderFrame is **not** a
|
|
|
|
ref-counted object, and it's lifetime is implicitly controlled by the lifetime
|
|
|
|
of the frame model. By passing itself to
|
|
|
|
nsEventListenerManager::AddEventListener(), the slider is passing in a pointer
|
|
|
|
that can be yanked out from underneath the event listener manager. When the
|
|
|
|
event listener manager is destroyed, it correctly tries to clean up any objects
|
|
|
|
still under it's control, including the already-deleted slider.
|
|
|
|
|
|
|
|
This bug is only evident when a slider is the last focused object before deletion.
|
|
|
|
Calling RemoveListener() removes *this* from nsEventListenerManager,
|
|
|
|
removing the worst symptom of the bug.
|
|
|
|
|
|
|
|
The real solution is to create a ref-counted listener object for the
|
|
|
|
slider to hand off to nsEventListenerManager::AddEventListener().
|
|
|
|
Part of that fix should be removing nsSliderFrame::AddRef and
|
|
|
|
nsSliderFrame::Release, which were masking this problem. Without those
|
|
|
|
methods, we would have gotten assertions as soon as the first slider was passed
|
|
|
|
to any interface that tried to refcount it.
|
|
|
|
*/
|
|
|
|
RemoveListener(); // remove this line when 21571 is fixed properly
|
|
|
|
|
|
|
|
// call base class Destroy()
|
1999-08-29 10:51:15 +00:00
|
|
|
return nsHTMLContainerFrame::Destroy(aPresContext);
|
|
|
|
}
|
|
|
|
|
1999-08-19 22:16:23 +00:00
|
|
|
|
1999-06-23 17:00:17 +00:00
|
|
|
void
|
|
|
|
nsSliderFrame::SetScrollbarListener(nsIScrollbarListener* aListener)
|
|
|
|
{
|
|
|
|
// Don't addref/release this, since it's actually a frame.
|
|
|
|
mScrollbarListener = aListener;
|
|
|
|
}
|
1999-08-19 22:16:23 +00:00
|
|
|
|
2000-01-21 21:56:09 +00:00
|
|
|
NS_IMETHODIMP_(void) nsSliderFrame::Notify(nsITimer *timer)
|
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();
|
|
|
|
nsRect thumbRect;
|
|
|
|
thumbFrame->GetRect(thumbRect);
|
|
|
|
|
|
|
|
nsIContent* scrollbar = GetScrollBar();
|
|
|
|
PRBool isHorizontal = IsHorizontal(scrollbar);
|
|
|
|
|
|
|
|
// see if the thumb has moved passed our original click point.
|
|
|
|
// if it has we want to stop.
|
|
|
|
if (isHorizontal) {
|
|
|
|
if (mChange < 0) {
|
|
|
|
if (thumbRect.x < mClickPoint.x)
|
|
|
|
stop = PR_TRUE;
|
|
|
|
} else {
|
|
|
|
if (thumbRect.x + thumbRect.width > mClickPoint.x)
|
|
|
|
stop = PR_TRUE;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (mChange < 0) {
|
|
|
|
if (thumbRect.y < mClickPoint.y)
|
|
|
|
stop = PR_TRUE;
|
|
|
|
} else {
|
2000-02-14 01:42:09 +00:00
|
|
|
if (thumbRect.y + thumbRect.height > mClickPoint.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) {
|
|
|
|
nsRepeatService::GetInstance()->Stop();
|
|
|
|
} else {
|
|
|
|
PageUpDown(thumbFrame, mChange);
|
|
|
|
}
|
1999-08-19 22:16:23 +00:00
|
|
|
}
|