Commit Graph

33845 Commits

Author SHA1 Message Date
Tim Ledbetter
b82eaad274 Ladybird: Move BrowserSettings/Defaults.h to Ladybird/DefaultSettings.h 2024-06-03 10:53:53 +02:00
Andrew Kaster
dd1fbd3513 Meta: Remove SerenityOS components not needed for Ladybird 2024-06-03 10:53:53 +02:00
Matthew Olsson
44bb6e8390 LibWeb: Handle the cssFloat and cssOffset keyframe properties properly 2024-06-03 10:53:32 +02:00
Matthew Olsson
36ceaf38d5 LibWeb: Check for nullish objects in process_a_keyframe algorithm 2024-06-03 10:53:32 +02:00
Matthew Olsson
37ee45db3d LibWeb: Use camelCase for JS keyframe objects 2024-06-03 10:53:32 +02:00
Matthew Olsson
b5c682bc2e LibWeb: Copy the keyframes in KeyframeEffect's copy constructor 2024-06-03 10:53:32 +02:00
Matthew Olsson
5b84bd6e45 LibWeb: Add DocumentOrShadowRoot::get_animations() 2024-06-03 10:53:32 +02:00
Matthew Olsson
37322baf54 LibWeb: Ensure all DocumentTimeline objects have the same time value
The DocumentTimeline constructor used the current millisecond time to
initialize its currentTime, but that means that a newly created timeline
would always have a different time value than other timelines that have
been through the update_animations_and_send_events function.
2024-06-03 10:53:32 +02:00
Nico Weber
4e9480b719 LibGfx/WebP: Add a VERIFY() for an assumption
This should have no behavior change after the previous commit.
2024-06-03 07:48:53 +02:00
Nico Weber
857750dfed LibGfx/WebPLoader: Survive calling loop_count() before other accessors
Fixes `animation` asserting when reading a webp input.

(The other order of operations is still covered by TestImageWriter.cpp.)
2024-06-03 07:48:53 +02:00
Andreas Kling
3020c5766e LibGfx: Remove unnecessary use of LibGUI in Gfx::Palette
Let's not require a cross-library badge like this.
2024-06-02 20:26:56 +02:00
Andreas Kling
09980af4ea LibWeb: Add Web::UIEvents::MouseButton enum, drop dependency on LibGUI
This was the only thing LibWeb needed from LibGUI, and we can just
duplicate the enum in LibWeb and get rid of a bogus dependency.
2024-06-02 20:24:42 +02:00
Andreas Kling
3e46874858 LibSyntax: Remove minor unnecessary use of LibGUI
This was the only stuff that made it look like LibSyntax depends on
LibGUI, when it really doesn't.
2024-06-02 20:00:29 +02:00
Jamie Mansfield
295c4ef51a LibWeb/Fetch: Use MimeType in DataURL 2024-06-02 19:55:53 +02:00
Jamie Mansfield
2b59ba19e0 LibWeb/WebSockets: Use correct URL parser 2024-06-02 19:55:53 +02:00
Jamie Mansfield
48e834918a LibWeb/SVG: Implement SVGTransformList.numberOfItems 2024-06-02 19:55:53 +02:00
Jamie Mansfield
4a1d02e7d8 LibWeb/SVG: Implement SVGTransformList.length 2024-06-02 19:55:53 +02:00
Diego
ad9457b725 LibWasm: Properly check memory.copy addresses
Prevents overflow when checking that `memory.copy` addresses are valid.
This prevents a potential crash in the VM.
2024-06-02 19:45:54 +02:00
Diego
308592969c LibWasm: Properly check table bounds in element instantiation
Offset is now checked using saturating addition to avoid overflow. This
prevents a crash in the VM during instantiation.
2024-06-02 19:31:25 +02:00
Diego
2fabbae0f6 LibWasm: Properly check active data segment offset in instantiation
Before, it was possible to crash the VM during instantiation when an
active data segment requested to put data in memory at an invalid
offset.
2024-06-02 19:30:40 +02:00
Andreas Kling
ae90e26315 LibJS/Bytecode: Make constant deduplication a bit smarter
Instead of scanning through the list of seen constants, we now have a
more structured storage of the constants true, false, null, undefined,
and every possible Int32 value.

