Commit graph

56737 commits

Author SHA1 Message Date
Timothy Flynn
7cdd07b89a LibWebView: Scroll inspected elements into view with a slight offset
When scrolling to the inspected element, if we scroll to its exact
position, it would often be placed behind the fixed header at the top of
the WebView. This patch gives the scroll a bit of an offset to scroll
comfortably beneath the header.
2023-11-24 17:19:08 -05:00
Timothy Flynn
aa4dcda5dc LibWeb+LibWebView+Ladybird: Scale scroll-to CSS positions in PageHost
The `page_did_request_scroll_to` API takes a CSS position, and thus
callers should not scale to device pixels before invoking it. Instead,
align this API with (most) other PageHost APIs which scale to device
pixels before sending the corresponding IPC message.

In the AppKit chrome, convert the provided device pixel position to a
widget position.
2023-11-24 17:19:08 -05:00
Timothy Flynn
778f10fb26 Revert "Meta: Port recent changes to GN build"
This reverts commit 754ecc56dd.

This was handled by: 49b7539290.
2023-11-24 11:24:58 -05:00
Timothy Flynn
fb1845f294 Ladybird/AppKit: Invert the horizontal delta scroll value
This matches the negation of the vertical scroll delta value. This makes
the scroll events behave as follows on macOS:

Natural scrolling enabled:
* Scrolling up on the trackpad scrolls down on the page.
* Scrolling right on the trackpad scrolls left on the page.

Natural scrolling disabled:
* Scrolling up on the trackpad scrolls up on the page.
* Scrolling right on the trackpad scrolls right on the page.
2023-11-24 11:22:17 -05:00
Timothy Flynn
754ecc56dd Meta: Port recent changes to GN build
a6106ca221
04c094343f
2023-11-24 11:22:17 -05:00
Sönke Holz
185715d832 Kernel/riscv64: Generate Kernel.bin from kernel ELF
This is necessary for being able to use the qemu `-kernel` option.
The QEMU virt machine uses OpenSBI's FW_DYNAMIC feature to pass
the kernel entry address, which is the virtual entry point address
specified in the kernel ELF. If we instead `objcopy` the kernel into a
raw binary, OpenSBI will jump to the physical kernel load address, which
is what we want it to do.
2023-11-24 08:52:02 -07:00
Sönke Holz
fa39a57474 Kernel/riscv64: Add missing input sections to linker script
The linker would otherwise put those sections after
`end_of_kernel_image`.
2023-11-24 08:50:19 -07:00
Andrew Kaster
49b7539290 Meta: Port recent changes to gn build
b7f8d7e357
048e179572
6d1a1daff9
04c094343f
a6106ca221
2023-11-24 08:43:01 -07:00
Andreas Kling
afeb551d57 LibJS/JIT: Add builtin for Math.exp() 2023-11-24 12:49:15 +01:00
Andreas Kling
8447544e17 LibJS/JIT: Add builtin for Math.round() 2023-11-24 12:49:15 +01:00
Andreas Kling
c2ff238467 LibJS/JIT: Add builtin for Math.ceil() 2023-11-24 12:49:15 +01:00
Andreas Kling
08590adf40 LibJS/JIT: Add builtin for Math.floor() 2023-11-24 12:49:15 +01:00
Andreas Kling
5e976d611e LibJS/JIT: Add builtin for Math.pow() 2023-11-24 12:49:15 +01:00
Andreas Kling
94b634f029 LibJS/JIT: Add builtin for Math.sqrt() 2023-11-24 12:49:15 +01:00
Andreas Kling
1d8a601f96 LibJS/JIT: Add builtin for Math.log()
Note that we still call out to a C++ helper, but by having a builtin,
we still avoid the cost of a full JS function call.
2023-11-24 12:49:15 +01:00
Andreas Kling
a6106ca221 AK: Use __builtin_offsetof() + -Wno-invalid-offsetof to silence ASAN
ASAN was crying way too much when running the LibJS JIT since the old
OFFSET_OF implementation was too wild for its liking.

