Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | // |
michael@0 | 7 | // Eric Vaughan |
michael@0 | 8 | // Netscape Communications |
michael@0 | 9 | // |
michael@0 | 10 | // See documentation in associated header file |
michael@0 | 11 | // |
michael@0 | 12 | |
michael@0 | 13 | #include "nsStackFrame.h" |
michael@0 | 14 | #include "nsStyleContext.h" |
michael@0 | 15 | #include "nsIContent.h" |
michael@0 | 16 | #include "nsCOMPtr.h" |
michael@0 | 17 | #include "nsHTMLParts.h" |
michael@0 | 18 | #include "nsIPresShell.h" |
michael@0 | 19 | #include "nsCSSRendering.h" |
michael@0 | 20 | #include "nsBoxLayoutState.h" |
michael@0 | 21 | #include "nsStackLayout.h" |
michael@0 | 22 | #include "nsDisplayList.h" |
michael@0 | 23 | |
michael@0 | 24 | nsIFrame* |
michael@0 | 25 | NS_NewStackFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) |
michael@0 | 26 | { |
michael@0 | 27 | return new (aPresShell) nsStackFrame(aPresShell, aContext); |
michael@0 | 28 | } |
michael@0 | 29 | |
michael@0 | 30 | NS_IMPL_FRAMEARENA_HELPERS(nsStackFrame) |
michael@0 | 31 | |
michael@0 | 32 | nsStackFrame::nsStackFrame(nsIPresShell* aPresShell, nsStyleContext* aContext): |
michael@0 | 33 | nsBoxFrame(aPresShell, aContext) |
michael@0 | 34 | { |
michael@0 | 35 | nsCOMPtr<nsBoxLayout> layout; |
michael@0 | 36 | NS_NewStackLayout(aPresShell, layout); |
michael@0 | 37 | SetLayoutManager(layout); |
michael@0 | 38 | } |
michael@0 | 39 | |
michael@0 | 40 | // REVIEW: The old code put everything in the background layer. To be more |
michael@0 | 41 | // consistent with the way other frames work, I'm putting everything in the |
michael@0 | 42 | // Content() (i.e., foreground) layer (see nsFrame::BuildDisplayListForChild, |
michael@0 | 43 | // the case for stacking context but non-positioned, non-floating frames). |
michael@0 | 44 | // This could easily be changed back by hacking nsBoxFrame::BuildDisplayListInternal |
michael@0 | 45 | // a bit more. |
michael@0 | 46 | void |
michael@0 | 47 | nsStackFrame::BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder, |
michael@0 | 48 | const nsRect& aDirtyRect, |
michael@0 | 49 | const nsDisplayListSet& aLists) |
michael@0 | 50 | { |
michael@0 | 51 | // BuildDisplayListForChild puts stacking contexts into the PositionedDescendants |
michael@0 | 52 | // list. So we need to map that list to aLists.Content(). This is an easy way to |
michael@0 | 53 | // do that. |
michael@0 | 54 | nsDisplayList* content = aLists.Content(); |
michael@0 | 55 | nsDisplayListSet kidLists(content, content, content, content, content, content); |
michael@0 | 56 | nsIFrame* kid = mFrames.FirstChild(); |
michael@0 | 57 | while (kid) { |
michael@0 | 58 | // Force each child into its own true stacking context. |
michael@0 | 59 | BuildDisplayListForChild(aBuilder, kid, aDirtyRect, kidLists, |
michael@0 | 60 | DISPLAY_CHILD_FORCE_STACKING_CONTEXT); |
michael@0 | 61 | kid = kid->GetNextSibling(); |
michael@0 | 62 | } |
michael@0 | 63 | } |