This fixes an O(n^2) issue found by Kraken/json-stringify-tinderbox.js
2024-06-02 16:34:08 +02:00
Andreas Kling
044539c60b LibJS/Bytecode: Rewrite Jump-to-Return-or-End as just Return or End
Instead of wasting time jumping to a shared Return or End instruction,
we can also emit a Return or End directly in many cases.
2024-06-02 16:34:08 +02:00
Andreas Kling
7971cfdd89 LibJS/Bytecode: Move bytecode operand rewriting to a separate pass
This way we don't have to do it whenever performing some kind of
instruction rewrite.
2024-06-02 16:34:08 +02:00
Andreas Kling
97983275bc LibJS/Bytecode: Perform constant folding on binary expressions
This turns expressions like `(2 + 3) * 8 / 2` into a constant (20)
at bytecode compilation time instead of generating instructions
to calculate the value.
2024-06-02 16:34:08 +02:00
Andreas Kling
c372a084a2 LibJS/Bytecode: Add and use copy_if_needed_to_preserve_evaluation_order
This is a new Bytecode::Generator helper that takes an operand and
returns the same operand, or a copy of it, in case a copy is required
to preserve correct evaluation order.

This can be used in a bunch of places where we're worried about
clobbering some value after obtaining it.

Practically, locals are always copied, and temporary registers as well
as constants are returned as-is.
2024-06-02 16:34:08 +02:00
Matthew Olsson
73aadddbc1 LibWeb: Reject invalid keyframe offset values 2024-06-02 16:07:12 +02:00
Matthew Olsson
e13cd914a9 LibWeb: Handle animating the 'all' property 2024-06-02 16:07:12 +02:00
Matthew Olsson
64ec66e209 LibWeb: Handle animating 'initial' property values 2024-06-02 16:07:12 +02:00
Matthew Olsson
2adb4c460d LibWeb: Change enum to enum class in KeyframeEffect 2024-06-02 16:07:12 +02:00
Matthew Olsson
6859826e3d LibWeb: Handle persisting an animation after it has been removed 2024-06-02 16:07:12 +02:00
Matthew Olsson
a80af938eb LibWeb: Support subtree option in Animatable.getAnimations() 2024-06-02 16:07:12 +02:00
Matthew Olsson
e2cb25e35c LibWeb: Support interpolation of mixed percentage dimension units 2024-06-02 15:12:17 +02:00
Diego
d1cfddc177 LibWasm: Check section lengths when parsing
Sections in WebAssembly give their length in bytes after they're
declared. This commit makes sure that length is upheld.
2024-06-01 22:27:15 +02:00
Liav A.
a7aa843bcc Utilities/tar: Open archive file before changing directory
Otherwise the utility will fail to open the archive file because it's
presumably not in the chosen directory.
2024-06-01 18:35:31 +02:00
Diego
d906255cbb LibWasm: Improve table support
Implements `table.get`, `table.set`, `elem.drop`, `table.size`,
and `table.grow`. Also fixes a few issues when generating ref-related
spectests. Also changes the `TableInstance` type to use
`Vector<Reference>` instead of `Vector<Optional<Reference>>`, because
the ability to be null is already encoded in the `Reference` type.
2024-06-01 16:21:03 +02:00
Nico Weber
347e2831b2 LibGfx/WebPWriter: Do not write color index if only one channel varies
The benefit of the color indexing transform is to have only one
varying channel after it (the green channel, which after the
transform serves as index into the color table).

