2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00: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/. */
|
2000-03-02 03:01:30 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Eric Vaughan
|
|
|
|
// Netscape Communications
|
|
|
|
//
|
|
|
|
// See documentation in associated header file
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "nsStackFrame.h"
|
2003-02-22 00:32:13 +00:00
|
|
|
#include "nsStyleContext.h"
|
2000-03-02 03:01:30 +00:00
|
|
|
#include "nsIContent.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsHTMLParts.h"
|
|
|
|
#include "nsIPresShell.h"
|
|
|
|
#include "nsCSSRendering.h"
|
2000-03-31 07:02:06 +00:00
|
|
|
#include "nsBoxLayoutState.h"
|
|
|
|
#include "nsStackLayout.h"
|
2006-08-03 21:39:39 +00:00
|
|
|
#include "nsDisplayList.h"
|
2000-03-02 03:01:30 +00:00
|
|
|
|
2005-10-26 21:46:39 +00:00
|
|
|
nsIFrame*
|
2009-01-19 18:31:33 +00:00
|
|
|
NS_NewStackFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
2000-03-02 03:01:30 +00:00
|
|
|
{
|
2015-01-06 09:27:56 +00:00
|
|
|
return new (aPresShell) nsStackFrame(aContext);
|
2009-09-12 16:49:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMPL_FRAMEARENA_HELPERS(nsStackFrame)
|
2000-03-02 03:01:30 +00:00
|
|
|
|
2015-01-06 09:27:56 +00:00
|
|
|
nsStackFrame::nsStackFrame(nsStyleContext* aContext):
|
|
|
|
nsBoxFrame(aContext)
|
2000-03-02 03:01:30 +00:00
|
|
|
{
|
2011-07-11 14:05:10 +00:00
|
|
|
nsCOMPtr<nsBoxLayout> layout;
|
2015-12-07 23:27:01 +00:00
|
|
|
NS_NewStackLayout(layout);
|
2016-04-21 04:28:33 +00:00
|
|
|
SetXULLayoutManager(layout);
|
2000-03-02 03:01:30 +00:00
|
|
|
}
|
|
|
|
|
2006-01-26 02:29:17 +00:00
|
|
|
// 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 11:12:27 +00:00
|
|
|
void
|
2006-01-26 02:29:17 +00:00
|
|
|
nsStackFrame::BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists)
|
2004-04-22 18:59:21 +00:00
|
|
|
{
|
2006-08-03 21:39:39 +00:00
|
|
|
// 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);
|
2006-01-26 02:29:17 +00:00
|
|
|
nsIFrame* kid = mFrames.FirstChild();
|
|
|
|
while (kid) {
|
2006-08-03 21:39:39 +00:00
|
|
|
// Force each child into its own true stacking context.
|
2013-02-14 11:12:27 +00:00
|
|
|
BuildDisplayListForChild(aBuilder, kid, aDirtyRect, kidLists,
|
|
|
|
DISPLAY_CHILD_FORCE_STACKING_CONTEXT);
|
2006-01-26 02:29:17 +00:00
|
|
|
kid = kid->GetNextSibling();
|
2000-03-02 03:01:30 +00:00
|
|
|
}
|
|
|
|
}
|