1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-08 05:27:14 +09:00
Commit graph

9522 commits

Author SHA1 Message Date
Tim Ledbetter
e2d0d8e2b9 LibWeb/CSS: Implement the scrollbar-color property
This allows the user to set the scrollbar thumb and track colors.
2025-06-02 00:17:51 +02:00
Aliaksandr Kalenik
285bc005cb LibJS: Do more comprehensive check if next() fast path is possible
Before this change each built-in iterator object has a boolean
`m_next_method_was_redefined`. If user code later changed the iterator’s
prototype (e.g. `Object.setPrototypeOf()`), we still believed the
built-in fast-path was safe and skipped the user supplied override,
producing wrong results.

With this change
`BuiltinIterator::as_builtin_iterator_if_next_is_not_redefined()` looks
up the current `next` property and verifies that it is still the
built-in native function.
2025-06-02 00:15:36 +02:00
Lucien Fiorini
0fcb574041 LibGfx+LibWeb: Turn Gfx::Filter into a SkImageFilter wrapper 2025-06-01 23:22:10 +02:00
Julien Le Bras
3ba6d129df LibJS: Cache string constants in Generator::add_constant
This mirrors the existing caching logic for int32 constants.
Avoids duplication of string constants in m_constants which could
result in stack overflows for large scripts with a lot of similar
strings.
2025-06-01 18:25:59 +02:00
Richard Gibson
9bf836e6c4 js: Don't escape printed strings with --disable-string-quotes 2025-06-01 09:51:09 -04:00
Timothy Flynn
5e40db5a17 AK: Remove some now-unnecessary workarounds for simdutf base64 usage 2025-06-01 08:03:00 -04:00
Aliaksandr Kalenik
4b4d960cba LibWeb: Cancel previous animation if new animation-name is "none"
"none" value should be interpreted as "no animation" to trigger the path
that cancels previous animation if it exists.
2025-06-01 05:02:12 +02:00
Shannon Booth
bc4317be20 LibWeb/HTML: Handle failure determining mime type fetching module script
Fixes crash in WPT test:

https://wpt.live/html/semantics/scripting-1/the-script-element/css-module/content-type-checking.html
2025-05-31 09:15:52 -04:00
Shannon Booth
caf959f06c LibWeb/FileAPI: Handle an aborted stream in Blob::get_stream() close
The streams AO that we were calling to close the stream would assert
if it was not in a readable state. This version of close is exported
publicly in the streams specification, and properly handles this
situation.

Fixes a crash in the imported test, and happens to fix some others!
2025-05-31 09:12:57 -04:00
Andrew Kaster
6f9e56870e CMake: Exclude GlobalFontConfig.h from autogenerated clang module
This header file is never included by any other headers, and including
it would require adding the fontconfig include paths to the swift
interop header generation, which is not desirable.
2025-05-30 15:21:17 -06:00
Andrew Kaster
17b7f192c4 LibGfx: Add a strict CMake check for the libpng apng patch 2025-05-30 15:21:07 -06:00
Andrew Kaster
0f81f021ce LibWeb: Clean up main thread promise when exiting RenderingThreads
Not cleaning these up by rejecting or resolving the promise causes
the main thread to try to reject them at EventLoop::exit() time.

If the RenderThread has already been destroyed by then, we get into
use-after-free territory and segfault.
2025-05-30 16:18:23 +02:00
Aliaksandr Kalenik
3178679f0b LibWeb: Implement CSS transitions support for pseudo elements
We already had all necessary things for pseudo elements support in place
except ability to save transition properties in Animatable. This commit
adds the missing part.
2025-05-30 15:48:16 +02:00
Andreas Kling
61285ffbee LibWeb: Add document null check in ...navigable_target_name_property_set 2025-05-30 10:13:25 +02:00
Andreas Kling
2eea8894a1 LibWeb: Don't crash on named property access on detached window
In WindowProxy.[[Get]] it's not guaranteed that the current principal
global object has an associated document at the moment. This may happen
if a script is continuing to execute while a navigation has been
initiated.

Because of that, we can't blindly dereference the active document
pointer, so this patch adds a null check.
2025-05-30 10:13:25 +02:00
Lucien Fiorini
81e84c8273 js: Add option to disable quotes around strings 2025-05-29 17:33:26 -06:00
Timothy Flynn
23855bd412 LibWebView: Do not make the client bitmap shareable for screenshots
Not sure what the issue is here, but it seems to cause very incorrect
screenshots on macOS. In any case, it's wasted computation.
2025-05-29 16:24:08 -04:00
InvalidUsernameException
164afdcc59 LibWeb: Ensure scroll offset is applied to mask-images
When recording the display list for a stacking context, the following
operations (relevant to this bug) happened:
* push a stacking context
  * as part of that push a None-value to the scroll frame id stack
* apply filters
* apply masking
* paint recursively

This meant that mask-images were always recorded without scroll frame
id, causing them to be painted without any scroll offset. As a result
mask-images would break as soon as the website using them was scrolled.

Instead, push to the scroll frame id stack later to solve the problem:
* push a stacking context
* apply filters
* apply masking
* push a None-value to the scroll frame id stack
* paint recursively
2025-05-29 22:02:07 +02:00
Callum Law
ed65d5b342 LibWeb: Serialize CSS declarations as shorthands where applicable
When serializing CSS declarations we now support combining multiple
properties into a single shorthand property in some cases.

This comes with a healthy dose of FIXMEs, including work to be done
around supporting:
 - Nested shorthands (e.g. background, border, etc)
 - Shorthands which aren't represented by the ShorthandStyleValue type
 - Subproperties pending substitution

This gains us a bunch of new test passes, both for WPT and in-tree
2025-05-29 12:04:28 +02:00
Callum Law
94f5a51820 LibWeb: Convert white-space CSS property to shorthand
This exposed a few bugs which caused the following tests to behave
incorrectly:
- `tab-size-text-wrap.html`: This previously relied on a bug where we
  incorrectly treated `white-space: pre` as allowing text wrapping. The
  fix here is to implement the text-wrap CSS shorthand property.

- `execCommand-preserveWhitespace.html`: We don't correctly serialize
  shorthand properties. This is covered by an existing FIXME in
  `CSSStyleProperties::serialized()`

- `white-space-shorthand.html`: The last 5 subtests here fail as we
  don't correctly handle shorthand properties in
  `CSSStyleProperties::remove_property()`. This is covered by an
  existing FIXME in said function.
2025-05-29 12:04:28 +02:00
Callum Law
9d06c86fe4 LibWeb: Support shorthands as relevant_css_property for editing commands 2025-05-29 12:04:28 +02:00
Callum Law
45689936f2 LibWeb: Support shorthand properties as presentational hints 2025-05-29 12:04:28 +02:00
Callum Law
9480b1fc5c LibWeb: Parse and propagate white-space-trim CSS property 2025-05-29 12:04:28 +02:00
Callum Law
50bdd2cb85 LibWeb: Parse and propagate text-wrap-mode CSS property 2025-05-29 12:04:28 +02:00
Callum Law
ea30356fba LibWeb: Parse and propagate white-space-collapse CSS property 2025-05-29 12:04:28 +02:00
R-Goc
3989059227 Libraries/Utilities/Tests: Build and test js.exe
This commit enables building and testing js.exe for windows. Needed
libraries are built in CI, and tests for those which pass were added.
Tests for LibJS which don't require javascripttestrunner were added but
the rest need to wait for that to be ported to windows.
2025-05-29 03:26:23 -06:00
R-Goc
96c197faf1 LibJS: Add minimum changes to build on Windows and run js.exe
This commit adds the minimal export macros needed to run js.exe on
windows. A followup commit is planned to move to explicit export
entirely.