If there is only one varying channel before the transform, it's
not beneficial. (...except if there are <= 16 colors, then the
pixel bundling presumably still works.)
2024-06-01 14:52:00 +02:00
Jamie Mansfield
e13b9bef5c LibWeb: Don't warn when 'scopes' is present in import maps
Another mistake I made when implementing import map support.
2024-06-01 07:42:48 -04:00
Jamie Mansfield
76eb7568c9 LibWeb: Set import map scopes when parsing 2024-06-01 07:42:48 -04:00
Andreas Kling
8b7ad09a07 LibJS: Add test to verify copying this to a local doesn't break
Co-Authored-By: Simon Wanner <simon+git@skyrising.xyz>
2024-06-01 09:39:50 +02:00
Andreas Kling
e6b1e54c44 LibJS/Bytecode: Don't generate ResolveThisBinding if not needed
Functions that don't have a FunctionEnvironment will get their `this`
value from the ExecutionContext. This patch stops generating
ResolveThisBinding instructions at all for functions like that, and
instead pre-populates the `this` register when entering a new bytecode
executable.
2024-06-01 09:39:50 +02:00
Andreas Kling
9d22db2802 LibJS/Bytecode: Pretty-print the this register as "this" 2024-06-01 09:39:50 +02:00
Andreas Kling
507f83a615 LibJS/Bytecode: Always resolve this binding into dedicated register
We already have a dedicated register slot for `this`, so instead of
having ResolveThisBinding take a `dst` operand, just write the value
directly into the `this` register every time.
2024-06-01 09:39:50 +02:00
Andreas Kling
9d57b55f24 LibJS/Bytecode: Make Generator aware of the function it's compiling 2024-06-01 09:39:50 +02:00
Andreas Kling
59c2637fdc LibJS/Bytecode: Rename emit_function_body_bytecode() -> compile()
This function isn't really one of the "emit_foo" family -- it's the main
compilation driver!
2024-06-01 09:39:50 +02:00
Timothy Flynn
b01e810a89 LibWeb+LibWebView+WebContent: Support case-insensitive find-in-page
This allows searching for text with case-insensitivity. As this is
probably what most users expect, the default behavior is changes to
perform case-insensitive lookups. Chromes may add UI to change the
behavior as they see fit.
2024-06-01 07:37:54 +02:00
Timothy Flynn
fe3fde2411 AK+LibUnicode: Implement a case-insensitive variant of find_byte_offset
The existing String::find_byte_offset is case-sensitive. This variant
allows performing searches using Unicode-aware case folding.
2024-06-01 07:37:54 +02:00
Diego
cf6aa77816 LibWasm: Fix memory limits validator discrepancy
The spec allows the maximum size of the linear memory to be 2^16.
However, we previously only allowed 2^16-1, which caused a spec
compliance issue.
2024-06-01 00:28:48 +02:00
Andrew Kaster
a9fdd819c3 LibCore: Don't leak EventLoopImplementationUnix's ThreadData
The ThreadData still has a lifetime a longer than the thread it was
created for, but at least now it's not leaked at process exit.
2024-05-31 15:24:46 -06:00
Nico Weber
8a21992030 image: Add a --webp-allowed-transforms switch
This is mainly useful for testing.
2024-05-31 22:39:25 +02:00
Nico Weber
533b29dde7 LibGfx/WebPWriter: Add a toggle for disabling individual transforms 2024-05-31 22:39:25 +02:00
Nico Weber
47d3245ea7 LibGfx/WebPWriter: Do not convert -inf to unsigned
Else UBSan complains about the color indexing test in this PR.
2024-05-31 22:39:25 +02:00
Nico Weber
9e61912f64 LibGfx/WebPWriter: Fix bug computing max_symbol bit length
Storing a number n needs floor(log2(n) + 1) bits, not ceil(log2(n)).
(The two expressions are identical except for when n is a power of 2.)

Serendipitously covered by the indexed color transform tests in this PR.
2024-05-31 22:39:25 +02:00
Nico Weber
5c990e87f4 LibGfx/WebPWriter: Add a dbgln_if() 2024-05-31 22:39:25 +02:00
Nico Weber
e212c20228 LibGfx/WebPWriter: Implement pixel bundling for color indexing
If an image has <= 16 colors, WebP lossless files pack multiple
color table indexes into a single pixel's green channel, further
reducing file size. This adds support for that.

