mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Bug 266890. Remove nsListboxScrollPortFrame by moving its functionality into nsListBoxFrame. Part of an ongoing effort to remove nsScrollboxFrame and its subclasses. r+sr=bryner
This commit is contained in:
parent
5b10c8c493
commit
82d2fed87b
@ -321,9 +321,6 @@ NS_NewMenuFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRUint32 aFlag
|
||||
nsresult
|
||||
NS_NewMenuBarFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame );
|
||||
|
||||
nsresult
|
||||
NS_NewListBoxScrollPortFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame );
|
||||
|
||||
nsresult
|
||||
NS_NewTreeBodyFrame (nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
@ -5797,15 +5794,11 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
|
||||
|
||||
nsCOMPtr<nsIBoxLayout> layout;
|
||||
|
||||
PRBool listboxScrollPort = PR_FALSE;
|
||||
|
||||
if (aTag == nsXULAtoms::listboxbody) {
|
||||
NS_NewListBoxLayout(aPresShell, layout);
|
||||
|
||||
rv = NS_NewListBoxBodyFrame(aPresShell, &newFrame, PR_FALSE, layout);
|
||||
((nsListBoxBodyFrame*)newFrame)->InitGroup(this, aPresContext);
|
||||
listboxScrollPort = PR_TRUE;
|
||||
|
||||
processChildren = PR_FALSE;
|
||||
}
|
||||
else
|
||||
@ -5816,15 +5809,10 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
|
||||
|
||||
// Boxes can scroll.
|
||||
if (display->IsScrollableOverflow()) {
|
||||
|
||||
nsIFrame* scrollPort = nsnull;
|
||||
if (listboxScrollPort) {
|
||||
NS_NewListBoxScrollPortFrame(aPresShell, &scrollPort);
|
||||
}
|
||||
// set the top to be the newly created scrollframe
|
||||
BuildScrollFrame(aPresShell, aPresContext, aState, aContent,
|
||||
aStyleContext, newFrame, aParentFrame, nsnull,
|
||||
topFrame, aStyleContext, scrollPort);
|
||||
topFrame, aStyleContext);
|
||||
|
||||
// we have a scrollframe so the parent becomes the scroll frame.
|
||||
aParentFrame = newFrame->GetParent();
|
||||
@ -5832,8 +5820,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
|
||||
primaryFrameSet = PR_TRUE;
|
||||
|
||||
frameHasBeenInitialized = PR_TRUE;
|
||||
|
||||
}
|
||||
}
|
||||
} //------- End Grid ------
|
||||
|
||||
// ------- Begin Row/Column ---------
|
||||
@ -6091,8 +6078,7 @@ nsCSSFrameConstructor::BeginBuildingScrollFrame(nsIPresShell* aPresSh
|
||||
nsIDocument* aDocument,
|
||||
PRBool aIsRoot,
|
||||
nsIFrame*& aNewFrame,
|
||||
nsIFrame*& aScrollableFrame,
|
||||
nsIFrame* aScrollPortFrame)
|
||||
nsIFrame*& aScrollableFrame)
|
||||
{
|
||||
// Check to see the type of parent frame so we know whether we need to
|
||||
// turn off/on scaling for the scrollbars
|
||||
@ -6137,7 +6123,7 @@ nsCSSFrameConstructor::BeginBuildingScrollFrame(nsIPresShell* aPresSh
|
||||
|
||||
InitGfxScrollFrame(aPresShell, aPresContext, aState, aContent, aDocument,
|
||||
aParentFrame, aContentParentFrame, contentStyle,
|
||||
aIsRoot, gfxScrollFrame, anonymousItems, aScrollPortFrame);
|
||||
aIsRoot, gfxScrollFrame, anonymousItems);
|
||||
|
||||
scrollFrame = anonymousItems.childList; // get the scrollport from the anonymous list
|
||||
parentFrame = gfxScrollFrame;
|
||||
@ -6258,8 +6244,7 @@ nsCSSFrameConstructor::BuildScrollFrame(nsIPresShell* aPresShell,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIFrame* aContentParentFrame,
|
||||
nsIFrame*& aNewFrame,
|
||||
nsStyleContext*& aScrolledContentStyle,
|
||||
nsIFrame* aScrollPortFrame)
|
||||
nsStyleContext*& aScrolledContentStyle)
|
||||
{
|
||||
// Check to see the type of parent frame so we know whether we need to
|
||||
// turn off/on scaling for the scrollbars
|
||||
@ -6289,8 +6274,7 @@ nsCSSFrameConstructor::BuildScrollFrame(nsIPresShell* aPresShell,
|
||||
mDocument,
|
||||
PR_FALSE,
|
||||
aNewFrame,
|
||||
scrollFrame,
|
||||
aScrollPortFrame);
|
||||
scrollFrame);
|
||||
|
||||
InitAndRestoreFrame(aPresContext, aState, aContent,
|
||||
scrollFrame, scrolledContentStyle, nsnull, aScrolledFrame);
|
||||
@ -6331,13 +6315,12 @@ nsCSSFrameConstructor::InitGfxScrollFrame(nsIPresShell* aPresShell,
|
||||
nsStyleContext* aStyleContext,
|
||||
PRBool aIsRoot,
|
||||
nsIFrame*& aNewFrame,
|
||||
nsFrameItems& aAnonymousFrames,
|
||||
nsIFrame* aScrollPortFrame)
|
||||
nsFrameItems& aAnonymousFrames)
|
||||
{
|
||||
if (!aScrollPortFrame)
|
||||
NS_NewScrollPortFrame(aPresShell, &aScrollPortFrame);
|
||||
nsIFrame* scrollPort;
|
||||
NS_NewScrollPortFrame(aPresShell, &scrollPort);
|
||||
|
||||
aAnonymousFrames.AddChild(aScrollPortFrame);
|
||||
aAnonymousFrames.AddChild(scrollPort);
|
||||
|
||||
// if there are any anonymous children for the scroll frame, create frames for them.
|
||||
CreateAnonymousFrames(aPresShell, aPresContext, aState, aContent, aDocument, aNewFrame,
|
||||
|
@ -741,8 +741,7 @@ private:
|
||||
nsIFrame* aParentFrame,
|
||||
nsIFrame* aContentParentFrame,
|
||||
nsIFrame*& aNewFrame,
|
||||
nsStyleContext*& aScrolledChildStyle,
|
||||
nsIFrame* aScrollPort = nsnull);
|
||||
nsStyleContext*& aScrolledChildStyle);
|
||||
|
||||
// Builds the initial ScrollFrame
|
||||
already_AddRefed<nsStyleContext>
|
||||
@ -757,8 +756,7 @@ private:
|
||||
nsIDocument* aDocument,
|
||||
PRBool aIsRoot,
|
||||
nsIFrame*& aNewFrame,
|
||||
nsIFrame*& aScrollableFrame,
|
||||
nsIFrame* aScrollPort = nsnull);
|
||||
nsIFrame*& aScrollableFrame);
|
||||
|
||||
// Completes the building of the scrollframe:
|
||||
// Creates and necessary views for the scrollframe and sets up the initial child list
|
||||
@ -784,8 +782,7 @@ private:
|
||||
nsStyleContext* aStyleContext,
|
||||
PRBool aIsRoot,
|
||||
nsIFrame*& aNewFrame,
|
||||
nsFrameItems& aAnonymousFrames,
|
||||
nsIFrame* aScrollPort = nsnull);
|
||||
nsFrameItems& aAnonymousFrames);
|
||||
|
||||
|
||||
// InitializeSelectFrame puts scrollFrame in aFrameItems if aBuildCombobox is false
|
||||
|
@ -349,6 +349,23 @@ nsLayoutUtils::FindSiblingViewFor(nsIView* aParentView, nsIFrame* aFrame) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
//static
|
||||
nsIScrollableFrame*
|
||||
nsLayoutUtils::GetScrollableFrameFor(nsIFrame *aScrolledFrame)
|
||||
{
|
||||
nsIFrame *frame = aScrolledFrame->GetParent();
|
||||
if (!frame) {
|
||||
return nsnull;
|
||||
}
|
||||
frame = frame->GetParent();
|
||||
if (!frame) {
|
||||
return nsnull;
|
||||
}
|
||||
nsIScrollableFrame *sf;
|
||||
CallQueryInterface(frame, &sf);
|
||||
return sf;
|
||||
}
|
||||
|
||||
//static
|
||||
nsIScrollableFrame*
|
||||
nsLayoutUtils::GetScrollableFrameFor(nsIScrollableView *aScrollableView)
|
||||
|
@ -181,6 +181,11 @@ public:
|
||||
*/
|
||||
static nsIScrollableFrame* GetScrollableFrameFor(nsIScrollableView *aScrollableView);
|
||||
|
||||
/**
|
||||
* GetScrollableFrameFor returns the scrollable frame for a scrolled frame
|
||||
*/
|
||||
static nsIScrollableFrame* GetScrollableFrameFor(nsIFrame *aScrolledFrame);
|
||||
|
||||
static nsPresContext::ScrollbarStyles
|
||||
ScrollbarStylesOfView(nsIScrollableView *aScrollableView);
|
||||
|
||||
|
@ -1304,6 +1304,12 @@ NS_PTR_TO_INT32(frame->GetProperty(nsLayoutAtoms::embeddingLevel))
|
||||
NS_HIDDEN_(nsresult)
|
||||
GetOrdinal(nsBoxLayoutState& aBoxLayoutState, PRUint32& aOrdinal);
|
||||
|
||||
/**
|
||||
* This returns the minimum size for the scroll area if this frame is
|
||||
* being scrolled. Usually it's (0,0).
|
||||
*/
|
||||
virtual nsSize GetMinSizeForScrollArea(nsBoxLayoutState& aBoxLayoutState) = 0;
|
||||
|
||||
NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent)=0;
|
||||
NS_IMETHOD IsCollapsed(nsBoxLayoutState& aBoxLayoutState, PRBool& aCollapsed)=0;
|
||||
// This does not alter the overflow area. If the caller is changing
|
||||
|
@ -181,6 +181,11 @@ public:
|
||||
*/
|
||||
static nsIScrollableFrame* GetScrollableFrameFor(nsIScrollableView *aScrollableView);
|
||||
|
||||
/**
|
||||
* GetScrollableFrameFor returns the scrollable frame for a scrolled frame
|
||||
*/
|
||||
static nsIScrollableFrame* GetScrollableFrameFor(nsIFrame *aScrolledFrame);
|
||||
|
||||
static nsPresContext::ScrollbarStyles
|
||||
ScrollbarStylesOfView(nsIScrollableView *aScrollableView);
|
||||
|
||||
|
@ -349,6 +349,23 @@ nsLayoutUtils::FindSiblingViewFor(nsIView* aParentView, nsIFrame* aFrame) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
//static
|
||||
nsIScrollableFrame*
|
||||
nsLayoutUtils::GetScrollableFrameFor(nsIFrame *aScrolledFrame)
|
||||
{
|
||||
nsIFrame *frame = aScrolledFrame->GetParent();
|
||||
if (!frame) {
|
||||
return nsnull;
|
||||
}
|
||||
frame = frame->GetParent();
|
||||
if (!frame) {
|
||||
return nsnull;
|
||||
}
|
||||
nsIScrollableFrame *sf;
|
||||
CallQueryInterface(frame, &sf);
|
||||
return sf;
|
||||
}
|
||||
|
||||
//static
|
||||
nsIScrollableFrame*
|
||||
nsLayoutUtils::GetScrollableFrameFor(nsIScrollableView *aScrollableView)
|
||||
|
@ -1304,6 +1304,12 @@ NS_PTR_TO_INT32(frame->GetProperty(nsLayoutAtoms::embeddingLevel))
|
||||
NS_HIDDEN_(nsresult)
|
||||
GetOrdinal(nsBoxLayoutState& aBoxLayoutState, PRUint32& aOrdinal);
|
||||
|
||||
/**
|
||||
* This returns the minimum size for the scroll area if this frame is
|
||||
* being scrolled. Usually it's (0,0).
|
||||
*/
|
||||
virtual nsSize GetMinSizeForScrollArea(nsBoxLayoutState& aBoxLayoutState) = 0;
|
||||
|
||||
NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent)=0;
|
||||
NS_IMETHOD IsCollapsed(nsBoxLayoutState& aBoxLayoutState, PRBool& aCollapsed)=0;
|
||||
// This does not alter the overflow area. If the caller is changing
|
||||
|
@ -321,9 +321,6 @@ NS_NewMenuFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRUint32 aFlag
|
||||
nsresult
|
||||
NS_NewMenuBarFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame );
|
||||
|
||||
nsresult
|
||||
NS_NewListBoxScrollPortFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame );
|
||||
|
||||
nsresult
|
||||
NS_NewTreeBodyFrame (nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
@ -5797,15 +5794,11 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
|
||||
|
||||
nsCOMPtr<nsIBoxLayout> layout;
|
||||
|
||||
PRBool listboxScrollPort = PR_FALSE;
|
||||
|
||||
if (aTag == nsXULAtoms::listboxbody) {
|
||||
NS_NewListBoxLayout(aPresShell, layout);
|
||||
|
||||
rv = NS_NewListBoxBodyFrame(aPresShell, &newFrame, PR_FALSE, layout);
|
||||
((nsListBoxBodyFrame*)newFrame)->InitGroup(this, aPresContext);
|
||||
listboxScrollPort = PR_TRUE;
|
||||
|
||||
processChildren = PR_FALSE;
|
||||
}
|
||||
else
|
||||
@ -5816,15 +5809,10 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
|
||||
|
||||
// Boxes can scroll.
|
||||
if (display->IsScrollableOverflow()) {
|
||||
|
||||
nsIFrame* scrollPort = nsnull;
|
||||
if (listboxScrollPort) {
|
||||
NS_NewListBoxScrollPortFrame(aPresShell, &scrollPort);
|
||||
}
|
||||
// set the top to be the newly created scrollframe
|
||||
BuildScrollFrame(aPresShell, aPresContext, aState, aContent,
|
||||
aStyleContext, newFrame, aParentFrame, nsnull,
|
||||
topFrame, aStyleContext, scrollPort);
|
||||
topFrame, aStyleContext);
|
||||
|
||||
// we have a scrollframe so the parent becomes the scroll frame.
|
||||
aParentFrame = newFrame->GetParent();
|
||||
@ -5832,8 +5820,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
|
||||
primaryFrameSet = PR_TRUE;
|
||||
|
||||
frameHasBeenInitialized = PR_TRUE;
|
||||
|
||||
}
|
||||
}
|
||||
} //------- End Grid ------
|
||||
|
||||
// ------- Begin Row/Column ---------
|
||||
@ -6091,8 +6078,7 @@ nsCSSFrameConstructor::BeginBuildingScrollFrame(nsIPresShell* aPresSh
|
||||
nsIDocument* aDocument,
|
||||
PRBool aIsRoot,
|
||||
nsIFrame*& aNewFrame,
|
||||
nsIFrame*& aScrollableFrame,
|
||||
nsIFrame* aScrollPortFrame)
|
||||
nsIFrame*& aScrollableFrame)
|
||||
{
|
||||
// Check to see the type of parent frame so we know whether we need to
|
||||
// turn off/on scaling for the scrollbars
|
||||
@ -6137,7 +6123,7 @@ nsCSSFrameConstructor::BeginBuildingScrollFrame(nsIPresShell* aPresSh
|
||||
|
||||
InitGfxScrollFrame(aPresShell, aPresContext, aState, aContent, aDocument,
|
||||
aParentFrame, aContentParentFrame, contentStyle,
|
||||
aIsRoot, gfxScrollFrame, anonymousItems, aScrollPortFrame);
|
||||
aIsRoot, gfxScrollFrame, anonymousItems);
|
||||
|
||||
scrollFrame = anonymousItems.childList; // get the scrollport from the anonymous list
|
||||
parentFrame = gfxScrollFrame;
|
||||
@ -6258,8 +6244,7 @@ nsCSSFrameConstructor::BuildScrollFrame(nsIPresShell* aPresShell,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIFrame* aContentParentFrame,
|
||||
nsIFrame*& aNewFrame,
|
||||
nsStyleContext*& aScrolledContentStyle,
|
||||
nsIFrame* aScrollPortFrame)
|
||||
nsStyleContext*& aScrolledContentStyle)
|
||||
{
|
||||
// Check to see the type of parent frame so we know whether we need to
|
||||
// turn off/on scaling for the scrollbars
|
||||
@ -6289,8 +6274,7 @@ nsCSSFrameConstructor::BuildScrollFrame(nsIPresShell* aPresShell,
|
||||
mDocument,
|
||||
PR_FALSE,
|
||||
aNewFrame,
|
||||
scrollFrame,
|
||||
aScrollPortFrame);
|
||||
scrollFrame);
|
||||
|
||||
InitAndRestoreFrame(aPresContext, aState, aContent,
|
||||
scrollFrame, scrolledContentStyle, nsnull, aScrolledFrame);
|
||||
@ -6331,13 +6315,12 @@ nsCSSFrameConstructor::InitGfxScrollFrame(nsIPresShell* aPresShell,
|
||||
nsStyleContext* aStyleContext,
|
||||
PRBool aIsRoot,
|
||||
nsIFrame*& aNewFrame,
|
||||
nsFrameItems& aAnonymousFrames,
|
||||
nsIFrame* aScrollPortFrame)
|
||||
nsFrameItems& aAnonymousFrames)
|
||||
{
|
||||
if (!aScrollPortFrame)
|
||||
NS_NewScrollPortFrame(aPresShell, &aScrollPortFrame);
|
||||
nsIFrame* scrollPort;
|
||||
NS_NewScrollPortFrame(aPresShell, &scrollPort);
|
||||
|
||||
aAnonymousFrames.AddChild(aScrollPortFrame);
|
||||
aAnonymousFrames.AddChild(scrollPort);
|
||||
|
||||
// if there are any anonymous children for the scroll frame, create frames for them.
|
||||
CreateAnonymousFrames(aPresShell, aPresContext, aState, aContent, aDocument, aNewFrame,
|
||||
|
@ -741,8 +741,7 @@ private:
|
||||
nsIFrame* aParentFrame,
|
||||
nsIFrame* aContentParentFrame,
|
||||
nsIFrame*& aNewFrame,
|
||||
nsStyleContext*& aScrolledChildStyle,
|
||||
nsIFrame* aScrollPort = nsnull);
|
||||
nsStyleContext*& aScrolledChildStyle);
|
||||
|
||||
// Builds the initial ScrollFrame
|
||||
already_AddRefed<nsStyleContext>
|
||||
@ -757,8 +756,7 @@ private:
|
||||
nsIDocument* aDocument,
|
||||
PRBool aIsRoot,
|
||||
nsIFrame*& aNewFrame,
|
||||
nsIFrame*& aScrollableFrame,
|
||||
nsIFrame* aScrollPort = nsnull);
|
||||
nsIFrame*& aScrollableFrame);
|
||||
|
||||
// Completes the building of the scrollframe:
|
||||
// Creates and necessary views for the scrollframe and sets up the initial child list
|
||||
@ -784,8 +782,7 @@ private:
|
||||
nsStyleContext* aStyleContext,
|
||||
PRBool aIsRoot,
|
||||
nsIFrame*& aNewFrame,
|
||||
nsFrameItems& aAnonymousFrames,
|
||||
nsIFrame* aScrollPort = nsnull);
|
||||
nsFrameItems& aAnonymousFrames);
|
||||
|
||||
|
||||
// InitializeSelectFrame puts scrollFrame in aFrameItems if aBuildCombobox is false
|
||||
|
@ -727,6 +727,12 @@ nsBox::GetMinSize(nsBoxLayoutState& aState, nsSize& aSize)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsSize
|
||||
nsBox::GetMinSizeForScrollArea(nsBoxLayoutState& aBoxLayoutState)
|
||||
{
|
||||
return nsSize(0, 0);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBox::GetMaxSize(nsBoxLayoutState& aState, nsSize& aSize)
|
||||
{
|
||||
|
@ -63,6 +63,8 @@ public:
|
||||
NS_IMETHOD GetFlex(nsBoxLayoutState& aBoxLayoutState, nscoord& aFlex);
|
||||
NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent);
|
||||
|
||||
virtual nsSize GetMinSizeForScrollArea(nsBoxLayoutState& aBoxLayoutState);
|
||||
|
||||
NS_IMETHOD IsCollapsed(nsBoxLayoutState& aBoxLayoutState, PRBool& aCollapsed);
|
||||
|
||||
NS_IMETHOD SetBounds(nsBoxLayoutState& aBoxLayoutState, const nsRect& aRect,
|
||||
|
@ -57,7 +57,6 @@
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsCSSFrameConstructor.h"
|
||||
#include "nsScrollPortFrame.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "nsIScrollbarFrame.h"
|
||||
#include "nsIScrollableView.h"
|
||||
@ -71,6 +70,8 @@
|
||||
#include "nsIDOMNSDocument.h"
|
||||
#include "nsPIBoxObject.h"
|
||||
#include "nsINodeInfo.h"
|
||||
#include "nsScrollPortFrame.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
|
||||
/////////////// nsListScrollSmoother //////////////////
|
||||
|
||||
@ -367,6 +368,44 @@ nsListBoxBodyFrame::DoLayout(nsBoxLayoutState& aBoxLayoutState)
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsSize
|
||||
nsListBoxBodyFrame::GetMinSizeForScrollArea(nsBoxLayoutState& aBoxLayoutState)
|
||||
{
|
||||
nsSize result(0, 0);
|
||||
nsAutoString sizeMode;
|
||||
GetContent()->GetAttr(kNameSpaceID_None, nsXULAtoms::sizemode, sizeMode);
|
||||
if (!sizeMode.IsEmpty()) {
|
||||
GetPrefSize(aBoxLayoutState, result);
|
||||
result.height = 0;
|
||||
nsIScrollableFrame* scrollFrame = nsLayoutUtils::GetScrollableFrameFor(this);
|
||||
if (scrollFrame &&
|
||||
scrollFrame->GetScrollbarStyles().mVertical == NS_STYLE_OVERFLOW_AUTO) {
|
||||
nsMargin scrollbars =
|
||||
scrollFrame->GetDesiredScrollbarSizes(&aBoxLayoutState);
|
||||
result.width += scrollbars.left + scrollbars.right;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsListBoxBodyFrame::GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize)
|
||||
{
|
||||
nsresult rv = nsBoxFrame::GetPrefSize(aBoxLayoutState, aSize);
|
||||
|
||||
PRInt32 size = GetFixedRowSize();
|
||||
if (size > -1)
|
||||
aSize.height = size*GetRowHeightTwips();
|
||||
|
||||
nsIScrollableFrame* scrollFrame = nsLayoutUtils::GetScrollableFrameFor(this);
|
||||
if (scrollFrame &&
|
||||
scrollFrame->GetScrollbarStyles().mVertical == NS_STYLE_OVERFLOW_AUTO) {
|
||||
nsMargin scrollbars = scrollFrame->GetDesiredScrollbarSizes(&aBoxLayoutState);
|
||||
aSize.width += scrollbars.left + scrollbars.right;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
///////////// nsIScrollbarMediator ///////////////
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -1429,83 +1468,6 @@ nsListBoxBodyFrame::RemoveChildFrame(nsBoxLayoutState &aState,
|
||||
aFrame->Destroy(mPresContext);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
///// nsListboxScrollPortFrame
|
||||
|
||||
class nsListboxScrollPortFrame : public nsScrollPortFrame
|
||||
{
|
||||
public:
|
||||
nsListboxScrollPortFrame(nsIPresShell* aShell);
|
||||
friend nsresult NS_NewScrollBoxFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
NS_IMETHOD GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||
NS_IMETHOD GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||
};
|
||||
|
||||
nsListboxScrollPortFrame::nsListboxScrollPortFrame(nsIPresShell* aShell):nsScrollPortFrame(aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsListboxScrollPortFrame::GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize)
|
||||
{
|
||||
nsIBox* child = nsnull;
|
||||
GetChildBox(&child);
|
||||
|
||||
nsresult rv = child->GetPrefSize(aBoxLayoutState, aSize);
|
||||
nsListBoxBodyFrame* outer = NS_STATIC_CAST(nsListBoxBodyFrame*,child);
|
||||
|
||||
nsAutoString sizeMode;
|
||||
outer->GetContent()->GetAttr(kNameSpaceID_None, nsXULAtoms::sizemode, sizeMode);
|
||||
if (!sizeMode.IsEmpty()) {
|
||||
nsCOMPtr<nsIScrollableFrame> scrollFrame(do_QueryInterface(mParent));
|
||||
if (scrollFrame &&
|
||||
scrollFrame->GetScrollbarStyles().mVertical == NS_STYLE_OVERFLOW_AUTO) {
|
||||
nsMargin scrollbars =
|
||||
scrollFrame->GetDesiredScrollbarSizes(&aBoxLayoutState);
|
||||
aSize.width += scrollbars.left + scrollbars.right;
|
||||
}
|
||||
}
|
||||
else aSize.width = 0;
|
||||
|
||||
aSize.height = 0;
|
||||
|
||||
AddMargin(child, aSize);
|
||||
AddBorderAndPadding(aSize);
|
||||
AddInset(aSize);
|
||||
nsIBox::AddCSSMinSize(aBoxLayoutState, this, aSize);
|
||||
return rv;
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsListboxScrollPortFrame::GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize)
|
||||
{
|
||||
nsIBox* child = nsnull;
|
||||
GetChildBox(&child);
|
||||
|
||||
nsresult rv = child->GetPrefSize(aBoxLayoutState, aSize);
|
||||
nsListBoxBodyFrame* outer = NS_STATIC_CAST(nsListBoxBodyFrame*,child);
|
||||
|
||||
PRInt32 size = outer->GetFixedRowSize();
|
||||
|
||||
if (size > -1)
|
||||
aSize.height = size*outer->GetRowHeightTwips();
|
||||
|
||||
nsCOMPtr<nsIScrollableFrame> scrollFrame(do_QueryInterface(mParent));
|
||||
if (scrollFrame &&
|
||||
scrollFrame->GetScrollbarStyles().mVertical == NS_STYLE_OVERFLOW_AUTO) {
|
||||
nsMargin scrollbars = scrollFrame->GetDesiredScrollbarSizes(&aBoxLayoutState);
|
||||
aSize.width += scrollbars.left + scrollbars.right;
|
||||
}
|
||||
|
||||
AddMargin(child, aSize);
|
||||
AddBorderAndPadding(aSize);
|
||||
AddInset(aSize);
|
||||
nsIBox::AddCSSPrefSize(aBoxLayoutState, this, aSize);
|
||||
return rv;
|
||||
|
||||
}
|
||||
|
||||
// Creation Routines ///////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult
|
||||
@ -1524,18 +1486,3 @@ NS_NewListBoxBodyFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRBool aI
|
||||
return NS_OK;
|
||||
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewListBoxScrollPortFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsListboxScrollPortFrame* it = new (aPresShell) nsListboxScrollPortFrame (aPresShell);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
*aNewFrame = it;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -93,6 +93,9 @@ public:
|
||||
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
|
||||
NS_IMETHOD NeedsRecalc();
|
||||
|
||||
virtual nsSize GetMinSizeForScrollArea(nsBoxLayoutState& aBoxLayoutState);
|
||||
NS_IMETHOD GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||
|
||||
// size calculation
|
||||
PRInt32 GetRowCount();
|
||||
PRInt32 GetRowHeightTwips() { return mRowHeight; }
|
||||
|
@ -478,8 +478,9 @@ nsScrollBoxFrame::GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize)
|
||||
NS_IMETHODIMP
|
||||
nsScrollBoxFrame::GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize)
|
||||
{
|
||||
aSize.width = 0;
|
||||
aSize.height = 0;
|
||||
nsIBox* child = nsnull;
|
||||
GetChildBox(&child);
|
||||
aSize = child->GetMinSizeForScrollArea(aBoxLayoutState);
|
||||
AddBorderAndPadding(aSize);
|
||||
AddInset(aSize);
|
||||
nsIBox::AddCSSMinSize(aBoxLayoutState, this, aSize);
|
||||
|
Loading…
Reference in New Issue
Block a user