Commit graph

5856 commits

Author SHA1 Message Date
Callum Law
cfc22a4075 LibWeb: Dont try to transition custom properties
Fixes a crash introduced in dd9d6d2
2025-11-11 07:53:41 +00:00
Tim Ledbetter
ec435a12ca LibWeb: Lower case only ASCII characters for selector comparisons
According to the specificcation all selector syntax is ASCII
case-insensitive.
2025-11-10 22:55:38 +01:00
Tim Ledbetter
61af399b50 LibWeb: Remove unnecessary lowercase name property from Attr 2025-11-10 22:55:38 +01:00
Psychpsyo
b7a71ca950 LibWeb: Correctly sort animations returned by getAnimations() 2025-11-10 18:29:07 +01:00
Callum Law
9d515ec666 LibWeb: Share a ColorResolutionContext in apply_style
There is no need to recreate this each time we need it when we can
instead create it once and then reuse it.

This is stop-gap since we should resolve colors to their computed forms
as part of StyleComputer::compute_properties

Reduces time spent in ColorResolutionContext::for_layout_node from ~1.1%
to ~0.1% when loading
https://en.wikipedia.org/wiki/2023_in_American_television
2025-11-10 12:11:36 +01:00
Callum Law
dd9d6d22ee LibWeb: Iterate over fewer properties in start_needed_transitions
We don't need to iterate every property in start_needed_transitions,
only those that appear in transition-property or have an existing
transition

Reduces the time spent in start_needed_transitions from ~5% to ~0.03%
when loading https://en.wikipedia.org/wiki/2023_in_American_television
2025-11-10 12:11:36 +01:00
Callum Law
bbb344d534 LibWeb: Compute font features in ComputedProperties
By doing this in computed properties rather than InlineLevelIterator we
only do it once per element rather than once per text fragment.

Reduces runtime of this process from ~15% to ~0.2% when loading
https://en.wikipedia.org/wiki/2023_in_American_television
2025-11-10 12:11:36 +01:00
Callum Law
7a5b948b5b LibWeb: Resolve more calculated values in ComputedProperties
We simplify these at style computation time so there is no need to
maintain them as {Number|Length}OrCalculated

Reduces the time spent in `Length::ResolutionContext::for_layout_node`
from 3.3% to 0.4% when loading
https://en.wikipedia.org/wiki/2023_in_American_television
2025-11-10 12:11:36 +01:00
Andreas Kling
0dacc94edd LibJS: Have JS::Lexer take a JS::SourceCode as input
This moves the responsibility of setting up a SourceCode object to the
users of JS::Lexer.

This means Lexer and Parser are free to use string views into the
SourceCode internally while working.

It also means Lexer no longer has to think about anything other than
UTF-16 (or ASCII) inputs. So the unit test for parsing various invalid
UTF-8 sequences is deleted here.
2025-11-09 12:14:03 +01:00
Lorenz A
f8330a2ec5 LibWeb: Do not execute unclosed SVG script tags 2025-11-09 01:43:46 +01:00
Jelle Raaijmakers
b4810f47a3 LibWeb: Hook up SVG component transfer filter to Skia 2025-11-09 01:22:48 +01:00
Jelle Raaijmakers
70e98e72a8 LibWeb: Add SVGFEFunc{A,B,G,R}Element 2025-11-09 01:22:48 +01:00
Jelle Raaijmakers
db321cb74f LibWeb: Add SVGComponentTransferFunctionElement
This will be the base for <feFuncR>, <feFuncG>, <feFuncB> and <feFuncA>.
2025-11-09 01:22:48 +01:00
Jelle Raaijmakers
03a8de566b LibWeb: Add SVGFEComponentTransferElement 2025-11-09 01:22:48 +01:00
Jelle Raaijmakers
c0630c700f LibWeb: Add SVGAnimatedNumberList 2025-11-09 01:22:48 +01:00
Jelle Raaijmakers
c5e7276c2f LibWeb: Add SVGNumberList 2025-11-09 01:22:48 +01:00
Jelle Raaijmakers
9991205403 LibWeb: Add SVGList<T> and use it for SVGTransformList
The spec defines a generic list interfaces that we can reuse. Currently
we only have SVGTransformList, but we will need this to add
SVGNumberList as well.
2025-11-09 01:22:48 +01:00
Jelle Raaijmakers
7e869c7816 LibWeb: Add SVGNumber 2025-11-09 01:22:48 +01:00
Andreas Kling
b28480f62d LibWeb: Propagate layout tree update in display: contents to parent
When an element has `display: contents` and it gets marked for a layout
tree rebuild, we actually have to mark its parent for rebuild as well.

