1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/xul/nsStackFrame.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,63 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +// 1.10 +// Eric Vaughan 1.11 +// Netscape Communications 1.12 +// 1.13 +// See documentation in associated header file 1.14 +// 1.15 + 1.16 +#include "nsStackFrame.h" 1.17 +#include "nsStyleContext.h" 1.18 +#include "nsIContent.h" 1.19 +#include "nsCOMPtr.h" 1.20 +#include "nsHTMLParts.h" 1.21 +#include "nsIPresShell.h" 1.22 +#include "nsCSSRendering.h" 1.23 +#include "nsBoxLayoutState.h" 1.24 +#include "nsStackLayout.h" 1.25 +#include "nsDisplayList.h" 1.26 + 1.27 +nsIFrame* 1.28 +NS_NewStackFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) 1.29 +{ 1.30 + return new (aPresShell) nsStackFrame(aPresShell, aContext); 1.31 +} 1.32 + 1.33 +NS_IMPL_FRAMEARENA_HELPERS(nsStackFrame) 1.34 + 1.35 +nsStackFrame::nsStackFrame(nsIPresShell* aPresShell, nsStyleContext* aContext): 1.36 + nsBoxFrame(aPresShell, aContext) 1.37 +{ 1.38 + nsCOMPtr<nsBoxLayout> layout; 1.39 + NS_NewStackLayout(aPresShell, layout); 1.40 + SetLayoutManager(layout); 1.41 +} 1.42 + 1.43 +// REVIEW: The old code put everything in the background layer. To be more 1.44 +// consistent with the way other frames work, I'm putting everything in the 1.45 +// Content() (i.e., foreground) layer (see nsFrame::BuildDisplayListForChild, 1.46 +// the case for stacking context but non-positioned, non-floating frames). 1.47 +// This could easily be changed back by hacking nsBoxFrame::BuildDisplayListInternal 1.48 +// a bit more. 1.49 +void 1.50 +nsStackFrame::BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder, 1.51 + const nsRect& aDirtyRect, 1.52 + const nsDisplayListSet& aLists) 1.53 +{ 1.54 + // BuildDisplayListForChild puts stacking contexts into the PositionedDescendants 1.55 + // list. So we need to map that list to aLists.Content(). This is an easy way to 1.56 + // do that. 1.57 + nsDisplayList* content = aLists.Content(); 1.58 + nsDisplayListSet kidLists(content, content, content, content, content, content); 1.59 + nsIFrame* kid = mFrames.FirstChild(); 1.60 + while (kid) { 1.61 + // Force each child into its own true stacking context. 1.62 + BuildDisplayListForChild(aBuilder, kid, aDirtyRect, kidLists, 1.63 + DISPLAY_CHILD_FORCE_STACKING_CONTEXT); 1.64 + kid = kid->GetNextSibling(); 1.65 + } 1.66 +}