2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
//
|
|
|
|
// Eric Vaughan
|
|
|
|
// Netscape Communications
|
|
|
|
//
|
|
|
|
// See documentation in associated header file
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "nsStackFrame.h"
|
|
|
|
#include "nsStyleContext.h"
|
|
|
|
#include "nsIContent.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsHTMLParts.h"
|
|
|
|
#include "nsIPresShell.h"
|
|
|
|
#include "nsCSSRendering.h"
|
|
|
|
#include "nsBoxLayoutState.h"
|
|
|
|
#include "nsStackLayout.h"
|
|
|
|
#include "nsDisplayList.h"
|
|
|
|
|
|
|
|
nsIFrame*
|
2009-01-19 10:31:33 -08:00
|
|
|
NS_NewStackFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2009-01-19 10:31:33 -08:00
|
|
|
return new (aPresShell) nsStackFrame(aPresShell, aContext);
|
2009-09-12 09:49:24 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMPL_FRAMEARENA_HELPERS(nsStackFrame)
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-01-19 10:31:33 -08:00
|
|
|
nsStackFrame::nsStackFrame(nsIPresShell* aPresShell, nsStyleContext* aContext):
|
2007-03-22 10:30:00 -07:00
|
|
|
nsBoxFrame(aPresShell, aContext)
|
|
|
|
{
|
2011-07-11 07:05:10 -07:00
|
|
|
nsCOMPtr<nsBoxLayout> layout;
|
2009-01-19 10:31:33 -08:00
|
|
|
NS_NewStackLayout(aPresShell, layout);
|
2007-03-22 10:30:00 -07:00
|
|
|
SetLayoutManager(layout);
|
|
|
|
}
|
|
|
|
|
|
|
|
// REVIEW: The old code put everything in the background layer. To be more
|
|
|
|
// consistent with the way other frames work, I'm putting everything in the
|
|
|
|
// Content() (i.e., foreground) layer (see nsFrame::BuildDisplayListForChild,
|
|
|
|
// the case for stacking context but non-positioned, non-floating frames).
|
|
|
|
// This could easily be changed back by hacking nsBoxFrame::BuildDisplayListInternal
|
|
|
|
// a bit more.
|
2013-02-14 03:12:27 -08:00
|
|
|
void
|
2007-03-22 10:30:00 -07:00
|
|
|
nsStackFrame::BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists)
|
|
|
|
{
|
|
|
|
// BuildDisplayListForChild puts stacking contexts into the PositionedDescendants
|
|
|
|
// list. So we need to map that list to aLists.Content(). This is an easy way to
|
|
|
|
// do that.
|
|
|
|
nsDisplayList* content = aLists.Content();
|
|
|
|
nsDisplayListSet kidLists(content, content, content, content, content, content);
|
|
|
|
nsIFrame* kid = mFrames.FirstChild();
|
|
|
|
while (kid) {
|
|
|
|
// Force each child into its own true stacking context.
|
2013-02-14 03:12:27 -08:00
|
|
|
BuildDisplayListForChild(aBuilder, kid, aDirtyRect, kidLists,
|
|
|
|
DISPLAY_CHILD_FORCE_STACKING_CONTEXT);
|
2007-03-22 10:30:00 -07:00
|
|
|
kid = kid->GetNextSibling();
|
|
|
|
}
|
|
|
|
}
|