Commit Graph

33845 Commits

Author SHA1 Message Date
Aliaksandr Kalenik
cc3d95a356 LibWeb: Remove did_request_scroll IPC call
No longer used after moving scrollbar painting into WebContent.
2024-06-05 07:03:42 +02:00
Aliaksandr Kalenik
5285e22f2a 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().
2024-06-05 07:03:42 +02:00
Aliaksandr Kalenik
eb909118bf LibWeb: Propagate scrollbar-width property from root element to viewport 2024-06-05 07:03:42 +02:00
Aliaksandr Kalenik
50920b0595 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 })
2024-06-05 07:03:42 +02:00
Jamie Mansfield
8e062a52a3 LibWeb: Move NetworkPartitionKey into a header
This is used elsewhere, such as the HTMLLinkElement.
2024-06-05 05:42:47 +01:00
Jamie Mansfield
2ffda00347 LibWeb: Implement HTMLImageElement.crossOrigin 2024-06-05 05:42:47 +01:00
Jamie Mansfield
d7d60268ec LibWeb: Implement HTMLLinkElement.crossOrigin 2024-06-05 05:42:47 +01:00
Jamie Mansfield
735859bc10 LibWeb: Implement HTMLLinkElement.fetchPriority 2024-06-05 05:42:47 +01:00
Jamie Mansfield
d1f884533e LibWeb: Update "create a link request" for spec changes
Fetch priority is added, and one line is split into two :)
2024-06-05 05:42:47 +01:00
Jamie Mansfield
21cf2c2981 LibWeb: Implement HTMLScriptElement.fetchPriority 2024-06-05 05:42:47 +01:00
Jamie Mansfield
8315ad6759 LibWeb: Implement HTMLImageElement.fetchPriority 2024-06-05 05:42:47 +01:00
Jamie Mansfield
956106c6d8 LibWeb: Add from_string function for request priority 2024-06-05 05:42:47 +01:00
Jamie Mansfield
2fde20adf9 LibWeb: Add IDL enum for fetch priority attribute 2024-06-05 05:42:47 +01:00
Andreas Kling
4822d1da4e LibWeb: Remove unused CRC2D::bitmap_font_fill_text() 2024-06-04 18:45:30 +02:00
Andreas Kling
e81bd34561 LibGfx: Remove more unused Font APIs 2024-06-04 18:45:30 +02:00
Andreas Kling
a4a3703fb4 LibGfx: Remove unused GlyphBitmap class 2024-06-04 18:45:30 +02:00
Andreas Kling
d86f54da30 LibGfx: Remove Font::presentation_size()
This was a legacy version of point_size() that returned a u8.
2024-06-04 18:45:30 +02:00
Andreas Kling
d95f5692a3 LibGfx: Remove Font::qualified_name() and some FontDatabase APIs
...because the FontDatabase APIs were not used, and they were the only
users of qualified_name().
2024-06-04 18:45:30 +02:00
Andreas Kling
eccfdede10 LibGfx: Remove various unused Font APIs 2024-06-04 18:45:30 +02:00
Andreas Kling
23bb449026 LibGfx: Remove Utf32View APIs from Painter 2024-06-04 18:45:30 +02:00
Andreas Kling
1a2a34fa43 LibGfx: Remove Bitmap::glyph_spacing()
This was only ever non-zero for SerenityOS bitmap fonts.
2024-06-04 18:45:30 +02:00
Andreas Kling
04a6e2f83d LibWeb: Remove Gfx::BitmapFont
This class supported the binary bitmap font file format in SerenityOS,
and isn't something we need in Ladybird.
2024-06-04 18:45:30 +02:00
Andreas Kling
30a92911fa WebContent: Remove update_system_fonts() IPC message
This was no longer doing anything. We'll eventually want a way to pass
system default fonts to each WebContent process, but we don't need to
squeeze everything through this API that was really meant for Serenity's
very idiosyncratic font system.
2024-06-04 18:45:30 +02:00
Andreas Kling
f78ed0600a LibGfx: Remove FontDatabase "default queries"
At last, nothing depends on these anymore.
2024-06-04 18:45:30 +02:00
Andreas Kling
966d442152 LibWeb+Ladybird: Remove FontPluginSerenity (+ use Ladybird::FontPlugin) 2024-06-04 18:45:30 +02:00
Andreas Kling
fac126bce9 Ladybird+LibWeb: Stop using Gfx::FontDatabase default fonts
This closes the window at WebContent process startup where we were
relying on Gfx::FontDatabase having some resolvable value in its default
font query.
2024-06-04 18:45:30 +02:00
Andreas Kling
49d546fe8b LibGfx: Remove Painter "draw op" mechanism
We were not making use of this in Ladybird, so let's simplify.
2024-06-04 18:45:30 +02:00
Andreas Kling
d3e802cbef LibGfx: Remove a whole bunch of unused Painter APIs 2024-06-04 18:45:30 +02:00
Andreas Kling
10335a07ee LibGfx: Remove Painter's "implicit font" concept
Nothing actually needs this, so let's remove it and no longer have to
deal with figuring out its fallback value.
2024-06-04 18:45:30 +02:00
Andreas Kling
ba8945f6f3 LibWeb: Make DrawText paint command always have a font
Nobody ever tries to create one without a font anyway.
2024-06-04 18:45:30 +02:00
Andreas Kling
1b2d08ee7e LibGfx: Remove a bunch of unused classes 2024-06-04 18:45:30 +02:00
Simon Wanner
0ab4722cee LibTextCodec: Use generated lookup tables for all single byte decoders 2024-06-04 10:21:07 +02:00
Simon Wanner
6b2c459901 LibTextCodec: Fix ISO-8859-1 vs. windows-1252 handling in web contexts
The Encoding specification maps ISO-8859-1 to windows-1252 and expects
the windows-1252 translation table to be used, which differs from
ISO-8859-1 for 0x80-0x9F.

