mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:57:44 +00:00
LibWeb: Split ColorStyleValue out of StyleValue.{h,cpp}
This commit is contained in:
parent
66bc816284
commit
77b2826402
13 changed files with 89 additions and 47 deletions
|
@ -18,6 +18,7 @@
|
|||
#include <LibWeb/CSS/StyleValues/BorderRadiusShorthandStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/BorderRadiusStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/BorderStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/ColorStyleValue.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/HTML/BrowsingContext.h>
|
||||
#include <LibWeb/Loader/LoadRequest.h>
|
||||
|
@ -1020,11 +1021,6 @@ CalculatedStyleValue::CalculationResult CalculatedStyleValue::CalcNumberSumPartW
|
|||
return value->resolve(layout_node, percentage_basis);
|
||||
}
|
||||
|
||||
ErrorOr<String> ColorStyleValue::to_string() const
|
||||
{
|
||||
return serialize_a_srgb_value(m_color);
|
||||
}
|
||||
|
||||
ErrorOr<String> ContentStyleValue::to_string() const
|
||||
{
|
||||
if (has_alt_text())
|
||||
|
@ -2088,26 +2084,6 @@ ErrorOr<String> StyleValueList::to_string() const
|
|||
return builder.to_string();
|
||||
}
|
||||
|
||||
ValueComparingNonnullRefPtr<ColorStyleValue> ColorStyleValue::create(Color color)
|
||||
{
|
||||
if (color.value() == 0) {
|
||||
static auto transparent = adopt_ref(*new ColorStyleValue(color));
|
||||
return transparent;
|
||||
}
|
||||
|
||||
if (color == Color::from_rgb(0x000000)) {
|
||||
static auto black = adopt_ref(*new ColorStyleValue(color));
|
||||
return black;
|
||||
}
|
||||
|
||||
if (color == Color::from_rgb(0xffffff)) {
|
||||
static auto white = adopt_ref(*new ColorStyleValue(color));
|
||||
return white;
|
||||
}
|
||||
|
||||
return adopt_ref(*new ColorStyleValue(color));
|
||||
}
|
||||
|
||||
ValueComparingNonnullRefPtr<GridTemplateAreaStyleValue> GridTemplateAreaStyleValue::create(Vector<Vector<String>> grid_template_area)
|
||||
{
|
||||
return adopt_ref(*new GridTemplateAreaStyleValue(grid_template_area));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue