mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-12 12:32:21 +00:00
LibWeb: Rename CSSColorValue::create() to create_from_color()
Soon, CSSColorValue will be an abstract class, and we'll instead create a CSSRGB, CSSHSL, or other specific color type from the Typed-OM spec. However, it's still useful to have an easy "just give me a style value for this color" method. So change the name to distinguish this from the usual StyleValue::create() methods.
This commit is contained in:
parent
4e48afd9a7
commit
37ea4e3b5f
Notes:
github-actions[bot]
2024-08-21 09:53:06 +00:00
Author: https://github.com/AtkinsSJ
Commit: 37ea4e3b5f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1091
11 changed files with 24 additions and 24 deletions
|
@ -46,12 +46,12 @@ void HTMLBodyElement::apply_presentational_hints(CSS::StyleProperties& style) co
|
|||
// https://html.spec.whatwg.org/multipage/rendering.html#the-page:rules-for-parsing-a-legacy-colour-value
|
||||
auto color = parse_legacy_color_value(value);
|
||||
if (color.has_value())
|
||||
style.set_property(CSS::PropertyID::BackgroundColor, CSS::CSSColorValue::create(color.value()));
|
||||
style.set_property(CSS::PropertyID::BackgroundColor, CSS::CSSColorValue::create_from_color(color.value()));
|
||||
} else if (name.equals_ignoring_ascii_case("text"sv)) {
|
||||
// https://html.spec.whatwg.org/multipage/rendering.html#the-page:rules-for-parsing-a-legacy-colour-value-2
|
||||
auto color = parse_legacy_color_value(value);
|
||||
if (color.has_value())
|
||||
style.set_property(CSS::PropertyID::Color, CSS::CSSColorValue::create(color.value()));
|
||||
style.set_property(CSS::PropertyID::Color, CSS::CSSColorValue::create_from_color(color.value()));
|
||||
} else if (name.equals_ignoring_ascii_case("background"sv)) {
|
||||
VERIFY(m_background_style_value);
|
||||
style.set_property(CSS::PropertyID::BackgroundImage, *m_background_style_value);
|
||||
|
|
|
@ -119,7 +119,7 @@ void HTMLFontElement::apply_presentational_hints(CSS::StyleProperties& style) co
|
|||
// https://html.spec.whatwg.org/multipage/rendering.html#phrasing-content-3:rules-for-parsing-a-legacy-colour-value
|
||||
auto color = parse_legacy_color_value(value);
|
||||
if (color.has_value())
|
||||
style.set_property(CSS::PropertyID::Color, CSS::CSSColorValue::create(color.value()));
|
||||
style.set_property(CSS::PropertyID::Color, CSS::CSSColorValue::create_from_color(color.value()));
|
||||
} else if (name.equals_ignoring_ascii_case("size"sv)) {
|
||||
// When a font element has a size attribute, the user agent is expected to use the following steps, known as the rules for parsing a legacy font size, to treat the attribute as a presentational hint setting the element's 'font-size' property:
|
||||
auto font_size_or_empty = parse_legacy_font_size(value);
|
||||
|
|
|
@ -38,7 +38,7 @@ void HTMLMarqueeElement::apply_presentational_hints(CSS::StyleProperties& style)
|
|||
// https://html.spec.whatwg.org/multipage/rendering.html#the-marquee-element-2:rules-for-parsing-a-legacy-colour-value
|
||||
auto color = parse_legacy_color_value(value);
|
||||
if (color.has_value())
|
||||
style.set_property(CSS::PropertyID::BackgroundColor, CSS::CSSColorValue::create(color.value()));
|
||||
style.set_property(CSS::PropertyID::BackgroundColor, CSS::CSSColorValue::create_from_color(color.value()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ void HTMLTableCellElement::apply_presentational_hints(CSS::StyleProperties& styl
|
|||
// https://html.spec.whatwg.org/multipage/rendering.html#tables-2:rules-for-parsing-a-legacy-colour-value
|
||||
auto color = parse_legacy_color_value(value);
|
||||
if (color.has_value())
|
||||
style.set_property(CSS::PropertyID::BackgroundColor, CSS::CSSColorValue::create(color.value()));
|
||||
style.set_property(CSS::PropertyID::BackgroundColor, CSS::CSSColorValue::create_from_color(color.value()));
|
||||
return;
|
||||
}
|
||||
if (name == HTML::AttributeNames::valign) {
|
||||
|
|
|
@ -76,7 +76,7 @@ void HTMLTableElement::apply_presentational_hints(CSS::StyleProperties& style) c
|
|||
// https://html.spec.whatwg.org/multipage/rendering.html#tables-2:rules-for-parsing-a-legacy-colour-value
|
||||
auto color = parse_legacy_color_value(value);
|
||||
if (color.has_value())
|
||||
style.set_property(CSS::PropertyID::BackgroundColor, CSS::CSSColorValue::create(color.value()));
|
||||
style.set_property(CSS::PropertyID::BackgroundColor, CSS::CSSColorValue::create_from_color(color.value()));
|
||||
return;
|
||||
}
|
||||
if (name == HTML::AttributeNames::cellspacing) {
|
||||
|
@ -92,7 +92,7 @@ void HTMLTableElement::apply_presentational_hints(CSS::StyleProperties& style) c
|
|||
auto legacy_line_style = CSS::CSSKeywordValue::create(CSS::Keyword::Outset);
|
||||
style.set_property(style_property, legacy_line_style);
|
||||
style.set_property(width_property, CSS::LengthStyleValue::create(CSS::Length::make_px(border)));
|
||||
style.set_property(color_property, CSS::CSSColorValue::create(Color(128, 128, 128)));
|
||||
style.set_property(color_property, CSS::CSSColorValue::create_from_color(Color(128, 128, 128)));
|
||||
};
|
||||
apply_border_style(CSS::PropertyID::BorderLeftStyle, CSS::PropertyID::BorderLeftWidth, CSS::PropertyID::BorderLeftColor);
|
||||
apply_border_style(CSS::PropertyID::BorderTopStyle, CSS::PropertyID::BorderTopWidth, CSS::PropertyID::BorderTopColor);
|
||||
|
|
|
@ -47,7 +47,7 @@ void HTMLTableRowElement::apply_presentational_hints(CSS::StyleProperties& style
|
|||
// https://html.spec.whatwg.org/multipage/rendering.html#tables-2:rules-for-parsing-a-legacy-colour-value
|
||||
auto color = parse_legacy_color_value(value);
|
||||
if (color.has_value())
|
||||
style.set_property(CSS::PropertyID::BackgroundColor, CSS::CSSColorValue::create(color.value()));
|
||||
style.set_property(CSS::PropertyID::BackgroundColor, CSS::CSSColorValue::create_from_color(color.value()));
|
||||
return;
|
||||
} else if (name == HTML::AttributeNames::background) {
|
||||
if (auto parsed_value = document().parse_url(value); parsed_value.is_valid())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue