100 Commits
Author SHA1 Message Date
Jelle Raaijmakers ef52f79ae0 LibWeb: Implement HTMLOrSVGElement.nonce
There are two FIXMEs remaining that depend on a functional
PolicyContainer, which we ignore for now and always behave like a CSP is
set.

(cherry picked from commit 84fe8d675b21ca5fa7da663e6ca86718f05cf29f)
2026-09-17 10:39:03 -04:00
Jelle Raaijmakers 92454e29fe LibWeb: Remove unused includes from HTMLElement and SVGElement
(cherry picked from commit 8dcab6977913268db13c90dd408a080111f1654e)
2026-09-17 10:39:03 -04:00
Jelle Raaijmakers 6259c8acc6 LibWeb: Factor out HTMLOrSVGElement
This is a mixin in the IDL, so let's treat it as a mixin in our code and
let both SVGElement and MathMLElement reuse the implementations that we
wrote for HTMLElement.

(cherry picked from commit 5f84c2c3afef81fac09b9b255baa97326ce2b4cd)
2026-09-17 10:39:03 -04:00
Jelle Raaijmakers d625c43bd1 Ports/SDL2: Clear g_app on VideoQuit
We initialize a static GUI::Application in VideoInit that is never
explicitly destructed. Because we don't do so, SDL2 applications can
crash on exit since static destruction of the application will try to
destruct its owned event loop, which was thread-local and already
destroyed.

By clearing the RefPtr in VideoQuit, we prevent crashing directly
afterwards in Serenity's `exit()`.
2026-08-11 08:15:39 -04:00
Jelle Raaijmakers 2765782693 Ports: Update to ScummVM 2026.3.0
Add giflib so the Hpl1 and Phoenix VR engines remain enabled. Hpl1
bundles AngelScript, which expects malloc.h on most non-BSD systems, but
Serenity provides the allocation functions through stdlib.h.
2026-08-11 06:17:36 -04:00
Jelle Raaijmakers f0b11ae0ff Ports: Use current giflib URL and SerenityOS build rules
SourceForge moved the 5.x releases into a subdirectory. Pass SerenityOS
as UNAME while building and installing so giflib selects ELF
shared-library flags on macOS hosts.
2026-08-11 06:17:36 -04:00
Jelle Raaijmakers de9b14e227 Ports: Make downloads fail on HTTP errors
Make curl reject HTTP errors so failed downloads are not mistaken for
valid files.
2026-08-11 06:17:36 -04:00
Jelle Raaijmakers 17573a1b6b Ports: Use cgit for config.sub and config.guess
Use Savannah's cgit endpoints, since the old gitweb endpoints now return
error pages instead of config.sub and config.guess.
2026-08-11 06:17:36 -04:00
Jelle Raaijmakers bff31bc187 CI: Upload wasm artifact on all branches
This might be useful someday, and I don't see a good reason to limit
this to the master branch.
2025-12-09 11:40:28 -05:00
Jelle Raaijmakers 006b918d66 CI: Stop using BUGGIEBOT_TOKEN for repository checkouts
We don't need a default token to have write permissions to anything,
since we use BUGGIEBOT_TOKEN to do the actual publishing. Additionally,
checkouts should just use the default token since both repositories are
public.

Finally, we pin the version for actions/checkout to 6.0.0 so we don't
include the change for the new `includeIf` git config in 6.0.1, which
breaks JamesIves/github-pages-deploy-action. The fix for that should
land in the first version after v4.7.4.
2025-12-09 11:40:28 -05:00
Jelle Raaijmakers 7625ac5a1d Ports: Update to ScummVM 2.9.1
Pass in `--disable-seq-midi` to prevent trying to compile against OSS
(we don't supply `sys/soundcard.h`).
2025-07-03 00:14:23 +02:00
Jelle Raaijmakers b8cb65086a Ports: Compile libmpeg2 with -std=gnu89
libmpeg2 defines `getopt()` without any parameters, which fails to
compile on newer C standards.
2025-07-03 00:14:23 +02:00
Jelle Raaijmakers c5011889bd LibC: Pull in timespec in signal.h instead of including time.h
According to POSIX, we must define `timespec`, but we _may_ include
`time.h` in doing so. Compiling ScummVM 2.9.1 against LibC was failing
because compared to glibc, we were pulling in `time.h` too early which
caused conflicts in ScummVM's `common/forbidden.h`.
2025-07-03 00:14:23 +02:00
Jelle Raaijmakers 8dad887627 Meta: Bump the pre-commit feature version to 2 in dev-container
Version 1 does not exist after the rename.
2025-06-23 21:16:51 +02:00
Jelle RaaijmakersandPhilipp Dreher d70a9435e6 Meta: Switch to different source for pre-commit feature in dev-container
Co-authored-by: Philipp Dreher <[email protected]>
2025-06-23 21:07:56 +02:00
Jelle Raaijmakers ccda8d1e28 LibWeb: Implement indexed property support for HTML::Storage
We only supported named properties on Storage, and as a result
`localStorage[0]` would be disconnected from the Storage's backing map.

Fixes at least 20 subtests in WPT in /webstorage.

(cherry picked from commit 4c189166f4f721211ff9b693f306f65033d70ac1)
2024-11-29 23:02:23 -05:00
Jelle Raaijmakers a19bb3d808 LibWeb: Clear grapheme segmenter when invalidating TextNode text
We only set the grapheme segmenter's text once after creating a new
segmenter, so we also need to clear it whenever we invalidate the text.

(cherry picked from commit 25516e351e46104ff445216e7835aaab9f9b9535)
2024-11-27 12:57:15 -05:00
Jelle Raaijmakers cbf8857e8d LibWeb: Do not resolve inline block height early if height is definite
This condition was included to implement flex containers with auto
height, but it actually can reset the definitive height to 0 for inline
blocks with only replaced elements such as an SVG. Removing the
condition does not break any in-tree test, so let's improve the
situation on the SVG side of things for now.

(cherry picked from commit 352a66390f27fb7bbbfa823364fefc9af00d4b63)
2024-11-24 13:38:45 -05:00
Jelle Raaijmakers ef09e057ee LibWeb: Fix filter: drop-shadow argument parsing
We were not discarding enough whitespace to actually get to the radius
and color values.

(cherry picked from commit c99fad77e1cfc8789f2a8d33e958d7b5bcf35ea9)
2024-11-19 11:02:38 -05:00
Jelle Raaijmakers 93a8c61fe9 LibWeb: Parse and store filter property
This shares its implementation with `backdrop-filter`.

(cherry picked from commit 29974de852fb14eef78a18232bd36d5c8955a214;
amended to resolve conflict on `height:` in expectations file, and to
remove change to DisplayListPlayerSkia.cpp which serenity doesn't have;
also updated FilterPainting.{h,cpp} for changes since serenity does not
have LadybirdBrowser/ladybird#736 and LadybirdBrowser/ladybird#886)
2024-11-19 11:02:38 -05:00
Jelle Raaijmakers 35f4f5cf54 LibWeb: Implement AudioListener
This exposes BaseAudioContext.listener, which is a container for
parameters related to the configuration of an actual "listener" in 3D
space.

(cherry picked from commit 2a98f2a12d5069a2189fa38b4a7e158d84ee03ec)
2024-11-14 17:46:06 -05:00
Jelle Raaijmakers f36546d591 LibWeb: Update DOM IDL specs
I noticed some of these were running behind the upstream spec.

(cherry picked from commit d5fd29adb79641830835e2efd9541de08d0ad6fc)
2024-11-14 17:46:06 -05:00
Jelle Raaijmakers ec6803eb44 LibWeb: Implement pending promises in BaseAudioContext
Move the pending promises list from AudioContext to BaseAudioContext and
deal with all remaining FIXMEs.

(cherry picked from commit 2df3488840ccf8e8c560bde4826897c2023dbe29)
2024-11-13 19:32:02 -05:00
Jelle Raaijmakers 57e6b8cd85 LibWeb: Add PointerEvent.getCoalescedEvents() and .getPredictedEvents()
Fixes at least 4 WPT subtests in /pointerevents.

(cherry picked from commit 27928cd28c89b2cbf1291c25be9accfb3ec18146)
2024-11-13 10:17:34 -05:00
Jelle Raaijmakers 3ce27bfc73 LibWeb: Add PointerEvent.persistentDeviceId
Fixes at least 2 WPT subtests in /pointerevents.

(cherry picked from commit effa21a69f9323871da927177b85f3c61b98cc3a)
2024-11-13 10:17:34 -05:00
Jelle Raaijmakers fb8870d710 LibWeb: Add barebones BaseAudioContext.decodeAudioData()
Implement just enough steps to get https://zty.pe/ working! :^)

(cherry picked from commit 14b2e5849d4b82aec6900253f6f035a9b356bad3)
2024-11-13 10:17:34 -05:00
Jelle Raaijmakers 4e0c54fa61 LibWeb: Accept JS::HeapFunction when queuing a media element task
This opens up the possibility of easier memory management in future
changes.

(cherry picked from commit 7b76438d579959edd800de14cb30c57eadb14669)
2024-11-13 10:17:34 -05:00
Jelle Raaijmakers b5f61be76a LibWeb: Move 'queue a media element task' to BaseAudioContext
We need these steps to be available for the yet to be implemented
`BaseAudioContext.decodeAudioData()`.

(cherry picked from commit 177e5210e09ee4b5906e5d7db34154fae4ec76c6)
2024-11-13 10:17:34 -05:00
Jelle Raaijmakers 4a6281221e LibWeb: Remove unused include from AudioBuffer
(cherry picked from commit 273a46cc769d1ad614d974ca6c60fb4911e81a07)
2024-11-13 10:17:34 -05:00
Jelle Raaijmakers d1a5ef62ce LibWeb: Correct AudioBuffer spec link
(cherry picked from commit 3df3977ca5f16ec3955e0222bc277fcf2619a915)
2024-11-13 10:17:34 -05:00
Jelle Raaijmakers 8563e4a1cc Meta: Reuse built-in JS types list for IDL to C++ generation
This opens up the code path for the `ArrayBuffer` type, which can now be
used as a method argument.

(cherry picked from commit 0b9d55b6761b85b3b80a459d6231841e72a26c51)
2024-11-13 10:17:34 -05:00
Jelle Raaijmakers 8c714769f3 LibWeb: Implement navigator.deviceMemory
Fixes at least 2 subtests in wpt/device-memory.

(cherry picked from commit 69f11fc1c657603b189015fd620f96e32adfb9fd)
2024-11-12 22:26:21 -05:00
Jelle Raaijmakers 3a79099303 LibWeb: Add WebIDL::Double type
(cherry picked from commit 6189d1ac9d73347638c3cbec4d7e21a390edd238)
2024-11-12 22:26:21 -05:00
Jelle Raaijmakers 2ce1b1af9b LibCore: Add System::physical_memory_bytes()
(cherry picked from commit 9515290fde3c973226c9737cbd055ebd85df7101)
2024-11-12 22:26:21 -05:00
Jelle Raaijmakers 957ee8276a LibWeb: Use right interface for custom SVG and MathML elements
The DOM spec gets overridden by both the SVG2 and MathML core specs in
that unknown elements should not inherit DOM::Element, but
SVG::SVGElement and MathML::MathMLElement respectively.

(cherry picked from commit 76e638b4ca10a91983877d6f6e7f037c1a720965)
2024-11-12 07:14:25 -05:00
Jelle Raaijmakers 07b7693349 LibWeb: Implement AudioNode.channelCount
(cherry picked from commit cb212015505f9a029c282d13697c9bd7e33df513)
2024-11-11 19:54:09 -05:00
Jelle Raaijmakers 8c86f9ad75 LibWeb: Implement AudioNode.numberOfInputs and .numberOfOutputs
(cherry picked from commit 7b4f0d13eede588368189bb612ca9c90e2d56894)
2024-11-11 19:54:09 -05:00
Jelle Raaijmakers 7189d342f5 LibWeb: Forward declare AudioDestinationNode to break header loop
(cherry picked from commit d7a3bad2b4c08b02c3df73e6c344c6bf7dadcbeb)
2024-11-11 19:54:09 -05:00
Jelle Raaijmakers b471972353 UI/Qt: Enable basic IME keyboard input for WebContentView
This makes dead keys work (e.g. typing ' and e results in é).

(cherry picked from commit 7e57cc7b090455e93261c847064f12a61d686ff3)
2024-11-10 18:24:10 -05:00
Jelle Raaijmakers fe5fa25f47 LibWeb: Implement the "fire a focus event" spec
We weren't setting the focus event's composed flag and view field
correctly.

(cherry picked from commit 124779a376a6951029f81bda980452440a6c6edf)
2024-11-09 07:30:40 -05:00
Jelle Raaijmakers eb7b733325 LibWeb: Compare start container to parent in Text.splitText()
Tiny mistake in the implementation of the spec; fixes 16 FAILs in the
WPT `/dom/ranges/Range-mutations-splitText.html` tests.

(cherry picked from commit dee81f354531c2e49be34279ca31ccc7ad9cbcca)
2024-11-09 07:29:52 -05:00
Jelle Raaijmakers 154af3da1c LibWeb: Implement HTMLMediaElement.preload attribute
This implements the `preload` reflected attribute. No actual preloading
is going on yet.

(cherry picked from commit fe933b2057eee8eb65d6e43a97b934bbe85d03bb)
2024-11-07 23:07:20 -05:00
Jelle Raaijmakers 6264698077 LibWeb: Check presence of WWW-Authenticate header in fetch response
If a HTTP 401 response we get does not contain a `WWW-Authenticate`
header, we should not trigger the logic to ask the user for credentials
and retry the request.

This part is hinted at in a TODO / 'Needs testing' remark in the spec
but needs to be fleshed out. Raised an upstream issue to do so:

  https://github.com/whatwg/fetch/issues/1766

This fixes login forms triggering an infinite fetch loop when providing
incorrect credentials.

Co-Authored-By: Victor Tran <[email protected]>
(cherry picked from commit e7984a77116d47fde150f81f6e18cae6aaa147ad)
2024-11-07 22:17:03 -05:00
Jelle Raaijmakers 94a64acb2e LibWeb: Account for intrinsic width or height in flex base size
In calculating the base size of a flex item, we have a piece of ad-hoc
code that deals with an item that does have an instrinsic aspect ratio,
but not a cross size to resolve that ratio against. In determining the
actual flex item size however, we also take into account the minimum
content width and height, which assumes the box' intrinsic width or
height when available. This would break having an image as a flex item,
which gets stretched to its maximum size within the flex container
instead of the flex item being shrunk to the instrinsic size of the
image.

Fix this by only stretching flex items that do not have an instrinsic
width nor height set.

(cherry picked from commit 7a783d3a89aec0caaa63a483c855fe921b6d0984)
2024-11-04 21:46:05 -05:00
Jelle Raaijmakers 7c9cafc8f9 LibWeb: Update two spec URIs
No functional changes.

(cherry picked from commit d82f8a4b16097ad2b5d0d61787c8f72c0f43830f)
2024-11-04 21:46:05 -05:00
Jelle Raaijmakers 97e91ab12d LibWeb: Remove unused includes
No functional changes.

(cherry picked from commit 89d21335a127dc385d91aeedac36e78aa662ee83)
2024-11-04 21:46:05 -05:00
Jelle Raaijmakers 33562cc25e LibWeb: Propagate input/textarea selection update to document selection
Calling `.setSelectionRange()` or `.select()` now updates the document
selection as well, visualizing the text selection.

(cherry picked from commit 732e3fa82f216a6f4114eb0e6bb89e167e95ab42)
2024-11-04 13:17:37 -05:00
Jelle Raaijmakers e140e94f25 LibWeb: Update input/textarea selection on document selection change
This causes UI interactions with the document selection to also update
the input and textarea DOM selection state. Note that we switch around
the order of focusing a DOM node and setting the selection, so we allow
the focus event to override whatever selection we came up with.

(cherry picked from commit badcdcacf5488b6aedab8184774393ba1e86821a)
2024-11-04 13:17:37 -05:00
Jelle Raaijmakers cb1edae2ca LibWeb: Implement input/textarea selection APIs
For both types of elements, `.selectionStart`, `.selectionEnd`,
`.selectionDirection`, `.setSelectionRange()`, `.select()` and the
`select` event are now implemented.

(cherry picked from commit 814ca3267ed73d7ad8492ef69ff87f95240cf922)
2024-11-04 13:17:37 -05:00
Jelle Raaijmakers 99262278ea LibWeb: Remove duplicate code from ViewportPaintable
No functional changes.

(cherry picked from commit 69bbeea4ef3308487145a85c68eb5413fa4ce287)
2024-11-04 13:17:37 -05:00
Jelle Raaijmakers 1da66b51fc Meta: Move SerenityOS.org website to separate repository
Our website is now hosted on GitHub pages, and published through this
new repository:

  https://github.com/SerenityOS/serenityos.org
2024-11-02 02:02:57 +01:00
Jelle Raaijmakers 1ac99ab1a5 LibIDL: Allow trailing comma in enumerations
IDL enumerations are one of the rare list types in the IDL spec that
allow for a trailing comma:

https://www.w3.org/Bugs/Public/show_bug.cgi?id=17508
(cherry picked from commit 47597d0fb83d78eaf43be549cd7fe23e9b239b78)
2024-11-01 08:31:05 -04:00
Jelle Raaijmakers da878d0695 LibGfx: Fix an off-by-one issue in EdgeFlagPathRasterizer
This caused the last scanlines for edges to render incorrectly. We had
some reference images which included these corruptions (they were almost
unnoticeable), so update them as well.

(cherry picked from commit 5865cf58641794eac73f200a784829d867ccf8b7;
but only the changes to EdgeFlagPathRasterizer.cpp that aren't related
to premultiplied alpha; also this affects more screenshot tests for
us since we use EdgeFlagPathRasterizer for most painting)
2024-10-21 10:13:03 -04:00
Jelle Raaijmakers a76bed61cb LibGfx: Prefix class members with m_ in EdgeTable
No functional changes.

(cherry picked from commit 56ff36a0ee4160913c40aa8553d8a49256b7c1b7)
2024-10-21 10:13:03 -04:00
Jelle Raaijmakers 0f29ed58ec LibGfx: Fix "coverage" typos in EdgeFlagPathRasterizer
No functional changes.

(cherry picked from commit f5d838b64ce539c05fa47cbf7b6881c1a793a743)
2024-10-21 10:13:03 -04:00
Jelle Raaijmakers 741c1afb7c LibGfx: Remove unused ColorRole forward from Color.h
(cherry picked from commit 3eb4da514ca2113a189adf9276f612537d033a6b)
2024-10-21 10:13:03 -04:00
Jelle Raaijmakers 004462c6e9 LibWeb: Implement history.scrollRestoration
(cherry picked from commit 2106617f5b97dd2e3c4aea11ef26685f43e75261)
2024-10-20 16:39:16 -04:00
Jelle Raaijmakers da60529ab8 Ports: Update ScummVM to 2.8.1 2024-04-10 21:12:25 +02:00
Jelle Raaijmakers 2831e68999 LibGL+LibGPU+LibSoftGPU: Implement constant blending color
Available since OpenGL 2.0, calling `glBlendColor` allows you to set a
constant color to be used as a blend factor.
2024-04-10 21:12:25 +02:00
Jelle Raaijmakers f3d3454976 LibGL: Move blending functions to a separate unit 2024-04-10 21:12:25 +02:00
Jelle Raaijmakers b2eaed43e9 Ports: Remove LibGL workarounds
Now that ports can find our OpenGL headers and shared library, remove
all configuration and patches that was previously needed to make ports
compile with LibGL.
2024-02-22 03:48:08 +01:00
Jelle Raaijmakers 857ab2e06d LibGL: Create symlinks for headers and shared library
This allows ports to access the OpenGL headers using `#include
<GL/gl.h>` and find the shared library at `/usr/lib/libGL.so` or
`/usr/lib/libGL.so.1`, removing the need for explicit include paths or
changed library names.
2024-02-22 03:48:08 +01:00
Jelle Raaijmakers 5cff59557e LibGL: Add all glPushAttrib bit flags
This is required to build the `sdl12-compat` port when it's using our
header files to compile.
2024-02-22 03:48:08 +01:00
Jelle Raaijmakers e54e2a5a4f Ports: Patch curl CMake issue
The CMake syntax was a bit too new for our toolchain's CMake. The
following patch was backported:

  https://github.com/curl/curl/commit/b2497a8d15284dfef4fa7f032572e07b0b4b4720

Relevant issue:

  https://github.com/curl/curl/issues/12920

As soon as the fix lands in the next curl version, we can remove this
patch again. :^)
2024-02-21 22:24:42 +01:00
Jelle Raaijmakers aa3a6767f6 LibGL+LibGPU+LibSoftGPU: Implement blend equations
This implements support for `glBlendEquation` and
`glBlendEquationSeparate`. These functions modify the calculation of the
resulting color in blending mode.
2024-02-19 23:23:40 +01:00
Jelle Raaijmakers 55668c3e48 LibGfx: Implement AK::min/max for Gfx::VectorN
These return a new `Gfx::VectorN` with the minimum or maximum value of
each element.
2024-02-19 23:23:40 +01:00
Jelle Raaijmakers 66859c8cd8 Ports/SDL2: Support ShowMessageBox before VideoInit
An SDL2 application is allowed to show a message box before the video
subsystem is initialized. This change makes sure GUI::Application is
initialized.

An example of this is SRB2: the process forks itself to let the child
process install itself as the signal handler and deal with errors. This
child process could try to show a message box long after the video
subsystem was initialized, but since it is a forked process there is no
static state for GUI::Application or the connection to the window
server and the process would crash because of a null dereference.
2024-02-15 12:33:23 +01:00
Jelle Raaijmakers 2a749525e0 LibGL: Add API stubs
- glBlendEquation
- glGetShaderInfoLog
- glGetUniformLocation
- glUniform*

This gives us full API coverage for the SRB2 port.
2024-02-14 15:09:53 +01:00
Jelle Raaijmakers e18bc2a748 LibGL: Combine glLightModel definitions
Create a single definition with two variants for `glLightModeli` and
`glLightModelf`.
2024-02-14 15:09:53 +01:00
Jelle Raaijmakers 60bd458ed2 LibGL: Allow function name override in API definitions
Instead of limiting ourselves to the key of the property in the JSON,
allow overriding the function name so we can generate completely
different function signatures with very similar names to other existing
API methods (e.g. `glUniform*` vs `glUniform*v`).
2024-02-14 15:09:53 +01:00
Jelle Raaijmakers 96675e61cd Kernel/TTY: Support non-blocking reads with termios VMIN == 0
In a TTY's non-canonical mode, data availability can be configured by
setting VMIN and VTIME to determine the minimum amount of bytes to read
and the timeout between bytes, respectively. Some ports (such as SRB2)
set VMIN to 0 which effectively makes reading a TTY such as stdin a
non-blocking read. We didn't support this, causing ports to hang as soon
as they try to read stdin without any data available.

Add a very duct-tapey implementation for the case where VMIN == 0 by
overwriting the TTY's description's blocking status; 3 FIXMEs are
included to make sure we clean this up some day.
2024-02-13 19:48:39 +01:00
Jelle Raaijmakers 50bba8d9fc Ports: Add glu as a dependency to SRB2
SRB2 will try to load libGLU.so.1 dynamically if started with the OpenGL
renderer, so add it as a dependency. The game still crashes immediately,
but this brings us one step closer :^)
2024-02-12 18:01:22 +01:00
Jelle Raaijmakers 401a37417b Ports: Update glu to 9.0.3
This necessitates a switch to the Meson build system. A nice side effect
of this is that we now build & install the shared library for glu as
well.
2024-02-12 18:01:22 +01:00
Jelle Raaijmakers 6b08b43a1e Ports: Update URL for qt6-qt5compat
They moved the file from `official_releases` to `archive` :^)
2024-02-06 08:46:10 +01:00
Jelle Raaijmakers f5dec55fd6 Kernel: Correct mapping of PS/2 keyboard exclamation point
Pressing Shift+1 resulted in `Key_Escape` being sent as the event's key.
2024-01-14 15:06:37 -07:00
Jelle Raaijmakers 055f78f528 Ports: Update SDL2 scancode mapping
This was broken since c8f27d7cb8 introduced a new enum value in
between existing values. Since the Serenity platform support in SDL2
relied on a sequential array index, a lot of keys were now incorrectly
mapped.

This introduces a new way to map Serenity `KeyCode` to SDL2's scancode
constants that is less prone to breaking in the future.
2024-01-14 15:06:37 -07:00
Jelle Raaijmakers 015622bc22 Kernel: Set correct KeyCode count
The underlying value of the `KeyCode::Key_*` enum values starts at 0,
so we should add 1 to `Key_Menu` to get the correct count.
2024-01-14 15:06:37 -07:00
Jelle Raaijmakers 8b2144c8e6 Ports: Update ScummVM to 2.8.0 2024-01-14 14:59:57 -07:00
Jelle Raaijmakers c58193bafa LibJS: Support large number of decimals in Number.prototype.toFixed
The spec asks us to perform some calculations that quickly exceed an
`u64`, but instead of jumping through hoops we can rely on our AK
implementation of floating point formatting to come up with the
correctly rounded result.

Note that most other JS engines seem to diverge from the spec as well
and fall back to a generic dtoa path.
2023-10-18 19:39:30 -04:00
Jelle Raaijmakers b015926f8e AK: Improve floating point decimals formatting
There were 2 issues with the way we formatted floating point decimals:
if the part after the decimal point exceeded the max of an u64 we would
generate wildly incorrect decimals, and we applied no rounding.

With this new code, we emit decimals one by one and perform a simple
reverse string walk to round the number up if required.
2023-10-18 19:39:30 -04:00
Jelle Raaijmakers 403d3bbdaf LibSoftGPU: Optimize GPU::Vertex lists
On my machine, benchmarking 3DFileViewer revealed ~2.5% of CPU time
spent in `Vector<GPU::Vertex>::try_append`. By carefully managing list
capacities, we can remove this method from profiles altogether.
2023-10-15 12:14:07 +02:00
Jelle Raaijmakers c978891dda LibGL: Optimize appends in gl_vertex
Optimize a very hot function by always performing unchecked appends.
When benchmarking 3DFileViewer on my machine, this takes the time spent
in `gl_vertex` down from ~8% to ~2%.
2023-10-15 12:14:07 +02:00
Jelle Raaijmakers edcb6176ce LibGL+Lib*GPU: Set model view and projection matrices separately
LibSoftGPU used to calculate the normal transformation based on the
model view transformation for every primitive, because that's when we
sent over the matrix. By making LibGL a bit smarter and only update the
matrices when they could have changed, we only need to calculate the
normal transformation once on every matrix update.

When viewing `Tuba.obj` in 3DFileViewer, this brings the percentage of
time spent in `FloatMatrix4x4::inverse()` down from 15% to 0%. :^)
2023-10-15 12:14:07 +02:00
Jelle Raaijmakers 126adfc392 3DFileViewer: Set timer to 15ms instead of 20ms
This approaches 60FPS and feels a bit smoother.
2023-10-15 12:14:07 +02:00
Jelle Raaijmakers 77c16d2ae7 3DFileViewer: Show correct framerate
We were confusing the time spent rendering with the time spent rendering
_and_ waiting for the next frame, which is important since we render
frames on a timer.
2023-10-15 12:14:07 +02:00
Jelle Raaijmakers 3c02e3ba09 Maps: Pad grid size to prevent missing tiles
Previously, we would divide the widget width and height by the tile size
and round up, which did not result in enough tiles to cover the entire
widget. Although this calculation is correct if you starting drawing
tiles in the top left corner, we have an additional offset to account
for.

Now, we take the number of tiles that fit in the widget completely and
pad it with 2 tiles to account for the partial left/right and top/bottom
sides. An additional tile is added to account for the iterator
translating by width / 2, which rounds down again.

The resulting tile rects are always intersected with the widget
dimensions, so even if we're generating more tile coordinates than
strictly necessary, we're not performing the actual download or draw
operations.
2023-10-03 20:25:09 +02:00
Jelle Raaijmakers eb4dd7f896 Maps: Fix spiraling tile iterator end
The `operator++` of the spiraling tile iterator was repeating the first
coordinates (`0, 0`) instead of moving to the next tile on the first
iteration. Swapping the move and check ensures we get to the end of the
iterator, fixing gray tiles that would sometimes pop up in the lower
right.

