mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +00:00
LibWeb: Add EdgeStyleValue
This represents a single edge and offset, this will be needed for the values of background-position-x/y.
This commit is contained in:
30
Userland/Libraries/LibWeb/CSS/StyleValues/EdgeStyleValue.cpp
Normal file
30
Userland/Libraries/LibWeb/CSS/StyleValues/EdgeStyleValue.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2023, MacDue <macdue@dueutil.tech>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "EdgeStyleValue.h"
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
ErrorOr<String> EdgeStyleValue::to_string() const
|
||||
{
|
||||
auto to_string = [](PositionEdge edge) {
|
||||
switch (edge) {
|
||||
case PositionEdge::Left:
|
||||
return "left";
|
||||
case PositionEdge::Right:
|
||||
return "right";
|
||||
case PositionEdge::Top:
|
||||
return "top";
|
||||
case PositionEdge::Bottom:
|
||||
return "bottom";
|
||||
}
|
||||
VERIFY_NOT_REACHED();
|
||||
};
|
||||
|
||||
return String::formatted("{} {}", to_string(m_properties.edge), TRY(m_properties.offset.to_string()));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user