LibWeb/DOM: Rename link_color to normal_link_color

This commit is contained in:
PGHales 2024-04-16 10:53:09 -06:00 committed by Andreas Kling
parent 7b75d0c1f0
commit ded344aa2c
Notes: sideshowbarker 2024-07-16 23:34:44 +09:00
5 changed files with 11 additions and 11 deletions

View file

@ -215,7 +215,7 @@ Color IdentifierStyleValue::to_color(Optional<Layout::NodeWithStyle const&> node
auto& document = node->document();
if (id() == CSS::ValueID::LibwebLink || id() == ValueID::Linktext)
return document.link_color();
return document.normal_link_color();
auto palette = document.page().palette();
switch (id()) {

View file

@ -1221,9 +1221,9 @@ void Document::update_paint_and_hit_testing_properties_if_needed()
paintable->resolve_paint_only_properties();
}
void Document::set_link_color(Color color)
void Document::set_normal_link_color(Color color)
{
m_link_color = color;
m_normal_link_color = color;
}
void Document::set_active_link_color(Color color)
@ -1468,10 +1468,10 @@ void Document::release_events()
// Do nothing
}
Color Document::link_color() const
Color Document::normal_link_color() const
{
if (m_link_color.has_value())
return m_link_color.value();
if (m_normal_link_color.has_value())
return m_normal_link_color.value();
return CSS::SystemColor::link_text();
}

View file

@ -198,8 +198,8 @@ public:
Color background_color() const;
Vector<CSS::BackgroundLayerData> const* background_layers() const;
Color link_color() const;
void set_link_color(Color);
Color normal_link_color() const;
void set_normal_link_color(Color);
Color active_link_color() const;
void set_active_link_color(Color);
@ -679,7 +679,7 @@ private:
JS::GCPtr<Layout::Viewport> m_layout_root;
Optional<Color> m_link_color;
Optional<Color> m_normal_link_color;
Optional<Color> m_active_link_color;
Optional<Color> m_visited_link_color;

View file

@ -65,7 +65,7 @@ void HTMLBodyElement::attribute_changed(FlyString const& name, Optional<String>
// https://html.spec.whatwg.org/multipage/rendering.html#the-page:rules-for-parsing-a-legacy-colour-value-3
auto color = parse_legacy_color_value(value.value_or(String {}));
if (color.has_value())
document().set_link_color(color.value());
document().set_normal_link_color(color.value());
} else if (name.equals_ignoring_ascii_case("alink"sv)) {
// https://html.spec.whatwg.org/multipage/rendering.html#the-page:rules-for-parsing-a-legacy-colour-value-5
auto color = parse_legacy_color_value(value.value_or(String {}));

View file

@ -579,7 +579,7 @@ Optional<BordersData> borders_data_for_outline(Layout::Node const& layout_node,
if (outline_style == CSS::OutlineStyle::Auto) {
// `auto` lets us do whatever we want for the outline. 2px of the link colour seems reasonable.
line_style = CSS::LineStyle::Dotted;
outline_color = layout_node.document().link_color();
outline_color = layout_node.document().normal_link_color();
outline_width = 2;
} else {
line_style = CSS::value_id_to_line_style(CSS::to_value_id(outline_style)).value_or(CSS::LineStyle::None);