A static_assert for the size of a struct is also ifdef'ed out as the
semantics around object layout and inheritance are different on MSVC abi
and the struct IteratorRecord ends up being 40 bytes not 32.
2025-05-29 03:26:23 -06:00
Andrew Kaster
e67495e141 LibCrypto: Forward declare tommath types properly on Windows 2025-05-29 03:26:23 -06:00
R-Goc
f669af3a5c LibGC: Add the minimum export macros required to link LibJS
This approach still requires the WINDOWS_EXPORT_ALL_SYMBOLS target
property, but it does let us run a lot more tests than before.
2025-05-29 03:26:23 -06:00
R-Goc
d5cb940fe0 LibGC: Use native windows allocation methods for GC blocks
This allows us to use DiscardVirtualMemory in the same way that we
use madvise with MADV_DONTNEED and MADV_FREE on Unix systems.
2025-05-29 03:26:23 -06:00
Andreas Kling
00ad2bd758 LibWeb: Use the GC::RootVector deduction guides where helpful 2025-05-29 03:46:49 +02:00
Andreas Kling
5c5283492b LibWeb: Iterate safely in HTMLSelectElement::set_value()
We can't iterate over m_cached_list_of_options and call set_selected()
in the loop, since that may end up rebuilding m_cached_list_of_options,
disrupting iteration.
2025-05-29 03:46:49 +02:00
Andreas Kling
18d17385fb LibWeb: Remove leftover debugging hack in process_top_layer_removals() 2025-05-29 03:46:49 +02:00
Andreas Kling
2afe208328 LibWeb: Iterate safely in process_top_layer_removals()
We should not remove from a container while iterating over it, since
that may disrupt iteration.
2025-05-29 03:46:49 +02:00
Andreas Kling
59d46af946 LibWeb: Iterate safely in update_animations_and_send_events()
Make copies of the animation timeline list and animations to dispatch
events at before iterating over them. This ensures that they can't be
modified during iteration.
2025-05-29 03:46:49 +02:00
Andreas Kling
32769393a8 LibWeb: Iterate safely in invalidate_style_of_elements_affected_by_has()
We move m_pending_nodes_for_style_invalidation_due_to_presence_of_has to
a local variable before iterating over it. This ensures that nothing can
be added to it while iterating.
2025-05-29 03:46:49 +02:00
Andreas Kling
d5892c7c7a LibGC: Add some deduction guides for GC::RootVector
This makes is easy to construct a RootVector from a vector or span of
references to GC objects.
2025-05-29 03:46:49 +02:00
Aliaksandr Kalenik
c2c9348636 LibWeb: Print FIXME instead of throwing NotSupportedError in WebAudio
This allows us to browse https://pierre.co/ instead of being navigated
to error screen.
2025-05-28 20:37:35 +02:00
Aliaksandr Kalenik
36a255eedd LibWeb: Fix glitchy CSS transitions
`start_needed_transitions()` decides which animations need to be started
based on previous and current style property values. Before this change,
we were using the style value without animations applied as the
"current" value. This caused issues such as starting a new transition
from the animation’s end value when an ongoing animation was
interrupted.
2025-05-28 17:35:59 +01:00
Aliaksandr Kalenik
62739c30d9 LibWeb: Schedule required invalidations when animation effect is removed
For example, if layout affecting property is animated then once this
animation is removed we need to schduled layout invalidation.
2025-05-28 17:35:59 +01:00
Aliaksandr Kalenik
6a029fb6d9 LibWeb: Reset animated CSS properties for pseudo elements
Previously we were resetting animated properties if animation effect's
target is not a pseudo element.
2025-05-28 17:35:59 +01:00
Callum Law
6c3ceb9284 LibWeb: Don't crash when handling invalid HTTP status codes
Example crash: https://wpt.live/fetch/h1-parsing/status-code.window.html

There is still work to make the above tests pass.
2025-05-27 12:58:08 -06:00
Ruben
3263b629c6 LibWeb: Correct the calculation for right float intrusion
We used to subtract the maximum right margin of any containing box,
but we want to subtract the entire right margin instead. This yielded
incorrect intrusions for right floats not placed in the root.
2025-05-27 17:31:47 +02:00
Timothy Flynn
8e5cc74eb1 LibJS: Add notation to Intl.PluralRules
This is a normative change in the ECMA-402 spec. See:
a7ff535
2025-05-27 10:39:25 -04:00
Tim Ledbetter
b16f34767e LibWeb: Ensure discrete interpolated properties are non-transitionable
If a property is uses discrete interpolation and TransitionBehavior is
not set to `AllowDiscrete` that property should be non-transitionable.

This is now true for properties whose animation type is not discrete,
but the animation type falls back to discrete.
2025-05-27 13:33:29 +02:00
Khaled Lakehal
9a071c9e89 LibWeb/HTML: Fix behavior when removing multiple from select element
This change ensures correct behavior when the `multiple` attribute is
removed from a `select` element, reducing the number of selected
`option` elements to one.

Fixes a failing WPT test:
https://wpt.live/html/semantics/forms/the-select-element/select-multiple.html
2025-05-27 18:58:31 +12:00
Shannon Booth
937994cfaa LibWeb: Make Environment's top level origin nullable
This matches the definition in the spec, and is also a step towards
removing the default constructor of URL::Origin.
2025-05-27 14:48:43 +12:00
Shannon Booth
556acd82ee LibWeb/Editing: Handle no active range in queryCommandState
Fixes a crash when this is invoked if no range is active for the
document.
2025-05-26 23:36:44 +02:00
Shannon Booth
7c7fec5e00 LibWeb/Editing: Pass normalized command name to editing AOs
As the internal algorithms perform case sensitive matching.
Fixes a crash in the included test, seen on gmail.com.
2025-05-26 23:36:44 +02:00
Rocco Corsi
9281baffd8 LibCore: Recognize filenames .shellrc and CMakeLists.txt as text
There was a missing comma in the array, so these two entries were
concatenated accidentally.
2025-05-26 14:23:43 -06:00