Commit graph

62888 commits

Author SHA1 Message Date
Andrew Kaster
989b4ac127 CMake: Ensure that dependency targets are built before AppKit UI files 2024-07-22 09:31:22 -06:00
Aliaksandr Kalenik
2ead999f2b LibGfx+LibWeb: Remove typeface classes for WOFF fonts
This change removes wrappers inherited from Gfx::Typeface for WOFF and
WOFF2 fonts. The only purpose they served is owning of ttf ByteBuffer
produced by decoding a WOFF/WOFF2 font. Now new FontData class is
responsible for holding ByteBuffer when a font is constructed from
non-externally owned memory.
2024-07-22 15:05:04 +02:00
mobounya
2497f43989 LibWeb: Update update_for_history_step_application
Update 'update_for_history_step_application' to meet some of the specs
introduced in https://github.com/whatwg/html/pull/9856 and in
https://github.com/whatwg/html/pull/9990
2024-07-22 10:39:46 +02:00
Lucas CHOLLET
1039561280 LibGfx: Use libjxl to decode JPEG XL images
It currently doesn't support animated image.

Note that Gfx::Bitmap has no support for get_pixel when the format is
RGBA8888. This is why it has been removed from the tests.
2024-07-22 09:15:16 +02:00
Tim Ledbetter
d417b75683 LibWeb/SVG: Ensure SVG transform has an inverse before using it
This avoids a crash that occurred when calling `getBBox()` on an SVG
element that had a transform with no inverse.

Found by Domato.
2024-07-22 09:13:25 +02:00
Tim Ledbetter
4cdafea363 LibWeb: Don't crash when SVG viewbox has a width of 0
Previously, `SVGSVGBox` would have a natural aspect ratio of 0 if it
had a viewbox with zero width. This led to a division by zero, causing
a crash.

Found by Domato.
2024-07-22 09:13:25 +02:00
Tim Ledbetter
604f6040a1 LibWeb: Clamp paintable box maximum scroll offset to 0
Previously calling `PaintableBox::set_scroll_offset()` with a
PaintableBox whose content size was larger than its scrollble overflow
rect would cause a crash.

Found by Domato.
2024-07-22 09:13:25 +02:00
Olekoop
6b88e43b3b LibAudio: Implement PlaybackStream for Android using Oboe
https://github.com/google/oboe

There are many ways to implement audio for Android, however this is
the recommended way to do it.
2024-07-21 16:09:36 -06:00
lmutter
abddd0ac1b UI/Qt: Move New Tab button in tab bar 2024-07-21 16:04:12 -06:00
circl
37f93e4be1 LibWeb: Replace templated retarget function with a regular one
The templating is not necessary anywhere and was effectively just a cast
2024-07-21 16:01:32 -06:00
circl
3adfdd3257 UI: Rename s_serenity_resource_root to s_ladybird_resource_root 2024-07-21 15:59:25 -06:00
Andrew Kaster
922c6bde87 CMake: Enable policy 0157 for more control over Swift compile mode 2024-07-21 15:55:47 -06:00
Andrew Kaster
68ce5f8290 Ladybird/AppKit: Port TaskManager window to Swift
This is just a direct port of the Objective-C++ code to Swift 6.
A future patch should probably update it to actually use SwiftUI.
2024-07-21 15:55:47 -06:00
Andrew Kaster
4066ce2c7e CMake: Ensure C/C++ compile options only applied when compiling C/C++ 2024-07-21 15:55:47 -06:00
Holger Hans Peter Freyther
02ba51f203 LibWeb/DOM: Avoid repeated calls to Node::navigable
Minor optimization to avoid looking up the navigable during a
layout operation.
2024-07-21 21:53:43 +02:00
Timothy Flynn
74d644a216 AK: Explicitly check for null data in Utf16View
The underlying CPU-specific instructions for operating on UTF-16 strings
behave differently for null inputs. Add an explicit check for this state
for consistency.
2024-07-21 19:57:07 +02:00
Timothy Flynn
144452d638 AK: Explicitly check for null data in Utf8View
The underlying CPU-specific instructions for operating on UTF-8 strings
behave differently for null inputs. Add an explicit check for this state
for consistency.
2024-07-21 19:57:07 +02:00
Edwin Hoksberg
ac6126e263 LibWeb: Support percentage values in SVG line element 2024-07-21 19:56:38 +02:00
Edwin Hoksberg
356bddbdbb LibWeb: Support percentage values in SVG text positioning element 2024-07-21 19:56:38 +02:00
Timothy Flynn
4795b9206c LibWebView: Prevent displaying two scroll bars in the inspector console
We currently display scroll bars for the JS console and its parent tab
container. We want the console output to be separately scrollable from
the tab content, but since both containers are scrollable, we end up
with nested scroll bars. This also makes actually scrolling feel pretty
awkward.

Prevent this by making the tab container non-scrollable when the JS
console is shown.
2024-07-21 19:31:35 +02:00
Aliaksandr Kalenik
44e23dce77 LibGfx+LibWeb: Remove everything in LibGfx/Filters
These are no longer needed after switching to use Skia for web page
painting.
2024-07-21 19:30:58 +02:00
Tim Ledbetter
ba56cb6e51 CI: Use single quotes for a literal string in notes-push.yml 2024-07-21 13:25:33 +02:00
Andreas Kling
98f88d49de LibWeb: Make getElementById() always return first match in tree order
We had a const and non-const version of this function, with slightly
different behavior (oops!)

This patch consolidates the implementations and keeps only the correct
behavior in there.

Fixes an issue where comments were not collapsible on Hacker News.
2024-07-21 11:42:53 +01:00
Jamie Mansfield
e4e64c15aa LibWeb/HTML: Stub History.scrollRestoration 2024-07-21 10:50:05 +02:00
Jamie Mansfield
9eede09c3c LibWeb/HTML: Stub HTMLImageElement.{x,y} 2024-07-21 10:50:05 +02:00
Jamie Mansfield
e1317915f4 LibWeb/SVG: Stub missing SVGLength attributes
setraises is no longer used by the spec, so I've removed that FIXME :^)
2024-07-21 10:50:05 +02:00
Jamie Mansfield
6c7089fc9e LibWeb/SVG: SVGSymbolElement includes SVGFitToViewBox 2024-07-21 10:50:05 +02:00
Aliaksandr Kalenik
821416027d LibWeb: Remove unused code in BorderRadiusCornerClipper
No longer used after DisplayListPlayerCPU is gone.
2024-07-21 10:36:17 +02:00
Aliaksandr Kalenik
48bd39c23c LibWeb/Painting: Remove unused apply_filter_list() function
No longer used after DisplayListPlayerCPU is gone.
2024-07-21 10:36:17 +02:00
Aliaksandr Kalenik
1ad35f4677 LibWeb: Remove unused shadow painting functions
No longer used after DisplayListPlayerCPU is gone.
2024-07-21 10:36:17 +02:00
Aliaksandr Kalenik
f3b3b3f5b9 LibWeb: Delete DisplayListPlayerCPU
No longer used after switching to Skia as a default.
2024-07-21 10:36:17 +02:00
Aliaksandr Kalenik
3627329bed Everywhere: Use Skia painter by default
Skia painter is visibly faster than LibGfx painter and has more complete
CSS transforms support. With this change:
- On Linux, it will try to use Vulkan-backend with fallback to
  CPU-backend
- On macOS it will try to use Metal-backend with fallback to
  CPU-backend
- headless-browser always runs with CPU-backend in layout mode
2024-07-21 10:36:17 +02:00
Aliaksandr Kalenik
9851176c25 headless-browser: Disable screenshot tests on macOS
LibGfx's output is consistent across different platforms, which allows
us to have one set of expectations for screenshot tests. This
consistency will not hold for Skia, where features like antialiasing and
gradient color interpolation vary slightly depending on the platform. In
upcoming changes, we are going to switch to using Skia as the default
painter, which leaves us with the following options:

- Have per-platform screenshot test expectations.
- Limit screenshot tests to run only on one platform and maintain a
  single set of expectation files.

For now, I have decided to choose the latter option, using Linux as it
seems to be the most popular platform among developers.
2024-07-21 10:36:17 +02:00
Aliaksandr Kalenik
9ab25c47a4 Tests: Transform some ref tests into screenshot tests
These test work with LibGfx painter but won't longer work after
switching to Skia, because it produces slightly different antialiasing,
rounding in color blending, etc.
2024-07-21 10:36:17 +02:00
sideshowbarker
de66e2551f CI: Make the notes-push workflow not run in forks 2024-07-21 10:34:24 +02:00
sideshowbarker
ce1aa49405 Documentation: Add a bit of history to the FAQ 2024-07-21 07:07:33 +02:00
Andrew Kaster
0384b484bd Ladybird: Set Mach port server namespace to ladybird.org 2024-07-20 23:03:45 +02:00
Andrew Kaster
faa6022ced Ladybird: Switch macOS plist information to use ladybird.org 2024-07-20 23:03:45 +02:00
Andrew Kaster
c6ecf01d7b Meta: Update mailmap with my new ladybird.org email address 2024-07-20 23:03:45 +02:00
mobounya
9c93630d02 LibWeb: Conform HTTP-network-or-cache to specs
Implement step 8.10 in '4.5. HTTP-network-or-cache fetch' from the
fetch specs.
2024-07-20 14:09:51 -06:00
mobounya
9e223f6dae LibWeb: Add fetch group from the fetch spec
Add fetch group concept from the '2.4. Fetch groups' in
the fetch specs to the environment settings object.
2024-07-20 14:09:51 -06:00
mobounya
8d38a1326e LibWeb: Implement fetch record from the fetch spec
Implement fetch record concept from the '2.4. Fetch groups' in
the fetch specs.
2024-07-20 14:09:51 -06:00
Ángel Carias
69da6a0ce4 LibWeb: Implement Text.wholeText
This getter returns the concatenation of the data of the contiguous
Text nodes of `this` (being this plus its siblings) in tree order.
2024-07-20 18:02:51 +01:00
Andreas Kling
7dacd6be89 LibWeb: Use static_cast<HTMLTemplateElement> right after an is<> check
The double verify_cast here was just barely visible in a profile.
2024-07-20 15:35:30 +02:00
Andreas Kling
f9f11dc51d LibWeb: Stop creating transient throwaway JS::Handles in HTML parser
These were being immediately stored in JS::GCPtrs (and dutifully visited
by HTMLParser), so creating temporary handles for them was a complete
waste of time.
2024-07-20 15:35:30 +02:00
Andreas Kling
dba6216caa LibWeb: Skip CSS tokenizer filtering when string has no '\r' or '\f'
When loading a canned version of reddit.com, we end up parsing many many
shadow tree style sheets of roughly ~170 KiB text each.

None of them have '\r' or '\f', yet we spend 2-3 ms for each sheet just
looping over and reconstructing the text to see if we need to normalize
any newlines.

This patch makes the common case faster in two ways:

- We use TextCodec::Decoder::to_utf8() instead of process()
  This way, we do a one-shot fast validation and conversion to UTF-8,
  instead of using the generic code-point-at-a-time callback API.

- We scan for '\r' and '\f' before filtering, and if neither is present,
  we simply use the unfiltered string.

With these changes, we now spend 0 ms in the filtering function for the
vast majority of style sheets I've seen so far.
2024-07-20 15:35:30 +02:00
Andreas Kling
7892ee355d LibWeb: Use StringBuilder::append_code_point() over append(Utf32View)
When appending a single Unicode code point, we don't have to go through
the trouble of creating a Utf32View wrapper over it.
2024-07-20 15:35:30 +02:00
Andreas Kling
1a46d8df5f LibTextCodec: Use String::from_utf8() when decoding UTF-8 to UTF-8
This way, we still perform UTF-8 validation, but don't go through the
slow generic code path that rebuilds the decoded string one code point
at a time.

This was a bottleneck when loading a canned copy of reddit.com, which
ended up being ~120 MiB large.

- Time spent decoding UTF-8 before this change: 1192 ms
- Time spent decoding UTF-8 after this change:  154 ms

That's still a long time, but 7.7x faster is nothing to sneeze at! :^)

Note that if the input fails UTF-8 validation, we still fall back to
the slow path and insert replacement characters per the WHATWG Encoding
spec: https://encoding.spec.whatwg.org/#utf-8-decode
2024-07-20 14:29:37 +02:00
sideshowbarker
1a9dabe5ff LibGfx: Handle UTF-16-encoded OpenType font names
This change makes OpenType::Name::string_for_id handle fonts whose names
are UTF-16-encoded (along with handling UTF-8-encoded names).

Otherwise, without this change, the existing code assumes the names are
UTF-8-encoded, fails gracelessly if they’re not, and crashes.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/75
2024-07-20 12:41:02 +01:00
Andreas Kling
3faff34bf6 LibWeb: Make details and summary elements display:block in the UA style
This is the expected behavior per the HTML spec. Fixes an issue where
styling these elements wouldn't have the expected effect unless you also
set the display property.
2024-07-20 13:09:28 +02:00