зеркало из https://github.com/mozilla/gecko-dev.git
1) fixed warnings.
2) scrollbars only work with left mouse
This commit is contained in:
Родитель
65276499e7
Коммит
8aa1be0dea
|
@ -56,9 +56,10 @@ void Coelesced()
|
|||
|
||||
#endif
|
||||
|
||||
nsBox::nsBox(nsIPresShell* aShell):mParentBox(nsnull),
|
||||
nsBox::nsBox(nsIPresShell* aShell):mMouseThrough(unset),
|
||||
mNextChild(nsnull),
|
||||
mMouseThrough(unset)
|
||||
mParentBox(nsnull)
|
||||
|
||||
{
|
||||
//mX = 0;
|
||||
//mY = 0;
|
||||
|
@ -133,11 +134,11 @@ nsBox::MarkDirty(nsBoxLayoutState& aState)
|
|||
if (parent)
|
||||
return parent->RelayoutDirtyChild(aState, this);
|
||||
else {
|
||||
nsIFrame* parent = nsnull;
|
||||
frame->GetParent(&parent);
|
||||
nsIFrame* parentFrame = nsnull;
|
||||
frame->GetParent(&parentFrame);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aState.GetPresShell(getter_AddRefs(shell));
|
||||
return parent->ReflowDirtyChild(shell, frame);
|
||||
return parentFrame->ReflowDirtyChild(shell, frame);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,7 +153,6 @@ nsBox::MarkStyleChange(nsBoxLayoutState& aState)
|
|||
{
|
||||
NeedsRecalc();
|
||||
|
||||
PRBool dirty = PR_FALSE;
|
||||
if (HasStyleChange())
|
||||
return NS_OK;
|
||||
|
||||
|
@ -175,11 +175,11 @@ nsBox::MarkStyleChange(nsBoxLayoutState& aState)
|
|||
*/
|
||||
nsIFrame* frame = nsnull;
|
||||
GetFrame(&frame);
|
||||
nsIFrame* parent = nsnull;
|
||||
frame->GetParent(&parent);
|
||||
nsIFrame* parentFrame = nsnull;
|
||||
frame->GetParent(&parentFrame);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aState.GetPresShell(getter_AddRefs(shell));
|
||||
return parent->ReflowDirtyChild(shell, frame);
|
||||
return parentFrame->ReflowDirtyChild(shell, frame);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1471,7 +1471,6 @@ nsBoxFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
|||
{
|
||||
// if the kid had a child before see if this child has mouse
|
||||
// though.
|
||||
nsresult rv = NS_OK;
|
||||
PRBool isAdaptor = PR_FALSE;
|
||||
nsCOMPtr<nsIBox> box = mInner->GetBoxForFrame(hit, isAdaptor);
|
||||
if (box) {
|
||||
|
@ -1480,27 +1479,6 @@ nsBoxFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
|||
// if the child says it can never mouse though ignore it.
|
||||
if (!mouseThrough)
|
||||
*aFrame = hit;
|
||||
else {
|
||||
/*
|
||||
// otherwise see if it has an opaque parent.
|
||||
nsIFrame* child = hit;
|
||||
while(child) {
|
||||
if (child == this)
|
||||
break;
|
||||
|
||||
const nsStyleColor* color = nsnull;
|
||||
child->GetStyleData(eStyleStruct_Color, (const nsStyleStruct*&)color);
|
||||
PRBool transparentBG = (!color || NS_STYLE_BG_COLOR_TRANSPARENT ==
|
||||
(color->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT));
|
||||
|
||||
if (!transparentBG) {
|
||||
*aFrame = hit;
|
||||
break;
|
||||
}
|
||||
child->GetParent(&child);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
|
||||
nsBoxLayoutState::nsBoxLayoutState(nsIPresContext* aPresContext):mPresContext(aPresContext),
|
||||
mReflowState(nsnull),
|
||||
mMaxElementSize(nsnull),
|
||||
mType(Dirty),
|
||||
mMaxElementSize(nsnull),
|
||||
mOverFlowSize(0,0),
|
||||
mIncludeOverFlow(PR_TRUE),
|
||||
mLayoutFlags(0)
|
||||
|
@ -67,11 +67,11 @@ nsBoxLayoutState::nsBoxLayoutState(nsIPresShell* aShell):mReflowState(nsnull),
|
|||
|
||||
nsBoxLayoutState::nsBoxLayoutState(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsHTMLReflowMetrics& aDesiredSize):mReflowState(&aReflowState),
|
||||
mPresContext(aPresContext),
|
||||
nsHTMLReflowMetrics& aDesiredSize):mPresContext(aPresContext),
|
||||
mReflowState(&aReflowState),
|
||||
mType(Dirty),
|
||||
mIncludeOverFlow(PR_TRUE),
|
||||
mOverFlowSize(0,0),
|
||||
mIncludeOverFlow(PR_TRUE),
|
||||
mLayoutFlags(0)
|
||||
|
||||
|
||||
|
@ -240,7 +240,7 @@ nsBoxLayoutState::UnWind(nsIReflowCommand* aCommand, nsIBox* aBox)
|
|||
// the target is deep inside html we will have to honor this one.
|
||||
// mark us as dirty so we don't post
|
||||
// a dirty reflow
|
||||
nsFrameState state;
|
||||
state = 0;
|
||||
nsIFrame* frame;
|
||||
aBox->GetFrame(&frame);
|
||||
frame->GetFrameState(&state);
|
||||
|
|
|
@ -55,6 +55,7 @@ public:
|
|||
nsBoxLayoutState(nsIPresContext* aPresContext);
|
||||
nsBoxLayoutState(nsIPresShell* aShell);
|
||||
nsBoxLayoutState(const nsBoxLayoutState& aState);
|
||||
virtual ~nsBoxLayoutState() {}
|
||||
|
||||
virtual void HandleReflow(nsIBox* aRootBox);
|
||||
|
||||
|
|
|
@ -84,7 +84,13 @@ public:
|
|||
}
|
||||
#endif
|
||||
|
||||
virtual PRBool GetInitialOrientation(PRBool& aHorizontal) { aHorizontal = PR_FALSE; return PR_TRUE; }
|
||||
// make sure we our kids get our orient, align, and autostretch instead of us.
|
||||
// our child box has no content node so it will search for a parent with one.
|
||||
// that will be us.
|
||||
virtual PRBool GetInitialOrientation(PRBool& aHorizontal) { aHorizontal = PR_FALSE; return PR_TRUE; }
|
||||
virtual PRBool GetInitialHAlignment(Halignment& aHalign) { aHalign = hAlign_Left; return PR_TRUE; }
|
||||
virtual PRBool GetInitialVAlignment(Valignment& aValign) { aValign = vAlign_Top; return PR_TRUE; }
|
||||
virtual PRBool GetInitialAutoStretch(PRBool& aStretch) { aStretch = PR_TRUE; return PR_TRUE; }
|
||||
|
||||
nsIFrame* GetTitleFrame(nsIPresContext* aPresContext, nsRect& aRect);
|
||||
nsIFrame* GetContentFrame(nsIPresContext* aPresContext);
|
||||
|
|
|
@ -78,13 +78,12 @@ nsBoxSizeListNodeImpl::Append(nsBoxLayoutState& aState, nsBoxSizeList* aChild)
|
|||
|
||||
nsBoxSizeListNodeImpl::nsBoxSizeListNodeImpl(nsIBox* aBox):mNext(nsnull),
|
||||
mParent(nsnull),
|
||||
mRefCount(0),
|
||||
mBox(aBox),
|
||||
mRefCount(0),
|
||||
mIsSet(PR_FALSE)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
nsBoxSizeList*
|
||||
nsBoxSizeListNodeImpl::GetAt(PRInt32 aIndex)
|
||||
{
|
||||
|
@ -119,7 +118,12 @@ nsBoxSizeListNodeImpl::Get(nsIBox* aBox)
|
|||
|
||||
//------ nsInfoListImpl2 ----
|
||||
|
||||
nsBoxSizeListImpl::nsBoxSizeListImpl(nsIBox* aBox):nsBoxSizeListNodeImpl(aBox),mListenerBox(nsnull), mListener(nsnull), mFirst(nsnull),mLast(nsnull),mCount(0)
|
||||
nsBoxSizeListImpl::nsBoxSizeListImpl(nsIBox* aBox):nsBoxSizeListNodeImpl(aBox),
|
||||
mFirst(nsnull),
|
||||
mLast(nsnull),
|
||||
mCount(0),
|
||||
mListener(nsnull),
|
||||
mListenerBox(nsnull)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -93,10 +93,7 @@ nsObeliskLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSi
|
|||
//nscoord totalWidth = 0;
|
||||
|
||||
if (node) {
|
||||
// for each info
|
||||
//while(node)
|
||||
//{
|
||||
// if the infos pref width is greater than aSize's use it.
|
||||
// if the infos pref width is greater than aSize's use it.
|
||||
// if the infos min width is greater than aSize's use it.
|
||||
// if the infos max width is smaller than aSizes then set it.
|
||||
nsBoxSize size = node->GetBoxSize(aState);
|
||||
|
@ -107,16 +104,9 @@ nsObeliskLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSi
|
|||
if (s > s2)
|
||||
s2 = s;
|
||||
|
||||
//totalWidth += size.pref;
|
||||
|
||||
//node = node->GetNext();
|
||||
}
|
||||
|
||||
//nscoord& width = GET_WIDTH(aSize, isHorizontal);
|
||||
//if (totalWidth > width)
|
||||
// width = totalWidth;
|
||||
|
||||
return NS_OK;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -132,9 +122,6 @@ nsObeliskLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSiz
|
|||
aBox->GetOrientation(isHorizontal);
|
||||
|
||||
if (node) {
|
||||
// for each info
|
||||
//while(node)
|
||||
//{
|
||||
// if the infos pref width is greater than aSize's use it.
|
||||
// if the infos min width is greater than aSize's use it.
|
||||
// if the infos max width is smaller than aSizes then set it.
|
||||
|
@ -145,8 +132,6 @@ nsObeliskLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSiz
|
|||
|
||||
if (s > s2)
|
||||
s2 = s;
|
||||
|
||||
// node = node->GetNext();
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
@ -165,10 +150,7 @@ nsObeliskLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSiz
|
|||
aBox->GetOrientation(isHorizontal);
|
||||
|
||||
if (node) {
|
||||
// for each info
|
||||
// while(node)
|
||||
//{
|
||||
// if the infos pref width is greater than aSize's use it.
|
||||
// if the infos pref width is greater than aSize's use it.
|
||||
// if the infos min width is greater than aSize's use it.
|
||||
// if the infos max width is smaller than aSizes then set it.
|
||||
nsBoxSize size = node->GetBoxSize(aState);
|
||||
|
@ -179,7 +161,6 @@ nsObeliskLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSiz
|
|||
if (s > s2)
|
||||
s2 = s;
|
||||
|
||||
// node = node->GetNext();
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
|
|
@ -79,7 +79,7 @@ NS_NewSliderFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
|||
} // NS_NewSliderFrame
|
||||
|
||||
nsSliderFrame::nsSliderFrame(nsIPresShell* aPresShell):nsBoxFrame(aPresShell),
|
||||
mCurPos(0), mScrollbarListener(nsnull),mChange(0)
|
||||
mCurPos(0), mScrollbarListener(nsnull),mChange(0), mMediator(nsnull)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -217,10 +217,10 @@ nsSliderFrame::Paint(nsIPresContext* aPresContext,
|
|||
thumb->GetMargin(m);
|
||||
thumbRect.Inflate(m);
|
||||
|
||||
nsRect rect;
|
||||
GetClientRect(rect);
|
||||
nsRect crect;
|
||||
GetClientRect(crect);
|
||||
|
||||
if (rect.width < thumbRect.width || rect.height < thumbRect.height)
|
||||
if (crect.width < thumbRect.width || crect.height < thumbRect.height)
|
||||
{
|
||||
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) {
|
||||
const nsStyleDisplay* disp = (const nsStyleDisplay*)
|
||||
|
@ -449,7 +449,6 @@ nsSliderFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
}
|
||||
break;
|
||||
|
||||
case NS_MOUSE_RIGHT_BUTTON_UP:
|
||||
case NS_MOUSE_LEFT_BUTTON_UP:
|
||||
// stop capturing
|
||||
//printf("stop capturing\n");
|
||||
|
@ -466,7 +465,10 @@ nsSliderFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
}
|
||||
|
||||
// XXX hack until handle release is actually called in nsframe.
|
||||
if (aEvent->message == NS_MOUSE_EXIT_SYNTH || aEvent->message == NS_MOUSE_RIGHT_BUTTON_UP || aEvent->message == NS_MOUSE_LEFT_BUTTON_UP)
|
||||
// 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);
|
||||
|
||||
if (aEvent->message == NS_MOUSE_EXIT_SYNTH || aEvent->message == NS_MOUSE_LEFT_BUTTON_UP)
|
||||
HandleRelease(aPresContext, aEvent, aEventStatus);
|
||||
|
||||
return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
|
@ -663,6 +665,24 @@ nsSliderFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
|||
return r;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSliderMediator::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
if (mSlider)
|
||||
return mSlider->MouseDown(aMouseEvent);
|
||||
else
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSliderMediator::MouseUp(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
if (mSlider)
|
||||
return mSlider->MouseUp(aMouseEvent);
|
||||
else
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSliderFrame::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
|
@ -672,6 +692,13 @@ nsSliderFrame::MouseDown(nsIDOMEvent* aMouseEvent)
|
|||
|
||||
nsCOMPtr<nsIDOMMouseEvent> mouseEvent(do_QueryInterface(aMouseEvent));
|
||||
|
||||
PRUint16 button = 0;
|
||||
mouseEvent->GetButton(&button);
|
||||
|
||||
// only if left button
|
||||
if (button != 1)
|
||||
return NS_OK;
|
||||
|
||||
RemoveListener();
|
||||
DragThumb(mPresContext, PR_TRUE);
|
||||
PRInt32 c = 0;
|
||||
|
@ -752,44 +779,32 @@ nsSliderFrame :: isDraggingThumb(nsIPresContext* aPresContext)
|
|||
void
|
||||
nsSliderFrame::AddListener()
|
||||
{
|
||||
if (!mMediator) {
|
||||
mMediator = new nsSliderMediator(this);
|
||||
NS_ADDREF(mMediator);
|
||||
}
|
||||
|
||||
nsIFrame* thumbFrame = mFrames.FirstChild();
|
||||
nsCOMPtr<nsIContent> content;
|
||||
thumbFrame->GetContent(getter_AddRefs(content));
|
||||
|
||||
nsCOMPtr<nsIDOMEventReceiver> reciever(do_QueryInterface(content));
|
||||
|
||||
reciever->AddEventListenerByIID(this,NS_GET_IID(nsIDOMMouseListener));
|
||||
reciever->AddEventListenerByIID(mMediator, NS_GET_IID(nsIDOMMouseListener));
|
||||
}
|
||||
|
||||
void
|
||||
nsSliderFrame::RemoveListener()
|
||||
{
|
||||
NS_ASSERTION(mMediator, "No listener was ever added!!");
|
||||
|
||||
nsIFrame* thumbFrame = mFrames.FirstChild();
|
||||
nsCOMPtr<nsIContent> content;
|
||||
thumbFrame->GetContent(getter_AddRefs(content));
|
||||
|
||||
nsCOMPtr<nsIDOMEventReceiver> reciever(do_QueryInterface(content));
|
||||
|
||||
reciever->RemoveEventListenerByIID(this,NS_GET_IID(nsIDOMMouseListener));
|
||||
}
|
||||
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsSliderFrame)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMMouseListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsITimerCallback)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsBoxFrame)
|
||||
|
||||
|
||||
NS_IMETHODIMP_(nsrefcnt)
|
||||
nsSliderFrame::AddRef(void)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(nsrefcnt)
|
||||
nsSliderFrame::Release(void)
|
||||
{
|
||||
return NS_OK;
|
||||
reciever->RemoveEventListenerByIID(mMediator, NS_GET_IID(nsIDOMMouseListener));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -811,7 +826,8 @@ nsSliderFrame::HandlePress(nsIPresContext* aPresContext,
|
|||
mChange = change;
|
||||
mClickPoint = aEvent->point;
|
||||
PageUpDown(thumbFrame, change);
|
||||
nsRepeatService::GetInstance()->Start(this);
|
||||
|
||||
nsRepeatService::GetInstance()->Start(mMediator);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -829,9 +845,16 @@ nsSliderFrame::HandleRelease(nsIPresContext* aPresContext,
|
|||
NS_IMETHODIMP
|
||||
nsSliderFrame::Destroy(nsIPresContext* aPresContext)
|
||||
{
|
||||
// tell our mediator if we have one we are gone.
|
||||
if (mMediator) {
|
||||
mMediator->SetSlider(nsnull);
|
||||
NS_RELEASE(mMediator);
|
||||
mMediator = nsnull;
|
||||
}
|
||||
|
||||
// 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();
|
||||
//nsRepeatService::GetInstance()->Stop();
|
||||
|
||||
// XXX: HACK! WORKAROUND FOR BUG 21571
|
||||
/*
|
||||
|
@ -857,7 +880,7 @@ nsSliderFrame::Destroy(nsIPresContext* aPresContext)
|
|||
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
|
||||
// RemoveListener(); // remove this line when 21571 is fixed properly
|
||||
|
||||
// call base class Destroy()
|
||||
return nsBoxFrame::Destroy(aPresContext);
|
||||
|
@ -911,6 +934,12 @@ nsSliderFrame::SetScrollbarListener(nsIScrollbarListener* aListener)
|
|||
mScrollbarListener = aListener;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(void) nsSliderMediator::Notify(nsITimer *timer)
|
||||
{
|
||||
if (mSlider)
|
||||
mSlider->Notify(timer);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(void) nsSliderFrame::Notify(nsITimer *timer)
|
||||
{
|
||||
PRBool stop = PR_FALSE;
|
||||
|
@ -949,6 +978,7 @@ NS_IMETHODIMP_(void) nsSliderFrame::Notify(nsITimer *timer)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
class nsThumbFrame : public nsTitledButtonFrame
|
||||
{
|
||||
public:
|
||||
|
@ -990,4 +1020,14 @@ NS_NewThumbFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
|||
return NS_OK;
|
||||
|
||||
} // NS_NewSliderFrame
|
||||
*/
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsSliderMediator)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMMouseListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsITimerCallback)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsITimerCallback)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_ADDREF(nsSliderMediator);
|
||||
NS_IMPL_RELEASE(nsSliderMediator);
|
||||
|
||||
|
|
|
@ -32,14 +32,15 @@
|
|||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMMouseListener.h"
|
||||
#include "nsIAnonymousContentCreator.h"
|
||||
#include "nsITimerCallback.h"
|
||||
#include "nsIDOMMouseListener.h"
|
||||
|
||||
class nsString;
|
||||
class nsIScrollbarListener;
|
||||
class nsISupportsArray;
|
||||
class nsITimer;
|
||||
class nsSliderFrame;
|
||||
|
||||
#define INITAL_REPEAT_DELAY 500
|
||||
#define REPEAT_DELAY 50
|
||||
|
@ -47,9 +48,72 @@ class nsITimer;
|
|||
nsresult NS_NewSliderFrame(nsIPresShell* aPresShell, nsIFrame** aResult) ;
|
||||
|
||||
|
||||
class nsSliderFrame : public nsBoxFrame,
|
||||
public nsIDOMMouseListener,
|
||||
public nsITimerCallback
|
||||
class nsSliderMediator : public nsIDOMMouseListener,
|
||||
public nsITimerCallback
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
nsSliderFrame* mSlider;
|
||||
|
||||
nsSliderMediator(nsSliderFrame* aSlider) { mSlider = aSlider; NS_INIT_ISUPPORTS(); }
|
||||
virtual ~nsSliderMediator() {}
|
||||
|
||||
virtual void SetSlider(nsSliderFrame* aSlider) { mSlider = aSlider; }
|
||||
|
||||
/**
|
||||
* Processes a mouse down event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
virtual nsresult MouseDown(nsIDOMEvent* aMouseEvent);
|
||||
|
||||
/**
|
||||
* Processes a mouse up event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
virtual nsresult MouseUp(nsIDOMEvent* aMouseEvent);
|
||||
|
||||
/**
|
||||
* Processes a mouse click event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*
|
||||
*/
|
||||
virtual nsresult MouseClick(nsIDOMEvent* aMouseEvent) { return NS_OK; }
|
||||
|
||||
/**
|
||||
* Processes a mouse click event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*
|
||||
*/
|
||||
virtual nsresult MouseDblClick(nsIDOMEvent* aMouseEvent) { return NS_OK; }
|
||||
|
||||
/**
|
||||
* Processes a mouse enter event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
virtual nsresult MouseOver(nsIDOMEvent* aMouseEvent) { return NS_OK; }
|
||||
|
||||
/**
|
||||
* Processes a mouse leave event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
virtual nsresult MouseOut(nsIDOMEvent* aMouseEvent) { return NS_OK; }
|
||||
|
||||
virtual nsresult HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
|
||||
NS_IMETHOD_(void) Notify(nsITimer *timer);
|
||||
|
||||
}; // class nsSliderFrame
|
||||
|
||||
class nsSliderFrame : public nsBoxFrame
|
||||
{
|
||||
public:
|
||||
nsSliderFrame(nsIPresShell* aShell);
|
||||
|
@ -103,54 +167,9 @@ public:
|
|||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList);
|
||||
|
||||
/**
|
||||
* Processes a mouse down event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
virtual nsresult MouseDown(nsIDOMEvent* aMouseEvent);
|
||||
|
||||
/**
|
||||
* Processes a mouse up event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
virtual nsresult MouseUp(nsIDOMEvent* aMouseEvent);
|
||||
|
||||
/**
|
||||
* Processes a mouse click event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*
|
||||
*/
|
||||
virtual nsresult MouseClick(nsIDOMEvent* aMouseEvent) { return NS_OK; }
|
||||
|
||||
/**
|
||||
* Processes a mouse click event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*
|
||||
*/
|
||||
virtual nsresult MouseDblClick(nsIDOMEvent* aMouseEvent) { return NS_OK; }
|
||||
|
||||
/**
|
||||
* Processes a mouse enter event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
virtual nsresult MouseOver(nsIDOMEvent* aMouseEvent) { return NS_OK; }
|
||||
|
||||
/**
|
||||
* Processes a mouse leave event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
virtual nsresult MouseOut(nsIDOMEvent* aMouseEvent) { return NS_OK; }
|
||||
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
NS_IMETHOD_(nsrefcnt) Release(void);
|
||||
|
||||
virtual nsresult HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
static PRInt32 GetCurrentPosition(nsIContent* content);
|
||||
|
@ -180,6 +199,7 @@ public:
|
|||
nsEventStatus* aEventStatus);
|
||||
|
||||
NS_IMETHOD_(void) Notify(nsITimer *timer);
|
||||
friend nsSliderMediator;
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -213,6 +233,7 @@ private:
|
|||
nscoord mChange;
|
||||
nsPoint mClickPoint;
|
||||
PRBool mRedrawImmediate;
|
||||
nsSliderMediator* mMediator;
|
||||
|
||||
}; // class nsSliderFrame
|
||||
|
||||
|
|
|
@ -119,10 +119,10 @@ nsSprocketLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState)
|
|||
nscoord maxAscent = 0;
|
||||
aBox->GetAscent(aState, maxAscent);
|
||||
|
||||
nscoord minSize = 0;
|
||||
nscoord maxSize = 0;
|
||||
nscoord min = 0;
|
||||
nscoord max = 0;
|
||||
PRInt32 flexes = 0;
|
||||
PopulateBoxSizes(aBox, aState, boxSizes, computedBoxSizes, minSize, maxSize, flexes);
|
||||
PopulateBoxSizes(aBox, aState, boxSizes, computedBoxSizes, min, max, flexes);
|
||||
|
||||
nscoord size = clientRect.width;
|
||||
if (!IsHorizontal(aBox))
|
||||
|
@ -133,21 +133,21 @@ nsSprocketLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState)
|
|||
|
||||
if (IsHorizontal(aBox)) {
|
||||
clientRect.width = size;
|
||||
if (clientRect.height < minSize)
|
||||
clientRect.height = minSize;
|
||||
if (clientRect.height < min)
|
||||
clientRect.height = min;
|
||||
|
||||
if (frameState & NS_STATE_AUTO_STRETCH) {
|
||||
if (clientRect.height > maxSize)
|
||||
clientRect.height = maxSize;
|
||||
if (clientRect.height > max)
|
||||
clientRect.height = max;
|
||||
}
|
||||
} else {
|
||||
clientRect.height = size;
|
||||
if (clientRect.width < minSize)
|
||||
clientRect.width = minSize;
|
||||
if (clientRect.width < min)
|
||||
clientRect.width = min;
|
||||
|
||||
if (frameState & NS_STATE_AUTO_STRETCH) {
|
||||
if (clientRect.width > maxSize)
|
||||
clientRect.width = maxSize;
|
||||
if (clientRect.width > max)
|
||||
clientRect.width = max;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -438,6 +438,7 @@ nsSprocketLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState)
|
|||
}
|
||||
|
||||
passes++;
|
||||
NS_ASSERTION(passes < 10, "A Box's child is constantly growing!!!!!");
|
||||
if (passes > 10) {
|
||||
break;
|
||||
}
|
||||
|
@ -574,7 +575,6 @@ nsSprocketLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, nsBox
|
|||
nsIBox* child = nsnull;
|
||||
aBox->GetChildBox(&child);
|
||||
|
||||
PRInt32 count = 0;
|
||||
aFlexes = 0;
|
||||
nsBoxSize* currentBox = nsnull;
|
||||
|
||||
|
@ -800,7 +800,7 @@ nsSprocketLayout::ChildResized(nsIBox* aBox,
|
|||
nscoord& childActualWidth = GET_WIDTH(aChildActualRect,isHorizontal);
|
||||
nscoord& containingWidth = GET_WIDTH(aContainingRect,isHorizontal);
|
||||
|
||||
nscoord childLayoutHeight = GET_HEIGHT(aChildLayoutRect,isHorizontal);
|
||||
//nscoord childLayoutHeight = GET_HEIGHT(aChildLayoutRect,isHorizontal);
|
||||
nscoord& childActualHeight = GET_HEIGHT(aChildActualRect,isHorizontal);
|
||||
nscoord& containingHeight = GET_HEIGHT(aContainingRect,isHorizontal);
|
||||
|
||||
|
@ -1254,9 +1254,9 @@ nsSprocketLayout::GetFlex(nsIBox* aBox, nsBoxLayoutState& aState, nscoord& aFlex
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSprocketLayout::IsCollapsed(nsIBox* aBox, nsBoxLayoutState& aState, PRBool& IsCollapsed)
|
||||
nsSprocketLayout::IsCollapsed(nsIBox* aBox, nsBoxLayoutState& aState, PRBool& aIsCollapsed)
|
||||
{
|
||||
return aBox->IsCollapsed(aState, IsCollapsed);
|
||||
return aBox->IsCollapsed(aState, aIsCollapsed);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -580,7 +580,6 @@ nsTextBoxFrame::CalcTextSize(nsBoxLayoutState& aBoxLayoutState)
|
|||
if (mNeedsRecalc)
|
||||
{
|
||||
nsSize size;
|
||||
nscoord ascent = 0;
|
||||
nsIPresContext* presContext = aBoxLayoutState.GetPresContext();
|
||||
nsIRenderingContext* rendContext = aBoxLayoutState.GetReflowState()->rendContext;
|
||||
if (rendContext) {
|
||||
|
|
|
@ -84,7 +84,13 @@ public:
|
|||
}
|
||||
#endif
|
||||
|
||||
virtual PRBool GetInitialOrientation(PRBool& aHorizontal) { aHorizontal = PR_FALSE; return PR_TRUE; }
|
||||
// make sure we our kids get our orient, align, and autostretch instead of us.
|
||||
// our child box has no content node so it will search for a parent with one.
|
||||
// that will be us.
|
||||
virtual PRBool GetInitialOrientation(PRBool& aHorizontal) { aHorizontal = PR_FALSE; return PR_TRUE; }
|
||||
virtual PRBool GetInitialHAlignment(Halignment& aHalign) { aHalign = hAlign_Left; return PR_TRUE; }
|
||||
virtual PRBool GetInitialVAlignment(Valignment& aValign) { aValign = vAlign_Top; return PR_TRUE; }
|
||||
virtual PRBool GetInitialAutoStretch(PRBool& aStretch) { aStretch = PR_TRUE; return PR_TRUE; }
|
||||
|
||||
nsIFrame* GetTitleFrame(nsIPresContext* aPresContext, nsRect& aRect);
|
||||
nsIFrame* GetContentFrame(nsIPresContext* aPresContext);
|
||||
|
|
|
@ -1512,7 +1512,7 @@ nsTitledButtonFrame::CacheSizes(nsBoxLayoutState& aBoxLayoutState)
|
|||
break;
|
||||
}
|
||||
|
||||
nscoord oldHeight = mPrefSize.height;
|
||||
//nscoord oldHeight = mPrefSize.height;
|
||||
|
||||
nsMargin focusBorder = mRenderer->GetAddedButtonBorderAndPadding();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче