1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 08:27:45 +00:00

LibWeb: Pass border radii data to shadow painting

This is not used yet, but will be needed for painting shadows on
elements that have a border-radius.
This commit is contained in:
MacDue 2022-06-20 12:09:11 +01:00 committed by Linus Groh
parent 5bf84a5b0e
commit 08baeb1e7d
5 changed files with 8 additions and 4 deletions

View file

@ -302,6 +302,7 @@ class PaintableWithLines;
class StackingContext;
class TextPaintable;
struct BorderRadiusData;
struct BorderRadiiData;
}
namespace Web::RequestIdleCallback {

View file

@ -69,7 +69,7 @@ void InlinePaintable::paint(PaintContext& context, Painting::PaintPhase phase) c
static_cast<int>(layer.spread_distance.to_px(layout_node())),
layer.placement == CSS::ShadowPlacement::Outer ? Painting::ShadowPlacement::Outer : Painting::ShadowPlacement::Inner);
}
Painting::paint_box_shadow(context, enclosing_int_rect(absolute_fragment_rect), resolved_box_shadow_data);
Painting::paint_box_shadow(context, enclosing_int_rect(absolute_fragment_rect), border_radii_data, resolved_box_shadow_data);
}
return IterationDecision::Continue;

View file

@ -230,7 +230,7 @@ void PaintableBox::paint_box_shadow(PaintContext& context) const
static_cast<int>(layer.spread_distance.to_px(layout_box())),
layer.placement == CSS::ShadowPlacement::Outer ? ShadowPlacement::Outer : ShadowPlacement::Inner);
}
Painting::paint_box_shadow(context, enclosing_int_rect(absolute_border_box_rect()), resolved_box_shadow_data);
Painting::paint_box_shadow(context, enclosing_int_rect(absolute_border_box_rect()), normalized_border_radii_data(), resolved_box_shadow_data);
}
BorderRadiiData PaintableBox::normalized_border_radii_data() const

View file

@ -9,13 +9,16 @@
#include <LibGfx/Filters/FastBoxBlurFilter.h>
#include <LibGfx/Painter.h>
#include <LibWeb/Layout/LineBoxFragment.h>
#include <LibWeb/Painting/BorderPainting.h>
#include <LibWeb/Painting/PaintContext.h>
#include <LibWeb/Painting/ShadowPainting.h>
namespace Web::Painting {
void paint_box_shadow(PaintContext& context, Gfx::IntRect const& content_rect, Vector<ShadowData> const& box_shadow_layers)
void paint_box_shadow(PaintContext& context, Gfx::IntRect const& content_rect, BorderRadiiData const& border_radii, Vector<ShadowData> const& box_shadow_layers)
{
(void) border_radii;
if (box_shadow_layers.is_empty())
return;

View file

@ -26,7 +26,7 @@ struct ShadowData {
ShadowPlacement placement;
};
void paint_box_shadow(PaintContext&, Gfx::IntRect const&, Vector<ShadowData> const&);
void paint_box_shadow(PaintContext&, Gfx::IntRect const&, BorderRadiiData const&, Vector<ShadowData> const&);
void paint_text_shadow(PaintContext&, Layout::LineBoxFragment const&, Vector<ShadowData> const&);
}