Implement gap/row-gap/column-gap (within the C ABI)

Summary:
This extracts the core changes from https://github.com/facebook/yoga/pull/1116, to support gap/row-gap/column-gap, mostly identical, apart from the rename of gaps -> gutters.

The core functionality in this PR looks to be well tested from the fixtures added. I am not an expert in the internals of Yoga, but I am seeing everything that I would expect to. The space for the gap is accounted for in line-breaking, and the accumulated gaps limit the available line-length, before sizing flexible children, so items are sized correctly as to accommodate the gap. Then the gap is used for spacing during main axis and cross-axis justification.

Changelog:
[Genral][Added] - Implement gap/row-gap/column-gap (within the yoga C ABI)

Reviewed By: javache

Differential Revision: D39922410

fbshipit-source-id: 5850f22032169028bd8383b49dd240b335c11d3d
This commit is contained in:
Nick Gerleman
2022-10-13 08:18:49 -07:00
committed by Facebook GitHub Bot
parent 05dd228317
commit 582533dbc6
7 changed files with 115 additions and 13 deletions

View File

@@ -204,6 +204,14 @@ public:
YGEdge edge,
CompactValue defaultValue);
static CompactValue computeRowGap(
const YGStyle::Gutters& gutters,
CompactValue defaultValue);
static CompactValue computeColumnGap(
const YGStyle::Gutters& gutters,
CompactValue defaultValue);
// Methods related to positions, margin, padding and border
YGFloatOptional getLeadingPosition(
const YGFlexDirection axis,
@@ -236,6 +244,9 @@ public:
YGFloatOptional getMarginForAxis(
const YGFlexDirection axis,
const float widthSize) const;
YGFloatOptional getGapForAxis(
const YGFlexDirection axis,
const float widthSize) const;
// Setters
void setContext(void* context) { context_ = context; }