mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-19 09:17:38 +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/MediaQueryListEvent.h>
|
||||
#include <LibWeb/CSS/StyleComputer.h>
|
||||
#include <LibWeb/CSS/SystemColor.h>
|
||||
#include <LibWeb/CSS/VisualViewport.h>
|
||||
#include <LibWeb/Cookie/ParsedCookie.h>
|
||||
#include <LibWeb/DOM/Attr.h>
|
||||
@ -1296,27 +1297,21 @@ Color Document::link_color() const
|
||||
{
|
||||
if (m_link_color.has_value())
|
||||
return m_link_color.value();
|
||||
if (!page())
|
||||
return Color::Blue;
|
||||
return page()->palette().link();
|
||||
return CSS::SystemColor::link_text();
|
||||
}
|
||||
|
||||
Color Document::active_link_color() const
|
||||
{
|
||||
if (m_active_link_color.has_value())
|
||||
return m_active_link_color.value();
|
||||
if (!page())
|
||||
return Color::Red;
|
||||
return page()->palette().active_link();
|
||||
return CSS::SystemColor::active_text();
|
||||
}
|
||||
|
||||
Color Document::visited_link_color() const
|
||||
{
|
||||
if (m_visited_link_color.has_value())
|
||||
return m_visited_link_color.value();
|
||||
if (!page())
|
||||
return Color::Magenta;
|
||||
return page()->palette().visited_link();
|
||||
return CSS::SystemColor::visited_text();
|
||||
}
|
||||
|
||||
// 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, Sam Atkins <atkinssj@serenityos.org>
|
||||
* Copyright (c) 2022-2023, Sam Atkins <atkinssj@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/GenericShorthands.h>
|
||||
#include <LibUnicode/CharacterTypes.h>
|
||||
#include <LibWeb/CSS/SystemColor.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/HTML/HTMLHtmlElement.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>();
|
||||
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);
|
||||
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);
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <LibGfx/Painter.h>
|
||||
#include <LibGfx/ShareableBitmap.h>
|
||||
#include <LibGfx/SystemTheme.h>
|
||||
#include <LibWeb/CSS/SystemColor.h>
|
||||
#include <LibWeb/Cookie/ParsedCookie.h>
|
||||
#include <LibWeb/HTML/BrowsingContext.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();
|
||||
|
||||
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);
|
||||
|
||||
if (!document->paintable())
|
||||
|
Loading…
Reference in New Issue
Block a user