/src/mozilla-central/layout/xul/nsStackFrame.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | // |
8 | | // Eric Vaughan |
9 | | // Netscape Communications |
10 | | // |
11 | | // See documentation in associated header file |
12 | | // |
13 | | |
14 | | #include "nsStackFrame.h" |
15 | | #include "mozilla/ComputedStyle.h" |
16 | | #include "nsIContent.h" |
17 | | #include "nsCOMPtr.h" |
18 | | #include "nsHTMLParts.h" |
19 | | #include "nsIPresShell.h" |
20 | | #include "nsCSSRendering.h" |
21 | | #include "nsBoxLayoutState.h" |
22 | | #include "nsStackLayout.h" |
23 | | #include "nsDisplayList.h" |
24 | | |
25 | | using namespace mozilla; |
26 | | |
27 | | nsIFrame* |
28 | | NS_NewStackFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) |
29 | 0 | { |
30 | 0 | return new (aPresShell) nsStackFrame(aStyle); |
31 | 0 | } |
32 | | |
33 | | NS_IMPL_FRAMEARENA_HELPERS(nsStackFrame) |
34 | | |
35 | | nsStackFrame::nsStackFrame(ComputedStyle* aStyle): |
36 | | nsBoxFrame(aStyle, kClassID) |
37 | 0 | { |
38 | 0 | nsCOMPtr<nsBoxLayout> layout; |
39 | 0 | NS_NewStackLayout(layout); |
40 | 0 | SetXULLayoutManager(layout); |
41 | 0 | } |
42 | | |
43 | | // REVIEW: The old code put everything in the background layer. To be more |
44 | | // consistent with the way other frames work, I'm putting everything in the |
45 | | // Content() (i.e., foreground) layer (see nsFrame::BuildDisplayListForChild, |
46 | | // the case for stacking context but non-positioned, non-floating frames). |
47 | | // This could easily be changed back by hacking nsBoxFrame::BuildDisplayListInternal |
48 | | // a bit more. |
49 | | void |
50 | | nsStackFrame::BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder, |
51 | | const nsDisplayListSet& aLists) |
52 | 0 | { |
53 | 0 | // BuildDisplayListForChild puts stacking contexts into the PositionedDescendants |
54 | 0 | // list. So we need to map that list to aLists.Content(). This is an easy way to |
55 | 0 | // do that. |
56 | 0 | nsDisplayList* content = aLists.Content(); |
57 | 0 | nsDisplayListSet kidLists(content, content, content, content, content, content); |
58 | 0 | nsIFrame* kid = mFrames.FirstChild(); |
59 | 0 | while (kid) { |
60 | 0 | // Force each child into its own true stacking context. |
61 | 0 | BuildDisplayListForChild(aBuilder, kid, kidLists, DISPLAY_CHILD_FORCE_STACKING_CONTEXT); |
62 | 0 | kid = kid->GetNextSibling(); |
63 | 0 | } |
64 | 0 | } |