mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:57:35 +00:00
LibWeb: Move PositionValue into its own files
It's in Position.{h,cpp} because it represents a <position> in CSS, even though it's currently named PositionValue to avoid collisions.
This commit is contained in:
parent
bcebca62d3
commit
d64ddeaec4
8 changed files with 165 additions and 133 deletions
|
@ -36,45 +36,6 @@
|
|||
|
||||
namespace Web::CSS {
|
||||
|
||||
// FIXME: Named PositionValue to avoid conflicts with enums, but this represents a <position>
|
||||
struct PositionValue {
|
||||
enum class HorizontalPreset {
|
||||
Left,
|
||||
Center,
|
||||
Right
|
||||
};
|
||||
|
||||
enum class VerticalPreset {
|
||||
Top,
|
||||
Center,
|
||||
Bottom
|
||||
};
|
||||
|
||||
enum class HorizontalEdge {
|
||||
Left,
|
||||
Right
|
||||
};
|
||||
|
||||
enum class VerticalEdge {
|
||||
Top,
|
||||
Bottom
|
||||
};
|
||||
|
||||
static PositionValue center()
|
||||
{
|
||||
return PositionValue { HorizontalPreset::Center, VerticalPreset::Center };
|
||||
}
|
||||
|
||||
Variant<HorizontalPreset, LengthPercentage> horizontal_position { HorizontalPreset::Left };
|
||||
Variant<VerticalPreset, LengthPercentage> vertical_position { VerticalPreset::Top };
|
||||
HorizontalEdge x_relative_to { HorizontalEdge::Left };
|
||||
VerticalEdge y_relative_to { VerticalEdge::Top };
|
||||
|
||||
CSSPixelPoint resolved(Layout::Node const& node, CSSPixelRect const& rect) const;
|
||||
ErrorOr<void> serialize(StringBuilder&) const;
|
||||
bool operator==(PositionValue const&) const = default;
|
||||
};
|
||||
|
||||
// FIXME: Find a better place for this helper.
|
||||
inline Gfx::Painter::ScalingMode to_gfx_scaling_mode(CSS::ImageRendering css_value)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue