Commit graph

34030 commits

Author SHA1 Message Date
Aziz Berkay Yesilyurt 32f513fc1c LibWeb/HTML: Update Text Input Styling
So that it is closer to the spec.
https://www.w3.org/TR/css-ui-4/#input-rules

(cherry picked from commit 13cd653d1ccf9ef486f4622e350614361e275a0c)
2024-07-13 18:22:56 -04:00
Arthur Hartwig Carlsson fd35cb2730 LibWeb: Don't insert out-of-flow elements into block pseudo elements
Like 1132c858e9, out-of-flow elements such
as float elements would get inserted into block level `::before` and
`::after` pseudo-element nodes when they should instead be inserted as a
sibling to the pseudo element. This change fixes that.

This fixes a few layout issues on the swedish tax agency website
(skatteverket.se). :^)

(cherry picked from commit 9ed2669fc801a3475c9f383ae7221b6a2b1a7fa5)
2024-07-13 18:22:38 -04:00
Arthur Hartwig Carlsson f11f4927c2 LibWeb: Refactor out-of-flow and in-flow into functions
The concept of out-of-flow and in-flow elements is used in a few places
in the layout code. This change refactors these concepts into functions.

(cherry picked from commit 196922ae5b44044cbf7baaf28fbfedba1b3d11f3)
2024-07-13 18:22:38 -04:00
Tim Ledbetter 1149e8a0e9 LibWeb/CSS: Use serif for font and font-family initial property values
These properties previously used sans-serif for their initial values.

(cherry picked from commit 0a1fc7ee132840c4e888967ecdd70e698d2ead33)
2024-07-13 18:22:23 -04:00
Tim Ledbetter b511ecee44 LibWeb/CSS: Set initial value of color property to canvastext
Previously the non-standard value `-libweb-palette-base-text` was used.

(cherry picked from commit 58589d6250696c86b3816efb979536e0633dafca)
2024-07-13 18:22:23 -04:00
simonkrauter 3df0082bb1 LibWeb: Correct HTMLMeterElement color selection
The logic of the comment "the region between the high boundary and the
maximum value must be treated as the optimum region" is correct.
However, the code below covered only two cases, the optimum case was
missing.
Fixes #473

(cherry picked from commit a676bd97a745cd7a4b33bb779e00ec68cb1d3c7c)
2024-07-13 18:22:04 -04:00
Keith Cirkel 83b113298a LibWeb: Add customElements.getName
(cherry picked from commit 8d593bcfeb96a3058abeec7bb772579e0c33fcb2)
2024-07-13 18:21:45 -04:00
Andreas Kling 4781543e2c LibWeb: Ensure EC on stack when resolving/rejecting image decode promise
Fixes #419

(cherry picked from commit 9c80326053356ddeb986df275a19468c16a8469a)
2024-07-13 17:37:57 -04:00
Jacob Wischnat 5cf467c86d LibMedia: Support videos with BT470BG color matrix
(cherry picked from commit 7a03ef45c2fa7f416a26955593fda34c4521f123)
2024-07-13 17:37:23 -04:00
Nico Weber 1a663078ed LibGfx/WebPLoader: Use transparent black as animation background color
This matches libwebp (see ZeroFillCanvas() call in
libwebp/src/demux/anim_decode.c:355 and ZeroFillFrameRect() call
in line 435, but in WebPAnimDecoderGetNext()) and makes files
written e.g. by asesprite look correct -- even though the old
behavior is also spec-compliant and arguably makes more sense.
Now nothing looks at the background color stored in the file.

See PR for an example image where it makes a visible difference.
2024-07-12 19:01:07 -04:00
Liav A. a5bc15355d DeviceDeviceMapper: Remove hardcoded list of pluggable once devices
Instead, simplify things by allowing the user to specify a specific
device entry in the configuration file, by specifying a minor number.

The first example of such device is the /dev/beep, as it resides on the
"generic" device node family (as it has a major number of 1).

However, because it can be skipped (if the user disables the beep device
through a kernel commandline option), we can't just create it blindly.
Therefore, when iterating on the configuration file the DeviceMapper
code detects the entry has a specific minor number of 10, and creates
a special DeviceNodeMatch (with a specific minor number being included).
When an event from /dev/devctl that notifies on the existence of the
/dev/beep device arrives, we find this specific match and don't create
an actual DeviceNodeFamily object, but rather blindly create a device
node.Mapper: Remove the concept of pluggable once devices
2024-07-12 18:44:49 -04:00
Liav A. f8851b9cf2 DeviceMapper: Don't hardcode a list of device node families
Instead, let the user define them through a configuration file which can
be written with the assistance of /sys/kernel/chardev_major_allocs and
/sys/kernel/blockdev_major_allocs files.
2024-07-12 18:44:49 -04:00
Dan Klishch 9bbadf7362 LibCrypto: Remove FIXMEs regarding possible optimizations in SHA{1,256}
These do not bring any noticeable (>0.5%) performance improvements.
2024-07-12 18:30:07 -04:00
Dan Klishch 16a251140a LibCrypto: Use static function pointer to choose SHA256 SIMD kernel
See previous commit for rationale.
2024-07-12 18:30:07 -04:00
Dan Klishch 645a220f3b LibCrypto: Use static member function pointer to choose SHA1 SIMD kernel
It turns out we cannot use function multi-versioning with "sha" feature
or even just plain ifunc resolvers without preprocessor guards. So,
instead of feeding ifdef-soup monster, we just use static member
function pointer.

Moving the kernel into the SHA1 class makes it possible to not pass
class members as parameters to it. This, however, requires us to
disambiguate different target "clones" of the kernel using some kind
of template.
2024-07-12 18:30:07 -04:00
Dan Klishch dbe37edde0 LibCrypto: Use AK::detect_cpu_features in ifunc resolvers
Note: AVX target clone does not bring any significant (>0.5%)
performance change.
2024-07-12 18:30:07 -04:00
Dan Klishch 225d9a2c1a AK: Introduce AK_CAN_CODEGEN_FOR_<FEATURE> macros
These replace `#if ARCH(...)` macros that were added to conditionally
include different hand-vectorized SIMD-implementations.
2024-07-12 18:30:07 -04:00
Dan Klishch f257271dcf LibCrypto: Deduplicate repeating attributes for lambdas with a macro
This also removes `[[gnu::target("sse4.2")]]` from nested functions:
since we don't explicitly use any of the SSE4.2 intrinsics there, the
said target is unneeded. Note that this won't prevent compiler from
choosing SSE4.2 intrinsics as the affected functions are always inlined
into `transform_impl_sha1` that has `[[gnu::target("sse4.2")]]`.
2024-07-12 18:30:07 -04:00
Dan Klishch 56b7f9e404 Meta: Globally disable -Wpsabi
This warning is triggered when one accepts or returns vectors from a
function (that is not marked with [[gnu::target(...)]]) which would have
been otherwise passed in register if the current translation unit had
been compiled with more permissive flags wrt instruction selection (i.
e. if one adds -mavx2 to cmdline). This will never be a problem for us
since we (a) never use different instruction selection options across
ABI boundaries; (b) most of the affected functions are actually
TU-local.

Moreover, even if we somehow properly annotated all of the SIMD helpers,
calling them across ABI (or target) boundaries would still be very
dangerous because of inconsistent and bogus handling of
[[gnu::target(...)]] across compilers. See
https://github.com/llvm/llvm-project/issues/64706 and
https://www.reddit.com/r/cpp/comments/17qowl2/comment/k8j2odi .
2024-07-12 18:30:07 -04:00
Alec Murphy 84d66ac538 LibGUI: Add alt shortcut for make_quit_action
This patch adds the common Ctrl-W shortcut to make_quit_action as an
alternate shortcut by default.

The shortcut can be disabled in programs using this key binding for a
different purpose, e.g. closing tabs, or instances where the "close
window" concept would not be applicable, such as CatDog.

To the best of my knowledge, I have disabled the shortcut for any
existing programs in the system where the aforementioned examples or any
additional conflicts would apply.
2024-07-12 09:54:28 -04:00
MacDue e8fe2f4ffe LibPDF: Use draw_rect() to show debug clipping rects
Using the path rasterizer here is much slower than simply drawing four
lines. This also more accurately shows the (real) clip as the bounding
box is truncated to an int before adding it as a clip rect.

Fixes #23056
2024-07-12 09:47:51 -04:00
PerrinJS f30dc92a1e cat: Add the -n line numbering feature
Adds the -n line numbering feature with the same formatting as gnu's cat
function.
2024-07-12 08:48:24 -04:00
Alec Murphy 1dca789d0f Calendar: Sort Events by start DateTime
This PR allows Calendar to display Events in chronological order.
2024-07-11 07:51:45 +01:00
circl 3961002ffd LibWeb: Use viewport position for did_enter_tooltip_area
This now matches the behavior of did_request_link_context_menu and
friends. Previously the coordinates relative to the page rather than
viewport were sent to the chrome.