My current test files all have more than 16 colors. For a 16x16
black-and-white bitmap that contains a little smiley face in the
middle, this reduces the output size from 128B to 54B.
2024-05-31 22:39:25 +02:00
Nico Weber
cae672e1f9 LibGfx/WebPWriter: Implement color indexing transform
If an image has 256 or fewer colors, WebP/Lossless allows storing
the colors in a helper image, and then storing just indexes into that
helper image in the main image's green channel, while setting
r, b, and a of the main image to 0.

Since constant-color channels need to space to store in WebP,
this reduces storage needed to 1/4th (if alpha is used) or 1/3rd
(if alpha is constant across the image).

If an image has <= 16 colors, WebP lossless files pack multiple
color table indexes into a single pixel's green channel, further
reducing file size. This pixel packing is not yet implemented in
this commit.

GIFs can store at most 256 colors per frame, so animated gifs
often have 256 or fewer colors, making this effective when
transcoding gifs.

(WebP also has a "subtract green" transform, which can be used
to need to store just a single channel for grayscale images, without
having to store a color table. That's not yet implemented -- for now,
we'll now store grayscale images using this color indexing transform
instead, which wastes to storage for the color table.)

(If an image has <= 256 colors but all these colors use only a single
channel, then storing a color table for these colors is also wasteful,
at least if the image has > 16 colors too. That's rare in practice,
but maybe we can add code for it later on.)

(WebP also has a "color cache" feature where the last few used colors
can be referenced using very few bits. This is what the webp spec says
is similar to palettes as well. We don't implement color cache writing
support yet either; maybe it's better than using a color indexing
transform for some inputs.)

Some numbers on my test files:

sunset-retro.png: No performance or binary size impact. The input
quickly uses more than 256 colors.

giphy.gif (184k): 4.1M -> 3.9M, 95.5 ms ± 4.9 ms -> 106.4 ms ± 5.3 ms
Most frames use more than 256 colors, but just barely. So fairly
expensive runtime wise, with just a small win.