The structure of the parent (and siblings) may change depending on how
the `display: contents` element changes (e.g position, display, etc.)
2025-11-08 11:20:32 +01:00
Jelle Raaijmakers
b6f5c91a35 LibWeb: Shave 168 bytes off of ARIAMixin
Instead of keeping the vectors inside ARIAMixin, point to the heap using
OwnPtrs.
2025-11-07 16:59:26 +01:00
Jelle Raaijmakers
9d26626200 LibWeb: Shave 24 bytes off of each DOM::Element 2025-11-07 16:59:26 +01:00
Jelle Raaijmakers
02611c9c12 LibWeb: Shave 16 bytes off of each HTMLElement 2025-11-07 16:59:26 +01:00
Andreas Kling
6894034774 LibWeb: Mark flex item main size definite if resolved from aspect-ratio
This matches the behavior of other engines and makes the cards on the
Apple App Store appear in the narrower layouts.
2025-11-07 16:42:32 +01:00
Sam Atkins
3166dabcd6 LibWeb/CSS: Implement StylePropertyMap::append() 2025-11-07 10:26:56 +00:00
Luke Wilde
7f7babe735 LibWeb: Remove spin_until from create_navigation_params_by_fetching
This is in similar fashion and reason to e095bf3
2025-11-07 04:08:30 +01:00
Aliaksandr Kalenik
ed9c0c1e09 LibWeb: Don't visit registered NavigationObserver from Navigable
NavigationObserver register itself in Navigable from constructor and
unregister itself from `finalize()`. The problem is that `finalize()`
won't be invoked for as long as NavigationObserver is visited by
Navigable, leading to GC leaks.
2025-11-07 04:08:30 +01:00
Luke Wilde
167de08c81 LibWeb: Remove exception throwing from Fetch
These were only here to manage OOMs, but there's not really any way to
recover from small OOMs in Fetch especially with its async nature.
2025-11-07 04:08:30 +01:00
Andreas Kling
baa9b6cc34 LibWeb: Prefer non-emoji font when deciding width of space between words
This fixes an issue where having an emoji font first in the font-family
cascade list would cause us to get the space width from the emoji font
as well.

We now look at adjacent text chunks when deciding which font to use for
space widths, instead of just blindly obeying the font-family value.
2025-11-06 23:42:01 +01:00
Daniel Price
3a70a4735a LibWeb: Create an execution context before registering import map
Fixes #6297
2025-11-06 17:07:22 -05:00
Undefine
2a73f779c3 LibWeb: Small WebGL spec fix for vertexAttribPointer 2025-11-06 19:02:36 +01:00
Undefine
5caead88fc LibWeb: Allow WebGL getParameter when WEBGL_draw_buffers is enabled
When that extensions is enabled we should allow getting the parameter
value of MAX_COLOR_ATTACHMENTS_WEBGL.
2025-11-06 19:02:36 +01:00
Undefine
d4ac9fc5c6 LibWeb: Implement WebGL extension OES_standard_derivatives 2025-11-06 19:02:36 +01:00
Undefine
2bf35881f9 LibWeb: Ensure compressed* WebGL functions don't allow disabled formats 2025-11-06 19:02:36 +01:00
Undefine
044ac2dd28 LibWeb: Fix WebGL getError
getError was just calling out to glGetError and never checking our
error value that we were maintaining ourselves.
2025-11-06 19:02:36 +01:00
Undefine
e7aeb71d29 LibWeb: Move WebGL error variable to WebGLRenderingContextBase
Implementations in both WebGL1 and WebGL2 were the same and most
probably will stay the same.
2025-11-06 19:02:36 +01:00
Tim Ledbetter
f6f238d15c ImageDecoder+LibWeb: Perform initial alpha conversion in ImageDecoder
This change moves the initial alpha premultiplication step for all
decoded images from WebContent to the ImageDecoder process. This
doesn't reduce the overall amount of work, but it can make sites with a
lot of images more responsive.
2025-11-06 17:56:29 +01:00
Luke Wilde
82bd3d3891 LibWeb: Avoid invoking Trusted Types where avoidable
Prevents observably calling Trusted Types, which can run arbitrary JS,
cause crashes due to use of MUST and allow arbitrary JS to modify
internal elements.
2025-11-06 11:43:06 -05:00
Luke Wilde
fb9406ddcd LibWeb: Make Trusted Types injection sink names more readable
No functional change.
2025-11-06 11:43:06 -05:00
Luke Wilde
60e1a136aa LibWeb: Use qualified names for SVG attribute reflectors 2025-11-06 11:43:06 -05:00
Luke Wilde
d211df8118 LibWeb: Implement Trusted Types for HTMLIFrameElement#srcdoc 2025-11-06 11:43:06 -05:00
stelar7
0f3a9a6958 LibWeb/CSS: Use correct property when looking up container-type 2025-11-06 13:28:17 +01:00
ayeteadoe
eb4ff07d83 LibWeb: Define SVGImageElement destructor for Core::Timer forward decl
This fixes a "error: member access into incomplete type 'Core::Timer'"
build error on clang-cl Windows.
2025-11-06 07:10:23 -05:00
Sam Atkins
1bcc489310 LibWeb/CSS: Subdivide into iterations when reading from StylePropertyMap 2025-11-06 10:34:48 +00:00
Sam Atkins
7292714592 LibWeb/CSS: Mark cursor as not a list-valued property
This is apparently supposed to always be treated as a single composite
value, for Typed OM at least.
2025-11-06 10:34:48 +00:00
Tim Ledbetter
478cf4f42c LibWeb: Explicitly disallow skipping 0 characters in HTML tokenizer
Previously, this caused the source position of an ambiguous ampersand
to be incorrect.
2025-11-06 10:59:54 +01:00
Timothy Flynn
e0a8eb3767 LibWeb+WebContent: Hook Fetch's HTTP cache into the clear-cache action
And fix a typo in an invocation to clear the cache.
2025-11-05 18:27:36 +01:00
Timothy Flynn
ac246caa0c LibWeb: Remove now-unused Resource and ResourceClient
And deal with the fallout of transitive includes.
2025-11-05 18:27:36 +01:00
Timothy Flynn
6057719f63 LibWeb: Use fetch to retrieve all HTMLLinkElement resources
HTMLLinkElement is the final user of Resource/ResourceClient (used for
preloads and icons). This ports these link types to use fetch according
to the spec.

Preloads were particularly goofy because they would be stored in the
ResourceLoader's ad-hoc cache. But this cache was never consulted for
organic loads, thus were never used. There is more work to be done to
use these preloads within fetch, but for now they at least are stored
in fetch's HTTP cache for re-use.
2025-11-05 18:27:36 +01:00
Timothy Flynn
c61fa1d7aa LibWeb: Pass the HTMLLinkElement fetched resource around as a ByteBuffer
Instead of passing around a large variant, which can only contain a
ByteBuffer, let's extract the ByteBuffer ahead of time and pass that
around.
2025-11-05 18:27:36 +01:00
Timothy Flynn
523433d57d LibWeb: Organize HTMLLinkElement more consistently with other IDL types
We don't typically put spec links for methods in both the .h and .cpp
(we just put them in the .cpp).

Let's also generally organize the methods in spec-order, which for
HTMLLinkElement generally goes: init fetch -> fetch -> process data.
Makes it a bit easier to scroll through the spec and the code at the
same time.
2025-11-05 18:27:36 +01:00