Since we never return from `operator++` without setting a valid
position, we can drop `current_x` and `current_y` and just use the
`Gfx::Point<T>` directly.
2023-10-03 20:25:09 +02:00
Jelle Raaijmakers 092bb76cd6 Maps: Use bilinear blending for downscaled tiles
Since we divide the width and height of the downscaled tiles by 2,
bilinear blending is identical to box sampling and should be preferred
since it's the simpler one of the two algorithms.
2023-10-03 20:25:09 +02:00
Jelle Raaijmakers 9240233378 Revert "AK: Refill a BufferedStream when it has less than the
...requested size"

This reverts commit 13573a6c4b.

Some clients of `BufferedStream` expect a non-blocking read by
`read_some` which the commit above made impossible by potentially
performing a blocking read. For example, the following command hangs:

    pro http://ipecho.net/plain

This is caused by the HTTP job expecting to read the body of the
response which is included in the active buffer, but since the buffered
data size is less than the buffer passed into `read_some`, another
blocking read is performed before anything is returned.

By reverting this commit, all tests still pass and `pro` no longer
hangs. Note that because of another bug related to `stdout` / `stderr`
mixing and the absence of a line ending, there is no output to the
command above except a progress update.
2023-09-11 21:38:24 -04:00
Jelle Raaijmakers ec416563a8 Maps: Zoom on doubleclick 2023-09-10 22:45:42 +02:00
Jelle Raaijmakers 0f330a4dcf Maps: Scale cached tiles from lower and higher zoom levels
When zooming in or out, if a tile is not yet cached, Maps now also
checks the lower and higher zoom levels for cached tiles and composites
a preview tile that is shown until the actual tile is loaded in.
2023-09-10 22:45:42 +02:00
Jelle Raaijmakers cf898f08ab Maps: Limit parallel downloading of tiles
Previously we would bombard RequestServer with as many requests as it
would take, but when frantically zooming in and out, we would run out of
fd's causing the Maps application to hang.

This implements a tile download queue and limits the amount of parallel
downloads to 8. This fixes the hangs accompanied by this debug console
message:

    Peer endpoint error: recvfd: Too many open files (errno=24)

It does not fix other sporadic hangs caused by requests that are never
finished, however.
2023-09-10 22:45:42 +02:00
Jelle Raaijmakers b21ca0d04e Maps: Add pledge and unveils 2023-09-05 20:16:05 +02:00
Jelle Raaijmakers 386505d0e0 Ports: Update README.md to show the right style for depends :^) 2023-08-16 00:38:18 +02:00
Jelle Raaijmakers bf927344fb Base: Teach ImageViewer and PixelPaint to open JXL, TGA images 2023-08-09 14:40:26 +02:00
Jelle Raaijmakers 1c19c2bc92 PixelPaint: Guess image type based on its filename
We do this in ImageViewer so it understands TGA images; let's do it in
PixelPaint as well :^)
2023-08-09 14:40:26 +02:00
Jelle Raaijmakers e272f796ad PixelPaint: Remove unused includes and method 2023-08-09 14:40:26 +02:00
Jelle Raaijmakers d78590fe0d Docs: Use the term 'amend' instead of 'squash' in CONTRIBUTING.md
Hopefully this makes it more clear what the intended action is. For a
lot of people "squashing" means combining multiple commits into one,
which is a common practice when merging to a branch.
2023-08-09 07:28:06 -04:00
Jelle Raaijmakers a8857c06b3 Ports: Update PHP to 8.2.8 2023-08-09 05:40:39 +02:00
Jelle Raaijmakers ba776390b5 LibC: Define time* macros before definitions
Otherwise, if an application defines its own macros, the implementations
get messed up. This way we redefine those macros if they're set.

This fixes the PHP port build.
2023-08-09 05:40:39 +02:00