(See comment on #24454 for the previous 4.9 MiB -> 4.1 MiB drop.)

7z7c.gif (11K): 118K -> 40K
Every frame has less than 256 colors (but more than 16, so no packing),
and so we can cut filesize roughly to 1/3rd: We only need to store an
index per channel. From 10.7x as large as the input to 3.6x as large.
2024-05-31 22:39:25 +02:00
Nico Weber
633f509eb4 LibGfx/WebP: Move TransformType to WebPSharedLossless.h 2024-05-31 22:39:25 +02:00
Nico Weber
804e85265e LibGfx/WebPWriter: Use an IsOpaque struct for tracking opacity
No behavior change, but this makes it easy to correctly set this
flag when adding an indexing transform: Opacity then needs to be
determined based on if colors in the color table have opacity,
not if the indexes into the color table do.

With this struct, only the first time something sets opacity is
honored, giving us those semantics.
2024-05-31 22:39:25 +02:00
Nico Weber
c5dedbc54a LibGfx/WebPWriter: Give write_VP8L_coded_image() a kind parameter
This way, it can be used to write entropy-coded-images too,
which will be used when writing transforms.
2024-05-31 22:39:25 +02:00
Nico Weber
b50702f490 LibGfx/WebP: Move ImageKind to WebPSharedLossless.h 2024-05-31 22:39:25 +02:00
Nico Weber
9dfb254c73 LibGfx/WebPWriter: Extract write_VP8L_coded_image() 2024-05-31 22:39:25 +02:00
Nico Weber
d9aa594e86 LibGfx/WebPWriter: Add comment for image-stream production 2024-05-31 22:39:25 +02:00
Nico Weber
286cc6f905 LibGfx/WebPLoader: Prefix a few dbgln_if()s with chunk name 2024-05-31 22:39:25 +02:00
Nico Weber
a2ddf054f2 LibGfx/WebPWriter: Remove two obsolete comments
In an early version of the huffman writing code, we always used 8 bits
here, and the comments still reflected that. Since we're now always
writing only as many bits as we need (in practice, still almost always
8), the comments are misleading.
2024-05-31 22:39:25 +02:00
Andreas Kling
391c53025e Revert "LibProtocol: Retry reading if read errors with EAGAIN"
This reverts commit d0f88d4958.

This made us hang when loading GitHub repo pages.
2024-05-31 17:17:24 +02:00
Andreas Kling
a48fc971c6 LibJS: Rearrange ExecutionContext members to shrink the class
Just a minor tweak to make the class 8 bytes smaller.
2024-05-31 16:31:33 +02:00
Andreas Kling
a3782782fa LibJS: Remove two unused members from ExecutionContext 2024-05-31 16:31:33 +02:00
Romain Chardiny
f5cacf25e1 Utilities: Add shred utility 2024-05-31 13:49:34 +01:00
Romain Chardiny
892da127d0 LibCore: Add wrapper for fsync() 2024-05-31 13:49:34 +01:00
Simon Wanner
11bb216912 LibTextCodec: Add replacement decoder 2024-05-31 07:56:26 +02:00
Simon Wanner
7f3b457e62 LibTextCodec: Add EUC-KR decoder 2024-05-31 07:56:26 +02:00
Simon Wanner
ded6512ca8 LibTextCodec: Add Shift_JIS decoder 2024-05-31 07:56:26 +02:00
Simon Wanner
06f7c393b2 LibTextCodec: Add ISO-2022-JP decoder 2024-05-31 07:56:26 +02:00
Simon Wanner
45f0ae52be LibTextCodec: Add EUC-JP decoder 2024-05-31 07:56:26 +02:00
Simon Wanner
9943bb1d8e LibTextCodec: Add Big5 decoder 2024-05-31 07:56:26 +02:00
Simon Wanner
2ce61fe6ea LibTextCodec: Add GBK/GB18030 decoder
Includes changes from GB-18030-2022, which are not yet included in the
Encoding Specification, but WebKit, Blink and WPT are already updated.
2024-05-31 07:56:26 +02:00
Simon Wanner
9ed52504ab LibTextCodec: Delegate to process() in default validate() implementation 2024-05-31 07:56:26 +02:00
Simon Wanner
88c2586f25 LibTextCodec: Remove unused decoder classes 2024-05-31 07:56:26 +02:00
Andrew Kaster
46e00a8f5e LibWeb: Parse TokenizedFeatures from window.open 2024-05-30 16:16:33 -04:00
Andrew Kaster
e2d50dc5dd LibWeb: Move window.open TokenizedFeature parsing into its own file 2024-05-30 16:16:33 -04:00
Tim Ledbetter
79143833b6 LibWeb/WebDriver: Ensure error responses are serialized correctly 2024-05-30 13:53:24 -04:00
stelar7
a4e97c1598 WebDriver: Dont assume the pageLoad is an i64 2024-05-30 11:46:02 -04:00
stelar7
fa9c234976 WebDriver: Parse webSocketUrl capability 2024-05-30 11:46:02 -04:00
Matthew Olsson
9ea6ab0ad4 LibJS+LibWeb: Fix a ton of JS_CELL-like macro issues 2024-05-30 09:29:20 -06:00
Tim Ledbetter
7aea87c9df LibWeb+LibWebView+WebContent: Add basic find in page functionality
This allows the browser to send a query to the WebContent process,
which will search the page for the given string and highlight any
occurrences of that string.
2024-05-30 16:30:11 +02:00
Diego
4eaabdad34 LibWasm: Properly read blocktypes
This works for now, but is technically still not spec compliant. Right
now, we're (potentially) missing one bit when reading function indices.
See the relevant issue: #24462.
2024-05-29 22:33:15 +02:00
Daniel Bertalan
9d3b73743e sql: Work around Clang 17/18 run-time call to consteval function
There was an issue with Clang that causes `consteval` function calls
from default initializers of fields to be made at run-time. This
manifested itself in the case of `ByteString::formatted` as an undefined
reference to `check_format_parameter_consistency` once format string
checking was enabled for Clang builds. The workaround is simple (just
move it to the member initializer list), and unblocks a useful change.
2024-05-29 13:34:15 -06:00
Andrew Kaster
ca806a3e18 WebDriver+WebContent: Add /session/🆔/window/consume-user-activation
This extension to the WebDriver spec is defined in the HTML spec, how
fun.
2024-05-29 21:30:15 +02:00
Andrew Kaster
9bc1318a78 LibWeb: Consume user activation when showing a picker dialog 2024-05-29 21:30:15 +02:00
Andrew Kaster
a3a74245d6 LibWeb: Implement consume user activation AO 2024-05-29 21:30:15 +02:00
Andrew Kaster
45860e3878 LibWeb: Move consume history-action user activation to Window 2024-05-29 21:30:15 +02:00
Andrew Kaster
9c6ebe21d2 LibWeb: Remove get prefix from activation timestamp getters 2024-05-29 21:30:15 +02:00
Andrew Kaster
2fde20993b LibWeb: Update show the picker if applicable to latest spec text 2024-05-29 21:30:15 +02:00
Jamie Mansfield
7da449ce01 LibWeb: Check correct activation (spec fix)
See:
- https://github.com/whatwg/html/commit/d28284f
2024-05-29 09:32:59 -06:00
Jamie Mansfield
34b2a4f7ca LibWeb: Add getter for history-action activation 2024-05-29 09:32:59 -06:00
Jamie Mansfield
a741f68eb9 LibWeb: Implement "consume history-action user activation" 2024-05-29 09:32:59 -06:00
Jamie Mansfield
30539db2fc LibWeb: Use Infinity<double> for infinity
Co-authored-by: Matthew Olsson <matthewcolsson@gmail.com>
2024-05-29 09:32:59 -06:00
Jamie Mansfield
01bd179eef LibWeb: Implement UserActivation 2024-05-29 09:32:59 -06:00
Jamie Mansfield
227151b881 LibWeb: Add getter for sticky activation 2024-05-29 09:32:59 -06:00
Matthew Olsson
1965943026 LibWeb: Reject invalid AnimationEffect duration string values 2024-05-29 08:18:24 +02:00
Matthew Olsson
3e221fbb2d IDLGenerators: Handle restricted/unrestricted floating point types 2024-05-29 08:18:24 +02:00
Matthew Olsson
2bd8093449 LibWeb: Detect explicit null timeline given in KeyframeAnimationOptions
We already do this for the timeline argument in the KeyframeEffect
constructor
2024-05-29 08:18:24 +02:00
Matthew Olsson
7bd62809a9 LibWeb: Include leading colons in KeyframeEffect::pseudo_element() 2024-05-29 08:18:24 +02:00
Matthew Olsson
854d02fe10 LibWeb: Reject more invalid pseudo-element selectors in KeyframeEffect
The old way this was written wouldn't actually check for the presence of
the two initial colons in the pseudo-element string.
2024-05-29 08:18:24 +02:00
Matthew Olsson
e188ab1493 LibWeb: Add missing spec links to KeyframeEffect 2024-05-29 08:18:24 +02:00
Tim Ledbetter
d0f88d4958 LibProtocol: Retry reading if read errors with EAGAIN
This fixes an issue where fetch requests to HTTP(s) addresses would
fail inside workers.
2024-05-29 08:17:18 +02:00
Tim Ledbetter
bb923983fc LibWeb: Implement WorkerGlobalScope.importScripts()
This method allows workers to synchronously import one or more scripts.
2024-05-29 08:17:18 +02:00
Tim Ledbetter
975a067f58 LibWeb: Align worker ESO getters with the specification
The `api_base_url()` and `policy_container()` getters now get their
respective objects from the global scope.
2024-05-29 08:17:18 +02:00
Tim Ledbetter
2d487ee5ab LibWeb: Add spec comments to WorkerEnvironmentSettingsObject::setup()
No behavior change.
2024-05-29 08:17:18 +02:00
MacDue
9c711bc868 LibWeb+Ladybird: Add option to enable the AffineCommandExecutorCPU
This adds a `--experimental-cpu-transforms` option to Ladybird and
WebContent (which defaults to false/off).

When enabled the AffineCommandExecutorCPU will be used to handle
painting transformed stacking contexts (i.e. stacking contexts where
the transform is something other than a simple translation). The regular
command executor will still handle the non-transformed cases.

This is hidden under a flag as the `AffineCommandExecutorCPU` is very
incomplete now. It missing support for clipping, text, and other basic
commands. Once most common commands have been implemented this flag
will be removed.
2024-05-29 08:17:01 +02:00
MacDue
b9db9013f5 LibWeb: Add (initial) AffineCommandExecutorCPU
This CommandExecutor is intended to provide better support for painting
stacking contexts where the transform is not a simple translation. It
is not intended to replace the CPU command executor (as its methods of
painting will likely be slower for the non-transformed case), instead,
it will function as a companion executor to handle transformations.

This is only intended to properly handle 2D transformations (skews,
rotations, scaling, etc). Full support for 3D transformations would
need further changes in LibGfx.

As it stands this is (very) incomplete and experimental, but hopefully,
this can be fleshed out to the point where it supports most common
painting commands.
2024-05-29 08:17:01 +02:00
MacDue
6333159108 LibWeb: Add support for nested painting command executors
This adds two new CommandResults: ContinueWithNestedExecutor and
ContinueWithParentExecutor.

ContinueWithNestedExecutor switches the command executor to the result
of calling `.nested_executor()` on the current CommandExecutor.

ContinueWithParentExecutor returns to the previous command executor
(i.e. what it was before the last ContinueWithNestedExecutor).
2024-05-29 08:17:01 +02:00
MacDue
a5442ad70d LibGfx: Add shortcut to draw_scaled_bitmap_with_transform() for scales
Using `draw_scaled_bitmap()` for simple scales is almost always better
than using `draw_scaled_bitmap_with_transform()` which does not respect
the scaling mode.
2024-05-29 08:17:01 +02:00
MacDue
f7bf14605c LibWeb: Remove PaintBorders recording painter command
`Painting::paint_all_borders()` only uses `.draw_line()` for simple
borders and `.fill_path()` for more complex cases. These are both
already supported by the `RecordingPainter` so removing this command
simplifies the painting API.

Two test changes:

css-background-clip-text: Borders are now drawn via the AA painter
(which makes them closer to how they appear in other browsers).

corner-clip-inside-scrollable: Borders removed (does not change test)
due to imperceptible sub-pixel changes.
2024-05-29 08:17:01 +02:00
Nico Weber
0ae36b9524 LibGfx/WebPWriter: Write correct alpha use hint in animation VP8L header
Since we now compute this for free, might as well fill it in.

As far as I can tell, no observable behavior difference anywhere.
2024-05-29 07:10:00 +01:00
Nico Weber
2d80a5c6ca LibGfx/WebPWriter: Let compress_VP8L_image*() return if image was opaque
We compute that as part of compression there anyways, so let's compute
it only once.

No behavior change.
2024-05-29 07:10:00 +01:00
Nico Weber
99d280a927 LibGfx/WebPLoader: Relax vp8x / vp8l alpha check
The check from 0805319d1e is too strict for animated images: It's
possible that an animation has alpha, but a frame doesn't.

(For example, if the animation is 10x10 pixels, but one frame updates
just 1x1 pixels. But even a full-sized frame could just not have alpha.)

If the VP8X header claims that the animation has alpha, we could check
that at least one frame has alpha, but for now we just don't do any
checking for animated images.
2024-05-29 07:10:00 +01:00
Nico Weber
c71b9fe6f8 LibGfx/WebPWriter: Add a comment explaining a file offset 2024-05-29 07:10:00 +01:00
Aliaksandr Kalenik
b8d18ebcf7 LibWeb+WebContent: Change event loop to synchronously paint next frame
...instead of scheduling repaint timer in PageClient.

This change fixes flickering on Discord that happened because:
- Event loop schedules repainting by activating repaint timer
- `Document::tear_down_layout_tree()` destroys paintable tree
- Repaint timer invokes callback and renders an empty frame because
  paintable tree was destroyed
2024-05-28 18:21:18 +02:00
Aliaksandr Kalenik
e806136116 LibWeb: Refresh clip and scroll state only when needed
Although refreshing is cheap, it was performed before each hit-testing
and was 2-4% in profiles on Discord and Twitter.

Now clip and scroll states are refreshed only if scroll offset has
changed.
2024-05-28 17:45:49 +02:00
Tim Ledbetter
d6297ec074 LibWeb: Cast to the correct type in Element::auto_directionality()
Previously, we always cast to a HTMLInputElement when getting the value
of an auto directionality form associated element. This caused
undefined behavior when determining the directionality of an element
that wasn't a HTMLInputElement.
2024-05-28 09:51:07 +02:00
Tim Ledbetter
0b0ad5c9db LibWeb: Calculate width property resolved value correctly
This means that relative width values are now correctly resolved when
calling `getComputedStyle()`.
2024-05-28 08:08:31 +02:00
Tim Ledbetter
7d192ed8c1 LibWeb: Don't crash on clicking a label with an associated text input
Previously, we assumed that all label control paintables were of type
`LabelablePaintable`. This caused a crash when clicking on a label with
a text input control.
2024-05-28 08:07:05 +02:00
Shannon Booth
6466fca20a LibWeb: Implement BaseAudioContext.createGain 2024-05-28 08:06:09 +02:00
Shannon Booth
1fa7235fec LibWeb: Add Implement GainNode interface
As with all other current audio nodes we still need to wire up the
inputs and outputs so it can be properly used in an audio context - but
this is enough to implement the public IDL interface.
2024-05-28 08:06:09 +02:00
Shannon Booth
97bf9e7953 LibWeb: Stub out Window-Management proposal extensions to Screen API
As defined in https://w3c.github.io/window-management
2024-05-27 17:24:51 -06:00
Simon Wanner
b79815c5a5 LibTextCodec: Add x-mac-cyrillic decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
07a9435da5 LibTextCodec: Add windows-1258 decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
275b89720b LibTextCodec: Add windows-1257 decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
c76308c7e6 LibTextCodec: Add windows-1256 decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
eb9ed10573 LibTextCodec: Add windows-1253 decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
2d35687db0 LibTextCodec: Add windows-874 decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
1b6878b6ca LibTextCodec: Add KOI8-U decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
1fd3a6f48c LibTextCodec: Add ISO-8859-16 decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
3e882f26db LibTextCodec: Sort checks in decoder_for mostly alphabetically
Keeps checks for common encodings (Latin1 & UTF-*) at the top.
2024-05-27 20:50:50 +02:00
Simon Wanner
56241df604 LibTextCodec: Add ISO-8859-14 decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
4188e328ac LibTextCodec: Add ISO-8859-13 decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
cc640f4363 LibTextCodec: Add ISO-8859-10 decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
d73220837e LibTextCodec: Add ISO-8859-8(-I) decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
24028e353e LibTextCodec: Add ISO-8859-7 decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
01c3b8091a LibTextCodec: Add ISO-8859-6 decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
763d904ad5 LibTextCodec: Add ISO-8859-5 decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
c6b17320db LibTextCodec: Add ISO-8859-4 decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
6c84edaaa2 LibTextCodec: Add ISO-8859-3 decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
fc783199f1 LibTextCodec: Add IBM866 decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
96b3c35358 LibTextCodec: Implement table based decoders as SingleByteDecoder
Instead of copy-pasting the implementation, let's use a single class.
This "Single Byte Decoder" concept even exists in the Encoding Spec :^)
2024-05-27 20:50:50 +02:00
Simon Wanner
3029406c4b LibWeb: Handle TextDecoder's fatal flag 2024-05-27 20:50:50 +02:00
Diego
f8ac883fb4 LibWasm: Implement element section parsing 2024-05-27 19:38:45 +02:00
Idan Horowitz
95b9d77536 Kernel: Prevent reference to unaligned u32 in MBRPartitionTable init
This is technically UB, so triggers KUBSAN.
2024-05-27 17:35:42 +02:00
Jamie Mansfield
3095daa7c8 LibWeb: Implement HTMLImageElement.currentSrc
Removes some console noise from lner.co.uk :)
2024-05-27 17:34:59 +02:00
Jamie Mansfield
600daea544 LibWeb: Implement HTMLIFrameElement.loading 2024-05-27 17:34:59 +02:00