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

LbWeb: Rename BoxShadowFoo => ShadowFoo

The `text-shadow` property is almost identical to `box-shadow`:
> Values are interpreted as for box-shadow [CSS-BACKGROUNDS-3].
> (But note that the inset keyword are not allowed.)

So, let's use the same data structures and parsing code for both. :^)
This commit is contained in:
Sam Atkins 2022-03-23 16:55:22 +00:00 committed by Andreas Kling
parent f9367a5fdb
commit 1094654adc
13 changed files with 101 additions and 101 deletions

View file

@ -58,7 +58,7 @@ void InlinePaintable::paint(PaintContext& context, Painting::PaintPhase phase) c
Painting::paint_background(context, layout_node(), enclosing_int_rect(absolute_fragment_rect), computed_values().background_color(), &computed_values().background_layers(), border_radius_data);
if (auto computed_box_shadow = computed_values().box_shadow(); !computed_box_shadow.is_empty()) {
Vector<Painting::BoxShadowData> resolved_box_shadow_data;
Vector<Painting::ShadowData> resolved_box_shadow_data;
resolved_box_shadow_data.ensure_capacity(computed_box_shadow.size());
for (auto const& layer : computed_box_shadow) {
resolved_box_shadow_data.empend(
@ -67,7 +67,7 @@ void InlinePaintable::paint(PaintContext& context, Painting::PaintPhase phase) c
static_cast<int>(layer.offset_y.to_px(layout_node())),
static_cast<int>(layer.blur_radius.to_px(layout_node())),
static_cast<int>(layer.spread_distance.to_px(layout_node())),
layer.placement == CSS::BoxShadowPlacement::Outer ? Painting::BoxShadowPlacement::Outer : Painting::BoxShadowPlacement::Inner);
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);
}

View file

@ -203,7 +203,7 @@ void PaintableBox::paint_box_shadow(PaintContext& context) const
if (box_shadow_data.is_empty())
return;
Vector<BoxShadowData> resolved_box_shadow_data;
Vector<ShadowData> resolved_box_shadow_data;
resolved_box_shadow_data.ensure_capacity(box_shadow_data.size());
for (auto const& layer : box_shadow_data) {
resolved_box_shadow_data.empend(
@ -212,7 +212,7 @@ void PaintableBox::paint_box_shadow(PaintContext& context) const
static_cast<int>(layer.offset_y.to_px(layout_box())),
static_cast<int>(layer.blur_radius.to_px(layout_box())),
static_cast<int>(layer.spread_distance.to_px(layout_box())),
layer.placement == CSS::BoxShadowPlacement::Outer ? BoxShadowPlacement::Outer : BoxShadowPlacement::Inner);
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);
}

View file

@ -13,7 +13,7 @@
namespace Web::Painting {
void paint_box_shadow(PaintContext& context, Gfx::IntRect const& content_rect, Vector<BoxShadowData> const& box_shadow_layers)
void paint_box_shadow(PaintContext& context, Gfx::IntRect const& content_rect, Vector<ShadowData> const& box_shadow_layers)
{
if (box_shadow_layers.is_empty())
return;
@ -24,7 +24,7 @@ void paint_box_shadow(PaintContext& context, Gfx::IntRect const& content_rect, V
for (int layer_index = box_shadow_layers.size() - 1; layer_index >= 0; layer_index--) {
auto& box_shadow_data = box_shadow_layers[layer_index];
// FIXME: Paint inset shadows.
if (box_shadow_data.placement != BoxShadowPlacement::Outer)
if (box_shadow_data.placement != ShadowPlacement::Outer)
continue;
// FIXME: Account for rounded corners.

View file

@ -11,20 +11,20 @@
namespace Web::Painting {
enum class BoxShadowPlacement {
enum class ShadowPlacement {
Outer,
Inner,
};
struct BoxShadowData {
struct ShadowData {
Gfx::Color color;
int offset_x;
int offset_y;
int blur_radius;
int spread_distance;
BoxShadowPlacement placement;
ShadowPlacement placement;
};
void paint_box_shadow(PaintContext&, Gfx::IntRect const&, Vector<BoxShadowData> const&);
void paint_box_shadow(PaintContext&, Gfx::IntRect const&, Vector<ShadowData> const&);
}