Initial flexbox implementation

This commit is contained in:
Dynamitos committed 2026-10-25 07:34:05 +01:00
1 parent 1bc73b6d2f
commit bcb9a7b148
15 files changed
+1504 -142

No files matched your search

+22 -1
View File
@@ -13,7 +13,28 @@ class Div : public Element {
virtual ~Div() {}
virtual void applyStyle(Style parentStyle, const Theme& theme) override {
style = parentStyle;
style.outerDisplay = OuterDisplayType::Block;
// CSS non-inherited properties: reset to defaults before applying template
// classes. width/height, min/max, margin/padding, gap, position offsets, and
// per-item flex properties (grow/shrink/order/basis/alignSelf) are all
// non-inherited in CSS — a child's Div classes opt in explicitly.
// Inherited (keep from parent): display, direction, wrap, justify, items,
// content, z, colors, font, lineHeight, fontSize, fontWeight.
style.widthType = DimensionType::Auto; style.width = 0;
style.minWidthType = DimensionType::Auto; style.minWidth = 0;
style.maxWidthType = DimensionType::Auto; style.maxWidth = 0;
style.heightType = DimensionType::Auto; style.height = 0;
style.minHeightType = DimensionType::Auto; style.minHeight = 0;
style.maxHeightType = DimensionType::Auto; style.maxHeight = 0;
style.paddingTop = 0; style.paddingBottom = 0;
style.paddingLeft = 0; style.paddingRight = 0;
style.marginTop = 0; style.marginBottom = 0;
style.marginLeft = 0; style.marginRight = 0;
style.gap = 0;
style.top = 0; style.bottom = 0; style.left = 0; style.right = 0;
style.position = Position::Static;
style.grow = 0.f; style.shrink = 1.f;
style.order = 0; style.alignSelfOverride = -1.f;
style.basisType = DimensionType::Auto; style.basis = 0.f;
(classes::apply(style, theme), ...);
}
private: