Bug 983434 part 2: Store FlexLines and FlexItems in MFBT LinkedLists instead of nsTArrays. r=mats

This commit is contained in:
Daniel Holbert 2014-03-18 09:23:23 +08:00
parent f29878633f
commit 1bdf779856
2 changed files with 315 additions and 231 deletions

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,10 @@
#define nsFlexContainerFrame_h___
#include "nsContainerFrame.h"
#include "nsTArrayForwardDeclare.h"
namespace mozilla {
template <class T> class LinkedList;
}
nsIFrame* NS_NewFlexContainerFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext);
@ -103,10 +106,12 @@ protected:
void SanityCheckAnonymousFlexItems() const;
#endif // DEBUG
FlexItem GenerateFlexItemForChild(nsPresContext* aPresContext,
nsIFrame* aChildFrame,
const nsHTMLReflowState& aParentReflowState,
const FlexboxAxisTracker& aAxisTracker);
// Returns a new FlexItem for the given child frame, allocated on the heap.
// Caller is responsible for managing the FlexItem's lifetime.
FlexItem* GenerateFlexItemForChild(nsPresContext* aPresContext,
nsIFrame* aChildFrame,
const nsHTMLReflowState& aParentReflowState,
const FlexboxAxisTracker& aAxisTracker);
// Returns nsresult because we might have to reflow aFlexItem.Frame() (to
// get its vertical intrinsic size in a vertical flexbox), and if that
@ -116,13 +121,17 @@ protected:
const nsHTMLReflowState& aParentReflowState,
const FlexboxAxisTracker& aAxisTracker);
// Creates FlexItems for all of our child frames, arranged in a list of
// FlexLines. These are returned by reference in |aLines|. Our actual
// return value has to be |nsresult|, in case we have to reflow a child
// to establish its flex base size and that reflow fails.
nsresult GenerateFlexLines(nsPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nscoord aContentBoxMainSize,
nscoord aAvailableHeightForContent,
const nsTArray<StrutInfo>& aStruts,
const FlexboxAxisTracker& aAxisTracker,
nsTArray<FlexLine>& aLines);
mozilla::LinkedList<FlexLine>& aLines);
nscoord GetMainSizeFromReflowState(const nsHTMLReflowState& aReflowState,
const FlexboxAxisTracker& aAxisTracker);