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