Commit graph

72801 commits

Author SHA1 Message Date
Lorenz A
3bc061d028 LibWeb: Allow all elements with tabindex attribute to be focusable 2025-11-12 13:57:05 +01:00
Tim Ledbetter
154e9db033 LibWeb: Cache the value of Element::lang()
This reduces the time spent in
`SelectorEngine::matches_lang_pseudo_class()` from 1.9% to 0.41% on
https://cloudflare.com
2025-11-12 12:36:16 +01:00
Tim Ledbetter
0ec97eabab LibWeb: Extract device_pixels_per_css_pixel getter from loop
This reduces time spent in StyleComputer::compute_property_values() by
~10% when loading https://html.spec.whatwg.org/
2025-11-12 11:21:17 +01:00
Tim Ledbetter
df23b42b37 LibWeb: Don't store custom name on StyleProperty
This reduces time spent in `~StyleProperty()` from 2.18% to 0.67% on
https://cloudflare.com.
2025-11-12 11:19:37 +01:00
Psychpsyo
eb21ea890c LibWeb: Implement CSS perspective property 2025-11-12 00:41:14 +01:00
Psychpsyo
e44a97e508 LibWeb: Pass 3D transforms to Skia 2025-11-12 00:41:14 +01:00
Psychpsyo
e0b5bd7894 LibWeb: Make transition order return -1 and 1 instead of 0 and 1
The old behavior was plain incorrect for a sorting function.
2025-11-11 21:57:47 +01:00
Psychpsyo
2c4f2a3cb6 LibWeb: Make transition order consider property name
class_specific_composite_order() also has no reason to return an
Optional<int>, since it can just return 0.
2025-11-11 13:46:56 +01:00
Tim Ledbetter
1df94c4513 LibCore: Introduce REPORT_TIME() for per call timing information
This macro outputs the time taken to reach the end of the current scope
to the debug console. It also shows the average time, total cumulative
time and the total number of calls.

It is also possible to limit the amount of debug output using
`REPORT_TIME_EVERY(name, n)` to only print every `n` calls.
2025-11-11 11:47:59 +01:00
Tim Ledbetter
298e934077 AK: Add human_readable_short_time()
This gives a more compact version of `human_readable_time()` to
nanosecond precision.
2025-11-11 11:47:59 +01:00
Jelle Raaijmakers
c845e2cef7 LibWeb: Don't join anonymous pseudo wrappers for block node insertion
This can happen if pseudo elements are absolutely positioned, they need
the nearest non-inline parent to determine their position.
2025-11-11 10:49:49 +01:00
Jelle Raaijmakers
ac829cf60a LibWeb: Hoist anonymous wrappers out of parent inline nodes
When we generate pseudo elements, we create anonymous wrappers that
might end up in an InlineNode, even if they have `display: block` set.
This causes them not to be rendered.

Do not rely on inline continuation logic for these anonymous wrappers,
but rather find the first layout parent that's not an InlineNode and
insert it into that.

Fixes #5042.
2025-11-11 10:49:49 +01:00
Tete17
660e1b8cd2 LibWeb: Add a bunch of eval tests in the trusted-types category 2025-11-11 09:58:34 +01:00
Tete17
6d173d931a LibWeb: Allow eval to execute TrustedScripts 2025-11-11 09:58:34 +01:00
Tete17
fb2062a9db LibWeb: Allow CSP to block eval invocations based on TrustedTypes
This allows trusted types directives to also restrict the contents
passed to eval.
2025-11-11 09:58:34 +01:00
Callum Law
55afa9d37e LibWeb: Avoid unnecessary work when element display property changes
`play_or_cancel_animations_after_display_property_change` is called
whenever an element is inserted or removed, or it's display property
changes, but it is only required to run if we actually have animations
to play or cancel.

