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:
@@ -321,9 +321,6 @@ NS_NewMenuFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRUint32 aFlag
|
|||||||
nsresult
|
nsresult
|
||||||
NS_NewMenuBarFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame );
|
NS_NewMenuBarFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame );
|
||||||
|
|
||||||
nsresult
|
|
||||||
NS_NewListBoxScrollPortFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame );
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
NS_NewTreeBodyFrame (nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
NS_NewTreeBodyFrame (nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||||
|
|
||||||
@@ -5797,15 +5794,11 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
|
|||||||
|
|
||||||
nsCOMPtr<nsIBoxLayout> layout;
|
nsCOMPtr<nsIBoxLayout> layout;
|
||||||
|
|
||||||
PRBool listboxScrollPort = PR_FALSE;
|
|
||||||
|
|
||||||
if (aTag == nsXULAtoms::listboxbody) {
|
if (aTag == nsXULAtoms::listboxbody) {
|
||||||
NS_NewListBoxLayout(aPresShell, layout);
|
NS_NewListBoxLayout(aPresShell, layout);
|
||||||
|
|
||||||
rv = NS_NewListBoxBodyFrame(aPresShell, &newFrame, PR_FALSE, layout);
|
rv = NS_NewListBoxBodyFrame(aPresShell, &newFrame, PR_FALSE, layout);
|
||||||
((nsListBoxBodyFrame*)newFrame)->InitGroup(this, aPresContext);
|
((nsListBoxBodyFrame*)newFrame)->InitGroup(this, aPresContext);
|
||||||
listboxScrollPort = PR_TRUE;
|
|
||||||
|
|
||||||
processChildren = PR_FALSE;
|
processChildren = PR_FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -5816,15 +5809,10 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
|
|||||||
|
|
||||||
// Boxes can scroll.
|
// Boxes can scroll.
|
||||||
if (display->IsScrollableOverflow()) {
|
if (display->IsScrollableOverflow()) {
|
||||||
|
|
||||||
nsIFrame* scrollPort = nsnull;
|
|
||||||
if (listboxScrollPort) {
|
|
||||||
NS_NewListBoxScrollPortFrame(aPresShell, &scrollPort);
|
|
||||||
}
|
|
||||||
// set the top to be the newly created scrollframe
|
// set the top to be the newly created scrollframe
|
||||||
BuildScrollFrame(aPresShell, aPresContext, aState, aContent,
|
BuildScrollFrame(aPresShell, aPresContext, aState, aContent,
|
||||||
aStyleContext, newFrame, aParentFrame, nsnull,
|
aStyleContext, newFrame, aParentFrame, nsnull,
|
||||||
topFrame, aStyleContext, scrollPort);
|
topFrame, aStyleContext);
|
||||||
|
|
||||||
// we have a scrollframe so the parent becomes the scroll frame.
|
// we have a scrollframe so the parent becomes the scroll frame.
|
||||||
aParentFrame = newFrame->GetParent();
|
aParentFrame = newFrame->GetParent();
|
||||||
@@ -5832,8 +5820,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
|
|||||||
primaryFrameSet = PR_TRUE;
|
primaryFrameSet = PR_TRUE;
|
||||||
|
|
||||||
frameHasBeenInitialized = PR_TRUE;
|
frameHasBeenInitialized = PR_TRUE;
|
||||||
|
}
|
||||||
}
|
|
||||||
} //------- End Grid ------
|
} //------- End Grid ------
|
||||||
|
|
||||||
// ------- Begin Row/Column ---------
|
// ------- Begin Row/Column ---------
|
||||||
@@ -6091,8 +6078,7 @@ nsCSSFrameConstructor::BeginBuildingScrollFrame(nsIPresShell* aPresSh
|
|||||||
nsIDocument* aDocument,
|
nsIDocument* aDocument,
|
||||||
PRBool aIsRoot,
|
PRBool aIsRoot,
|
||||||
nsIFrame*& aNewFrame,
|
nsIFrame*& aNewFrame,
|
||||||
nsIFrame*& aScrollableFrame,
|
nsIFrame*& aScrollableFrame)
|
||||||
nsIFrame* aScrollPortFrame)
|
|
||||||
{
|
{
|
||||||
// Check to see the type of parent frame so we know whether we need to
|
// Check to see the type of parent frame so we know whether we need to
|
||||||
// turn off/on scaling for the scrollbars
|
// turn off/on scaling for the scrollbars
|
||||||
@@ -6137,7 +6123,7 @@ nsCSSFrameConstructor::BeginBuildingScrollFrame(nsIPresShell* aPresSh
|
|||||||
|
|
||||||
InitGfxScrollFrame(aPresShell, aPresContext, aState, aContent, aDocument,
|
InitGfxScrollFrame(aPresShell, aPresContext, aState, aContent, aDocument,
|
||||||
aParentFrame, aContentParentFrame, contentStyle,
|
aParentFrame, aContentParentFrame, contentStyle,
|
||||||
aIsRoot, gfxScrollFrame, anonymousItems, aScrollPortFrame);
|
aIsRoot, gfxScrollFrame, anonymousItems);
|
||||||
|
|
||||||
scrollFrame = anonymousItems.childList; // get the scrollport from the anonymous list
|
scrollFrame = anonymousItems.childList; // get the scrollport from the anonymous list
|
||||||
parentFrame = gfxScrollFrame;
|
parentFrame = gfxScrollFrame;
|
||||||
@@ -6258,8 +6244,7 @@ nsCSSFrameConstructor::BuildScrollFrame(nsIPresShell* aPresShell,
|
|||||||
nsIFrame* aParentFrame,
|
nsIFrame* aParentFrame,
|
||||||
nsIFrame* aContentParentFrame,
|
nsIFrame* aContentParentFrame,
|
||||||
nsIFrame*& aNewFrame,
|
nsIFrame*& aNewFrame,
|
||||||
nsStyleContext*& aScrolledContentStyle,
|
nsStyleContext*& aScrolledContentStyle)
|
||||||
nsIFrame* aScrollPortFrame)
|
|
||||||
{
|
{
|
||||||
// Check to see the type of parent frame so we know whether we need to
|
// Check to see the type of parent frame so we know whether we need to
|
||||||
// turn off/on scaling for the scrollbars
|
// turn off/on scaling for the scrollbars
|
||||||
@@ -6289,8 +6274,7 @@ nsCSSFrameConstructor::BuildScrollFrame(nsIPresShell* aPresShell,
|
|||||||
mDocument,
|
mDocument,
|
||||||
PR_FALSE,
|
PR_FALSE,
|
||||||
aNewFrame,
|
aNewFrame,
|
||||||
scrollFrame,
|
scrollFrame);
|
||||||
aScrollPortFrame);
|
|
||||||
|
|
||||||
InitAndRestoreFrame(aPresContext, aState, aContent,
|
InitAndRestoreFrame(aPresContext, aState, aContent,
|
||||||
scrollFrame, scrolledContentStyle, nsnull, aScrolledFrame);
|
scrollFrame, scrolledContentStyle, nsnull, aScrolledFrame);
|
||||||
@@ -6331,13 +6315,12 @@ nsCSSFrameConstructor::InitGfxScrollFrame(nsIPresShell* aPresShell,
|
|||||||
nsStyleContext* aStyleContext,
|
nsStyleContext* aStyleContext,
|
||||||
PRBool aIsRoot,
|
PRBool aIsRoot,
|
||||||
nsIFrame*& aNewFrame,
|
nsIFrame*& aNewFrame,
|
||||||
nsFrameItems& aAnonymousFrames,
|
nsFrameItems& aAnonymousFrames)
|
||||||
nsIFrame* aScrollPortFrame)
|
|
||||||
{
|
{
|
||||||
if (!aScrollPortFrame)
|
nsIFrame* scrollPort;
|
||||||
NS_NewScrollPortFrame(aPresShell, &aScrollPortFrame);
|
NS_NewScrollPortFrame(aPresShell, &scrollPort);
|
||||||
|
|
||||||
aAnonymousFrames.AddChild(aScrollPortFrame);
|
aAnonymousFrames.AddChild(scrollPort);
|
||||||
|
|
||||||
// if there are any anonymous children for the scroll frame, create frames for them.
|
// if there are any anonymous children for the scroll frame, create frames for them.
|
||||||
CreateAnonymousFrames(aPresShell, aPresContext, aState, aContent, aDocument, aNewFrame,
|
CreateAnonymousFrames(aPresShell, aPresContext, aState, aContent, aDocument, aNewFrame,
|
||||||
|
|||||||
@@ -741,8 +741,7 @@ private:
|
|||||||
nsIFrame* aParentFrame,
|
nsIFrame* aParentFrame,
|
||||||
nsIFrame* aContentParentFrame,
|
nsIFrame* aContentParentFrame,
|
||||||
nsIFrame*& aNewFrame,
|
nsIFrame*& aNewFrame,
|
||||||
nsStyleContext*& aScrolledChildStyle,
|
nsStyleContext*& aScrolledChildStyle);
|
||||||
nsIFrame* aScrollPort = nsnull);
|
|
||||||
|
|
||||||
// Builds the initial ScrollFrame
|
// Builds the initial ScrollFrame
|
||||||
already_AddRefed<nsStyleContext>
|
already_AddRefed<nsStyleContext>
|
||||||
@@ -757,8 +756,7 @@ private:
|
|||||||
nsIDocument* aDocument,
|
nsIDocument* aDocument,
|
||||||
PRBool aIsRoot,
|
PRBool aIsRoot,
|
||||||
nsIFrame*& aNewFrame,
|
nsIFrame*& aNewFrame,
|
||||||
nsIFrame*& aScrollableFrame,
|
nsIFrame*& aScrollableFrame);
|
||||||
nsIFrame* aScrollPort = nsnull);
|
|
||||||
|
|
||||||
// Completes the building of the scrollframe:
|
// Completes the building of the scrollframe:
|
||||||
// Creates and necessary views for the scrollframe and sets up the initial child list
|
// Creates and necessary views for the scrollframe and sets up the initial child list
|
||||||
@@ -784,8 +782,7 @@ private:
|
|||||||
nsStyleContext* aStyleContext,
|
nsStyleContext* aStyleContext,
|
||||||
PRBool aIsRoot,
|
PRBool aIsRoot,
|
||||||
nsIFrame*& aNewFrame,
|
nsIFrame*& aNewFrame,
|
||||||
nsFrameItems& aAnonymousFrames,
|
nsFrameItems& aAnonymousFrames);
|
||||||
nsIFrame* aScrollPort = nsnull);
|
|
||||||
|
|
||||||
|
|
||||||
// InitializeSelectFrame puts scrollFrame in aFrameItems if aBuildCombobox is false
|
// InitializeSelectFrame puts scrollFrame in aFrameItems if aBuildCombobox is false
|
||||||
|
|||||||
@@ -349,6 +349,23 @@ nsLayoutUtils::FindSiblingViewFor(nsIView* aParentView, nsIFrame* aFrame) {
|
|||||||
return nsnull;
|
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
|
//static
|
||||||
nsIScrollableFrame*
|
nsIScrollableFrame*
|
||||||
nsLayoutUtils::GetScrollableFrameFor(nsIScrollableView *aScrollableView)
|
nsLayoutUtils::GetScrollableFrameFor(nsIScrollableView *aScrollableView)
|
||||||
|
|||||||
@@ -181,6 +181,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
static nsIScrollableFrame* GetScrollableFrameFor(nsIScrollableView *aScrollableView);
|
static nsIScrollableFrame* GetScrollableFrameFor(nsIScrollableView *aScrollableView);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GetScrollableFrameFor returns the scrollable frame for a scrolled frame
|
||||||
|
*/
|
||||||
|
static nsIScrollableFrame* GetScrollableFrameFor(nsIFrame *aScrolledFrame);
|
||||||
|
|
||||||
static nsPresContext::ScrollbarStyles
|
static nsPresContext::ScrollbarStyles
|
||||||
ScrollbarStylesOfView(nsIScrollableView *aScrollableView);
|
ScrollbarStylesOfView(nsIScrollableView *aScrollableView);
|
||||||
|
|
||||||
|
|||||||
@@ -1304,6 +1304,12 @@ NS_PTR_TO_INT32(frame->GetProperty(nsLayoutAtoms::embeddingLevel))
|
|||||||
NS_HIDDEN_(nsresult)
|
NS_HIDDEN_(nsresult)
|
||||||
GetOrdinal(nsBoxLayoutState& aBoxLayoutState, PRUint32& aOrdinal);
|
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 GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent)=0;
|
||||||
NS_IMETHOD IsCollapsed(nsBoxLayoutState& aBoxLayoutState, PRBool& aCollapsed)=0;
|
NS_IMETHOD IsCollapsed(nsBoxLayoutState& aBoxLayoutState, PRBool& aCollapsed)=0;
|
||||||
// This does not alter the overflow area. If the caller is changing
|
// This does not alter the overflow area. If the caller is changing
|
||||||
|
|||||||
@@ -181,6 +181,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
static nsIScrollableFrame* GetScrollableFrameFor(nsIScrollableView *aScrollableView);
|
static nsIScrollableFrame* GetScrollableFrameFor(nsIScrollableView *aScrollableView);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GetScrollableFrameFor returns the scrollable frame for a scrolled frame
|
||||||
|
*/
|
||||||
|
static nsIScrollableFrame* GetScrollableFrameFor(nsIFrame *aScrolledFrame);
|
||||||
|
|
||||||
static nsPresContext::ScrollbarStyles
|
static nsPresContext::ScrollbarStyles
|
||||||
ScrollbarStylesOfView(nsIScrollableView *aScrollableView);
|
ScrollbarStylesOfView(nsIScrollableView *aScrollableView);
|
||||||
|
|
||||||
|
|||||||
@@ -349,6 +349,23 @@ nsLayoutUtils::FindSiblingViewFor(nsIView* aParentView, nsIFrame* aFrame) {
|
|||||||
return nsnull;
|
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
|
//static
|
||||||
nsIScrollableFrame*
|
nsIScrollableFrame*
|
||||||
nsLayoutUtils::GetScrollableFrameFor(nsIScrollableView *aScrollableView)
|
nsLayoutUtils::GetScrollableFrameFor(nsIScrollableView *aScrollableView)
|
||||||
|
|||||||
@@ -1304,6 +1304,12 @@ NS_PTR_TO_INT32(frame->GetProperty(nsLayoutAtoms::embeddingLevel))
|
|||||||
NS_HIDDEN_(nsresult)
|
NS_HIDDEN_(nsresult)
|
||||||
GetOrdinal(nsBoxLayoutState& aBoxLayoutState, PRUint32& aOrdinal);
|
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 GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent)=0;
|
||||||
NS_IMETHOD IsCollapsed(nsBoxLayoutState& aBoxLayoutState, PRBool& aCollapsed)=0;
|
NS_IMETHOD IsCollapsed(nsBoxLayoutState& aBoxLayoutState, PRBool& aCollapsed)=0;
|
||||||
// This does not alter the overflow area. If the caller is changing
|
// 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
|
nsresult
|
||||||
NS_NewMenuBarFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame );
|
NS_NewMenuBarFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame );
|
||||||
|
|
||||||
nsresult
|
|
||||||
NS_NewListBoxScrollPortFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame );
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
NS_NewTreeBodyFrame (nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
NS_NewTreeBodyFrame (nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||||
|
|
||||||
@@ -5797,15 +5794,11 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
|
|||||||
|
|
||||||
nsCOMPtr<nsIBoxLayout> layout;
|
nsCOMPtr<nsIBoxLayout> layout;
|
||||||
|
|
||||||
PRBool listboxScrollPort = PR_FALSE;
|
|
||||||
|
|
||||||
if (aTag == nsXULAtoms::listboxbody) {
|
if (aTag == nsXULAtoms::listboxbody) {
|
||||||
NS_NewListBoxLayout(aPresShell, layout);
|
NS_NewListBoxLayout(aPresShell, layout);
|
||||||
|
|
||||||
rv = NS_NewListBoxBodyFrame(aPresShell, &newFrame, PR_FALSE, layout);
|
rv = NS_NewListBoxBodyFrame(aPresShell, &newFrame, PR_FALSE, layout);
|
||||||
((nsListBoxBodyFrame*)newFrame)->InitGroup(this, aPresContext);
|
((nsListBoxBodyFrame*)newFrame)->InitGroup(this, aPresContext);
|
||||||
listboxScrollPort = PR_TRUE;
|
|
||||||
|
|
||||||
processChildren = PR_FALSE;
|
processChildren = PR_FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -5816,15 +5809,10 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
|
|||||||
|
|
||||||
// Boxes can scroll.
|
// Boxes can scroll.
|
||||||
if (display->IsScrollableOverflow()) {
|
if (display->IsScrollableOverflow()) {
|
||||||
|
|
||||||
nsIFrame* scrollPort = nsnull;
|
|
||||||
if (listboxScrollPort) {
|
|
||||||
NS_NewListBoxScrollPortFrame(aPresShell, &scrollPort);
|
|
||||||
}
|
|
||||||
// set the top to be the newly created scrollframe
|
// set the top to be the newly created scrollframe
|
||||||
BuildScrollFrame(aPresShell, aPresContext, aState, aContent,
|
BuildScrollFrame(aPresShell, aPresContext, aState, aContent,
|
||||||
aStyleContext, newFrame, aParentFrame, nsnull,
|
aStyleContext, newFrame, aParentFrame, nsnull,
|
||||||
topFrame, aStyleContext, scrollPort);
|
topFrame, aStyleContext);
|
||||||
|
|
||||||
// we have a scrollframe so the parent becomes the scroll frame.
|
// we have a scrollframe so the parent becomes the scroll frame.
|
||||||
aParentFrame = newFrame->GetParent();
|
aParentFrame = newFrame->GetParent();
|
||||||
@@ -5832,8 +5820,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
|
|||||||
primaryFrameSet = PR_TRUE;
|
primaryFrameSet = PR_TRUE;
|
||||||
|
|
||||||
frameHasBeenInitialized = PR_TRUE;
|
frameHasBeenInitialized = PR_TRUE;
|
||||||
|
}
|
||||||
}
|
|
||||||
} //------- End Grid ------
|
} //------- End Grid ------
|
||||||
|
|
||||||
// ------- Begin Row/Column ---------
|
// ------- Begin Row/Column ---------
|
||||||
@@ -6091,8 +6078,7 @@ nsCSSFrameConstructor::BeginBuildingScrollFrame(nsIPresShell* aPresSh
|
|||||||
nsIDocument* aDocument,
|
nsIDocument* aDocument,
|
||||||
PRBool aIsRoot,
|
PRBool aIsRoot,
|
||||||
nsIFrame*& aNewFrame,
|
nsIFrame*& aNewFrame,
|
||||||
nsIFrame*& aScrollableFrame,
|
nsIFrame*& aScrollableFrame)
|
||||||
nsIFrame* aScrollPortFrame)
|
|
||||||
{
|
{
|
||||||
// Check to see the type of parent frame so we know whether we need to
|
// Check to see the type of parent frame so we know whether we need to
|
||||||
// turn off/on scaling for the scrollbars
|
// turn off/on scaling for the scrollbars
|
||||||
@@ -6137,7 +6123,7 @@ nsCSSFrameConstructor::BeginBuildingScrollFrame(nsIPresShell* aPresSh
|
|||||||
|
|
||||||
InitGfxScrollFrame(aPresShell, aPresContext, aState, aContent, aDocument,
|
InitGfxScrollFrame(aPresShell, aPresContext, aState, aContent, aDocument,
|
||||||
aParentFrame, aContentParentFrame, contentStyle,
|
aParentFrame, aContentParentFrame, contentStyle,
|
||||||
aIsRoot, gfxScrollFrame, anonymousItems, aScrollPortFrame);
|
aIsRoot, gfxScrollFrame, anonymousItems);
|
||||||
|
|
||||||
scrollFrame = anonymousItems.childList; // get the scrollport from the anonymous list
|
scrollFrame = anonymousItems.childList; // get the scrollport from the anonymous list
|
||||||
parentFrame = gfxScrollFrame;
|
parentFrame = gfxScrollFrame;
|
||||||
@@ -6258,8 +6244,7 @@ nsCSSFrameConstructor::BuildScrollFrame(nsIPresShell* aPresShell,
|
|||||||
nsIFrame* aParentFrame,
|
nsIFrame* aParentFrame,
|
||||||
nsIFrame* aContentParentFrame,
|
nsIFrame* aContentParentFrame,
|
||||||
nsIFrame*& aNewFrame,
|
nsIFrame*& aNewFrame,
|
||||||
nsStyleContext*& aScrolledContentStyle,
|
nsStyleContext*& aScrolledContentStyle)
|
||||||
nsIFrame* aScrollPortFrame)
|
|
||||||
{
|
{
|
||||||
// Check to see the type of parent frame so we know whether we need to
|
// Check to see the type of parent frame so we know whether we need to
|
||||||
// turn off/on scaling for the scrollbars
|
// turn off/on scaling for the scrollbars
|
||||||
@@ -6289,8 +6274,7 @@ nsCSSFrameConstructor::BuildScrollFrame(nsIPresShell* aPresShell,
|
|||||||
mDocument,
|
mDocument,
|
||||||
PR_FALSE,
|
PR_FALSE,
|
||||||
aNewFrame,
|
aNewFrame,
|
||||||
scrollFrame,
|
scrollFrame);
|
||||||
aScrollPortFrame);
|
|
||||||
|
|
||||||
InitAndRestoreFrame(aPresContext, aState, aContent,
|
InitAndRestoreFrame(aPresContext, aState, aContent,
|
||||||
scrollFrame, scrolledContentStyle, nsnull, aScrolledFrame);
|
scrollFrame, scrolledContentStyle, nsnull, aScrolledFrame);
|
||||||
@@ -6331,13 +6315,12 @@ nsCSSFrameConstructor::InitGfxScrollFrame(nsIPresShell* aPresShell,
|
|||||||
nsStyleContext* aStyleContext,
|
nsStyleContext* aStyleContext,
|
||||||
PRBool aIsRoot,
|
PRBool aIsRoot,
|
||||||
nsIFrame*& aNewFrame,
|
nsIFrame*& aNewFrame,
|
||||||
nsFrameItems& aAnonymousFrames,
|
nsFrameItems& aAnonymousFrames)
|
||||||
nsIFrame* aScrollPortFrame)
|
|
||||||
{
|
{
|
||||||
if (!aScrollPortFrame)
|
nsIFrame* scrollPort;
|
||||||
NS_NewScrollPortFrame(aPresShell, &aScrollPortFrame);
|
NS_NewScrollPortFrame(aPresShell, &scrollPort);
|
||||||
|
|
||||||
aAnonymousFrames.AddChild(aScrollPortFrame);
|
aAnonymousFrames.AddChild(scrollPort);
|
||||||
|
|
||||||
// if there are any anonymous children for the scroll frame, create frames for them.
|
// if there are any anonymous children for the scroll frame, create frames for them.
|
||||||
CreateAnonymousFrames(aPresShell, aPresContext, aState, aContent, aDocument, aNewFrame,
|
CreateAnonymousFrames(aPresShell, aPresContext, aState, aContent, aDocument, aNewFrame,
|
||||||
|
|||||||
@@ -741,8 +741,7 @@ private:
|
|||||||
nsIFrame* aParentFrame,
|
nsIFrame* aParentFrame,
|
||||||
nsIFrame* aContentParentFrame,
|
nsIFrame* aContentParentFrame,
|
||||||
nsIFrame*& aNewFrame,
|
nsIFrame*& aNewFrame,
|
||||||
nsStyleContext*& aScrolledChildStyle,
|
nsStyleContext*& aScrolledChildStyle);
|
||||||
nsIFrame* aScrollPort = nsnull);
|
|
||||||
|
|
||||||
// Builds the initial ScrollFrame
|
// Builds the initial ScrollFrame
|
||||||
already_AddRefed<nsStyleContext>
|
already_AddRefed<nsStyleContext>
|
||||||
@@ -757,8 +756,7 @@ private:
|
|||||||
nsIDocument* aDocument,
|
nsIDocument* aDocument,
|
||||||
PRBool aIsRoot,
|
PRBool aIsRoot,
|
||||||
nsIFrame*& aNewFrame,
|
nsIFrame*& aNewFrame,
|
||||||
nsIFrame*& aScrollableFrame,
|
nsIFrame*& aScrollableFrame);
|
||||||
nsIFrame* aScrollPort = nsnull);
|
|
||||||
|
|
||||||
// Completes the building of the scrollframe:
|
// Completes the building of the scrollframe:
|
||||||
// Creates and necessary views for the scrollframe and sets up the initial child list
|
// Creates and necessary views for the scrollframe and sets up the initial child list
|
||||||
@@ -784,8 +782,7 @@ private:
|
|||||||
nsStyleContext* aStyleContext,
|
nsStyleContext* aStyleContext,
|
||||||
PRBool aIsRoot,
|
PRBool aIsRoot,
|
||||||
nsIFrame*& aNewFrame,
|
nsIFrame*& aNewFrame,
|
||||||
nsFrameItems& aAnonymousFrames,
|
nsFrameItems& aAnonymousFrames);
|
||||||
nsIFrame* aScrollPort = nsnull);
|
|
||||||
|
|
||||||
|
|
||||||
// InitializeSelectFrame puts scrollFrame in aFrameItems if aBuildCombobox is false
|
// InitializeSelectFrame puts scrollFrame in aFrameItems if aBuildCombobox is false
|
||||||
|
|||||||
@@ -727,6 +727,12 @@ nsBox::GetMinSize(nsBoxLayoutState& aState, nsSize& aSize)
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsSize
|
||||||
|
nsBox::GetMinSizeForScrollArea(nsBoxLayoutState& aBoxLayoutState)
|
||||||
|
{
|
||||||
|
return nsSize(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsBox::GetMaxSize(nsBoxLayoutState& aState, nsSize& aSize)
|
nsBox::GetMaxSize(nsBoxLayoutState& aState, nsSize& aSize)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ public:
|
|||||||
NS_IMETHOD GetFlex(nsBoxLayoutState& aBoxLayoutState, nscoord& aFlex);
|
NS_IMETHOD GetFlex(nsBoxLayoutState& aBoxLayoutState, nscoord& aFlex);
|
||||||
NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent);
|
NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent);
|
||||||
|
|
||||||
|
virtual nsSize GetMinSizeForScrollArea(nsBoxLayoutState& aBoxLayoutState);
|
||||||
|
|
||||||
NS_IMETHOD IsCollapsed(nsBoxLayoutState& aBoxLayoutState, PRBool& aCollapsed);
|
NS_IMETHOD IsCollapsed(nsBoxLayoutState& aBoxLayoutState, PRBool& aCollapsed);
|
||||||
|
|
||||||
NS_IMETHOD SetBounds(nsBoxLayoutState& aBoxLayoutState, const nsRect& aRect,
|
NS_IMETHOD SetBounds(nsBoxLayoutState& aBoxLayoutState, const nsRect& aRect,
|
||||||
|
|||||||
@@ -57,7 +57,6 @@
|
|||||||
#include "nsIDOMElement.h"
|
#include "nsIDOMElement.h"
|
||||||
#include "nsIDOMNodeList.h"
|
#include "nsIDOMNodeList.h"
|
||||||
#include "nsCSSFrameConstructor.h"
|
#include "nsCSSFrameConstructor.h"
|
||||||
#include "nsScrollPortFrame.h"
|
|
||||||
#include "nsIScrollableFrame.h"
|
#include "nsIScrollableFrame.h"
|
||||||
#include "nsIScrollbarFrame.h"
|
#include "nsIScrollbarFrame.h"
|
||||||
#include "nsIScrollableView.h"
|
#include "nsIScrollableView.h"
|
||||||
@@ -71,6 +70,8 @@
|
|||||||
#include "nsIDOMNSDocument.h"
|
#include "nsIDOMNSDocument.h"
|
||||||
#include "nsPIBoxObject.h"
|
#include "nsPIBoxObject.h"
|
||||||
#include "nsINodeInfo.h"
|
#include "nsINodeInfo.h"
|
||||||
|
#include "nsScrollPortFrame.h"
|
||||||
|
#include "nsLayoutUtils.h"
|
||||||
|
|
||||||
/////////////// nsListScrollSmoother //////////////////
|
/////////////// nsListScrollSmoother //////////////////
|
||||||
|
|
||||||
@@ -367,6 +368,44 @@ nsListBoxBodyFrame::DoLayout(nsBoxLayoutState& aBoxLayoutState)
|
|||||||
return rv;
|
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 ///////////////
|
///////////// nsIScrollbarMediator ///////////////
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
@@ -1429,83 +1468,6 @@ nsListBoxBodyFrame::RemoveChildFrame(nsBoxLayoutState &aState,
|
|||||||
aFrame->Destroy(mPresContext);
|
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 ///////////////////////////////////////////////////////////////////////
|
// Creation Routines ///////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
@@ -1524,18 +1486,3 @@ NS_NewListBoxBodyFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRBool aI
|
|||||||
return NS_OK;
|
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 DoLayout(nsBoxLayoutState& aBoxLayoutState);
|
||||||
NS_IMETHOD NeedsRecalc();
|
NS_IMETHOD NeedsRecalc();
|
||||||
|
|
||||||
|
virtual nsSize GetMinSizeForScrollArea(nsBoxLayoutState& aBoxLayoutState);
|
||||||
|
NS_IMETHOD GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||||
|
|
||||||
// size calculation
|
// size calculation
|
||||||
PRInt32 GetRowCount();
|
PRInt32 GetRowCount();
|
||||||
PRInt32 GetRowHeightTwips() { return mRowHeight; }
|
PRInt32 GetRowHeightTwips() { return mRowHeight; }
|
||||||
|
|||||||
@@ -478,8 +478,9 @@ nsScrollBoxFrame::GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize)
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsScrollBoxFrame::GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize)
|
nsScrollBoxFrame::GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize)
|
||||||
{
|
{
|
||||||
aSize.width = 0;
|
nsIBox* child = nsnull;
|
||||||
aSize.height = 0;
|
GetChildBox(&child);
|
||||||
|
aSize = child->GetMinSizeForScrollArea(aBoxLayoutState);
|
||||||
AddBorderAndPadding(aSize);
|
AddBorderAndPadding(aSize);
|
||||||
AddInset(aSize);
|
AddInset(aSize);
|
||||||
nsIBox::AddCSSMinSize(aBoxLayoutState, this, aSize);
|
nsIBox::AddCSSMinSize(aBoxLayoutState, this, aSize);
|
||||||
|
|||||||
Reference in New Issue
Block a user