Sam Atkins
2d3dea0770
LibWeb/CSS: Update quirks-mode styling for form elements
...
The current HTML spec uses margin-block-end instead of margin-bottom.
2025-03-26 09:47:45 +00:00
Sam Atkins
b2873d7ed6
LibWeb/CSS: Add new list-style-position quirk
...
Corresponds to d79381d822
In quirks mode, a `<li>` with no parent list element now has
`list-style-position: inside`.
2025-03-26 09:47:45 +00:00
Sam Atkins
612aabaedf
Tests: Import list-style quirks test from WPT
2025-03-26 09:47:45 +00:00
Aliaksandr Kalenik
8cae20af1b
LibWeb: Maintain a mapping for fast lookup in getElementById()
...
With this change we maintain a data structure that maps ids to
corresponding elements. This allows us to avoid tree traversal in
getElementById() in all cases except ones when lookup happens for
unconnected elements.
2025-03-26 08:36:25 +00:00
Andreas Kling
7165d69868
AK: Inline more of the String and FlyString member functions
...
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
This is to help recover some of the performance regression from no
longer using DeprecatedFlyString (which was aggressively inlined.)
2025-03-26 02:20:11 +00:00
Aliaksandr Kalenik
275985ff3d
LibWeb: Ignore non-box element while collecting abspos nodes for layout
...
All abspos boxes are expected to be blockified, so we are certain that
we can ignore non-box elements when collecting abspos nodes for layout.
Fixes a crash caused by an attempt to cast a BreakNode to a Box while
performing abspos layout.
2025-03-26 00:17:53 +00:00
Andreas Kling
d856858015
LibWeb: Cache and reuse inline style for text input shadow trees
...
Instead of reparsing the style attributes every time we instantiate
the internal shadow tree for a text input element, we now parse them
once (in the internal CSS realm) and reuse them for all elements.
Roughly a ~10% speedup on Speedometer 2.1 :^)
2025-03-25 23:57:00 +00:00
Andreas Kling
ba030f0363
LibWeb: Add an engine-internal CSS realm for internal style parsing
...
This is used for default UA style right now, and we'll expand its use in
the near future.
Note that this required teaching the CSS parser to handle url()
functions when there's no document URL to resolve them against. If we
don't handle that, namespace rules in UA style don't parse correctly.
2025-03-25 23:57:00 +00:00
Andreas Kling
c12f8b80dc
LibJS: Add fast_is<T> helpers for all the primitive wrapper objects
...
The JS runtime is full of checks for is<NumberObject> and friends.
They were showing up in a Speedometer profile as ~1% spent in
dynamic_cast, and this basically chops that down to nothing.
2025-03-25 23:57:00 +00:00
Andreas Kling
3cc5b1a6a5
LibJS: Do a bit less stuff in PropertyKey::try_coerce_into_number()
...
The many out-of-line function calls here stood out in a profile.
2025-03-25 23:57:00 +00:00
Jelle Raaijmakers
91d6902725
UI: Add Cmd+U as a shortcut for "View Source" to AppKit
...
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
This mirrors the shortcut we have in our Qt UI.
2025-03-25 17:08:42 -04:00
Jelle Raaijmakers
a9ef5b4924
Meta: Increase max open file descriptors in WPT.sh
...
On some macs, the default maximum number of file descriptors is 256.
This quickly makes the WPT runner run out of descriptors, so let's check
the active value and increase the soft limit if necessary.
2025-03-25 16:24:06 -04:00
Jelle Raaijmakers
6a3c3ee291
LibWeb: Coerce NaNs to 0 when escaping top-level calculations
2025-03-25 19:53:36 +00:00
Jelle Raaijmakers
545d151948
LibWeb: Make transform: scale(calc(..))
work
...
The `transform` property supports transform functions that sometimes
need their `calc(percentage)` values to be converted to a number instead
of a length. Currently this only applies to the `scale*` family of
functions, which are marked as such in `TransformFunctions.json`.
We were not consistently applying the `NumberPercentage` type to these
functions though, and in addition, any `NumberPercentage` value would
not consider calculated values.
2025-03-25 19:53:36 +00:00
Andreas Kling
202cbe7df6
LibJS: Constant-fold unary expressions
...
!0 and !1 are very common patterns in minified JavaScript, and we should
figure out that they're constants. :^)
2025-03-25 19:14:12 +00:00
Luke Wilde
de892abdba
LibWeb: Don't apply DPR or zoom level to screen.{width,height}
...
Safari and WebKit don't apply these, while Firefox only applies the
zoom level. This fixes https://x.com/ showing the tablet view.
2025-03-25 17:34:41 +00:00
Psychpsyo (Cameron)
c7926b2212
LibWeb: Change while to for loop
2025-03-25 15:50:45 +00:00
stelar7
1844e10cd3
LibWeb/IDB: Correctly check if transaction was aborted
...
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
The associated databases upgrade transaction could be
null at the time we try to access it here.
2025-03-25 10:50:03 +00:00
stelar7
e8b7447c36
LibWeb/IDB: Abort transaction in database upgrade if needed
2025-03-25 10:50:03 +00:00
stelar7
923927564d
LibWeb/IDB: Set the source of a IDBRequest
2025-03-25 10:50:03 +00:00
Aliaksandr Kalenik
090ac66af1
LibWeb: Repeat grid track sizing with minmax where both are not definite
...
...should be treated as invalid value.
2025-03-25 09:53:04 +00:00
Sam Atkins
88e11eea2d
LibWeb: Implement functional pseudo-element parsing
...
"Functional" as in "it's a function token" and not "it works", because
the behaviour for these is unimplemented. :^)
This is modeled after the pseudo-class parsing, but with some changes
based on things I don't like about that implementation. I've
implemented the `<pt-name-selector>` parameter used by view-transitions
for now, but nothing else.
2025-03-25 07:54:13 +00:00
Sam Atkins
5cf04a33ad
LibWeb/CSS: Add method for parsing <custom-ident>
directly
...
We specifically want to parse one inside a selector, where we only care
about the string itself and don't want a whole style value.
2025-03-25 07:54:13 +00:00
Sam Atkins
285fbc8f1c
LibWeb/CSS: Parse local() font sources more correctly
...
There were several issues with the previous parsing code, like ignoring
trailing tokens, not handling whitespace, and not requiring the value
to be a `<family-name>`. So, fix all that.
Also correct the serialization code, which didn't call
`serialize_a_string()` previously.
2025-03-25 07:53:59 +00:00
Sam Atkins
93a2c9946f
LibWeb: Use FlyString for local font sources
...
The next commit will make it so we always have a FlyString, so this lets
us keep using it instead of turning it into a String.
2025-03-25 07:53:59 +00:00
Sam Atkins
f8536fc48a
LibWeb/CSS: Split out <family-name>
parsing
...
This type is used individually elsewhere in the spec. This also lets us
separate out the `<generic-family>` type.
2025-03-25 07:53:59 +00:00
Timothy Flynn
2e5e5d3816
LibWeb: Pass along the init dictionary for error / buffer change events
...
Otherwise, information stored in the base event init dictionary will be
dropped.
2025-03-25 07:52:12 +00:00
Tim Ledbetter
9ce5bbe059
LibWeb: Remove CubicBezier cached sample inline cache
...
This reduces the size of CubicBezier objects from 1592 bytes to 56
bytes.
2025-03-25 07:51:27 +00:00
Jess
f3a937ee76
LibJS: Fix integer overflow in target_offset
of TypedArray.set()
2025-03-25 07:45:42 +00:00
Andreas Kling
dc83f3375c
LibWeb: Don't drop entire layout tree on object element update
...
It's sufficient to just rebuild the layout subtree rooted at the object
element itself.
2025-03-25 07:31:42 +00:00
Andreas Kling
a6836054cc
LibWeb: Don't drop entire layout tree on input element src change
2025-03-25 07:31:42 +00:00
Andreas Kling
305a5ad30b
LibWeb: Don't drop entire layout tree for SVG element transform changes
...
A partial update is enough here and avoids a lot of work.
Dramatically reduces time spent on relayouts on https://duolingo.com/
2025-03-25 07:31:42 +00:00
Andreas Kling
dc56435ecd
LibWeb: Skip "overlay" paint phase when there's no inspected node
...
This avoids a bunch of tree traversal that doesn't find anything to
paint anyway.
2025-03-25 07:31:42 +00:00
Andreas Kling
62d450c632
LibWeb: Fix layout invalidation debug logging (UPDATE_LAYOUT_DEBUG)
...
This was broken in a recent refactoring and no longer printed for
anything but document invalidations.
2025-03-25 07:31:42 +00:00
Aliaksandr Kalenik
6b9e8cf40c
LibWeb: Lazily allocate data required to run CSS animations
...
Push notes / build (push) Waiting to run
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Instead of reserving space for data required to run animations in every
DOM element, we now allocate it lazily only if element actually has some
animations. This allows us to save 336 bytes on non-animated DOM
elements.
2025-03-25 00:15:36 +01:00
Andreas Kling
6b6d3b32a4
LibRegex: Remove the StringCopyMatches mode
...
This mode made a lot of incorrect assumptions about string lifetimes,
and instead of fixing it, let's just remove it and tweak the few unit
tests that used it.
2025-03-24 22:27:17 +00:00
Andreas Kling
f1914893e9
LibJS+LibWeb: Remove more uses of DeprecatedFlyString
2025-03-24 22:27:17 +00:00
Andreas Kling
46a5710238
LibJS: Use FlyString in PropertyKey instead of DeprecatedFlyString
...
This required dealing with *substantial* fallout.
2025-03-24 22:27:17 +00:00
Andreas Kling
fc744e3f3f
LibJS: Add fast path for strings in Value::to_property_key()
...
If the Value is already a primitive string, we can skip all the
conversion ceremony and return a PropertyKey right away.
2025-03-24 22:27:17 +00:00
Andreas Kling
1662223e89
AK: Tweak ShortString bit layout slightly
...
Move the byte count one step to the left in order to make space
for the JS::StringOrSymbol flag.
2025-03-24 22:27:17 +00:00
Andreas Kling
53da8893ac
LibJS: Replace PropertyKey(char[]) with PropertyKey(FlyString)
...
...and deal with the fallout.
2025-03-24 22:27:17 +00:00
Andreas Kling
d7908dbff5
LibJS: Change PropertyKey(ByteString) to PropertyKey(String)
...
...and deal with the fallout.
2025-03-24 22:27:17 +00:00
Andreas Kling
3b5032c4b1
LibJS: Remove unused StringOrSymbol constructors
2025-03-24 22:27:17 +00:00
Andreas Kling
e83a2c2369
LibJS: Prefer Value::to_string() over to_byte_string() in more places
...
We should always prefer working with String, and Value::to_string() may
even return a cached String if the Value refers to a primitive string,
but no caching occurs for ByteString.
2025-03-24 22:27:17 +00:00
Timothy Flynn
8155377b5f
LibWebView: Move stored settings to the system configuration directory
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
2025-03-24 22:55:35 +01:00
Aliaksandr Kalenik
a8285f255b
LibJS: Skip allocation of temp object for primitive types in Value::get
...
Previously, `String.prototype.split()` caused the construction of a
temporary StringObject when a string primitive was passed as an
argument, solely to perform a Symbol.split lookup. This change allows
skipping that allocation by looking directly into the prototype of
primitive values.
As a result, we can avoid ~200000 StringObject allocations in a single
test from the Speedometer 2 benchmark.
Co-Authored-By: Andreas Kling <andreas@ladybird.org>
2025-03-24 20:38:11 +01:00
Aliaksandr Kalenik
057e643a63
LibWeb: Don't assume length-percentage is always a length [GFC]
...
Fixes crashing when trying to get length from LengthPercentage with
percentage value.
2025-03-24 18:59:21 +01:00
Jelle Raaijmakers
685cc1aae8
Everywhere: Remove Nix build support
...
A significant portion of reported build problems come from people trying
to build Ladybird with Nix, and it seems there's always something broken
for someone. The maintainers are currently not focused on supporting
Nix, and as a result PRs are not reviewed as well as they could have
been.
This removes all Nix-related files.
2025-03-24 17:22:08 +00:00
Jelle Raaijmakers
582084e74e
CI: Call webhook as soon as new JS benchmark results are in
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
2025-03-24 12:49:30 +01:00
Sam Atkins
82b1d5537e
Documentation: Document the new PseudoElements.json file
2025-03-24 09:49:50 +00:00