1
0
mirror of https://github.com/roytam1/UXP.git synced 2026-05-29 08:54:28 +00:00

Issue #1370 - Part 3: Implement content keyword for flex-basis property

Partially based on https://bugzilla.mozilla.org/show_bug.cgi?id=1105111
This commit is contained in:
FranklinDM
2022-04-06 23:59:01 +08:00
committed by roytam1
parent b6b20a04ec
commit 9dc59c43f1
9 changed files with 63 additions and 8 deletions
+14 -2
View File
@@ -4647,11 +4647,23 @@ nsFrame::SetCoordToFlexBasis(bool aIsInlineFlexItem,
return;
}
const nsStyleCoord* newCoord = aFlexBasis;
// Having 'content' as the value of the 'flex-basis' property is
// equivalent to setting both 'flex-basis' and the main size
// properties to 'auto', which is why a dummy 'auto' value will
// be used here for the main size property.
if (aFlexBasis->GetUnit() == eStyleUnit_Enumerated &&
aFlexBasis->GetIntValue() == NS_STYLE_FLEX_BASIS_CONTENT) {
static const nsStyleCoord autoStyleCoord(eStyleUnit_Auto);
newCoord = &autoStyleCoord;
}
// Override whichever styleCoord is in the flex container's main axis
if (aIsInlineFlexItem) {
*aInlineStyle = aFlexBasis;
*aInlineStyle = newCoord;
} else {
*aBlockStyle = aFlexBasis;
*aBlockStyle = newCoord;
}
}