Other contexts expect to get the actual ISO-8859-1 encoding, with 1-to-1
mapping to U+0000-U+00FF, when requesting it.

`decoder_for_exact_name` is introduced, which skips the mapping from
aliases to the encoding name done by `get_standardized_encoding`.
2024-06-04 10:21:07 +02:00
Simon Wanner
46d5cf0443 LibTextCodec: Fix some incorrect encoding aliases 2024-06-04 10:21:07 +02:00
Simon Wanner
09f2d79cb1 LibTextCodec: Bring TextCodec::get_standardized_encoding closer to spec 2024-06-04 10:21:07 +02:00
Simon Wanner
987910ad0f LibWeb: Bring TextDecoder constructor closer to spec 2024-06-04 10:21:07 +02:00
Andreas Kling
6321e97b09 AK: Remove various unused things 2024-06-04 09:19:39 +02:00
Andreas Kling
5b4d071daa Everywhere: Remove LibCrypt
This was totally unused.
2024-06-04 09:19:39 +02:00
Andreas Kling
f2fd8fc928 Everywhere: Remove LibGemini
This hasn't been maintained (or worked at all) for a long time,
and it's not a widely supported protocol, so let's drop it.
2024-06-04 09:19:39 +02:00
Andreas Kling
e4cd91761d Everywhere: Remove LibMarkdown
This was used to convert markdown into HTML for display in the browser,
but no other browser behaves this way, so let's simplify things by
removing it.

(Yes, we could implement all kinds of "convert to HTML and display" for
every file format out there, but that's far outside the scope of a
browser engine.)
2024-06-04 09:19:39 +02:00
Timothy Flynn
edb527e04d Libraries: Remove some Serenity-only interface implementations 2024-06-04 07:45:42 +02:00
Timothy Flynn
126cbce632 Meta: Remove empty LibSystem library and references 2024-06-04 07:45:42 +02:00
Jamie Mansfield
a419dcbe8b LibWeb/Fetch: Update "HTTP fetch" algorithm to latest spec comments
The spec and implementation's comments had diverged a little, this
brings them in line :)
2024-06-04 07:27:52 +02:00
Diego
50dc1c3c19 LibWasm: Fix memarg multi-memory reading
The extension bit for the memory index present in memargs is at
position 6, but we previously checked position 5, which caused a few
spec issues.
2024-06-03 16:20:19 +02:00
Tim Ledbetter
c76140f6ed LibDSP: Remove LibDSP 2024-06-03 15:58:55 +02:00
Tim Ledbetter
d7768cdd0f LibAudio: Move MDCT.h from LibDSP to LibAudio 2024-06-03 15:58:55 +02:00
Timothy Flynn
bdbe2fdcc5 Everywhere: Replace SERENITY_SOURCE_DIR with LADYBIRD_SOURCE_DIR
In order to have checkouts of both SerenityOS and Ladybird, we need to
use a different environment variable for Ladybird.
2024-06-03 15:57:59 +02:00
Andreas Kling
e70d96e4e7 Everywhere: Remove a lot more things we don't need 2024-06-03 10:53:53 +02:00
Andreas Kling
421aa7c475 Everywhere: Remove more unused components 2024-06-03 10:53:53 +02:00
Tim Ledbetter
5863ef852d Meta: Remove references to unused utilities 2024-06-03 10:53:53 +02:00
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