mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:28:12 +00:00
LibWeb: Convert images to common AbstractImageStyleValue base
This commit moves both the ImageStyleValue and LinearGradientStyleValue to a common base class of AbstractImageStyleValue. This abstracts getting the natural_width/height, loading/resolving, and painting the image. Now for 'free' you get: - Linear gradients working with the various background sizing/repeat properties. - Linear gradients working as list-markers :^) -- best feature ever! P.s. This commit is a little large as it's tricky to make this change incrementally without breaking things.
This commit is contained in:
parent
264543b90a
commit
6a6475673f
13 changed files with 140 additions and 70 deletions
|
@ -765,9 +765,9 @@ void BlockFormattingContext::layout_list_item_marker(ListItemBox const& list_ite
|
|||
|
||||
int image_width = 0;
|
||||
int image_height = 0;
|
||||
if (auto const* list_style_image = marker.list_style_image_bitmap()) {
|
||||
image_width = list_style_image->rect().width();
|
||||
image_height = list_style_image->rect().height();
|
||||
if (auto const* list_style_image = marker.list_style_image()) {
|
||||
image_width = list_style_image->natural_width().value_or(0);
|
||||
image_height = list_style_image->natural_height().value_or(0);
|
||||
}
|
||||
|
||||
int default_marker_width = max(4, marker.font().glyph_height() - 4);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue