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

69603 commits

Author SHA1 Message Date
Lucien Fiorini
8b08162942 js: Make print variadic for consistency with other repls 2025-05-29 17:33:26 -06:00
Lucien Fiorini
81e84c8273 js: Add option to disable quotes around strings 2025-05-29 17:33:26 -06:00
Timothy Flynn
f46f9b0f02 Meta: Restore default "build everything" behavior in ladybird.py
By default, we want `ladybird.py build` to build everything. We were
previously defaulting to only building the Ladybird target.

We now only fall back to the Ladybird target for commands that run a
program. So `ladybird.py run` will build and run Ladybird.
2025-05-29 16:24:17 -04:00
Timothy Flynn
aa0fcc67b3 Meta: Tentatively support BSD distributions in ladybird.py
Support was unknowingly dropped when porting ladybird.sh to ladybird.py.
This tentatively restores this support, but is untested on a BSD system.
2025-05-29 16:24:17 -04:00
Timothy Flynn
7ce88eb4cd Everywhere: Document use of ladybird.py over ladybird.sh 2025-05-29 16:24:17 -04:00
Timothy Flynn
6ac729e03d Meta: Replace ladybird.sh contents with invocation to ladybird.py
All features supported by ladybird.sh should now work in ladybird.py.
Let's forward invocations and warn that ladybird.sh will be removed.
2025-05-29 16:24:17 -04:00
Timothy Flynn
f2eaf1e57b Meta: Use new run_command utility to invoke subprocesses
As opposed to just running subprocess.check_call, our `run_command`
utility handles e.g. ctrl+c to avoid spamming the terminal with
KeyboardInterrupt stack traces.
2025-05-29 16:24:17 -04:00
Timothy Flynn
a5bfb686f4 Meta: Integrate find_compiler.py into ladybird.py 2025-05-29 16:24:17 -04:00
Timothy Flynn
3d0fdaacff Meta: Migrate find_compiler.sh logic to a python script
This will allow us to re-use this logic from within other python
scripts. The find_compiler.sh script still exists, as it is used by
some other bash scripts. The pick_host_compiler() function will now
execute find_compiler.py and store its result in $CC and $CXX.

Note that the python script supports Windows.
2025-05-29 16:24:17 -04:00
Timothy Flynn
8e792cd094 Meta: Support python 3.9 in ladybird.py
This is the default python version on macOS, so let's support it since
it is trivial for now. Using "str | None" as a type annotation is only
supported in python 3.10 or later.
2025-05-29 16:24:17 -04:00
Timothy Flynn
a76e880dfe Meta: Extract platform detection utilities to their own file
This will be needed by other scripts.

To do so, this patch gives up on the importlib method of importing
packages. I tried extracting this helper to e.g. __init__.py, but the
python runtime was unable to find the imported symbols.
2025-05-29 16:24:17 -04:00
Timothy Flynn
872a112cad Meta: Add SPDX license identifier to ladybird.py and BuildVcpkg.py 2025-05-29 16:24:17 -04: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
b0cc87c276 Utilities: Port js.exe on windows without repl
This commit allows building js.cpp on windows. The repl functionality is
ifdef'ed out. To decrease the number of ifdefs the code that runs the
repl on Linux was moved into one place. Some globals that are unused as
a result of that are markes maybe_unused. The following commit enables
building and testing js in cmake for windows.
2025-05-29 03:26:23 -06:00
R-Goc
550aace91c Meta: Add flags for compilation and testing of js
This commit adds flags necessary for compilation and testing of js.exe.
The stack size is increased to match linux.
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
Andreas Kling
e0e09f71be RequestServer: Don't try to self-destruct already-destroyed request 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
Andrew Kaster
c5071c9025 Tests: Re-enable TestLibCoreMappedFile and TestLibCoreStream
These tests previously only ran on SerenityOS. They needed test input
location changes. The Stream tests also needed to explicitly set
SO_REUSEADDR for the tcp servers.
2025-05-27 20:34:47 -06:00
Andrew Kaster
a94605febe CI: Bump swift toolchain to main-snapshot-2025-05-26 2025-05-27 20:33:42 -06:00
Andrew Kaster
e90a0dc69c CI: Update alternatives for llvm-symbolizer on Ubuntu jobs
Swift jobs were failing a test due to the llvm-symbolizer not being
available in the default location next to the clang binary. swift.org
toolchains don't ship this tool, so LSAN suppressions were not being
applied, failing TestWOFF2.

This was hard to reproduce locally, because I have always had a set of
alternatives set up for the full suite of LLVM tools on my machine.
2025-05-27 20:33:42 -06:00
Andrew Kaster
cd333fe3e9 CI: Use Blacksmith cache action only on Blacksmith runners
Their cache action only works on their runners. For jobs that run on
other runners, we have use the default cache action. At least until they
update their cache product to work or fallback on other runners.
2025-05-27 17:42:25 -06:00
Dan Berglund
d9e90d4556 AppKit: Check availability before using macOS 15 API in TabController
This keeps the code building on older macOS versions.
2025-05-27 13:39:24 -06:00
Dan Berglund
bd3135f8d3 CMake: Set default CMAKE_OSX_DEPLOYMENT_TARGET to 14.0
This makes the build system aware of which macOS version we're
targeting, and will make it an error to newer APIs without explicitly
checking the availability.

Note that the js REPL CI job still sets the deployment target to 11.0
explicitly.
2025-05-27 13:39:24 -06: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
Timothy Flynn
24da7b006e Meta: Change the ladybird.py target to be a positional argument
This affords us some API symmetry with ladybird.sh.
2025-05-27 20:02:37 +02:00
Timothy Flynn
25666390f6 Meta: Alias the "ladybird" target to "Ladybird" in ladybird.py
We do the same thing in ladybird.sh for convenience.
2025-05-27 20:02:37 +02:00
Timothy Flynn
e7fe2d3dab Meta: Do not pass non-existing extra arguments to addr2line build step
The variadic nature of the addr2line command is currently taken by the
`addresses` option.
2025-05-27 20:02:37 +02:00