Commit Graph

59162 Commits

Author SHA1 Message Date
Shannon Booth
f9e5b43b7a LibWeb: Rename URL platform object to DOMURL
Along with putting functions in the URL namespace into a DOMURL
namespace.

This is done as LibWeb is in an awkward situation where it needs
two URL classes. AK::URL is the general purpose URL class which
is all that is needed in 95% of cases. URL in the Web namespace
is needed predominantly for interfacing with the javascript
interfaces.

Because of two URLs in the same namespace, AK::URL has had to be
used throughout LibWeb. If we move AK::URL into a URL namespace,
this becomes more painful - where ::URL::URL is required to
specify the constructor (and something like
::URL::create_with_url_or_path in other places).

To fix this problem - rename the class in LibWeb implementing the
URL IDL interface to DOMURL, along with moving the other Web URL
related classes into this DOMURL folder.

One could argue that this name also makes the situation a little
more clear in LibWeb for why these two URL classes need be used
in the first place.
2024-02-25 08:54:31 +01:00
Shannon Booth
1b6346ee1c LibWeb: Add support for implementing an IDL class with a different name
Add support for the extended attribute "ImplementedAs" for IDL
interfaces too. This allows a class which implements an IDL interface to
have a different class name than the interface itself.
2024-02-25 08:54:31 +01:00
Matthew Olsson
62f62a0e52 LibWeb: Correctly set timing function in AnimationEffect::update_timing
Also pulls out the parse_easing_string function out since it will be
needed elsewhere
2024-02-25 08:51:50 +01:00
Matthew Olsson
b33bb0997a LibWeb: Move easing parsing code out into a dedicated function
This will be used outside of StyleComputer
2024-02-25 08:51:50 +01:00
Matthew Olsson
c8b9c137a1 LibWeb: Handle discrete properties
This also changes transform's animation-type to by-computed-value. It is
far easier to handle since we switch on StyleValue::type(), and it might
be the case that this applies to all custom animated properties and we
don't need "custom" at all, but let's wait until we get to those
properties to make that decision.
2024-02-25 08:51:50 +01:00
Matthew Olsson
ee63c729e5 LibWeb: Expand shorthand properties in KeyframeEffect 2024-02-25 08:51:50 +01:00
Matthew Olsson
9e0ff9c140 LibWeb: Expose CSS shorthand -> longhand conversion
This conversion needs to be done by KeyframEffect as well
2024-02-25 08:51:50 +01:00
Matthew Olsson
af1f0c673e LibWeb: Remove old animation-direction handling from StyleComputer
This is now handled by Web Animations, so if the animation was ever
running backwards, this logic would re-reverse it so that it played
forwards again.
2024-02-25 08:51:50 +01:00
Matthew Olsson
70ded2ef42 LibGfx: Add Oklab support to Gfx::Color
Interpolation of color on the web is done via the oklab colorspace
2024-02-25 08:51:50 +01:00
Domenico Iezzi
71a784741f LibGUI: Add Calendar property for mode
If a user selects Year as the default view mode for Calendar app, then
all apps using Calendar widget will default to this view if not
manually overridden with a Calendar::toggle_mode call.

This commit introduces a "mode" property that allows the selection of
the default mode for the calendar widget in GML files. In this way
there is no need to manually call toggle_mode when constructing
UIs with Calendar widget.
2024-02-24 18:54:51 -07:00
Domenico Iezzi
1153068407 LibGUI: Remove redundant Widget::update calls from DatePicker
In DatePicker constructor, calling to Widget::update after
Calendar::update_tiles is redundant since it is already called
internally by update_tiles.

This commit also remove unused header files from DatePicker header.
2024-02-24 18:54:51 -07:00
Domenico Iezzi
bc9bba1d9b LibGUI: Explicitly fire a resize event when toggling Calendar mode
Calendar::toggle_mode function performed a call to Widget::resize with
swapped width and height parameters as a quick way to trigger a
resize_event (resize event is generated only when the new rect size is
different from the old one, hence the swapped parameters).

This method does not work when width and height are equal, such as in
the DatePicker widget where width and height are fixed to 200x200. In
such case, calls to Calendar::toggle_mode would not generate a resize
event, leaving tiles uninitialized, therefore the widget was not able
to properly paint the Month view.

