mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-09 18:16:09 +03:00
LibWeb: Use system colors in more places
This commit is contained in:
parent
cd273f2312
commit
84a5c67d6b
Notes:
sideshowbarker
2024-07-17 06:28:38 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/84a5c67d6b Pull-request: https://github.com/SerenityOS/serenity/pull/20743
@ -20,6 +20,7 @@
|
|||||||
#include <LibWeb/CSS/MediaQueryList.h>
|
#include <LibWeb/CSS/MediaQueryList.h>
|
||||||
#include <LibWeb/CSS/MediaQueryListEvent.h>
|
#include <LibWeb/CSS/MediaQueryListEvent.h>
|
||||||
#include <LibWeb/CSS/StyleComputer.h>
|
#include <LibWeb/CSS/StyleComputer.h>
|
||||||
|
#include <LibWeb/CSS/SystemColor.h>
|
||||||
#include <LibWeb/CSS/VisualViewport.h>
|
#include <LibWeb/CSS/VisualViewport.h>
|
||||||
#include <LibWeb/Cookie/ParsedCookie.h>
|
#include <LibWeb/Cookie/ParsedCookie.h>
|
||||||
#include <LibWeb/DOM/Attr.h>
|
#include <LibWeb/DOM/Attr.h>
|
||||||
@ -1296,27 +1297,21 @@ Color Document::link_color() const
|
|||||||
{
|
{
|
||||||
if (m_link_color.has_value())
|
if (m_link_color.has_value())
|
||||||
return m_link_color.value();
|
return m_link_color.value();
|
||||||
if (!page())
|
return CSS::SystemColor::link_text();
|
||||||
return Color::Blue;
|
|
||||||
return page()->palette().link();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Color Document::active_link_color() const
|
Color Document::active_link_color() const
|
||||||
{
|
{
|
||||||
if (m_active_link_color.has_value())
|
if (m_active_link_color.has_value())
|
||||||
return m_active_link_color.value();
|
return m_active_link_color.value();
|
||||||
if (!page())
|
return CSS::SystemColor::active_text();
|
||||||
return Color::Red;
|
|
||||||
return page()->palette().active_link();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Color Document::visited_link_color() const
|
Color Document::visited_link_color() const
|
||||||
{
|
{
|
||||||
if (m_visited_link_color.has_value())
|
if (m_visited_link_color.has_value())
|
||||||
return m_visited_link_color.value();
|
return m_visited_link_color.value();
|
||||||
if (!page())
|
return CSS::SystemColor::visited_text();
|
||||||
return Color::Magenta;
|
|
||||||
return page()->palette().visited_link();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/webappapis.html#relevant-settings-object
|
// https://html.spec.whatwg.org/multipage/webappapis.html#relevant-settings-object
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022-2023, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2022-2023, Andreas Kling <kling@serenityos.org>
|
||||||
* Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
|
* Copyright (c) 2022-2023, Sam Atkins <atkinssj@serenityos.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/GenericShorthands.h>
|
#include <AK/GenericShorthands.h>
|
||||||
#include <LibUnicode/CharacterTypes.h>
|
#include <LibUnicode/CharacterTypes.h>
|
||||||
|
#include <LibWeb/CSS/SystemColor.h>
|
||||||
#include <LibWeb/DOM/Document.h>
|
#include <LibWeb/DOM/Document.h>
|
||||||
#include <LibWeb/HTML/HTMLHtmlElement.h>
|
#include <LibWeb/HTML/HTMLHtmlElement.h>
|
||||||
#include <LibWeb/Layout/BlockContainer.h>
|
#include <LibWeb/Layout/BlockContainer.h>
|
||||||
@ -616,10 +617,10 @@ static void paint_text_fragment(PaintContext& context, Layout::TextNode const& t
|
|||||||
|
|
||||||
auto selection_rect = context.enclosing_device_rect(fragment.selection_rect(text_node.font())).to_type<int>();
|
auto selection_rect = context.enclosing_device_rect(fragment.selection_rect(text_node.font())).to_type<int>();
|
||||||
if (!selection_rect.is_empty()) {
|
if (!selection_rect.is_empty()) {
|
||||||
painter.fill_rect(selection_rect, context.palette().selection());
|
painter.fill_rect(selection_rect, CSS::SystemColor::highlight());
|
||||||
Gfx::PainterStateSaver saver(painter);
|
Gfx::PainterStateSaver saver(painter);
|
||||||
painter.add_clip_rect(selection_rect);
|
painter.add_clip_rect(selection_rect);
|
||||||
painter.draw_text_run(baseline_start.to_type<int>(), view, scaled_font, context.palette().selection_text());
|
painter.draw_text_run(baseline_start.to_type<int>(), view, scaled_font, CSS::SystemColor::highlight_text());
|
||||||
}
|
}
|
||||||
|
|
||||||
paint_text_decoration(context, painter, text_node, fragment);
|
paint_text_decoration(context, painter, text_node, fragment);
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include <LibGfx/Painter.h>
|
#include <LibGfx/Painter.h>
|
||||||
#include <LibGfx/ShareableBitmap.h>
|
#include <LibGfx/ShareableBitmap.h>
|
||||||
#include <LibGfx/SystemTheme.h>
|
#include <LibGfx/SystemTheme.h>
|
||||||
|
#include <LibWeb/CSS/SystemColor.h>
|
||||||
#include <LibWeb/Cookie/ParsedCookie.h>
|
#include <LibWeb/Cookie/ParsedCookie.h>
|
||||||
#include <LibWeb/HTML/BrowsingContext.h>
|
#include <LibWeb/HTML/BrowsingContext.h>
|
||||||
#include <LibWeb/Layout/Viewport.h>
|
#include <LibWeb/Layout/Viewport.h>
|
||||||
@ -130,7 +131,7 @@ void PageHost::paint(Web::DevicePixelRect const& content_rect, Gfx::Bitmap& targ
|
|||||||
auto background_color = this->background_color();
|
auto background_color = this->background_color();
|
||||||
|
|
||||||
if (background_color.alpha() < 255)
|
if (background_color.alpha() < 255)
|
||||||
painter.clear_rect(bitmap_rect, palette().base());
|
painter.clear_rect(bitmap_rect, Web::CSS::SystemColor::canvas());
|
||||||
painter.fill_rect(bitmap_rect, background_color);
|
painter.fill_rect(bitmap_rect, background_color);
|
||||||
|
|
||||||
if (!document->paintable())
|
if (!document->paintable())
|
||||||
|
Loading…
Reference in New Issue
Block a user