Reduces time spent in the aforementioned function from ~2% to ~0.03%
when loading https://en.wikipedia.org/wiki/2023_in_American_television
2025-11-11 08:35:39 +00:00
Callum Law
cfc22a4075 LibWeb: Dont try to transition custom properties
Fixes a crash introduced in dd9d6d2
2025-11-11 07:53:41 +00:00
Zaggy1024
8fa081cb1d Tests: Add a test for Matroska blocks with Xiph lacing 2025-11-11 00:50:42 +01:00
Zaggy1024
82586645dc LibMedia: Export MatroskaDemuxer for use in tests 2025-11-11 00:50:42 +01:00
Zaggy1024
5640541c44 LibMedia: Handle Xiph lacing in Matroska files 2025-11-11 00:50:42 +01:00
dependabot[bot]
8002c06c13 CI: Bump JamesIves/github-pages-deploy-action from 4.7.3 to 4.7.4
Bumps [JamesIves/github-pages-deploy-action](https://github.com/jamesives/github-pages-deploy-action) from 4.7.3 to 4.7.4.
- [Release notes](https://github.com/jamesives/github-pages-deploy-action/releases)
- [Commits](https://github.com/jamesives/github-pages-deploy-action/compare/v4.7.3...v4.7.4)

---
updated-dependencies:
- dependency-name: JamesIves/github-pages-deploy-action
  dependency-version: 4.7.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-11 00:28:42 +01: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
Andreas Kling
2c389ae96c RequestServer: Allow caching of HTTP responses with "Expires" header
Per RFC 9111, we're allowed to cache HTTP responses that don't have a
"Cache-Control" header, provided they do have an "Expires" header.

This lets us cache JavaScript resources on https://x.com/ and makes
it load much faster when cached.
2025-11-10 07:34:49 -05: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
201803f601 LibJS: Cache length-in-code-units in SourceCode
This avoids some bit twiddling whenever accessing the length in code
units in the lexer.
2025-11-09 12:14:03 +01:00
Andreas Kling
7c7a035347 LibJS: Cache an Utf16View for the full code string in SourceCode
This avoids doing the ASCII/UTF-16 flag check every time we access
character data from the lexer.
2025-11-09 12:14:03 +01:00
Andreas Kling
fa44fd58d8 LibJS: Remove ParserState::lookahead_lexer
The lookahead lexer used by next_token() no longer needs to be kept
alive, since tokens created by Parser::next_token() now have any string
views guaranteed safe by the fact that they point into the one true
SourceCode provided by whoever set up the lexer.
2025-11-09 12:14:03 +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
Andreas Kling
9ca25e55d7 LibJS: Rearrange Lexer members to shrink it by 16 bytes
This is useful since the parser's state saving mechanism works by
copying the lexer object.
2025-11-09 12:14:03 +01:00
Andreas Kling
81671c3f0f LibJS: Remove unnecessary ParsedIdentifiers thing from Lexer
Identifier tokens are stored as Utf16FlyString, so there's no need to
forcibly keep them alive through this mechanism. (It was useful when
tokens only had string views.)
2025-11-09 12:14:03 +01:00
Andreas Kling
fdd9413e71 LibJS: Avoid some unnecessary ref count churn in parser 2025-11-09 12:14:03 +01:00
Andreas Kling
841fe0b51c LibJS: Don't store current token in both Lexer and Parser
Just give Parser a way to access the one stored in Lexer.
2025-11-09 12:14:03 +01:00
Andreas Kling
d3e8fbd9cd LibJS: Don't create unique FunctionParameters for every empty param set 2025-11-09 12:14:03 +01:00
Andreas Kling
72aa90312a LibJS: Make JS::Token::message an enum instead of a StringView
Just to make JS::Token a little smaller.
2025-11-09 12:14:03 +01:00
Andreas Kling
73593101d7 js: Add -p flag to run in parse-only mode
This will be useful for working on parser performance.
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
Timothy Flynn
0dd8e1e6f2 LibWebView: Add a bit of explicit handling for "localhost:port" URLs
LibURL parses "localhost:8000" as a URL with a scheme of "localhost" and
basename of "8000". Similar to "mailto:" URLs.  We then drop the URL as
having an invalid scheme.

Let's explicitly check for such localhost URLs here and prepend a valid
scheme, as it is a bit of a special case.
2025-11-08 11:14:44 -05:00