This commit replaces Widget::resize call with a manual triggering of
the event.
2024-02-24 18:54:51 -07:00
Dan Klishch
9966feab4d Meta: Allow collecting code coverage on Lagom 2024-02-24 17:13:16 -07:00
Kemal Zebari
7fbc8bf719 Documentation: Recommend using clangd for code formatting in VSCode
Turns out clangd supports code formatting using the clang-format
engine. Because we also document another code formatter to install,
when users use both extensions VSCode will ask to choose one or the
other. Therefore, let's just choose clangd for code formatting since
it is needed anyways for code comprehension.
2024-02-24 16:45:41 -07:00
Liav A
fff49ab6d3 Kernel/FileSystem: Avoid double locking m_inode_lock in the Ext2 driver 2024-02-24 16:45:26 -07:00
Liav A
b63a1dda63 Kernel/FileSystem: Enforce locking of m_inode_lock when truncating Inode
Such operation is almost equivalent to writing on an Inode, so lock the
Inode m_inode_lock exclusively.
All FileSystem Inode implementations then override a new method called
truncate_locked which should implement the actual truncating.
2024-02-24 16:45:26 -07:00
Hendiadyoin1
53dd04e219 Kernel/riscv64: Read the timebase-frequency from the device tree 2024-02-24 16:43:44 -07:00
Hendiadyoin1
3941277940 Kernel/riscv64: Get the kernel command line from the device tree
This also hides the fdt dump by default now,
it can be activated by adding `dump_fdt` to the kernel command line
2024-02-24 16:43:44 -07:00
Hendiadyoin1
51b841b4b2 Meta: Enable serial_debug on riscv
This mirrors the currently hardcoded command line
2024-02-24 16:43:44 -07:00
Hendiadyoin1
a99bd8eda6 Kernel/riscv64: Initialize PCI controllers using the device tree
Currently the search path is limited to `/soc/pci*` but this is enough
to get it to work on qemu.
2024-02-24 16:43:44 -07:00
Hediadyoin1
7309427d2f Kernel/riscv64: Unflatten the DeviceTree 2024-02-24 16:43:44 -07:00
Hendiadyoin1
d3f6b03733 Kernel/riscv64: Take the memory map from the FDT and dump it
For this the BootInfo struct was made architecture specific
2024-02-24 16:43:44 -07:00
Hediadyoin1
21a21c6a11 LibDeviceTree: Add a simple DeviceTree class
This makes it easier to work with device tree nodes and properties, then
writing simple state machines to parse the device tree.
This also makes the old slow traversal methods use the
DeviceTreeProperty helper class, and adds a simple test.
2024-02-24 16:43:44 -07:00
Hendiadyoin1
0fa718ead8 Meta: Compile fdtdump on lagom 2024-02-24 16:43:44 -07:00
Hendiadyoin1
d6bb5579ad LibDeviceTree: Make the dump more akin to the original fdtdump
This also makes it possible to compile the library in the Kernel
2024-02-24 16:43:44 -07:00
Hendiadyoin1
38cb5444d9 AK: Make StringView::for_each_split_view() aware of IterationDecision 2024-02-24 16:43:44 -07:00
Sönke Holz
1fc0c84017 Kernel/riscv64: Implement Processor::assume_context
This code is based on the aarch64 implementation.
2024-02-24 16:42:58 -07:00
Sönke Holz
726865592c Kernel/riscv64: Implement Processor::switch_context
This code is based on the aarch64 implementation.
2024-02-24 16:42:58 -07:00
Sönke Holz
494e026ca7 Kernel/riscv64: Implement Processor::init_context
This code is based on the aarch64 implementation.
2024-02-24 16:42:58 -07:00
Sönke Holz
efdc433ebc Kernel/riscv64: Implement thread_context_first_enter
thread_context_first_enter reuses the context restoring code in the
trap handler, just like other arches already do.