(cherry picked from commit 990cf9b4e9476d15494a9538614762119d759b2d)
2024-07-10 09:20:15 -04:00
Diego 5e8dba07a6 LibWasm: Give names to functions exported to JS via ref.func
https://webassembly.github.io/spec/js-api/index.html#name-of-the-webassembly-function
(cherry picked from commit e8fd8982f82e91f97b24523f3ee60eef774990dd)
2024-07-10 01:10:12 +02:00
Diego f5a27dda1d LibWasm: Error when parsed section lengths are invalidated
(cherry picked from commit afd8d90f3237e0cffaabb05becbff16f8c8fdd25)
2024-07-10 01:10:12 +02:00
Diego 3bec014c53 LibWasm: Remove Wasm::ValueType::Kind::Null* variants
As far as I know, they're not in the spec and don't serve any purposes
in the internals of LibWasm.

(cherry picked from commit 5382fbb6171555264e29872029330e1373b39671)
2024-07-10 01:10:12 +02:00
Diego 29ae76925f LibWasm: Fix comparisons between 0.0 and -0.0
According to the spec, -0.0 < 0.0.

(cherry picked from commit 31c7e98a4a46c2d0ef93c5fca47d64d05b96449f)
2024-07-10 01:10:12 +02:00
Diego 3ed4cac2a5 LibWasm: Fix some floating-point conversion issues
NaN bit patterns are now (hopefully) preserved. `static_cast` does not
preserve the bit pattern of a given NaN, so ideally we'd use some other
sort of cast and avoid `static_cast` altogether, but that's a large
change for this commit. For now, this fixes the issues found in spec
tests.

