mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 18:08:58 +00:00
Cleanup of reflow command handling
This commit is contained in:
parent
0a012c1d28
commit
a8d3d80ebc
@ -54,11 +54,17 @@ nsContainerFrame::SetInitialChildList(nsIPresContext& aPresContext,
|
||||
NS_PRECONDITION(mFrames.IsEmpty(), "already initialized");
|
||||
|
||||
nsresult result;
|
||||
if (nsnull != mFrames.FirstChild()) {
|
||||
if (!mFrames.IsEmpty()) {
|
||||
// We already have child frames which means we've already been
|
||||
// initialized
|
||||
result = NS_ERROR_UNEXPECTED;
|
||||
} else if (nsnull != aListName) {
|
||||
} else if (aListName) {
|
||||
// All we know about is the unnamed principal child list
|
||||
result = NS_ERROR_INVALID_ARG;
|
||||
} else {
|
||||
#ifdef NS_DEBUG
|
||||
nsFrame::VerifyDirtyBitSet(aChildList);
|
||||
#endif
|
||||
mFrames.SetFrames(aChildList);
|
||||
result = NS_OK;
|
||||
}
|
||||
|
@ -54,11 +54,17 @@ nsContainerFrame::SetInitialChildList(nsIPresContext& aPresContext,
|
||||
NS_PRECONDITION(mFrames.IsEmpty(), "already initialized");
|
||||
|
||||
nsresult result;
|
||||
if (nsnull != mFrames.FirstChild()) {
|
||||
if (!mFrames.IsEmpty()) {
|
||||
// We already have child frames which means we've already been
|
||||
// initialized
|
||||
result = NS_ERROR_UNEXPECTED;
|
||||
} else if (nsnull != aListName) {
|
||||
} else if (aListName) {
|
||||
// All we know about is the unnamed principal child list
|
||||
result = NS_ERROR_INVALID_ARG;
|
||||
} else {
|
||||
#ifdef NS_DEBUG
|
||||
nsFrame::VerifyDirtyBitSet(aChildList);
|
||||
#endif
|
||||
mFrames.SetFrames(aChildList);
|
||||
result = NS_OK;
|
||||
}
|
||||
|
@ -89,9 +89,15 @@ nsScrollFrame::SetInitialChildList(nsIPresContext& aPresContext,
|
||||
{
|
||||
nsresult rv = nsHTMLContainerFrame::SetInitialChildList(aPresContext, aListName,
|
||||
aChildList);
|
||||
|
||||
nsIFrame* frame = mFrames.FirstChild();
|
||||
|
||||
// There must be one and only one child frame
|
||||
if (!frame) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
} else if (mFrames.GetLength() > 1) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
// Verify that the scrolled frame has a view
|
||||
nsIView* scrolledView;
|
||||
@ -109,6 +115,37 @@ nsScrollFrame::SetInitialChildList(nsIPresContext& aPresContext,
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScrollFrame::AppendFrames(nsIPresContext& aPresContext,
|
||||
nsIPresShell& aPresShell,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aFrameList)
|
||||
{
|
||||
// Only one child frame allowed
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScrollFrame::InsertFrames(nsIPresContext& aPresContext,
|
||||
nsIPresShell& aPresShell,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aPrevFrame,
|
||||
nsIFrame* aFrameList)
|
||||
{
|
||||
// Only one child frame allowed
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScrollFrame::RemoveFrame(nsIPresContext& aPresContext,
|
||||
nsIPresShell& aPresShell,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aOldFrame)
|
||||
{
|
||||
// Scroll frames doesn't support incremental changes
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScrollFrame::DidReflow(nsIPresContext& aPresContext,
|
||||
nsDidReflowStatus aStatus)
|
||||
@ -221,31 +258,32 @@ nsScrollFrame::CreateScrollingView(nsIPresContext& aPresContext)
|
||||
// Set the view's opacity
|
||||
viewManager->SetViewOpacity(view, color->mOpacity);
|
||||
|
||||
// Because we only paintg the border and we don't paint a background,
|
||||
// Because we only paint the border and we don't paint a background,
|
||||
// inform the view manager that we have transparent content
|
||||
viewManager->SetViewContentTransparency(view, PR_TRUE);
|
||||
|
||||
// XXX If it's fixed positioned, then create a widget too
|
||||
// If it's fixed positioned, then create a widget too
|
||||
CreateScrollingViewWidget(view, position);
|
||||
|
||||
// Get the nsIScrollableView interface
|
||||
nsIScrollableView* scrollingView;
|
||||
view->QueryInterface(kScrollViewIID, (void**)&scrollingView);
|
||||
|
||||
// Create widgets for scrolling
|
||||
// Have the scrolling view create its internal widgets
|
||||
scrollingView->CreateScrollControls();
|
||||
|
||||
// Set the scroll preference
|
||||
// Set the scrolling view's scroll preference
|
||||
nsScrollPreference scrollPref = (NS_STYLE_OVERFLOW_SCROLL == display->mOverflow)
|
||||
? nsScrollPreference_kAlwaysScroll :
|
||||
nsScrollPreference_kAuto;
|
||||
// if this is a scroll frame for a viewport and its webshell
|
||||
|
||||
// If this is a scroll frame for a viewport and its webshell
|
||||
// has its scrolling set, use that value
|
||||
// XXX This is a huge hack, and we should not be checking the web shell's
|
||||
// scrolling preference...
|
||||
nsIFrame* parentFrame = nsnull;
|
||||
GetParent(&parentFrame);
|
||||
//nsCOMPtr<nsIAtom> frameType;
|
||||
nsIAtom* frameType = nsnull;
|
||||
//parent->GetFrameType(getter_AddRefs(frameType));
|
||||
parent->GetFrameType(&frameType);
|
||||
if (nsLayoutAtoms::viewportFrame == frameType) {
|
||||
NS_RELEASE(frameType);
|
||||
|
@ -26,6 +26,9 @@
|
||||
*
|
||||
* It only supports having a single child frame that typically is an area
|
||||
* frame, but doesn't have to be. The child frame must have a view, though
|
||||
*
|
||||
* Scroll frames don't support incremental changes, i.e. you can't replace
|
||||
* or remove the scrolled frame
|
||||
*/
|
||||
class nsScrollFrame : public nsHTMLContainerFrame {
|
||||
public:
|
||||
@ -37,10 +40,31 @@ public:
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow);
|
||||
|
||||
// Called to set the one and only child frame. Returns NS_ERROR_INVALID_ARG
|
||||
// if the child frame is NULL, and NS_ERROR_UNEXPECTED if the child list
|
||||
// contains more than one frame
|
||||
NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList);
|
||||
|
||||
// Because there can be only one child frame, these two function return
|
||||
// NS_ERROR_FAILURE
|
||||
NS_IMETHOD AppendFrames(nsIPresContext& aPresContext,
|
||||
nsIPresShell& aPresShell,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aFrameList);
|
||||
NS_IMETHOD InsertFrames(nsIPresContext& aPresContext,
|
||||
nsIPresShell& aPresShell,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aPrevFrame,
|
||||
nsIFrame* aFrameList);
|
||||
|
||||
// This function returns NS_ERROR_NOT_IMPLEMENTED
|
||||
NS_IMETHOD RemoveFrame(nsIPresContext& aPresContext,
|
||||
nsIPresShell& aPresShell,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aOldFrame);
|
||||
|
||||
NS_IMETHOD DidReflow(nsIPresContext& aPresContext,
|
||||
nsDidReflowStatus aStatus);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user