By turning off the invalid-offsetof warnings, we can use the offsetof
builtin instead. However, I'm leaving this as a wrapper macro, since
we may still want to do something different for other compilers.
2023-11-24 12:49:15 +01:00
david072
1541942e10 LibCards/CardPainter: Add a helper for accessing the caches
The CardPainter in LibCards caches already painted bitmaps. This adds a
helper that gets the bitmap from a cache or creates a new one, if the it
doesn't exist yet. It does this by calling a creator function with the
new bitmap, which can then paint into the bitmap. This makes the code a
bit simpler and shorter.
2023-11-24 11:45:32 +00:00
david072
bac7c057e9 Spider: Make non-movable cards disabled :^)
In Spider, cards that can't be moved are now shown as disabled using the
helpers in LibCards. This makes it much easier to see what can be moved
and to where, overall improving the game significantly!
2023-11-24 11:45:32 +00:00
david072
0a806837b5 LibCards/CardStack: Helper to update the cards' disabled flags
This adds a little helper in Cards::CardStack that updates the disabled
flags for its cards depending on a movement rule. It does this by
searching from the bottom up for the last card that is valid. It then
sets the disabled flag for all cards above that card, if it isn't upside
down.
2023-11-24 11:45:32 +00:00
david072
55168b50dc LibCards: Painting disabled cards 2023-11-24 11:45:32 +00:00
david072
65b9cb63ee Spider: Port to the GML compiler 2023-11-24 11:45:32 +00:00
Shannon Booth
b7bcdf7c53 LibWeb: Fix UAF in CSSStyleSheet
CSSNamespaceRule returns a copy of a DeprecatedString, meaning that the
view returned by the namespace in CSSStyleSheet is into a temporary
string.
2023-11-24 10:57:17 +01:00
Shannon Booth
673329e1bd LibWeb: Use ArrayBufferView for ReadableStreamBYOBReader
Which means that we now have support for DataViews.

Using the ArrayBufferView class also seems to make this read a whole
bunch nicer as well.
2023-11-24 08:43:35 +01:00
Shannon Booth
eab20129b9 LibWeb: Use ArrayBufferView for Crypto::getRandomValues
Co-Authored-By: Matthew Olsson <mattco@serenityos.org>
2023-11-24 08:43:35 +01:00
Shannon Booth
04c094343f LibWeb+Meta: Add wrapper for the BufferSource/ArrayBufferView IDL types
These wrappers will make it much easier to do various operations on the
different ArrayBuffer-related classes in LibWeb compared to the current
solution, which is to just accept a Handle<Object> everywhere (and use
"any" in the *.idl files).

Co-Authored-By: Matthew Olsson <mattco@serenityos.org>
2023-11-24 08:43:35 +01:00
Sam Atkins
54d0aafff0 LibGfx: Use FourCC as OpenType::Tag type
The one deviation from the spec here is to use this in the WOFF
TableDirectoryEntry's tag field. However, *not* making that a Tag made
a lot of things more complicated than they need to be.
2023-11-24 08:42:46 +01:00
Sam Atkins
0423225290 LibGfx: Make FourCC more useful
A few small changes that didn't seem to deserve separate commits:
- Mark it as packed to remove compiler complaints when it's a member of
  a packed struct.
- Add a default constructor for places where we fill in a struct
  gradually.
- Restrict the constructor to exactly 4-character string literals.
- Add a to_u32() method for the one place that needs that.
2023-11-24 08:42:46 +01:00
Sam Atkins
2c24192e1f LibGfx: Move FourCC to its own file
These are used in fonts too, so let's not limit them to ImageLoader.
2023-11-24 08:42:46 +01:00
timmot
9f2ee86e4d Tests/LibWeb: Test canvas fillStyle parsing of rgb strings 2023-11-24 08:42:18 +01:00
timmot
c713445253 LibWeb: Report when CanvasFillOrStrokeStyle parsing fails 2023-11-24 08:42:18 +01:00
timmot
2ecc1d64d8 LibGfx: Accept decimal numbers when parsing rgb and rgba strings
This will round all numbers and clamp them within the limits of a u8.
This also standardises on returning u8 instead of uint/int.
2023-11-24 08:42:18 +01:00
timmot
da3cfd5bbc AK+LibWeb: Make clamp_to_int generic over all integrals 2023-11-24 08:42:18 +01:00
Andrew Kaster
cf7b13c708 LibWeb: Visit WorkerAgent from Worker 2023-11-24 08:41:38 +01:00
Andrew Kaster
1602663b9e LibWeb+WebWorker: Implement a first cut of post_message for Workers
This implementation completely ignores MessagePorts, and manually plumbs
data through LocalSockets.
2023-11-24 08:41:38 +01:00
Andrew Kaster
05ec93e276 WebWorker: Reuse main thread VM for DedicatedWorker realms
While creating a new VM feels warm and fuzzy from an isolation
perspective, having multiple JS heaps in the same process is a footgun
waiting to happen. Additionally, there are still many places in LibWeb
that reach for the main thread VM to check for the current realm to do
things, such as Web::HTML::incumbent_settings_object().
2023-11-24 08:41:38 +01:00
Andrew Kaster
e30ecacb71 WebWorker: Exit the event loop when the connection from the client dies
This mimics the behavior of other services, and prevents zombie service
processes from sticking around when no longer needed.
2023-11-24 08:41:38 +01:00
Andrew Kaster
79fa892ca1 Tests: Add stub for the internals object when not running in test mode
This allows developers to open LibWeb test html files in Ladybird or in
other browsers to observe their behavior without the internals object.
2023-11-24 08:41:38 +01:00
Andrew Kaster
bbdf766fb0 AK: Add helpers to convert arbitrary Spans to {Readonly}Bytes
The streams and other common APIs require byte spans to operate on
arbitrary data. This is less than helpful when wanting to serialize
spans of other data types, such as from an Array or Vector of u32s.
2023-11-24 08:41:38 +01:00
Aliaksandr Kalenik
5f7ac559a7 LibAccelGfx+LibWeb: Add support for stacking context opacity
For each stacking context with an opacity less than 1, we create a
separate framebuffer. We then blit the texture attached to this
framebuffer with the specified opacity.

