Bug 670148, remove nsIScrollbarFrame, r=roc

This commit is contained in:
Neil Deakin 2011-07-11 10:05:09 -04:00
parent bf5ff724ae
commit 46aa977563
12 changed files with 33 additions and 107 deletions

View File

@ -56,7 +56,7 @@
#include "nsIDocument.h"
#include "nsBoxLayoutState.h"
#include "nsINodeInfo.h"
#include "nsIScrollbarFrame.h"
#include "nsScrollbarFrame.h"
#include "nsIScrollbarMediator.h"
#include "nsITextControlFrame.h"
#include "nsIDOMHTMLTextAreaElement.h"
@ -3559,10 +3559,7 @@ nsGfxScrollFrameInner::GetActualScrollbarSizes() const
void
nsGfxScrollFrameInner::SetScrollbarVisibility(nsIBox* aScrollbar, PRBool aVisible)
{
if (!aScrollbar)
return;
nsIScrollbarFrame* scrollbar = do_QueryFrame(aScrollbar);
nsScrollbarFrame* scrollbar = do_QueryFrame(aScrollbar);
if (scrollbar) {
// See if we have a mediator.
nsIScrollbarMediator* mediator = scrollbar->GetScrollbarMediator();

View File

@ -125,7 +125,6 @@ public:
nsISVGGlyphFragmentNode_id,
nsISVGSVGFrame_id,
nsIScrollableFrame_id,
nsIScrollbarFrame_id,
nsIScrollbarMediator_id,
nsISelectControlFrame_id,
nsIStatefulFrame_id,

View File

@ -42,19 +42,16 @@
#include "nsQueryFrame.h"
class nsIScrollbarFrame;
class nsScrollbarFrame;
class nsIScrollbarMediator
{
public:
NS_DECL_QUERYFRAME_TARGET(nsIScrollbarMediator)
// The nsIFrame aScrollbar argument below denotes the
// scrollbar that's firing the notification. It should be
// where the same object as where nsIScrollbarFrame is implemented
NS_IMETHOD PositionChanged(nsIScrollbarFrame* aScrollbar, PRInt32 aOldIndex, PRInt32& aNewIndex) = 0;
NS_IMETHOD ScrollbarButtonPressed(nsIScrollbarFrame* aScrollbar, PRInt32 aOldIndex, PRInt32 aNewIndex) = 0;
// The aScrollbar argument denotes the scrollbar that's firing the notification.
NS_IMETHOD PositionChanged(nsScrollbarFrame* aScrollbar, PRInt32 aOldIndex, PRInt32& aNewIndex) = 0;
NS_IMETHOD ScrollbarButtonPressed(nsScrollbarFrame* aScrollbar, PRInt32 aOldIndex, PRInt32 aNewIndex) = 0;
NS_IMETHOD VisibilityChanged(PRBool aVisible) = 0;
};

View File

@ -1,59 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* 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.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsIScrollbarFrame_h___
#define nsIScrollbarFrame_h___
#include "nsQueryFrame.h"
class nsIScrollbarMediator;
class nsIScrollbarFrame : public nsQueryFrame
{
public:
NS_DECL_QUERYFRAME_TARGET(nsIScrollbarFrame)
// Sets the scrollbar mediator content. We will try to get its primary frame
// and then QI that to nsIScrollbarMediator as necessary.
virtual void SetScrollbarMediatorContent(nsIContent* aMediator) = 0;
// Do NOT hold on to this.
virtual nsIScrollbarMediator* GetScrollbarMediator() = 0;
};
#endif

View File

@ -54,7 +54,7 @@
#include "nsIDOMNodeList.h"
#include "nsCSSFrameConstructor.h"
#include "nsIScrollableFrame.h"
#include "nsIScrollbarFrame.h"
#include "nsScrollbarFrame.h"
#include "nsIView.h"
#include "nsIViewManager.h"
#include "nsStyleContext.h"
@ -214,8 +214,8 @@ nsListBoxBodyFrame::Init(nsIContent* aContent,
nsIScrollableFrame* scrollFrame = nsLayoutUtils::GetScrollableFrameFor(this);
if (scrollFrame) {
nsIBox* verticalScrollbar = scrollFrame->GetScrollbarBox(PR_TRUE);
if (verticalScrollbar) {
nsIScrollbarFrame* scrollbarFrame = do_QueryFrame(verticalScrollbar);
nsScrollbarFrame* scrollbarFrame = do_QueryFrame(verticalScrollbar);
if (scrollbarFrame) {
scrollbarFrame->SetScrollbarMediatorContent(GetContent());
}
}
@ -353,7 +353,7 @@ nsListBoxBodyFrame::GetPrefSize(nsBoxLayoutState& aBoxLayoutState)
///////////// nsIScrollbarMediator ///////////////
NS_IMETHODIMP
nsListBoxBodyFrame::PositionChanged(nsIScrollbarFrame* aScrollbar, PRInt32 aOldIndex, PRInt32& aNewIndex)
nsListBoxBodyFrame::PositionChanged(nsScrollbarFrame* aScrollbar, PRInt32 aOldIndex, PRInt32& aNewIndex)
{
if (mScrolling || mRowHeight == 0)
return NS_OK;
@ -423,7 +423,7 @@ nsListBoxBodyFrame::VisibilityChanged(PRBool aVisible)
}
NS_IMETHODIMP
nsListBoxBodyFrame::ScrollbarButtonPressed(nsIScrollbarFrame* aScrollbar, PRInt32 aOldIndex, PRInt32 aNewIndex)
nsListBoxBodyFrame::ScrollbarButtonPressed(nsScrollbarFrame* aScrollbar, PRInt32 aOldIndex, PRInt32 aNewIndex)
{
if (aOldIndex == aNewIndex)
return NS_OK;

View File

@ -90,8 +90,8 @@ public:
NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRInt32 aModType);
// nsIScrollbarMediator
NS_IMETHOD PositionChanged(nsIScrollbarFrame* aScrollbar, PRInt32 aOldIndex, PRInt32& aNewIndex);
NS_IMETHOD ScrollbarButtonPressed(nsIScrollbarFrame* aScrollbar, PRInt32 aOldIndex, PRInt32 aNewIndex);
NS_IMETHOD PositionChanged(nsScrollbarFrame* aScrollbar, PRInt32 aOldIndex, PRInt32& aNewIndex);
NS_IMETHOD ScrollbarButtonPressed(nsScrollbarFrame* aScrollbar, PRInt32 aOldIndex, PRInt32 aNewIndex);
NS_IMETHOD VisibilityChanged(PRBool aVisible);
// nsIReflowCallback

View File

@ -49,7 +49,7 @@
#include "nsINameSpaceManager.h"
#include "nsGkAtoms.h"
#include "nsSliderFrame.h"
#include "nsIScrollbarFrame.h"
#include "nsScrollbarFrame.h"
#include "nsIScrollbarMediator.h"
#include "nsRepeatService.h"
#include "nsGUIEvent.h"
@ -245,7 +245,7 @@ nsScrollbarButtonFrame::DoButtonAction(PRBool aSmoothScroll)
else if (curpos > maxpos)
curpos = maxpos;
nsIScrollbarFrame* sb = do_QueryFrame(scrollbar);
nsScrollbarFrame* sb = do_QueryFrame(scrollbar);
if (sb) {
nsIScrollbarMediator* m = sb->GetScrollbarMediator();
if (m) {

View File

@ -62,7 +62,7 @@ NS_NewScrollbarFrame (nsIPresShell* aPresShell, nsStyleContext* aContext)
NS_IMPL_FRAMEARENA_HELPERS(nsScrollbarFrame)
NS_QUERYFRAME_HEAD(nsScrollbarFrame)
NS_QUERYFRAME_ENTRY(nsIScrollbarFrame)
NS_QUERYFRAME_ENTRY(nsScrollbarFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsBoxFrame)
NS_IMETHODIMP
@ -129,11 +129,7 @@ nsScrollbarFrame::AttributeChanged(PRInt32 aNameSpaceID,
if (aAttribute != nsGkAtoms::curpos)
return rv;
nsIFrame* parent = GetParent();
if (!parent)
return rv;
nsIScrollableFrame* scrollable = do_QueryFrame(parent);
nsIScrollableFrame* scrollable = do_QueryFrame(GetParent());
if (!scrollable)
return rv;
@ -170,16 +166,12 @@ nsScrollbarFrame::GetScrollbarMediator()
if (!mScrollbarMediator)
return nsnull;
nsIFrame* f = mScrollbarMediator->GetPrimaryFrame();
if (!f)
return nsnull;
// check if the frame is a scroll frame. If so, get the scrollable frame
// inside it.
nsIScrollableFrame* scrollFrame = do_QueryFrame(f);
if (scrollFrame) {
f = scrollFrame->GetScrolledFrame();
if (!f)
return nsnull;
}
nsIScrollbarMediator* sbm = do_QueryFrame(f);

View File

@ -43,18 +43,19 @@
#define nsScrollbarFrame_h__
#include "nsBoxFrame.h"
#include "nsIScrollbarFrame.h"
class nsIScrollbarMediator;
nsIFrame* NS_NewScrollbarFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
class nsScrollbarFrame : public nsBoxFrame, public nsIScrollbarFrame
class nsScrollbarFrame : public nsBoxFrame
{
public:
nsScrollbarFrame(nsIPresShell* aShell, nsStyleContext* aContext):
nsBoxFrame(aShell, aContext), mScrollbarMediator(nsnull) {}
NS_DECL_QUERYFRAME_TARGET(nsScrollbarFrame)
#ifdef DEBUG
NS_IMETHOD GetFrameName(nsAString& aResult) const {
return MakeFrameName(NS_LITERAL_STRING("ScrollbarFrame"), aResult);
@ -91,9 +92,8 @@ public:
virtual nsIAtom* GetType() const;
// nsIScrollbarFrame
virtual void SetScrollbarMediatorContent(nsIContent* aMediator);
virtual nsIScrollbarMediator* GetScrollbarMediator();
void SetScrollbarMediatorContent(nsIContent* aMediator);
nsIScrollbarMediator* GetScrollbarMediator();
// nsBox methods

View File

@ -60,7 +60,7 @@
#include "nsScrollbarButtonFrame.h"
#include "nsISliderListener.h"
#include "nsIScrollbarMediator.h"
#include "nsIScrollbarFrame.h"
#include "nsScrollbarFrame.h"
#include "nsILookAndFeel.h"
#include "nsRepeatService.h"
#include "nsBoxLayoutState.h"
@ -297,7 +297,7 @@ nsSliderFrame::AttributeChanged(PRInt32 aNameSpaceID,
current = max;
// set the new position and notify observers
nsIScrollbarFrame* scrollbarFrame = do_QueryFrame(scrollbarBox);
nsScrollbarFrame* scrollbarFrame = do_QueryFrame(scrollbarBox);
if (scrollbarFrame) {
nsIScrollbarMediator* mediator = scrollbarFrame->GetScrollbarMediator();
if (mediator) {
@ -812,7 +812,7 @@ nsSliderFrame::SetCurrentPositionInternal(nsIContent* aScrollbar, PRInt32 aNewPo
mUserChanged = PR_TRUE;
nsIScrollbarFrame* scrollbarFrame = do_QueryFrame(scrollbarBox);
nsScrollbarFrame* scrollbarFrame = do_QueryFrame(scrollbarBox);
if (scrollbarFrame) {
// See if we have a mediator.
nsIScrollbarMediator* mediator = scrollbarFrame->GetScrollbarMediator();

View File

@ -842,7 +842,7 @@ FindScrollParts(nsIFrame* aCurrFrame, nsTreeBodyFrame::ScrollParts* aResult)
}
}
nsIScrollbarFrame *sf = do_QueryFrame(aCurrFrame);
nsScrollbarFrame *sf = do_QueryFrame(aCurrFrame);
if (sf) {
if (!aCurrFrame->IsHorizontal()) {
if (!aResult->mVScrollbar) {
@ -4148,7 +4148,7 @@ nsTreeBodyFrame::ScrollHorzInternal(const ScrollParts& aParts, PRInt32 aPosition
}
NS_IMETHODIMP
nsTreeBodyFrame::ScrollbarButtonPressed(nsIScrollbarFrame* aScrollbar, PRInt32 aOldIndex, PRInt32 aNewIndex)
nsTreeBodyFrame::ScrollbarButtonPressed(nsScrollbarFrame* aScrollbar, PRInt32 aOldIndex, PRInt32 aNewIndex)
{
ScrollParts parts = GetScrollParts();
@ -4167,7 +4167,7 @@ nsTreeBodyFrame::ScrollbarButtonPressed(nsIScrollbarFrame* aScrollbar, PRInt32 a
}
NS_IMETHODIMP
nsTreeBodyFrame::PositionChanged(nsIScrollbarFrame* aScrollbar, PRInt32 aOldIndex, PRInt32& aNewIndex)
nsTreeBodyFrame::PositionChanged(nsScrollbarFrame* aScrollbar, PRInt32 aOldIndex, PRInt32& aNewIndex)
{
ScrollParts parts = GetScrollParts();

View File

@ -60,7 +60,7 @@
#include "nsDataHashtable.h"
#include "imgIRequest.h"
#include "imgIDecoderObserver.h"
#include "nsIScrollbarFrame.h"
#include "nsScrollbarFrame.h"
#include "nsThreadUtils.h"
class nsOverflowChecker;
@ -146,8 +146,8 @@ public:
virtual PRBool PseudoMatches(nsCSSSelector* aSelector);
// nsIScrollbarMediator
NS_IMETHOD PositionChanged(nsIScrollbarFrame* aScrollbar, PRInt32 aOldIndex, PRInt32& aNewIndex);
NS_IMETHOD ScrollbarButtonPressed(nsIScrollbarFrame* aScrollbar, PRInt32 aOldIndex, PRInt32 aNewIndex);
NS_IMETHOD PositionChanged(nsScrollbarFrame* aScrollbar, PRInt32 aOldIndex, PRInt32& aNewIndex);
NS_IMETHOD ScrollbarButtonPressed(nsScrollbarFrame* aScrollbar, PRInt32 aOldIndex, PRInt32 aNewIndex);
NS_IMETHOD VisibilityChanged(PRBool aVisible) { Invalidate(); return NS_OK; }
// Overridden from nsIFrame to cache our pres context.
@ -173,9 +173,9 @@ public:
friend class nsTreeColumn;
struct ScrollParts {
nsIScrollbarFrame* mVScrollbar;
nsScrollbarFrame* mVScrollbar;
nsCOMPtr<nsIContent> mVScrollbarContent;
nsIScrollbarFrame* mHScrollbar;
nsScrollbarFrame* mHScrollbar;
nsCOMPtr<nsIContent> mHScrollbarContent;
nsIFrame* mColumnsFrame;
nsIScrollableFrame* mColumnsScrollFrame;