mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-01 15:18:06 +00:00
LibGfx+LibWeb: Turn Gfx::Filter into a SkImageFilter wrapper
This commit is contained in:
parent
417f4edc46
commit
0fcb574041
Notes:
github-actions[bot]
2025-06-01 21:23:19 +00:00
Author: https://github.com/ananas-dev
Commit: 0fcb574041
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4692
Reviewed-by: https://github.com/kalenikaliaksandr ✅
Reviewed-by: https://github.com/konradekk
26 changed files with 412 additions and 256 deletions
|
@ -118,8 +118,8 @@ public:
|
|||
static CSS::Display display() { return CSS::Display { CSS::DisplayOutside::Inline, CSS::DisplayInside::Flow }; }
|
||||
static Color color() { return Color::Black; }
|
||||
static Color stop_color() { return Color::Black; }
|
||||
static Vector<Gfx::Filter> backdrop_filter() { return {}; }
|
||||
static Vector<Gfx::Filter> filter() { return {}; }
|
||||
static Optional<Gfx::Filter> backdrop_filter() { return {}; }
|
||||
static Optional<Gfx::Filter> filter() { return {}; }
|
||||
static Color background_color() { return Color::Transparent; }
|
||||
static CSS::ListStyleType list_style_type() { return CSS::CounterStyleNameKeyword::Disc; }
|
||||
static CSS::ListStylePosition list_style_position() { return CSS::ListStylePosition::Outside; }
|
||||
|
@ -451,8 +451,8 @@ public:
|
|||
CSS::JustifyContent justify_content() const { return m_noninherited.justify_content; }
|
||||
CSS::JustifySelf justify_self() const { return m_noninherited.justify_self; }
|
||||
CSS::JustifyItems justify_items() const { return m_noninherited.justify_items; }
|
||||
Vector<Gfx::Filter> const& backdrop_filter() const { return m_noninherited.backdrop_filter; }
|
||||
Vector<Gfx::Filter> const& filter() const { return m_noninherited.filter; }
|
||||
Optional<Gfx::Filter> const& backdrop_filter() const { return m_noninherited.backdrop_filter; }
|
||||
Optional<Gfx::Filter> const& filter() const { return m_noninherited.filter; }
|
||||
Vector<ShadowData> const& box_shadow() const { return m_noninherited.box_shadow; }
|
||||
CSS::BoxSizing box_sizing() const { return m_noninherited.box_sizing; }
|
||||
CSS::Size const& width() const { return m_noninherited.width; }
|
||||
|
@ -680,8 +680,8 @@ protected:
|
|||
CSS::LengthBox inset { InitialValues::inset() };
|
||||
CSS::LengthBox margin { InitialValues::margin() };
|
||||
CSS::LengthBox padding { InitialValues::padding() };
|
||||
Vector<Gfx::Filter> backdrop_filter { InitialValues::backdrop_filter() };
|
||||
Vector<Gfx::Filter> filter { InitialValues::filter() };
|
||||
Optional<Gfx::Filter> backdrop_filter { InitialValues::backdrop_filter() };
|
||||
Optional<Gfx::Filter> filter { InitialValues::filter() };
|
||||
BorderData border_left;
|
||||
BorderData border_top;
|
||||
BorderData border_right;
|
||||
|
@ -849,8 +849,8 @@ public:
|
|||
void set_list_style_type(CSS::ListStyleType value) { m_inherited.list_style_type = value; }
|
||||
void set_list_style_position(CSS::ListStylePosition value) { m_inherited.list_style_position = value; }
|
||||
void set_display(CSS::Display value) { m_noninherited.display = value; }
|
||||
void set_backdrop_filter(Vector<Gfx::Filter> backdrop_filter) { m_noninherited.backdrop_filter = move(backdrop_filter); }
|
||||
void set_filter(Vector<Gfx::Filter> filter) { m_noninherited.filter = move(filter); }
|
||||
void set_backdrop_filter(Optional<Gfx::Filter> backdrop_filter) { m_noninherited.backdrop_filter = move(backdrop_filter); }
|
||||
void set_filter(Optional<Gfx::Filter> filter) { m_noninherited.filter = move(filter); }
|
||||
void set_border_bottom_left_radius(CSS::BorderRadiusData value)
|
||||
{
|
||||
m_noninherited.has_noninitial_border_radii = true;
|
||||
|
|
|
@ -4545,7 +4545,7 @@ RefPtr<CSSStyleValue const> Parser::parse_filter_value_list_value(TokenStream<Co
|
|||
|
||||
auto filter_token_to_operation = [&](auto filter) {
|
||||
VERIFY(to_underlying(filter) < to_underlying(FilterToken::Blur));
|
||||
return static_cast<Gfx::ColorFilter::Type>(filter);
|
||||
return static_cast<Gfx::ColorFilterType>(filter);
|
||||
};
|
||||
|
||||
auto parse_filter_function_name = [&](auto name) -> Optional<FilterToken> {
|
||||
|
|
|
@ -78,19 +78,19 @@ String FilterValueListStyleValue::to_string(SerializationMode) const
|
|||
builder.appendff("{}(",
|
||||
[&] {
|
||||
switch (color.operation) {
|
||||
case Gfx::ColorFilter::Type::Brightness:
|
||||
case Gfx::ColorFilterType::Brightness:
|
||||
return "brightness"sv;
|
||||
case Gfx::ColorFilter::Type::Contrast:
|
||||
case Gfx::ColorFilterType::Contrast:
|
||||
return "contrast"sv;
|
||||
case Gfx::ColorFilter::Type::Grayscale:
|
||||
case Gfx::ColorFilterType::Grayscale:
|
||||
return "grayscale"sv;
|
||||
case Gfx::ColorFilter::Type::Invert:
|
||||
case Gfx::ColorFilterType::Invert:
|
||||
return "invert"sv;
|
||||
case Gfx::ColorFilter::Type::Opacity:
|
||||
case Gfx::ColorFilterType::Opacity:
|
||||
return "opacity"sv;
|
||||
case Gfx::ColorFilter::Type::Saturate:
|
||||
case Gfx::ColorFilterType::Saturate:
|
||||
return "saturate"sv;
|
||||
case Gfx::ColorFilter::Type::Sepia:
|
||||
case Gfx::ColorFilterType::Sepia:
|
||||
return "sepia"sv;
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
|
|
|
@ -45,7 +45,7 @@ struct HueRotate {
|
|||
};
|
||||
|
||||
struct Color {
|
||||
Gfx::ColorFilter::Type operation;
|
||||
Gfx::ColorFilterType operation;
|
||||
NumberPercentage amount { Number { Number::Type::Integer, 1.0 } };
|
||||
float resolved_amount() const;
|
||||
bool operator==(Color const&) const = default;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue