mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:30:27 +00:00
8cd81a8615
- Bug 1155478 - Use smart pointers for three members of nsIPresShell; r=roc (5ebb5e433)
- Bug 1150614: place floats correctly in vertical writing modes with dir="rtl", r=jfkthame (020ca8893)
- Tests for bug 1150614, r=jfkthame (edba1ffeb)
- Fix test regressions from bug 1150614, r=jfkthame (a68607adc)
- Bug 1162485 - Ensure the vertical-text.enabled pref is set for reftests that involve vertical writing modes. r=smontagu (948cb3a80)
- Bug 1167930 - Handle direction:rtl in vertical modes when converting a LogicalMargin to physical. r=smontagu (0ca0afe6e)
- Bug 1180643 - Fix the SetY() method on LogicalPoint to update the correct field. r=smontagu (3071253fd)
- Bug 1181087 - part 1 - Eliminate the few callers of physical-coordinate setters on the logical-coordinate geometry classes. r=smontagu (3462b41a8)
- Bug 1181087 - part 2 - Remove the unused physical setter methods on logical-coordinate classes. r=smontagu (0715086a8)
- Bug 1145218 - Make the float manager's writing-mode field debug-only, and assert that it matches what callers are passing in. r=smontagu (ee625acd2)
- Bug 756984 - Collapse the selection on the last text node on the line, skipping br and inline frames when clicking past the end of line; r=roc,ehsan (c4dcea1d6)
- Bug 1131451 part 1 - Replace containerWidth with containerSize in logical-coordinate classes and APIs, frame classes, etc. r=dholbert (ad4b55deb)
- Bug 1173646 part 1: Add reftest with flex items whose writing-mode differs from their flex container. r=mats (3dd3d7f97)
- Bug 1173646 part2: Add reftest variants with different writing-mode values on flex container. (no review) (0c82aad87)
- Bug 1173646 part 3: Make FlexItems cache their WritingMode, for quick access. r=mats (7398c33a6)
- Bug 1173646 part 4: Convert isize/bsize into flex container's writing-mode in flexbox macros that aim to pick a main-axis or cross-axis value. r=mats (80ebd414e)
- Bug 1155488 - Mark nsIPresShell::mHiddenInvalidationObserverRefreshDriver as MOZ_UNSAFE_REF; r=roc (10c98ad8f)
- Bug 1156008 - Convert CapturingContentInfo::mContent to StaticRefPtr; r=roc (9ffee3ef4)
- Bug 1177690 - part 3 - Reftests for bevelled corners on collapsed table border. r=dholbert (26e3aff00)
- Bug 1131451 part 2 - Respect the container height when converting vertical-RTL inline-direction coordinates. r=dholbert (594340514)
- Bug 1131451 followup - Remove one more bidi-in-vertical-mode hack that is no longer required. r=dholbert (696b0194f)
- Bug 1183896. Don't assume that relatively positioned table cells actually have positioned offsets computed, because in the case of position:sticky they don't. r=dholbert (remaining parts of rev c87f3d591) (f868b8a64)
218 lines
9.3 KiB
C++
218 lines
9.3 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code is subject to the terms of the Mozilla Public License
|
|
* version 2.0 (the "License"). You can obtain a copy of the License at
|
|
* http://mozilla.org/MPL/2.0/. */
|
|
|
|
/* rendering object for CSS "display: flex" */
|
|
|
|
#ifndef nsFlexContainerFrame_h___
|
|
#define nsFlexContainerFrame_h___
|
|
|
|
#include "nsContainerFrame.h"
|
|
|
|
namespace mozilla {
|
|
template <class T> class LinkedList;
|
|
class LogicalPoint;
|
|
} // namespace mozilla
|
|
|
|
nsContainerFrame* NS_NewFlexContainerFrame(nsIPresShell* aPresShell,
|
|
nsStyleContext* aContext);
|
|
|
|
typedef nsContainerFrame nsFlexContainerFrameSuper;
|
|
|
|
class nsFlexContainerFrame : public nsFlexContainerFrameSuper {
|
|
public:
|
|
NS_DECL_FRAMEARENA_HELPERS
|
|
NS_DECL_QUERYFRAME_TARGET(nsFlexContainerFrame)
|
|
NS_DECL_QUERYFRAME
|
|
|
|
// Factory method:
|
|
friend nsContainerFrame* NS_NewFlexContainerFrame(nsIPresShell* aPresShell,
|
|
nsStyleContext* aContext);
|
|
|
|
// Forward-decls of helper classes
|
|
class FlexItem;
|
|
class FlexLine;
|
|
class FlexboxAxisTracker;
|
|
struct StrutInfo;
|
|
|
|
// nsIFrame overrides
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
const nsRect& aDirtyRect,
|
|
const nsDisplayListSet& aLists) override;
|
|
|
|
virtual void Reflow(nsPresContext* aPresContext,
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
const nsHTMLReflowState& aReflowState,
|
|
nsReflowStatus& aStatus) override;
|
|
|
|
virtual nscoord
|
|
GetMinISize(nsRenderingContext* aRenderingContext) override;
|
|
virtual nscoord
|
|
GetPrefISize(nsRenderingContext* aRenderingContext) override;
|
|
|
|
virtual nsIAtom* GetType() const override;
|
|
#ifdef DEBUG_FRAME_DUMP
|
|
virtual nsresult GetFrameName(nsAString& aResult) const override;
|
|
#endif
|
|
// Flexbox-specific public methods
|
|
bool IsHorizontal();
|
|
|
|
protected:
|
|
// Protected constructor & destructor
|
|
explicit nsFlexContainerFrame(nsStyleContext* aContext) :
|
|
nsFlexContainerFrameSuper(aContext)
|
|
{}
|
|
virtual ~nsFlexContainerFrame();
|
|
|
|
/*
|
|
* This method does the bulk of the flex layout, implementing the algorithm
|
|
* described at:
|
|
* http://dev.w3.org/csswg/css-flexbox/#layout-algorithm
|
|
* (with a few initialization pieces happening in the caller, Reflow().
|
|
*
|
|
* Since this is a helper for Reflow(), this takes all the same parameters
|
|
* as Reflow(), plus a few more parameters that Reflow() sets up for us.
|
|
*
|
|
* (The logic behind the division of work between Reflow and DoFlexLayout is
|
|
* as follows: DoFlexLayout() begins at the step that we have to jump back
|
|
* to, if we find any visibility:collapse children, and Reflow() does
|
|
* everything before that point.)
|
|
*/
|
|
void DoFlexLayout(nsPresContext* aPresContext,
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
const nsHTMLReflowState& aReflowState,
|
|
nsReflowStatus& aStatus,
|
|
nscoord aContentBoxMainSize,
|
|
nscoord aAvailableBSizeForContent,
|
|
nsTArray<StrutInfo>& aStruts,
|
|
const FlexboxAxisTracker& aAxisTracker);
|
|
|
|
/**
|
|
* Checks whether our child-frame list "mFrames" is sorted, using the given
|
|
* IsLessThanOrEqual function, and sorts it if it's not already sorted.
|
|
*
|
|
* XXXdholbert Once we support pagination, we need to make this function
|
|
* check our continuations as well (or wrap it in a function that does).
|
|
*
|
|
* @return true if we had to sort mFrames, false if it was already sorted.
|
|
*/
|
|
template<bool IsLessThanOrEqual(nsIFrame*, nsIFrame*)>
|
|
bool SortChildrenIfNeeded();
|
|
|
|
// Protected flex-container-specific methods / member-vars
|
|
#ifdef DEBUG
|
|
void SanityCheckAnonymousFlexItems() const;
|
|
#endif // DEBUG
|
|
|
|
/*
|
|
* Returns a new FlexItem for the given child frame, allocated on the heap.
|
|
* Guaranteed to return non-null. Caller is responsible for managing the
|
|
* FlexItem's lifetime.
|
|
*
|
|
* Before returning, this method also processes the FlexItem to resolve its
|
|
* flex basis (including e.g. auto-height) as well as to resolve
|
|
* "min-height:auto", via ResolveAutoFlexBasisAndMinSize(). (Basically, the
|
|
* returned FlexItem will be ready to participate in the "Resolve the
|
|
* Flexible Lengths" step of the Flex Layout Algorithm.)
|
|
*/
|
|
FlexItem* GenerateFlexItemForChild(nsPresContext* aPresContext,
|
|
nsIFrame* aChildFrame,
|
|
const nsHTMLReflowState& aParentReflowState,
|
|
const FlexboxAxisTracker& aAxisTracker);
|
|
|
|
/**
|
|
* This method performs a "measuring" reflow to get the content height of
|
|
* aFlexItem.Frame() (treating it as if it had auto-height), & returns the
|
|
* resulting height.
|
|
* (Helper for ResolveAutoFlexBasisAndMinSize().)
|
|
*/
|
|
nscoord MeasureFlexItemContentHeight(nsPresContext* aPresContext,
|
|
FlexItem& aFlexItem,
|
|
bool aForceVerticalResizeForMeasuringReflow,
|
|
const nsHTMLReflowState& aParentReflowState);
|
|
|
|
/**
|
|
* This method resolves an "auto" flex-basis and/or min-main-size value
|
|
* on aFlexItem, if needed.
|
|
* (Helper for GenerateFlexItemForChild().)
|
|
*/
|
|
void ResolveAutoFlexBasisAndMinSize(nsPresContext* aPresContext,
|
|
FlexItem& aFlexItem,
|
|
const nsHTMLReflowState& aItemReflowState,
|
|
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.
|
|
void GenerateFlexLines(nsPresContext* aPresContext,
|
|
const nsHTMLReflowState& aReflowState,
|
|
nscoord aContentBoxMainSize,
|
|
nscoord aAvailableBSizeForContent,
|
|
const nsTArray<StrutInfo>& aStruts,
|
|
const FlexboxAxisTracker& aAxisTracker,
|
|
mozilla::LinkedList<FlexLine>& aLines);
|
|
|
|
nscoord GetMainSizeFromReflowState(const nsHTMLReflowState& aReflowState,
|
|
const FlexboxAxisTracker& aAxisTracker);
|
|
|
|
nscoord ComputeCrossSize(const nsHTMLReflowState& aReflowState,
|
|
const FlexboxAxisTracker& aAxisTracker,
|
|
nscoord aSumLineCrossSizes,
|
|
nscoord aAvailableBSizeForContent,
|
|
bool* aIsDefinite,
|
|
nsReflowStatus& aStatus);
|
|
|
|
void SizeItemInCrossAxis(nsPresContext* aPresContext,
|
|
const FlexboxAxisTracker& aAxisTracker,
|
|
nsHTMLReflowState& aChildReflowState,
|
|
FlexItem& aItem);
|
|
|
|
/**
|
|
* Moves the given flex item's frame to the given LogicalPosition (modulo any
|
|
* relative positioning).
|
|
*
|
|
* This can be used in cases where we've already done a "measuring reflow"
|
|
* for the flex item at the correct size, and hence can skip its final reflow
|
|
* (but still need to move it to the right final position).
|
|
*
|
|
* @param aReflowState The flex container's reflow state.
|
|
* @param aItem The flex item whose frame should be moved.
|
|
* @param aFramePos The position where the flex item's frame should
|
|
* be placed. (pre-relative positioning)
|
|
* @param aContainerSize The flex container's size (required by some methods
|
|
* that we call, to interpret aFramePos correctly).
|
|
*/
|
|
void MoveFlexItemToFinalPosition(const nsHTMLReflowState& aReflowState,
|
|
const FlexItem& aItem,
|
|
mozilla::LogicalPoint& aFramePos,
|
|
const nsSize& aContainerSize);
|
|
/**
|
|
* Helper-function to reflow a child frame, at its final position determined
|
|
* by flex layout.
|
|
*
|
|
* @param aPresContext The presentation context being used in reflow.
|
|
* @param aAxisTracker A FlexboxAxisTracker with the flex container's axes.
|
|
* @param aReflowState The flex container's reflow state.
|
|
* @param aItem The flex item to be reflowed.
|
|
* @param aFramePos The position where the flex item's frame should
|
|
* be placed. (pre-relative positioning)
|
|
* @param aContainerSize The flex container's size (required by some methods
|
|
* that we call, to interpret aFramePos correctly).
|
|
*/
|
|
void ReflowFlexItem(nsPresContext* aPresContext,
|
|
const FlexboxAxisTracker& aAxisTracker,
|
|
const nsHTMLReflowState& aReflowState,
|
|
const FlexItem& aItem,
|
|
mozilla::LogicalPoint& aFramePos,
|
|
const nsSize& aContainerSize);
|
|
|
|
bool mChildrenHaveBeenReordered; // Have we ever had to reorder our kids
|
|
// to satisfy their 'order' values?
|
|
};
|
|
|
|
#endif /* nsFlexContainerFrame_h___ */
|