(cherry picked from commit c882498d4450c4c2e46d77a8ab36afc4eb412c00)
2024-07-10 01:10:12 +02:00
Diego d7d36a28de LibWasm: Validate potentially empty else branch in if instruction
(cherry picked from commit fce8ed15630a4969be7c9761b9b7d3cef0530cc6)
2024-07-10 01:10:12 +02:00
Alec Murphy 648b36f3c5 PixelPaint: Disable Crop to Selection if empty
This PR resolves 2 FIXMEs.
2024-07-08 00:06:17 +01:00
mkblumenau 3caa3da8ac WindowServer: Remove some old TODOs in Window.cpp
These were resolved in 74ae6ac (#1010)
2024-07-07 13:27:12 +02:00
Aliaksandr Kalenik 8cb38da92f LibWeb: Implement scrollbars dragging
(cherry picked from commit 881e97084625184543b93cee235cb0b96ee055ae)
2024-07-07 11:32:25 +02:00
Aliaksandr Kalenik 0d9a9490f0 LibWeb: Remove did_request_scroll_to IPC call
No longer used after moving scrollbar painting into WebContent.

(cherry picked from commit 94eacf6da736f957a5fc22faa552341165aaf1ca)
2024-07-07 11:32:25 +02:00
Aliaksandr Kalenik 5728f22dd8 LibWeb: Remove did_request_scroll IPC call
No longer used after moving scrollbar painting into WebContent.

(cherry picked from commit cc3d95a356ea3769d325c2f7bb73947cb4ba7baa)
2024-07-07 11:32:25 +02:00
Aliaksandr Kalenik 40a570e237 LibWeb+WebContent: Move scrollbar painting into WebContent
The main intention of this change is to have a consistent look and
behavior across all scrollbars, including elements with
`overflow: scroll` and `overflow: auto`, iframes, and a page.

Before:
- Page's scrollbar is painted by Browser (Qt/AppKit) using the
  corresponding UI framework style,
- Both WebContent and Browser know the scroll position offset.
- WebContent uses did_request_scroll_to() IPC call to send updates.
- Browser uses set_viewport_rect() to send updates.

After:
- Page's scrollbar is painted on WebContent side using the same style as
  currently used for elements with `overflow: scroll` and
  `overflow: auto`. A nice side effects: scrollbars are now painted for
  iframes, and page's scrollbar respects scrollbar-width CSS property.
- Only WebContent knows scroll position offset.
- did_request_scroll_to() is no longer used.
- set_viewport_rect() is changed to set_viewport_size().

(cherry picked from commit 5285e22f2aa09152365179865f135e7bc5d254a5)

Co-authored-by: Jamie Mansfield <jmansfield@cadixdev.org>
Co-authored-by: Nico Weber <thakis@chromium.org>
2024-07-07 11:32:25 +02:00
Aliaksandr Kalenik 17f9b16c46 LibWeb: Propagate scrollbar-width property from root element to viewport
(cherry picked from commit eb909118bfe9d939a1109823b6e0b8736abab138)
2024-07-07 11:32:25 +02:00
Aliaksandr Kalenik 5e288aa0b0 LibWeb: Scroll into viewport from a task in set_focused_element()
This is a hack needed to preserve current behaviour after making set
viewport_rect() being not async in upcoming changes.

For example both handle_mousedown and handle_mouseup should use the same
viewport scroll offset even though handle_mousedown runs focusing steps
that might cause scrolling to focused element:
- handle_mousedown({ 0, 0 })
  - run_focusing_steps()
  - set_focused_element()
  - scroll_into_viewport() changes viewport scroll offset
- handle_mouseup({ 0, 0 })

(cherry picked from commit 50920b05953a6bc2aacb07d291d503052caadf15)
2024-07-07 11:32:25 +02:00
Daniel Bertalan 85b7ce8c2f LibJS: Add missing ValueInlines.h include for Value::to_numeric
When compiling with `-O2 -g1` optimizations (as done in the main
Serenity build), no out-of-line definitions end up emitted for
`Value::to_numeric`, causing files that reference the function but don't
include the definition from `ValueInlines.h` to add an undefined
reference in LibJS.so.
2024-07-07 11:11:02 +02:00
mkblumenau eb1e054d65 LibAudio: Use clamp() in Sample::clip()
Sample::clip() now uses clamp().
2024-07-06 22:24:20 +02:00
Liav A. 60e9f24084 Utilities/init: Remove all-mice device node
We are going to remove this device from the kernel in the next commit,
so prepare for that by not creating a device node.
2024-07-06 21:42:32 +02:00
Liav A. 5cc402e7e2 WindowServer: Add basic support for hotplug events in the EventLoop
Add inode watchers on the /tmp/system/devicemap/family/{mouse,keyboard}/
directories.

Then instruct those watchers to dispatch a refresh call to the vectors
which hold references to these devices.
2024-07-06 21:42:32 +02:00
Liav A. aa2d76cd78 Utilities: Add the lsdev utility
This utility lists all devices' major number allocations, for character
and block devices. It can help the user to figure out the DeviceMapper
service manages spawning of device nodes in /dev and other associated
files under the /tmp/system/devicemap directory.
2024-07-06 21:42:32 +02:00
Liav A. 5292bb3fe0 Utilities/init+DeviceMapper: Add IPC hotplug notifications mechanism
The new mechanism is basically adding or removing symbolic links to
device nodes in /dev. These symbolic links are located in the directory
of /tmp/system/devicemap/nodes/{block,char} which contain subdirectories
for major number allocation, which then hold these symbolic links.

An interested userspace program could then open an inode watcher on the
subdirectories which hold the symbolic link for added or removed links
to indicate hotplug events of insertion or removal of a device.
2024-07-06 21:42:32 +02:00
Liav A. 5e8a0e6217 DeviceMapper: Use DeviceNodeType from Kernel API in all possible cases
Having a separate enum is pointless, and opens the possibility of having
duplicates elsewhere. Therefore, just unify everything under one known
enum.
2024-07-06 21:42:32 +02:00
Liav A. fdff05cc97 Kernel+Userland: Simplify minor number allocation for virtual consoles
There is simply no advantage with putting both virtual console devices
and serial TTY devices on the same major number.

Putting them on separate major numbers greatly simplifies the allocation
mechanism on the DeviceMapper code, because it no longer needs to
calculate offsets of minor numbers, and should start from number 0 to
theoretically infinite amount of device nodes.
2024-07-06 21:42:32 +02:00
Liav A. 08b9766b33 DeviceMapper: Simplify formatting patterns for device paths 2024-07-06 21:42:32 +02:00
Alec Murphy 0f72978fd1 FileManager: Add keyboard shortcut for new window
This patch adds the common Ctrl-N shortcut to FileManager for opening a
new window.
2024-07-05 14:01:01 +02:00
Marek Knápek 37c66c1520 LibCrypto: Implement SHA-256 by using x86 intrinsics
Co-Authored-By: Hendiadyoin1 <leon.a@serenityos.org>
2024-07-05 00:52:30 +02:00
Marek Knápek e01d78d8b6 LibCrypto: Implement SHA-1 by using x86 intrinsics
Co-Authored-By: Hendiadyoin1 <leon.a@serenityos.org>
2024-07-05 00:52:30 +02:00