Tim Ledbetter
ad06ac0d58
LibWeb: Implement the color-interpolation
property for SVG gradients
...
This changes the operating color space for gradient `<linearGradient>`
and `<radialGradient>` elements.
2025-08-17 10:51:05 +02:00
norbiros
783ae44462
LibWeb: Fix color interpolation by premultiplying alpha
...
The current Color::interpolate_color method does not follow the specs
properly. Started improving it by handling premultiplied alpha in color
interpolation.
Only one WPT test covers this (color-transition-premultiplied), which we
currently pass due to a different approach in Color.mixed_with.
2025-08-14 11:09:05 +02:00
Callum Law
7182a537f3
LibWeb: Reduce inaccuracies when creating rotation matrices
...
When converting rotate transform functions `sin` and `cos` can sometimes
be inaccurate. To avoid these inaccuracies we:
- Mod the angle to minimise inaccuracies in the first place.
- Discard tiny (smaller than epsilon) values returned by `sin` and
`cos` as inaccuracies.
This is in line with other browsers (e.g. Gecko and WebKit).
2025-08-11 17:10:04 +01:00
Jelle Raaijmakers
85ad99b98a
LibWeb: Implement <feMerge>
SVG filter
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
2025-08-07 16:41:12 +02:00
Jelle Raaijmakers
1377dba7af
LibWeb: Implement <feOffset>
SVG filter
2025-08-07 16:41:12 +02:00
Tim Ledbetter
22225af994
LibGfx: Reorder CompositingAndBlendingOperator
values
...
This change aligns blending operator values with the constants in
`SVGFEBlendElement`.
2025-08-06 15:21:03 +02:00
Timothy Flynn
d893d3234d
LibGfx: Support UTF-16 SVG text placement
2025-08-05 15:13:36 +02:00
Jelle Raaijmakers
62cf33b98e
LibGfx: Remove WebP animation writer and utility
...
This went unused.
2025-08-05 11:30:20 +02:00
Idan Horowitz
e81c33da42
LibGfx: Skip manual cropping for the degenerate case
2025-08-04 23:39:11 +02:00
Idan Horowitz
3c3da1ce8c
LibGfx: Allow specifying outside color in Bitmap::cropped()
...
This is required for LibWeb bitmap cropping.
2025-08-04 23:39:11 +02:00
Idan Horowitz
bf2dc77dfc
LibGfx: Remove unused new bitmap format option from Bitmap::cropped()
2025-08-04 23:39:11 +02:00
Callum Law
8a4e9f571f
LibWeb: Respect letter-spacing
for last glyph of each chunk
...
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Previously we would omit the letter spacing for the end glyph of each
chunk in a misguided attempt to conform to the spec's instruction that
we "really should not append letter spacing to the right or trailing
edge of a line", this behaviour can be removed entirely as other
browsers (Firefox, Chrome) don't implement it either.
2025-08-03 22:23:34 +02:00
Aliaksandr Kalenik
41e3ddb7fa
LibGfx+LibWeb: Remove aa_translation
from StrokePath
and FillPath
...
`aa_translation` is something we inherited from times when
AntiAliasingPainter was a thing. This change replaces it by applying
offset directly to path.
2025-08-03 10:42:33 +02:00
Aliaksandr Kalenik
1001ff2599
LibGfx+LibWeb: Delete unused PaintStyle::paint()
implementations
...
These are unused since we moved to Skia and it's misleading to keep
them around.
2025-08-01 04:39:50 -04:00
Timothy Flynn
f3146d3320
LibGfx: Implement a UTF-16 Color stringifier
2025-07-28 12:25:11 +02:00
Arran Ireland
9a8599f265
LibGfx+LibMedia+LibWeb: Use new Matrix subscript operator
2025-07-28 09:15:23 +02:00
Arran Ireland
423e944a92
LibGfx+LibWeb: Upgrade to multi-arg subscript operator in Matrix
...
See the following for more details:
https://en.cppreference.com/w/cpp/language/operators.html#Array_subscript_operator
2025-07-28 09:15:23 +02:00
Rocco Corsi
d322c3a21f
LibGfx: VulkanContext coverity reports integer_overflow on index
...
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Coverity static analysis reports that the code that scans the queue
families for one that has the graphics bit, can be -1 if none are
found, which could cause a problem when the -1 (signed) value is
used later as an index in a uint32_t (unsigned) variable.
Its not immediately clear how often this could occur, not finding
a queue family with the graphics bit, but adding some protecting
just in case.
2025-07-27 23:38:49 -04:00
Timothy Flynn
0e9b694058
LibGfx: Support UTF-16 text shaping
...
We can achieve this with templating the string view type, and then just
piping the view into the correct `hb_buffer_add_utf*` API.
2025-07-25 18:16:22 +02:00
Jelle Raaijmakers
a9862d60bf
LibGfx: Add Color::from_utf16_string()
2025-07-24 07:18:25 -04:00
Kenneth Myhra
09f336bf8f
LibGfx: Use static_cast instead of C-style cast
2025-07-20 12:30:43 +12:00
Jelle Raaijmakers
0f642ecb5c
LibGfx: Replace Bitmap::visually_equals() with ::diff()
...
This produces more granural information on the actual pixel errors
present between two bitmaps. It now also asserts that both bitmaps are
the same size, since we should never compare two differently sized
bitmaps anyway.
2025-07-17 12:59:11 +01:00
Jelle Raaijmakers
144eac44fb
LibGfx: Remove Font::pixel_size_rounded_up()
...
The remaining callsites were removed in the previous commit.
2025-07-15 19:05:36 +01:00
Andreas Kling
a4fb21308d
LibWeb: Don't add range data for FontCascadeList with no Unicode ranges
...
This fixes a bunch of WPT crashes in /html/canvas/offscreen/text/
2025-07-15 10:06:10 +02:00
Andreas Kling
0fece0650e
LibGfx: Let FontCascadeList quickly reject out-of-range code points
...
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
By keeping track of the enclosing range around all Unicode ranges of a
FontCascadeList entry, we can quickly reject any code point that's
outside all ranges.
This knocks font_for_code_point() from 7% to 3% in the profile when
scrolling on https://screenshotone.com/
2025-07-14 19:05:25 +02:00
Lucien Fiorini
635adc8aa7
LibWeb/SVG: Implement resolution for a subset of SVG filters
2025-07-09 18:07:12 +01:00
Aliaksandr Kalenik
c18314b942
LibWeb+LibGfx: Replace BackingStore with PaintingSurface
...
Now, when Skia backend context is available by the time backing stores
are allocated, there is no need to have a separate BackingStore class.
This allows us to get rid of BackingStore -> PaintingSurface cache.
2025-07-04 16:12:47 +02:00
ayeteadoe
d897bfae91
CMake: Rename all_generated target to better convey intent
2025-07-03 23:19:41 +02:00
ayeteadoe
25f5936dee
CMake: Rename serenity_* helper functions/macros to ladybird_*
2025-07-03 23:19:41 +02:00
Timothy Flynn
62d9a84b8d
AK+Everywhere: Replace custom number parsers with fast_float
...
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Build Dev Container Image / build (push) Has been cancelled
Our floating point number parser was based on the fast_float library:
https://github.com/fastfloat/fast_float
However, our implementation only supports 8-bit characters. To support
UTF-16, we will need to be able to convert char16_t-based strings to
numbers as well. This works out-of-the-box with fast_float.
We can also use fast_float for integer parsing.
2025-07-03 09:51:56 -04:00
Jelle Raaijmakers
180bb0fc5d
Everywhere: Remove LibRIFF
2025-07-02 12:01:12 +01:00
ayeteadoe
2119ea982e
LibGfx: Enable in Windows CI
2025-06-26 19:35:14 -06:00
Jelle Raaijmakers
2687246808
LibGfx: Use NonnullRefPtr<Bitmap> for frame descriptors
...
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
This makes it a bit easier to reason about where bitmaps should be
available.
2025-06-25 22:54:48 +12:00
Tim Ledbetter
e69d9fb331
LibGfx: Destroy FontConfig string iterator after use
...
This avoids a memory leak in `FontDatabase::font_directories()`.
2025-06-25 08:59:49 +02:00
Sam Atkins
423cdd447d
LibWeb+LibGfx: Apply editorial punctuation/whitespace/markup fixes
...
Corresponds to d426109ea1
and fd08f81d06
2025-06-25 03:12:19 +12:00
Tom Lynch
b3d459f4de
LibGfx: Nearest neighbor scaling for ScalingMode::SmoothPixels
2025-06-23 16:05:52 +02:00
Luke Wilde
ffae0d8b2d
LibGfx/AVIF: Always reduce decoding output to a bit depth of 8
...
Gfx::Bitmap only supports a bit depth of 8, therefore we refused to
load AVIF images which didn't have this bit depth.
However, we can tell the libavif decoder to reduce the output depth by
setting avifRGBImage.depth to 8. This allows us to support any input
depth.
Makes images load on https://www.ikea.com/ which uses Cloudflare Images
to re-encode their images to 16-bit AVIF.
2025-06-18 14:27:24 +02:00
Colin Reeder
d4a5d16d27
LibGfx: Explicitly link against fontconfig
2025-06-17 16:55:50 -06:00
Shannon Booth
766cbf4937
LibGfx: Remove dependency on LibURL
...
This was previously a dependency (from ICC, if I recall correctly),
but this no longer appears to be the case.
2025-06-17 20:54:03 +02:00
Jelle Raaijmakers
46a46a1c61
LibGfx+LibWeb: Append glyphs in LineBoxFragment run more efficiently
...
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Since we know the number of glyphs we're going to append, ensure the
LineBoxFragment run's capacity once and perform unchecked appends.
2025-06-17 17:03:33 +02:00
Jelle Raaijmakers
5ac067c804
LibGfx: Inline Font::pixel_metrics()
...
Calls to this method were showing up in profiles.
2025-06-17 17:03:33 +02:00
Jelle Raaijmakers
df20ac0f3c
LibGfx: Optimize Gfx::measure_text_width()
...
Instead of constructing a GlyphRun, just add the X advances of all
glyphs to determine a text's width.
2025-06-17 17:03:33 +02:00
Jelle Raaijmakers
631c857301
LibGfx: Only determine glyphs info once in TextLayout
...
We were calling into `hb_buffer_get_glyph_infos()` twice and setting up
an unused `Vector<hb_glyph_info_t>`.
2025-06-17 17:03:33 +02:00
Jelle Raaijmakers
e80914a399
LibGfx: Use Vector::extend()
to extend fonts in FontCascadeList
...
This only grows the capacity once, if required.
2025-06-17 17:03:33 +02:00
Jelle Raaijmakers
7d1ee3a2fa
LibGfx+LibWeb: Perform unchecked appends related to text layout
...
Use unchecked appends in places where we know for certain the vector has
enough capacity.
2025-06-17 11:55:28 +02:00
Jelle Raaijmakers
6710aa102a
LibGfx: Return NonnullRefPtr
in Gfx::shape_text()
...
We always return a glyph run here.
2025-06-17 11:55:28 +02:00
Viktor Szépe
19f88f96dc
Everywhere: Fix typos - act III
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
2025-06-16 14:20:48 +01:00
aplefull
bfc79a403d
LibGfx: Fix ICC v2 profiles with table-based L* curves
...
Skia's SkColorSpace::Make() doesn't seem to like ICC v2 profiles
containing table-based L* transfer curves. Now we use
skcms_ApproximateCurve() to convert these tables to parametric curves
that Skia supports in case Skia's SkColorSpace::Make() fails.
2025-06-16 11:31:42 +02:00
Jelle Raaijmakers
dd4d7d0939
LibGfx: Ensure capacity for glyph runs in TextLayout
...
We can reserve the capacity for new glyph runs since we already know the
glyph count.
2025-06-13 17:31:18 +02:00
Jelle Raaijmakers
4b6489917b
LibGfx: Disable tech(variations)
font support for now
...
We apparently don't support it in the right way, since it causes the
wrong font to display on https://ladybird.org .
2025-06-12 11:04:37 +01:00