Skip to content

Commit

Permalink
clean: remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
LastLeaf committed Dec 26, 2024
1 parent ff36dc3 commit 6ad2859
Show file tree
Hide file tree
Showing 6 changed files with 268 additions and 39 deletions.
111 changes: 107 additions & 4 deletions float-pigment-css/float_pigment_css.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ struct Angle;
struct CalcExpr;


static const uint16_t TEMP_SHEET_INDEX = UINT16_MAX;

enum class AnimationDirectionItem {
Normal,
Reverse,
Expand Down Expand Up @@ -2643,6 +2645,97 @@ struct JustifyItemsType {
};
};

struct GapType {
enum class Tag {
Invalid,
Initial,
Inherit,
Unset,
Var,
VarInShorthand,
Invalid0,
Invalid7,
Invalid8,
Invalid9,
InvalidA,
InvalidB,
InvalidC,
InvalidD,
InvalidE,
InvalidF,
Invalid10,
Invalid11,
Invalid12,
Invalid13,
Invalid14,
Invalid15,
Invalid16,
Invalid17,
Invalid18,
Invalid19,
Invalid1A,
Invalid1B,
Invalid1C,
Invalid1D,
Invalid1E,
Invalid1F,
Invalid20,
Invalid21,
Invalid22,
Invalid23,
Invalid24,
Invalid25,
Invalid26,
Invalid27,
Invalid28,
Invalid29,
Invalid2A,
Invalid2B,
Invalid2C,
Invalid2D,
Invalid2E,
Invalid2F,
Invalid30,
Invalid31,
Invalid32,
Invalid33,
Invalid34,
Invalid35,
Invalid36,
Invalid37,
Invalid38,
Invalid39,
Invalid3A,
Invalid3B,
Invalid3C,
Invalid3D,
Invalid3E,
Invalid3F,
Normal,
Length,
};

struct Var_Body {
Box<StrRef> _0;
};

struct VarInShorthand_Body {
Box<StrRef> _0;
Box<StrRef> _1;
};

struct Length_Body {
Length _0;
};

Tag tag;
union {
Var_Body var;
VarInShorthand_Body var_in_shorthand;
Length_Body length;
};
};

struct Color {
enum class Tag {
Undefined,
Expand Down Expand Up @@ -7717,8 +7810,8 @@ struct Property {
FlexBasis,
JustifyItems,
Order,
Invalid2C,
Invalid2D,
RowGap,
ColumnGap,
Invalid2E,
Invalid2F,
Invalid30,
Expand Down Expand Up @@ -8043,6 +8136,14 @@ struct Property {
NumberType _0;
};

struct RowGap_Body {
GapType _0;
};

struct ColumnGap_Body {
GapType _0;
};

struct BackgroundColor_Body {
ColorType _0;
};
Expand Down Expand Up @@ -8490,6 +8591,8 @@ struct Property {
FlexBasis_Body flex_basis;
JustifyItems_Body justify_items;
Order_Body order;
RowGap_Body row_gap;
ColumnGap_Body column_gap;
BackgroundColor_Body background_color;
BackgroundImage_Body background_image;
BackgroundSize_Body background_size;
Expand Down Expand Up @@ -9042,6 +9145,6 @@ const char *substitute_variable(const char *expr_ptr,
CustomPropertyGetter getter,
CustomPropertySetter setter);

} // extern "C"
} // extern "C"

} // namespace float_pigment
} // namespace float_pigment
30 changes: 27 additions & 3 deletions float-pigment-forest/float_pigment_layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,15 @@ using MeasureMaxContentWidth = float;

using MeasureMaxContentHeight = float;

using MeasureFunc = Size(*)(NodePtr, MeasureMaxWidth, MeasureMode, MeasureMaxHeight, MeasureMode, MeasureMinWidth, MeasureMinHeight, MeasureMaxContentWidth, MeasureMaxContentHeight);
using MeasureFunc = Size(*)(NodePtr,
MeasureMaxWidth,
MeasureMode,
MeasureMaxHeight,
MeasureMode,
MeasureMinWidth,
MeasureMinHeight,
MeasureMaxContentWidth,
MeasureMaxContentHeight);

using CalcHandle = int32_t;

Expand Down Expand Up @@ -238,6 +246,14 @@ void NodeStyleSetBottomPercentage(NodePtr node, float value);

void NodeStyleSetBoxSizing(NodePtr node, BoxSizingType value);

void NodeStyleSetColumnGap(NodePtr node, float value);

void NodeStyleSetColumnGapCalcHandle(NodePtr node, int32_t calc_handle);

void NodeStyleSetColumnGapNormal(NodePtr node);

void NodeStyleSetColumnGapPercentage(NodePtr node, float value);

void NodeStyleSetDisplay(NodePtr node, DisplayType value);

void NodeStyleSetFlexBasis(NodePtr node, float value);
Expand Down Expand Up @@ -418,6 +434,14 @@ void NodeStyleSetRightNone(NodePtr node);

void NodeStyleSetRightPercentage(NodePtr node, float value);

void NodeStyleSetRowGap(NodePtr node, float value);

void NodeStyleSetRowGapCalcHandle(NodePtr node, int32_t calc_handle);

void NodeStyleSetRowGapNormal(NodePtr node);

void NodeStyleSetRowGapPercentage(NodePtr node, float value);

void NodeStyleSetTextAlign(NodePtr node, TextAlignType value);

void NodeStyleSetTop(NodePtr node, float value);
Expand All @@ -444,6 +468,6 @@ void NodeStyleSetWritingMode(NodePtr node, WritingModeType value);

const char *NodeToString(NodePtr node, bool recursive, bool layout, bool style);

} // extern "C"
} // extern "C"

} // namespace float_pigment
} // namespace float_pigment
23 changes: 0 additions & 23 deletions float-pigment-layout/src/special_positioned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,26 +454,3 @@ pub(crate) fn compute_special_position<T: LayoutTreeNode>(

layout_unit.gen_origin(axis_info, **parent.inner_size, offset_main, offset_cross);
}

pub(crate) fn compute_position_relative<T: LayoutTreeNode>(
node: &T,
parent_inner_size: Normalized<Size<T::Length>>,
) {
let mut layout_unit = node.layout_node().unit();
let style = node.style();
// apply relative offset
let left = style.left().resolve_num(parent_inner_size.width, node);
let right = style.right().resolve_num(parent_inner_size.width, node);
let top = style.top().resolve_num(parent_inner_size.height, node);
let bottom = style.bottom().resolve_num(parent_inner_size.height, node);
if let Some(left) = left.val() {
layout_unit.result.origin.x += left;
} else if let Some(right) = right.val() {
layout_unit.result.origin.x -= right;
}
if let Some(top) = top.val() {
layout_unit.result.origin.y += top;
} else if let Some(bottom) = bottom.val() {
layout_unit.result.origin.y -= bottom;
}
}
4 changes: 2 additions & 2 deletions float-pigment/float_pigment_css.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,6 @@ void *map,
CustomPropertyGetter getter,
CustomPropertySetter setter);

} // extern "C"
} // extern "C"

} // namespace float_pigment
} // namespace float_pigment
30 changes: 27 additions & 3 deletions float-pigment/float_pigment_layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,15 @@ using MeasureMaxContentWidth = float;

using MeasureMaxContentHeight = float;

using MeasureFunc = Size(*)(NodePtr, MeasureMaxWidth, MeasureMode, MeasureMaxHeight, MeasureMode, MeasureMinWidth, MeasureMinHeight, MeasureMaxContentWidth, MeasureMaxContentHeight);
using MeasureFunc = Size(*)(NodePtr,
MeasureMaxWidth,
MeasureMode,
MeasureMaxHeight,
MeasureMode,
MeasureMinWidth,
MeasureMinHeight,
MeasureMaxContentWidth,
MeasureMaxContentHeight);

using CalcHandle = int32_t;

Expand Down Expand Up @@ -238,6 +246,14 @@ void NodeStyleSetBottomPercentage(NodePtr node, float value);

void NodeStyleSetBoxSizing(NodePtr node, BoxSizingType value);

void NodeStyleSetColumnGap(NodePtr node, float value);

void NodeStyleSetColumnGapCalcHandle(NodePtr node, int32_t calc_handle);

void NodeStyleSetColumnGapNormal(NodePtr node);

void NodeStyleSetColumnGapPercentage(NodePtr node, float value);

void NodeStyleSetDisplay(NodePtr node, DisplayType value);

void NodeStyleSetFlexBasis(NodePtr node, float value);
Expand Down Expand Up @@ -418,6 +434,14 @@ void NodeStyleSetRightNone(NodePtr node);

void NodeStyleSetRightPercentage(NodePtr node, float value);

void NodeStyleSetRowGap(NodePtr node, float value);

void NodeStyleSetRowGapCalcHandle(NodePtr node, int32_t calc_handle);

void NodeStyleSetRowGapNormal(NodePtr node);

void NodeStyleSetRowGapPercentage(NodePtr node, float value);

void NodeStyleSetTextAlign(NodePtr node, TextAlignType value);

void NodeStyleSetTop(NodePtr node, float value);
Expand All @@ -444,6 +468,6 @@ void NodeStyleSetWritingMode(NodePtr node, WritingModeType value);

const char *NodeToString(NodePtr node, bool recursive, bool layout, bool style);

} // extern "C"
} // extern "C"

} // namespace float_pigment
} // namespace float_pigment
Loading

0 comments on commit 6ad2859

Please sign in to comment.