The `ld x2, 1*8(sp)` is unnecessary in the trap handler, as the stack
pointer should be equal to the stack pointer slot in the RegisterState
if the trap is from supervisor mode (and we currently don't support
user traps).
This load will however make us unable to reuse that code for
thread_context_first_enter.
2024-02-24 16:42:58 -07:00
Sönke Holz
7fbcceb657 Kernel/riscv64: Implement enter_thread_context
This code is based on the aarch64 implementation.
2024-02-24 16:42:58 -07:00
Sönke Holz
2f33e7a964 Kernel/riscv64: Stub out Processor::set_thread_specific_data 2024-02-24 16:42:58 -07:00
Sönke Holz
7fff6eef09 Kernel/riscv64: Implement Processor::initialize_context_switching
This code is based on the aarch64 implementation.
2024-02-24 16:42:58 -07:00
Sönke Holz
1429c83942 Kernel/riscv64: Implement {load,store}_fpu_state
This commit adds two functions which save/restore the entire FPU state.
On RISC-V, you only need to save the floating pointer registers
themselves and the fcsr CSR, which contains the entire state of the F/D
extensions.
2024-02-24 16:42:58 -07:00
Sönke Holz
cd389833d4 Kernel/riscv64: Use TimeManagement as an entropy source for now
Better entropy will require us to parse the riscv,isa devicetree
property and then use the Zkr extension, if present.
2024-02-24 16:37:20 -07:00
Sönke Holz
f6151b3c9e Kernel/Storage: Add AssertSizes to AHCI structs 2024-02-24 16:36:47 -07:00
Sönke Holz
f85099ea47 Kernel/Storage: Make AHCI::HBA::port_regs a flexible array member
Some real hardware apparently uses smaller BAR sizes than sizeof(HBA)
with a completely filled port_regs member.
Change the port_regs array to a flexible array member, so we don't panic
while verifying that the BAR size is large enough to map this struct.
Accesses to this array are already bounds checked against
AHCI::Limits::MaxPorts.
2024-02-24 16:36:47 -07:00
Sönke Holz
6fd02d2a04 Kernel: Add PCI::map_bar overloads that don't take an explicit size
These overloads map the entire BAR space instead.
2024-02-24 16:36:47 -07:00
Bastiaan van der Plaat
089a98607c LibWeb: Add HTMLPreElement width property 2024-02-24 16:35:11 -07:00
Hugh Davenport
2e8ff1855c Browser: Allow system shortcuts to function
Before shortcuts like ALT-F4, etc did not work. This makes the window
ignore keydown events. In the future this may be altered to allow for
custom shortcuts from within ladybird?
2024-02-24 16:30:50 -07:00
Lucas CHOLLET
cb03ab4a5a LibPDF: Handle the BlackIs1 parameter of the CCITTFaxDecode Filter 2024-02-24 16:24:45 -07:00
Lucas CHOLLET
6b3bab5c8a LibPDF: Plug in the CCITTFaxDecode filter to our CCITT decoder
We only call the decoder for Group 4 images. We do support Group 3
images, but let's wait to find a PDF with these before adding support.
2024-02-24 16:24:45 -07:00
Ilya Hanov
a16f0e9053 Meta: Prevent "serenity.sh gdb" to close other tmux sessions
"Meta/serenity.sh gdb" command opens tmux and
creates windows for GDB and emulator's logs.

The problem is that while it uses "trap" to close
just opened tmux session once debugging
is finished, it will close previously
opened session as well due to "trap" is
setup twice.

This commit tries to prevent touching
other tmux session.
2024-02-24 16:21:45 -07:00
Sönke Holz
0b0ea19d12 LibELF+readelf: Add support for RISC-V dynamic relocation types 2024-02-24 16:05:50 -07:00
Sönke Holz
f8628f94b8 LibELF: Refactor how arch-specific dynamic relocation types are handled
We currently expect that the relocation type numbers are unique across
all architectures. But RISC-V and x86_64 use the same numbers for
different relocation types (R_X86_64_COPY = R_RISCV_JUMP_SLOT = 5).

So create a generic reloc type enum which maps to the arch-specific
reloc types instead of checking for all arch reloc types individually
everywhere.
2024-02-24 16:05:50 -07:00
Liav A
c216e7439f Kernel: Require StorageDevice reference for StorageDevicePartition
Allowing creation of StorageDevicePartition objects for any arbitrary
BlockDevice objects means that we could technically create a
StorageDevicePartition for another StorageDevicePartition which is
obviously not the intention for this code. Instead, require to pass a
StorageDevice reference to ensure this cannot happen.
2024-02-24 16:01:26 -07:00
Liav A
f08f339e9a Kernel: Return EIO if attached device is gone in StorageDevicePartition
The previous code will just do a nullptr-dereference if the underlying
device is gone, so instead gracefully return EIO error.
2024-02-24 16:01:26 -07:00
Liav A
67e028e4f4 Kernel: Declare proper blocking support for StorageDevicePartitions 2024-02-24 16:01:26 -07:00
Liav A
42ed0a6c94 Kernel/Storage: Rename DiskPartition => StorageDevicePartition
We deal with partitions for storage devices, not only for disk devices,
originally harddrives.
2024-02-24 16:01:26 -07:00
Liav A
4e651d0e4f Kernel/Storage: Convert StorageDevice class members to be const
It is expected that these class members will be set when the object is
created (so they're set in the class constructor method) and never
change again, as its the driver responsibility to find these values
before creating a StorageDevice object.

This makes it easier to rely on these values later on as we don't expect
them to ever change for a StorageDevice object during its lifetime.
2024-02-24 16:01:26 -07:00