mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Bug 1465290 part 1 - [css-grid-2] Add frame bits to nsGridContainerFrame that is set if it's a subgrid in an axis. r=dholbert
This commit is contained in:
parent
4b62519e23
commit
59ec467d3a
@ -344,6 +344,12 @@ FRAME_STATE_BIT(GridContainer, 22, NS_STATE_GRID_GENERATE_COMPUTED_VALUES)
|
||||
// True if the container has no grid items; may lie if there is a pending reflow
|
||||
FRAME_STATE_BIT(GridContainer, 23, NS_STATE_GRID_SYNTHESIZE_BASELINE)
|
||||
|
||||
// True if the container is a subgrid in its inline axis
|
||||
FRAME_STATE_BIT(GridContainer, 24, NS_STATE_GRID_IS_COL_SUBGRID)
|
||||
|
||||
// True if the container is a subgrid in its block axis
|
||||
FRAME_STATE_BIT(GridContainer, 25, NS_STATE_GRID_IS_ROW_SUBGRID)
|
||||
|
||||
// == Frame state bits that apply to SVG frames ===============================
|
||||
|
||||
FRAME_STATE_GROUP(SVG, nsSVGDisplayableFrame)
|
||||
|
@ -6330,6 +6330,36 @@ nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
|
||||
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
|
||||
}
|
||||
|
||||
void
|
||||
nsGridContainerFrame::Init(nsIContent* aContent,
|
||||
nsContainerFrame* aParent,
|
||||
nsIFrame* aPrevInFlow)
|
||||
{
|
||||
nsContainerFrame::Init(aContent, aParent, aPrevInFlow);
|
||||
|
||||
nsFrameState bits = nsFrameState(0);
|
||||
if (MOZ_LIKELY(!aPrevInFlow)) {
|
||||
// skip our scroll frame and such if we have it
|
||||
auto* parent = aParent;
|
||||
while (parent && parent->GetContent() == aContent) {
|
||||
parent = parent->GetParent();
|
||||
}
|
||||
if (parent && parent->IsGridContainerFrame()) {
|
||||
const auto* pos = StylePosition();
|
||||
if (pos->GridTemplateColumns().mIsSubgrid) {
|
||||
bits |= NS_STATE_GRID_IS_COL_SUBGRID;
|
||||
}
|
||||
if (pos->GridTemplateRows().mIsSubgrid) {
|
||||
bits |= NS_STATE_GRID_IS_ROW_SUBGRID;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
bits = aPrevInFlow->GetStateBits() & (NS_STATE_GRID_IS_COL_SUBGRID |
|
||||
NS_STATE_GRID_IS_ROW_SUBGRID);
|
||||
}
|
||||
AddStateBits(bits);
|
||||
}
|
||||
|
||||
nscoord
|
||||
nsGridContainerFrame::IntrinsicISize(gfxContext* aRenderingContext,
|
||||
IntrinsicISizeType aType)
|
||||
|
@ -97,6 +97,8 @@ public:
|
||||
ReflowOutput& aDesiredSize,
|
||||
const ReflowInput& aReflowInput,
|
||||
nsReflowStatus& aStatus) override;
|
||||
void Init(nsIContent* aContent, nsContainerFrame* aParent,
|
||||
nsIFrame* aPrevInFlow) override;
|
||||
nscoord GetMinISize(gfxContext* aRenderingContext) override;
|
||||
nscoord GetPrefISize(gfxContext* aRenderingContext) override;
|
||||
void MarkIntrinsicISizesDirty() override;
|
||||
@ -217,6 +219,20 @@ public:
|
||||
return GetProperty(ExplicitNamedAreasProperty());
|
||||
}
|
||||
|
||||
/** Return true if this frame is subgridded in its aAxis. */
|
||||
bool IsSubgrid(mozilla::LogicalAxis aAxis) const {
|
||||
return HasAnyStateBits(
|
||||
aAxis == mozilla::eLogicalAxisBlock ? NS_STATE_GRID_IS_ROW_SUBGRID
|
||||
: NS_STATE_GRID_IS_COL_SUBGRID);
|
||||
}
|
||||
bool IsColSubgrid() const { return IsSubgrid(mozilla::eLogicalAxisInline); }
|
||||
bool IsRowSubgrid() const { return IsSubgrid(mozilla::eLogicalAxisBlock); }
|
||||
/** Return true if this frame is subgridded in any axis. */
|
||||
bool IsSubgrid() const {
|
||||
return HasAnyStateBits(NS_STATE_GRID_IS_ROW_SUBGRID |
|
||||
NS_STATE_GRID_IS_COL_SUBGRID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a containing grid frame, and ensure it has computed grid info
|
||||
* @return nullptr if aFrame has no grid container, or frame was destroyed
|
||||
|
Loading…
Reference in New Issue
Block a user