зеркало из https://github.com/mozilla/pjs.git
Replace nsSliderFrame::GetContentOf with static GetContentOfBox to fix hiding warning and avoid unnecessary |this| argument. b=42634 Patch from Marc Loiselle <mloiselle@yahoo.com>. r=dbaron sr=bryner
This commit is contained in:
Родитель
e403c64e9e
Коммит
7a51cf1597
|
@ -82,6 +82,16 @@
|
||||||
// Turn this on if you want to debug slider frames.
|
// Turn this on if you want to debug slider frames.
|
||||||
#undef DEBUG_SLIDER
|
#undef DEBUG_SLIDER
|
||||||
|
|
||||||
|
static already_AddRefed<nsIContent>
|
||||||
|
GetContentOfBox(nsIBox *aBox)
|
||||||
|
{
|
||||||
|
nsIFrame *frame;
|
||||||
|
nsIContent *content;
|
||||||
|
aBox->GetFrame(&frame);
|
||||||
|
frame->GetContent(&content);
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
NS_NewSliderFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
NS_NewSliderFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||||
{
|
{
|
||||||
|
@ -244,7 +254,7 @@ nsSliderFrame::AttributeChanged(nsIPresContext* aPresContext,
|
||||||
|
|
||||||
nsIBox* scrollbarBox = GetScrollbar();
|
nsIBox* scrollbarBox = GetScrollbar();
|
||||||
nsCOMPtr<nsIContent> scrollbar;
|
nsCOMPtr<nsIContent> scrollbar;
|
||||||
GetContentOf(scrollbarBox, getter_AddRefs(scrollbar));
|
scrollbar = GetContentOfBox(scrollbarBox);
|
||||||
PRInt32 current = GetCurrentPosition(scrollbar);
|
PRInt32 current = GetCurrentPosition(scrollbar);
|
||||||
PRInt32 max = GetMaxPosition(scrollbar);
|
PRInt32 max = GetMaxPosition(scrollbar);
|
||||||
if (current < 0 || current > max)
|
if (current < 0 || current > max)
|
||||||
|
@ -345,7 +355,7 @@ nsSliderFrame::DoLayout(nsBoxLayoutState& aState)
|
||||||
// get the scrollbar
|
// get the scrollbar
|
||||||
nsIBox* scrollbarBox = GetScrollbar();
|
nsIBox* scrollbarBox = GetScrollbar();
|
||||||
nsCOMPtr<nsIContent> scrollbar;
|
nsCOMPtr<nsIContent> scrollbar;
|
||||||
GetContentOf(scrollbarBox, getter_AddRefs(scrollbar));
|
scrollbar = GetContentOfBox(scrollbarBox);
|
||||||
PRBool isHorizontal = IsHorizontal();
|
PRBool isHorizontal = IsHorizontal();
|
||||||
|
|
||||||
// get the thumb's pref size
|
// get the thumb's pref size
|
||||||
|
@ -454,7 +464,7 @@ nsSliderFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||||
{
|
{
|
||||||
nsIBox* scrollbarBox = GetScrollbar();
|
nsIBox* scrollbarBox = GetScrollbar();
|
||||||
nsCOMPtr<nsIContent> scrollbar;
|
nsCOMPtr<nsIContent> scrollbar;
|
||||||
GetContentOf(scrollbarBox, getter_AddRefs(scrollbar));
|
scrollbar = GetContentOfBox(scrollbarBox);
|
||||||
PRBool isHorizontal = IsHorizontal();
|
PRBool isHorizontal = IsHorizontal();
|
||||||
|
|
||||||
if (isDraggingThumb(aPresContext))
|
if (isDraggingThumb(aPresContext))
|
||||||
|
@ -739,14 +749,6 @@ nsSliderFrame::GetScrollbar()
|
||||||
return ibox;
|
return ibox;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
nsSliderFrame::GetContentOf(nsIBox* aBox, nsIContent** aContent)
|
|
||||||
{
|
|
||||||
nsIFrame* frame = nsnull;
|
|
||||||
aBox->GetFrame(&frame);
|
|
||||||
frame->GetContent(aContent);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
nsSliderFrame::PageUpDown(nsIFrame* aThumbFrame, nscoord change)
|
nsSliderFrame::PageUpDown(nsIFrame* aThumbFrame, nscoord change)
|
||||||
{
|
{
|
||||||
|
@ -755,7 +757,7 @@ nsSliderFrame::PageUpDown(nsIFrame* aThumbFrame, nscoord change)
|
||||||
// get the values from our own node.
|
// get the values from our own node.
|
||||||
nsIBox* scrollbarBox = GetScrollbar();
|
nsIBox* scrollbarBox = GetScrollbar();
|
||||||
nsCOMPtr<nsIContent> scrollbar;
|
nsCOMPtr<nsIContent> scrollbar;
|
||||||
GetContentOf(scrollbarBox, getter_AddRefs(scrollbar));
|
scrollbar = GetContentOfBox(scrollbarBox);
|
||||||
|
|
||||||
if (mScrollbarListener)
|
if (mScrollbarListener)
|
||||||
mScrollbarListener->PagedUpDown(); // Let the listener decide our increment.
|
mScrollbarListener->PagedUpDown(); // Let the listener decide our increment.
|
||||||
|
@ -771,7 +773,7 @@ nsSliderFrame::CurrentPositionChanged(nsIPresContext* aPresContext)
|
||||||
{
|
{
|
||||||
nsIBox* scrollbarBox = GetScrollbar();
|
nsIBox* scrollbarBox = GetScrollbar();
|
||||||
nsCOMPtr<nsIContent> scrollbar;
|
nsCOMPtr<nsIContent> scrollbar;
|
||||||
GetContentOf(scrollbarBox, getter_AddRefs(scrollbar));
|
scrollbar = GetContentOfBox(scrollbarBox);
|
||||||
|
|
||||||
PRBool isHorizontal = IsHorizontal();
|
PRBool isHorizontal = IsHorizontal();
|
||||||
|
|
||||||
|
@ -1024,7 +1026,7 @@ nsSliderFrame::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||||
|
|
||||||
nsIBox* scrollbarBox = GetScrollbar();
|
nsIBox* scrollbarBox = GetScrollbar();
|
||||||
nsCOMPtr<nsIContent> scrollbar;
|
nsCOMPtr<nsIContent> scrollbar;
|
||||||
GetContentOf(scrollbarBox, getter_AddRefs(scrollbar));
|
scrollbar = GetContentOfBox(scrollbarBox);
|
||||||
|
|
||||||
// set it
|
// set it
|
||||||
SetCurrentPosition(scrollbar, thumbFrame, pospx, PR_FALSE);
|
SetCurrentPosition(scrollbar, thumbFrame, pospx, PR_FALSE);
|
||||||
|
|
|
@ -232,7 +232,6 @@ public:
|
||||||
private:
|
private:
|
||||||
|
|
||||||
nsIBox* GetScrollbar();
|
nsIBox* GetScrollbar();
|
||||||
void GetContentOf(nsIBox* aBox, nsIContent** aContent);
|
|
||||||
|
|
||||||
void PageUpDown(nsIFrame* aThumbFrame, nscoord change);
|
void PageUpDown(nsIFrame* aThumbFrame, nscoord change);
|
||||||
void SetCurrentPosition(nsIContent* scrollbar, nsIFrame* aThumbFrame, nscoord pos, PRBool aIsSmooth);
|
void SetCurrentPosition(nsIContent* scrollbar, nsIFrame* aThumbFrame, nscoord pos, PRBool aIsSmooth);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче