Setting GfxScrollFrame as the PrimaryFrame for scrolled content instead of the ScrollPortFrame. Also fixed some spots that were not correctly getting at the scrolled frame from the PrimaryFrame. b=23803 r=evaughan

git-svn-id: svn://10.0.0.236/trunk@58865 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
attinasi%netscape.com
2000-01-27 02:19:12 +00:00
parent aeffd0ea97
commit 7a42258bf9
2 changed files with 46 additions and 26 deletions

View File

@@ -78,6 +78,7 @@
#include "nsBlockFrame.h"
#include "nsGfxTextControlFrame.h"
#include "nsIScrollableFrame.h"
#include "nsIServiceManager.h"
#include "nsIXBLService.h"
@@ -2260,6 +2261,8 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
styleContext = newContext;
aParentFrame = newScrollFrame;
// now set the primary frame to the ScrollFrame
aState.mFrameManager->SetPrimaryFrameFor( aDocElement, scrollFrame );
}
nsIFrame* contentFrame = nsnull;
@@ -2288,9 +2291,6 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
aParentFrame, styleContext, nsnull, contentFrame);
}
// set the primary frame
aState.mFrameManager->SetPrimaryFrameFor(aDocElement, contentFrame);
// Finish building the scrollframe
if (isScrollable) {
FinishBuildingScrollFrame(aPresContext,
@@ -2582,6 +2582,9 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
view->QueryInterface(kScrollViewIID, (void**)&scrollableView);
viewManager->SetRootScrollableView(scrollableView);
parentFrame = newScrollableFrame;
// now set the primary frame to the ScrollFrame
state.mFrameManager->SetPrimaryFrameFor( aDocElement, newFrame );
// if gfx scrollbars store them
if (HasGfxScrollbars(aPresContext)) {
@@ -3307,7 +3310,9 @@ nsCSSFrameConstructor::ConstructFieldSetFrame(nsIPresShell* aPresShell,
nsIFrame * newFrame;
PRUint32 flags = aIsAbsolutelyPositioned ? NS_BLOCK_SPACE_MGR : 0;
nsresult rv = NS_NewFieldSetFrame(aPresShell, &newFrame, flags);
if (!NS_SUCCEEDED(rv)){
return rv;
}
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
@@ -4149,6 +4154,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
// we have a scrollframe so the parent becomes the scroll frame.
newFrame->GetParent(&aParentFrame);
primaryFrameSet = PR_TRUE;
frameHasBeenInitialized = PR_TRUE;
@@ -4171,6 +4177,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
// we have a scrollframe so the parent becomes the scroll frame.
newFrame->GetParent(&aParentFrame);
primaryFrameSet = PR_TRUE;
frameHasBeenInitialized = PR_TRUE;
@@ -4500,9 +4507,6 @@ nsCSSFrameConstructor::FinishBuildingScrollFrame(nsIPresContext* aPresConte
// the the scroll frames child list
aScrollFrame->SetInitialChildList(aPresContext, nsnull, aScrolledFrame);
if (aContent != nsnull)
aState.mFrameManager->SetPrimaryFrameFor(aContent, aScrolledFrame);
return NS_OK;
}
@@ -4599,6 +4603,9 @@ nsCSSFrameConstructor::BuildScrollFrame (nsIPresShell* aPresShell,
aScrolledContentStyle = scrolledContentStyle;
// now set the primary frame to the ScrollFrame
aState.mFrameManager->SetPrimaryFrameFor( aContent, aNewFrame );
return NS_OK;
}
@@ -5566,14 +5573,17 @@ nsCSSFrameConstructor::GetFrameFor(nsIPresShell* aPresShell,
}
}
} else {
// If the primary frame is a scroll frame, then get the scrolled frame.
// That's the frame that gets the reflow command
const nsStyleDisplay* display;
frame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display);
if (display->IsBlockLevel() && IsScrollable(aPresContext, display)) {
frame->FirstChild(aPresContext, nsnull, &frame);
}
// If the primary frame is a scroll frame, then get the scrolled frame.
// That's the frame that gets the reflow command
nsIScrollableFrame *pScrollableFrame = nsnull;
if (NS_SUCCEEDED( frame->QueryInterface(nsIScrollableFrame::GetIID(),
(void **)&pScrollableFrame) ))
{
pScrollableFrame->GetScrolledFrame( aPresContext, frame );
}
// if we get an outer table frame use its 1st child which is a table inner frame
// if we get a table cell frame use its 1st child which is an area frame
else if ((NS_STYLE_DISPLAY_TABLE == display->mDisplay) ||