mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-07 00:56:14 +00:00
LibDraw+LibHTML: Make link colors themeable
Add "Link", "ActiveLink" and "VisitedLink" colors to the system theme definition, and implement support for them in LibHTML. Note that <body link="foo" alink="bar" vlink="baz"> takes precedence over the system colors. Author style also takes precedence, since we only fetch the system color in case the CSS color is -libhtml-link.
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include <LibHTML/DOM/HTMLHtmlElement.h>
|
||||
#include <LibHTML/DOM/HTMLTitleElement.h>
|
||||
#include <LibHTML/Frame.h>
|
||||
#include <LibHTML/HtmlView.h>
|
||||
#include <LibHTML/Layout/LayoutDocument.h>
|
||||
#include <LibHTML/Layout/LayoutTreeBuilder.h>
|
||||
#include <stdio.h>
|
||||
@@ -275,3 +276,30 @@ Vector<const Element*> Document::get_elements_by_name(const String& name) const
|
||||
});
|
||||
return elements;
|
||||
}
|
||||
|
||||
Color Document::link_color() const
|
||||
{
|
||||
if (m_link_color.has_value())
|
||||
return m_link_color.value();
|
||||
if (!frame())
|
||||
return Color::Blue;
|
||||
return frame()->html_view()->palette().link();
|
||||
}
|
||||
|
||||
Color Document::active_link_color() const
|
||||
{
|
||||
if (m_active_link_color.has_value())
|
||||
return m_active_link_color.value();
|
||||
if (!frame())
|
||||
return Color::Red;
|
||||
return frame()->html_view()->palette().active_link();
|
||||
}
|
||||
|
||||
Color Document::visited_link_color() const
|
||||
{
|
||||
if (m_visited_link_color.has_value())
|
||||
return m_visited_link_color.value();
|
||||
if (!frame())
|
||||
return Color::Magenta;
|
||||
return frame()->html_view()->palette().visited_link();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user