To avoid the performance overhead of reading pixels from the texture
into Gfx::Bitmap, a new method that allows for direct blitting from
the texture is introduced, named blit_scaled_texture().
2023-11-24 08:39:55 +01:00
Aliaksandr Kalenik
cb90daadc7 LibAccelGfx: Add cache for programs
Having programs cache shared between painters would allow us to create
more than one painter without worrying about shaders recompilation.
2023-11-24 08:39:55 +01:00
Aliaksandr Kalenik
d5630fedf1 LibAccelGfx+WebContent: Introduce Canvas that represents framebuffer 2023-11-24 08:39:55 +01:00
Timothy Flynn
c03b69e664 LibWebView+Ladybird: Remove now-unused WebView TreeModel
This was used to provided base functionality for model-based chromes for
viewing the DOM and accessibility trees. All chromes now use the WebView
inspector model for those trees, thus this class is unused.
2023-11-24 08:37:19 +01:00
Timothy Flynn
84c4eef565 Ladybird/AppKit: Port the Inspector to the WebView InspectorClient 2023-11-24 08:37:19 +01:00
Timothy Flynn
52b5bcdb6d Ladybird/Qt: Port the Inspector to the WebView InspectorClient 2023-11-24 08:37:19 +01:00
Timothy Flynn
39e32e80cd Browser: Port the Inspector to the WebView InspectorClient 2023-11-24 08:37:19 +01:00
Timothy Flynn
1fe486cebe LibWebView: Implement a WebView-based Inspector client
This is modeled after a similar implementation for the JS console.

This client takes over an inspector WebView (created by the chrome) to
create the inspector application. Currently, this application includes
the DOM tree and accessibility tree as a first pass. It can later be
extended to included the style tables, the JS console itself, etc.
2023-11-24 08:37:19 +01:00
Timothy Flynn
ffdc2d8add LibWeb+LibWebView+WebContent: Add an Inspector IDL object to the Window
This is an internal object that must be explicitly enabled by the chrome
before it is added to the Window. The Inspector object will be used by a
special WebView that will replace all chrome-specific inspector windows.
The IDL defines methods that this WebView will need to inform the chrome
of various events, such as the user clicking a DOM node.
2023-11-24 08:37:19 +01:00
Timothy Flynn
30e96749de LibWebView+WebContent: Remove unused did_get_dom_node_properties IPC
This is never invoked. The functionality it provides is implemented by
the return value of the `inspect_dom_node` IPC.
2023-11-24 08:37:19 +01:00
Timothy Flynn
fcaa994d4e LibWebView: Extract CSS to highlight HTML source to a constant
We will be re-using (and extending) this style in the WebView-based DOM
inspector.
2023-11-24 08:37:19 +01:00
Timothy Flynn
b5162ceabd LibWeb: Remove special handling of disclosure-open/closed markers
Setting the marker's content width here is causing the text that follows
the marker to be indented a bit too much. This is noticeable when a line
with a disclosure marker is followed by a line with any other marker. It
previously would look something like:

    >    Text inline with disclosure-closed marker
    * Text inline with circle marker
    # Text inline with square marker

Now the disclosure marker line matches other marker types:

    > Text inline with disclosure-closed marker
    * Text inline with circle marker
    # Text inline with square marker
2023-11-24 08:37:19 +01:00