Timothy Flynn
c846616d51
LibWeb: Adjust positions by the scroll offset for scrollbar hit testing
...
This ensures we scroll to the correct position when dragging a scrollbar
or clicking its gutter.
2025-05-08 10:40:58 +01:00
Timothy Flynn
22532c769c
LibWeb: Be less lenient in scrollbar hit testing
...
A scrollbar contains a mouse position only if its gutter rect contains
that position. We were incorrectly deciding a position was contained if
it fell to the right of a vertical scrollbar, or below a horizontal
scrollbar.
2025-05-08 10:40:58 +01:00
Sam Atkins
a8529629e2
LibWeb/HTML: Update "is script closable" to current spec
...
Corresponds to d7fc63a84a
and 7a48703e77
2025-05-08 10:39:34 +01:00
Ali Mohammad Pur
638a354b29
LibWeb/WebAssembly: Throw appropriate errors as defined by the spec
2025-05-08 03:35:11 -06:00
Ali Mohammad Pur
333ba93d49
LibWeb/WebAssembly: Define the hacky 'native' errors given in the spec
...
These cannot be implemented "correctly" as the set of native errors as
defined by ecma262 is closed, but we can get pretty close.
2025-05-08 03:35:11 -06:00
Francesco Gazzetta
5610f5a865
LibWeb/HTML: Add missing include to CanvasRenderingContext2D.cpp
...
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 (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, 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
Fixes linking of CanvasRenderingContext2D on some systems:
[2959/3075] Linking CXX shared library lib/liblagom-web.so.0.0.0
FAILED: lib/liblagom-web.so.0.0.0
: && /nix/store/f0m6caffiykyvsjim9376a3hx2yj2ghj-gcc-wrapper-14.2.1.20250322/bin/g++ -fPIC -O3 -DNDEBUG -fstack-protector-strong -Wl,-z,defs -Wl,--no-undefined -Wl,--no-allow-shlib-undefined -Wl,--dependency-file=Lagom/Libraries/LibWeb/CMakeFiles/LibWeb.dir/link.d -shared -Wl,-soname,liblagom-web.so.0 -o lib/liblagom-web.so.0.0.0 @CMakeFiles/LibWeb.rsp && :
/nix/store/hzw38c3f7s0w200cgk9645z53al7k8lw-binutils-2.44/bin/ld: Lagom/Libraries/LibWeb/CMakeFiles/LibWeb.dir/HTML/CanvasRenderingContext2D.cpp.o: in function `Web::HTML::CanvasRenderingContext2D::context_attributes_from_options(JS::VM&, JS::Value) [clone .localalias]':
CanvasRenderingContext2D.cpp:(.text+0x355a): undefined reference to `JS::Value::to_boolean() const'
/nix/store/hzw38c3f7s0w200cgk9645z53al7k8lw-binutils-2.44/bin/ld: CanvasRenderingContext2D.cpp:(.text+0x38e6): undefined reference to `JS::Value::to_boolean() const'
/nix/store/hzw38c3f7s0w200cgk9645z53al7k8lw-binutils-2.44/bin/ld: CanvasRenderingContext2D.cpp:(.text+0x3d67): undefined reference to `JS::Value::to_boolean() const'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
Co-authored-by: Timothy Flynn <trflynn89@pm.me>
2025-05-07 16:53:09 -04:00
Jelle Raaijmakers
d424dc1b32
LibWeb: Assign new wrapped node list to container for insertParagraph
...
Forgot to implement this part of the spec.
2025-05-07 16:11:31 +02:00
Jelle Raaijmakers
c56f7d9cde
LibWeb: Invalidate sibling style for :only-child
and :*-of-type
...
After f7a3f785a8
, sibling nodes' styles
were no longer invalidated after a node was removed. This reuses the
flag for `:first-child` and `:last-child` to indicate that a node's
style might be affected by any structural change in its siblings.
Fixes #4631 .
Resolves the `:only-child` ACID3 failure as documented in #1231 .
2025-05-07 14:55:12 +03:00
Psychpsyo
dbece92637
LibWeb: Make elements with 'opacity: 0' respond to hit-testing
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 (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, 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-05-07 01:45:07 +03:00
Lyra
39dae6fb2d
LibWeb: Fix SRI handling of badly-formatted strings
2025-05-06 13:02:58 -04:00
Timothy Flynn
0da7441b9b
LibWeb: Set the initiator type for script-initiated CSS requests
...
Similar to other ad-hoc behavior in this method, we need to handle
requests which are not associated with a style sheet. For example:
<script>
const element = document.createElement('div');
element.style['background'] = 'url(https://foo.com/img.png )';
document.body.appendChild(element);
</script>
Will not be associated with a style sheet.
This is needed to ensure we fire a PerformanceResourceTiming event for
this resource load. This is not currently testable in CI, as this event
is also gated by HTTP/S requests.
2025-05-06 17:37:34 +01:00
Timothy Flynn
4fc8443757
LibWeb: Translate scrollbar gutters by the cumulative scroll offset
...
This `translate_by` function is invoked with the cumulative scroll
offset during display list execution. Applying the offset to the gutter
was missed in 66e422b4f1
.
2025-05-06 16:38:23 +03:00
stelar7
9d5f6108e4
LibWeb/IDB: Implement recent spec changes
2025-05-06 13:30:37 +01:00
Mark Langen
6cbb5d2785
LibWeb: Parse and propagate touch-action CSS property
...
Co-authored-by: Sam Atkins <sam@ladybird.org>
2025-05-06 12:22:01 +01:00
stelar7
2774068ca0
LibWeb/IDB: Initialize the index set in a ObjectStore handle
2025-05-06 11:16:01 +02:00
stelar7
0ed71d87ca
LibWeb/IDB: Dont move away the name when creating an Index
2025-05-06 11:16:01 +02:00
stelar7
f3a31c98ea
LibWeb/IDB: Use correct key comparison when doing Index lookup
2025-05-06 11:16:01 +02:00
stelar7
64c4bea189
LibWeb/IDB: Implement IDBCursor::continue
2025-05-06 11:16:01 +02:00
stelar7
08f73db773
LibWeb/IDB: Return undefined if request was an error
2025-05-06 11:16:01 +02:00
stelar7
d0156e2c88
LibWeb/IDB: Use invalidation reason when returning DataError
2025-05-06 11:16:01 +02:00
stelar7
05fe37619a
LibWeb/IDB: Implement IDBObjectStore::open_cursor
2025-05-06 11:16:01 +02:00
stelar7
98d08b27e4
LibWeb/IDB: Implement iterate_a_cursor
2025-05-06 11:16:01 +02:00
stelar7
0890b10d11
LibWeb/IDB: Improve error messages related to transaction state
2025-05-06 11:16:01 +02:00
Bastiaan van der Plaat
58b735010b
LibWeb: Add -webkit-box-* legacy CSS property aliases
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 (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, 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-05-05 23:36:31 +02:00
Andreas Kling
183c847c80
LibJS: Cache PutById to setters in the prototype chain
...
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, 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 (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, 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 *extremely* common on the web, but barely shows up at all in
JavaScript benchmarks.
A typical example is setting Element.innerHTML on a HTMLDivElement.
HTMLDivElement doesn't have innerHTML, so it has to travel up the
prototype chain until it finds it.
Before this change, we didn't cache this at all, so we had to travel
the prototype chain every time a setter like this was used.
We now use the same mechanism we already had for GetBydId and cache
PutById setter accesses in the prototype chain as well.
1.74x speedup on MicroBench/setter-in-prototype-chain.js
2025-05-05 15:21:43 +02:00
Jelle Raaijmakers
71665fa504
LibWeb: Scale font size by 1.15 for line-height: normal
...
Browsers such as Chrome and Firefox apply an arbitrary scale to the
current font size if `normal` is used for `line-height`. Firefox uses
1.2 while Chrome uses 1.15. Let's go with the latter for now, it's
relatively easy to change if we ever want to go back on that decision.
This also requires updating the expectations for a lot of layout tests.
The upside of this is that it's a bit easier to compare our layout
results to other browsers', especially Chrome.
2025-05-05 13:15:56 +02:00
Psychpsyo
7c36a82129
LibWeb: Improve parsing for the CSS contain property
...
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 (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, 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 makes us actually respect the grammar and nets us a couple
extra WPT passes in the parsing section.
2025-05-04 22:24:26 +01:00
Timothy Flynn
1c075d6039
LibWeb: Remove Web::Infra ASCII case conversion methods
...
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 (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, 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
We have more optimized versions of these methods in AK.
2025-05-04 15:59:17 +02:00
Sam Atkins
de6df6f403
LibWeb/CSS: Parse and use CSS URL request modifiers
2025-05-03 23:22:40 +01:00
Sam Atkins
a1fb34d7f2
LibWeb/CSS: Alphabetize Enums.json
2025-05-03 23:22:40 +01:00
Shannon Booth
e476d21ed0
LibJS: Add and use PrimitiveString::length_in_utf16_code_units
...
I was investigating an optimization in this area, and while it
didn't seem to have a noticable improvement, it still seems
useful to apply this change.
2025-05-03 16:18:47 +02:00
Sam Atkins
560317b3d0
LibWeb/CSS: Update spec comment in calc() simplification algorithm
...
This was corrected in 8bcf3ada9e
2025-05-03 14:54:33 +01:00
Sam Atkins
1cb1526178
LibWeb/CSS: Remove document-URL hack from create_a_style_sheet()
...
We no longer need this, because we don't complete URLs during parsing,
and the location is set elsewhere when needed.
2025-05-03 12:01:43 +01:00
Sam Atkins
bc1d323ba0
LibWeb/CSS: Remove URL parameter to the CSS Parser
...
We no longer complete any URLs during parsing.
2025-05-03 12:01:43 +01:00
Sam Atkins
9e2e796f2d
LibWeb/CSS: Use CSS::URL for font-fetching
...
ParsedFontFace and FontLoader now both keep track of which
CSSStyleSheet (if any) was the source of the font-face, so the URLs can
be completed correctly.
2025-05-03 12:01:43 +01:00
Sam Atkins
14fb567a0f
LibWeb/CSS: Stop overwriting style sheet location after construction
2025-05-03 12:01:43 +01:00
Sam Atkins
981ede900a
LibWeb/DOM: Create style element style sheets with document's base URL
...
This is the simplest fix I could find that resolves a buggy interaction
between this and the CSS fetch algorithms, which also doesn't regress
anything. (As far as I can tell.)
2025-05-03 12:01:43 +01:00
Sam Atkins
7a4854732a
LibWeb/CSS: Make CSS::URL formattable
2025-05-03 12:01:43 +01:00
Sam Atkins
efad6e96aa
LibWeb/CSS: Set CSSFontFaceDescriptors' parent rule
2025-05-03 12:01:43 +01:00
Sam Atkins
ffc01626f7
LibWeb/CSS: Load fonts using fetch
...
Convert FontLoader to use fetch_a_style_resource(). ResourceLoader used
to keep its downloaded data around for us, but fetch doesn't, so we use
Gfx::Typeface::try_load_from_temporary_memory() so that the font has a
permanent copy of that data.
2025-05-03 12:01:43 +01:00
Sam Atkins
f76f8dcce1
LibWeb/CSS: Return the FetchController from fetch_a_style_resource()
2025-05-03 12:01:43 +01:00
Sam Atkins
6b762331df
LibGfx: Rename WOFF[2]::try_load_from_externally_owned_memory()
...
Typeface::try_load_from_externally_owned_memory() relies on that
external owner keeping the memory around. However, neither WOFF nor
WOFF2 do so - they both create separate ByteBuffers to hold the TTF
data. So, rename them to make it clearer that they don't have any
requirements on the byte owner.
2025-05-03 12:01:43 +01:00
Tim Ledbetter
23009779e1
LibWeb: Interpolate font-style
values correctly
...
These are interpolated by computed value, except a value of `normal` is
treated as `oblique 0deg`.
2025-05-03 12:05:22 +02:00
Tim Ledbetter
c0f9b11070
LibWeb: Parse oblique font-style
with an angle value
2025-05-03 12:05:22 +02:00
Timothy Flynn
ea77092100
LibWeb: Begin implementing SharedWorker
...
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (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, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, 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
Shared workers are essentially just workers that may be accessed from
scripts within the same origin. There are plenty of FIXMEs here (mostly
building on existing worker FIXMEs that are already in place), but this
lets us run the shared worker variants of WPT tests.
2025-05-02 17:48:02 -04:00
Timothy Flynn
469d5ccc4b
LibWeb: Add FIXME about Worker's constructor's scriptURL parameter
...
TrustedScriptURL is its own interface that we haven't implemented yet.
2025-05-02 17:48:02 -04:00
Timothy Flynn
56f047119c
LibWeb: Alphabetically sort LibWeb sources
...
I sorted this list when added shared worker sources, and this is the
fallout.
2025-05-02 17:48:02 -04:00
Timothy Flynn
912009f6b3
LibWeb: Implement navigator.clipboard.read
2025-05-02 17:46:16 -04:00
Timothy Flynn
a4e9a27343
LibWeb: Implement navigator.clipboard.write
2025-05-02 17:46:16 -04:00
Timothy Flynn
a1985e57e7
LibWeb: Implement navigator.clipboard.readText
2025-05-02 17:46:16 -04:00