mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 10:34:58 +00:00
LibWeb: Compute the final border-style property before painting
Instead of doing a CSS property lookup for the line style of each border edge during paint, we now cache the final CSS::LineStyle to use in the Layout::BorderData.
This commit is contained in:
parent
88ca932fac
commit
2cbbab8f73
7 changed files with 82 additions and 50 deletions
|
@ -259,6 +259,35 @@ Optional<CSS::WhiteSpace> StyleProperties::white_space() const
|
|||
return {};
|
||||
}
|
||||
|
||||
Optional<CSS::LineStyle> StyleProperties::line_style(CSS::PropertyID property_id) const
|
||||
{
|
||||
auto value = property(property_id);
|
||||
if (!value.has_value() || !value.value()->is_string())
|
||||
return {};
|
||||
auto string = value.value()->to_string();
|
||||
if (string == "none")
|
||||
return CSS::LineStyle::None;
|
||||
if (string == "hidden")
|
||||
return CSS::LineStyle::Hidden;
|
||||
if (string == "dotted")
|
||||
return CSS::LineStyle::Dotted;
|
||||
if (string == "dashed")
|
||||
return CSS::LineStyle::Dashed;
|
||||
if (string == "solid")
|
||||
return CSS::LineStyle::Solid;
|
||||
if (string == "double")
|
||||
return CSS::LineStyle::Double;
|
||||
if (string == "groove")
|
||||
return CSS::LineStyle::Groove;
|
||||
if (string == "ridge")
|
||||
return CSS::LineStyle::Ridge;
|
||||
if (string == "inset")
|
||||
return CSS::LineStyle::Inset;
|
||||
if (string == "outset")
|
||||
return CSS::LineStyle::Outset;
|
||||
return {};
|
||||
}
|
||||
|
||||
Optional<CSS::Float> StyleProperties::float_() const
|
||||
{
|
||||
auto value = property(CSS::PropertyID::Float);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue