Commit graph

66299 commits

Author SHA1 Message Date
Pavel Shliak
2be45c1ccf AK: Remove redundant condition from Quick Sort
if (size <= 1)
       return;
This means that size is at the very minimum 2,
and pivot_point at the very minimum equals 1 as size / 2;
The condition if (pivot_point) can never be false.
2024-12-22 12:33:41 +01:00
Sam Atkins
349caecc18 LibWeb/CSS: Use fetch for CSS import rules
This still has a few FIXMEs, but it's a ResourceLoader use gone! :^)
2024-12-22 12:30:09 +01:00
Sam Atkins
a4db7e9e23 LibWeb: Add method for "is CORS-same-origin" 2024-12-22 12:30:09 +01:00
Sam Atkins
ae943965dc LibWeb/CSS: Implement "fetch a style resource" algorithm 2024-12-22 12:30:09 +01:00
Sam Atkins
00948c4746 LibWeb/CSS: Expose CSSStyleSheet's origin clean flag 2024-12-22 12:30:09 +01:00
Lucas CHOLLET
868052a865 Meta: Update libjxl to version 0.11.1 2024-12-22 11:33:19 +01:00
Lucas CHOLLET
91edc06fad Meta: Update vcpkg to the December 2024 release 2024-12-22 11:33:19 +01:00
Andreas Kling
74469a0c1f LibWeb: Make CSS::ComputedProperties GC-allocated 2024-12-22 10:12:49 +01:00
Andreas Kling
c1cad8fa0e LibWeb: Rename CSS::StyleProperties => CSS::ComputedProperties
Now that StyleProperties is only used to hold computed properties, let's
name it ComputedProperties.
2024-12-22 10:12:49 +01:00
Andreas Kling
ed7f4664c2 LibWeb: Split StyleComputer work into two phases with separate outputs
Before this change, StyleComputer would essentially take a DOM element,
find all the CSS rules that apply to it, and resolve the computed value
for each CSS property for that element.

This worked great, but it meant we had to do all the work of selector
matching and cascading every time.

To enable new optimizations, this change introduces a break in the
middle of this process where we've produced a "CascadedProperties".
This object contains the result of the cascade, before we've begun
turning cascaded values into computed values.

The cascaded properties are now stored with each element, which will
later allow us to do partial updates without re-running the full
StyleComputer machine. This will be particularly valuable for
re-implementing CSS inheritance, which is extremely heavy today.

Note that CSS animations and CSS transitions operate entirely on the
computed values, even though the cascade order would have you believe
they happen earlier. I'm not confident we have the right architecture
for this, but that's a separate issue.
2024-12-22 10:12:49 +01:00
Jelle Raaijmakers
4d9f17eddf LibGfx+LibWeb: Draw glyph runs with subpixel accuracy
This improves the quality of our font rendering, especially when
animations are involved. Relevant changes:

  * Skia fonts have their subpixel flag set, which means that individual
    glyphs are rendered at subpixel offsets causing glyph runs as a
    whole to look better.

  * Fragment offsets are no longer rounded to whole device pixels, and
    instead the floating point offset is kept. This allows us to pass
    through the floating point baseline position all the way to the Skia
    calls, which already expected that to be a float position.

The `scrollable-contains-table.html` ref test needed different table
headings since they would slightly inflate the column size in the test
file, but not the reference.
2024-12-21 23:09:52 +01:00
Ali Mohammad Pur
e32a9b2c6f LibWeb/WebAssembly: Use wasm funcaddr of exported functions on import
Previously this was proxying the call through javascript, which lead to
unexpected crashes when functions returned things that js-api did not
like.
This commit also adds in the spec comments and fixes a few inaccuracies
that were present in the process.
2024-12-21 20:16:12 +01:00
Jelle Raaijmakers
c0285f4a7e LibWeb: Do not require visible nodes in the wrap editing algorithm
The spec doesn't say they should exist, so we should not
`VERIFY_NOT_REACHED()` when they don't. Prevents a crash in the WPT
`editing/event.html` tests.
2024-12-21 19:15:58 +01:00
Jelle Raaijmakers
c093c895da LibWeb: Implement step 15 of the editing delete action 2024-12-21 19:15:58 +01:00
Jelle Raaijmakers
30a3fe8387 LibWeb: Remove unnecessary condition from editing delete action 2024-12-21 19:15:58 +01:00
Jelle Raaijmakers
ff25d66dae LibWeb: Prevent potential null deref in editing delete action 2024-12-21 19:15:58 +01:00
Jelle Raaijmakers
a7c75f6fdb LibWeb: Update CSS resolved values spec link to editor's draft URL 2024-12-21 19:15:58 +01:00
Jelle Raaijmakers
e6631a4216 LibWeb: Add concept of boundary point to DOM::AbstractRange
This makes comparing the relative position of boundary points a bit
nicer when one of the boundary points is the range's start or end.
2024-12-21 19:15:58 +01:00
Jelle Raaijmakers
a3b3f2f30d LibWeb: Prevent null deref in the "restore the values of nodes" algo 2024-12-21 19:15:58 +01:00
Jelle Raaijmakers
c90c5aad29 LibWeb: Implement the "record current states and values" Editing algo 2024-12-21 19:15:58 +01:00
Jelle Raaijmakers
2c51ed8dec LibWeb: Rework obtaining resolved styles in the Editing API
The algorithm referenced to in the Editing spec whenever they talk about
obtaining the "resolved" style or value is actually implemented in
ResolvedCSSStyleDeclaration, so use that instead of going directly to
the computed styles.
2024-12-21 19:15:58 +01:00
Jelle Raaijmakers
433c19c1ed LibWeb: Lay out CommandDefinitions for Editing API a bit nicer
No functional changes.
2024-12-21 19:15:58 +01:00
Jelle Raaijmakers
2d130ffad4 LibWeb: Make new_container in insertParagraph command a GC::Ref
This value will never be null.
2024-12-21 19:15:58 +01:00
Jelle Raaijmakers
5e2cb00f75 LibWeb: Update active range after updating selection in insertParagraph
We were using an old range after collapsing the selection. Fixes 3 WPT
subtests in `editing/run`.
2024-12-21 19:15:58 +01:00
Jelle Raaijmakers
2052792663 LibWeb: Use correct boundaries in Selection::collapse_to_start/end()
We were using the anchor_node() as the boundary point node when
collapsing a selection, but the spec tells us to use the start and end
boundary point nodes.
2024-12-21 19:15:58 +01:00
Sam Atkins
eb11c35640 LibWeb/CSS: Use CSSNumericType for CalculationResult's numeric type
When we originally implemented calc(), the result of a calculation was
guaranteed to be a single CSS type like a Length or Angle. However, CSS
Values 4 now allows more complex type arithmetic, which is represented
by the CSSNumericType class. Using that directly makes us more correct,
and allows us to remove a large amount of now ad-hoc code.

Unfortunately this is a large commit but the changes it makes are
interconnected enough that doing one at a time causes test
regressions.

In no particular order:

- Update our "determine the type of a calculation" code to match the
  newest spec, which sets percent hints in a couple more cases. (One of
  these we're skipping for now, I think it fails because of the FIXMEs
  in CSSNumericType::matches_foo().)
- Make the generated math-function-parsing code aware of the difference
  between arguments being the same type, and being "consistent" types,
  for each function. Otherwise those extra percent hints would cause
  them to fail validation incorrectly.
- Use the CSSNumericType as the type for the CalculationResult.
- Calculate and assign each math function's type in its constructor,
  instead of calculating it repeatedly on-demand.

The `CalculationNode::resolved_type()` method is now entirely unused and
has been removed.
2024-12-21 18:14:28 +01:00
Sam Atkins
8d40550478 LibWeb/CSS: Bring CSSNumericType algorithms up to date with spec
Took the opportunity to pull out a helper function for
entry_with_value_1_while_all_others_are_0(), too.

A couple of these require us to have extra contextual information about
what type percentages should resolve to. Until we have that available,
these are left as FIXMEs with a rough approximation.
2024-12-21 18:14:28 +01:00
Sam Atkins
0d19007cb5 LibWeb/CSS: Make CSSNumericType dump() infallible
This is a remnant of the tiny-OOM-propagation party.
2024-12-21 18:14:28 +01:00
Sam Atkins
9cbd08a330 LibWeb/CSS: Implement "consistent type" concept on CSSNumericType 2024-12-21 18:14:28 +01:00
Sam Atkins
2192868a0e LibWeb/CSS: Remove unused ProductOperation enum 2024-12-21 18:14:28 +01:00
Sam Atkins
0149f7d4e4 LibWeb/CSS: Remove unnecessary CalculatedStyleValue const-casts 2024-12-21 18:14:28 +01:00
Sam Atkins
69a0f28d04 Revert "LibWeb/CSS: Rename CalculatedStyleValue -> CSSMathValue"
This reverts commit 76daba3069.

We're going to need separate types for the JS-exposed style values, so
it doesn't make sense for us to match their names with our internal
types.
2024-12-21 18:14:28 +01:00
Tim Ledbetter
34f78ca152 Meta: Add a --debug-process option to WPT.sh
This passes the `--debug-process` option to WebDriver.
2024-12-20 23:42:02 +01:00
Tim Ledbetter
2528055703 WebDriver: Add a --debug-process option
This forwards the `--debug-process` argument to the browser process
launched by WebDriver.
2024-12-20 23:42:02 +01:00
Aliaksandr Kalenik
30d915c361 LibGfx+LibWeb: Specify bottom left origin for WebGL's PaintingSurface
By doing that we eliminate the need for the vertical flip flag.

As a side effect it fixes the bug when doing:
`canvasContext2d.drawImage(canvasWithWebGLContext, 0, 0);`
produced a flipped image because we didn't account for different origin
while serializing PaintingSurface into Gfx::Bitmap.

Visual progress on https://ciechanow.ski/curves-and-surfaces/
2024-12-20 20:47:45 +01:00
Sam Atkins
28388f1fd2 LibWeb/CSS: Don't overwrite active font load when requesting a pt size
start_loading_next_url() is a no-op if there's a pending resource load,
but not if that resource load has successfully loaded already. There is
a delay between the font resource loading, and it being processed into
a vector font. Calling font_with_point_size() in that gap would
previously erase the previously-loaded font, if the font had multiple
URLs to choose from.

This fixes the icon font on mods.factorio.com :^)
2024-12-20 18:19:37 +01:00
Feng Yu
b3edbd7bf2 LibWeb: Implement the ClipboardItem API
Spec: https://w3c.github.io/clipboard-apis/#clipboard-item-interface
2024-12-20 15:29:18 +00:00
Gingeh
bdd6729d78 LibWeb: Use paintables when calculating mouse event offset 2024-12-20 15:50:41 +01:00
Aliaksandr Kalenik
c9105955f6 LibWeb/WebGL: Add support for ANGLEInstancedArrays extension
This is only WebGL 1.0 extension. It's enabled in ANGLE by default.

Progress on https://ciechanow.ski/curves-and-surfaces/ that relies on
this extension.
2024-12-20 15:31:58 +01:00
Aliaksandr Kalenik
99b49a5978 CodeGenerators: Add support for LegacyNoInterfaceObject IDL attribute
When applied, corresponding interface object will not be exposed on the
global object, e.g. for the following IDL:
```
Exposed=(Window,Worker), LegacyNoInterfaceObject]
interface ANGLE_instanced_arrays {
};
```

executing `"ANGLE_instanced_arrays" in window` will return `false`.
2024-12-20 15:31:58 +01:00
sideshowbarker
3365cae4a9 Tests: Import more WPT ARIA tests (more regression coverage); no code 2024-12-20 06:23:21 -08:00
Tyler Dence
0378645c25 LibWeb: PlatformObject::DefineOwnProperty fix 'has own property' check
PlatformObjects with named properties does not qualify as 'has own
property' just by virtue of a named property existing.

This fixes at least one WPT test, which is imported.
2024-12-20 15:10:24 +01:00
Tim Ledbetter
9585700876 LibWeb: Don't try to wait for HTTP server to exit if kill call fails 2024-12-20 14:59:56 +01:00
Tim Ledbetter
a450d64ffa LibCore: Return correct error code from Process::wait_for_termination 2024-12-20 14:59:56 +01:00
Pavel Shliak
4cd1ef12d7 LibWeb: Refer a spec issue in Location::internal_get_own_property 2024-12-20 14:46:28 +01:00
Pavel Shliak
361c6f1b64 LibWeb: Update Location initialization according to spec 2024-12-20 14:46:28 +01:00
sideshowbarker
695ce3763e LibWeb: Replace ARIA “synonym” roles with their preferred synonyms
This change does replacement of ARIA roles that have newer synonyms.

There are a number of newer ARIA roles that are synonyms for older
roles. https://wpt.fyi/results/wai-aria/role/synonym-roles.html has a
number of subtests which expect that when retrieving the value of an
explicitly- specified role attribute, if the value is one of the older
role values, implementations must replace that with its newer synonym.
2024-12-20 05:45:59 -08:00
sideshowbarker
e9dedeee34 Tests: Import ARIAMixin string attributes CEReactions tests (no code) 2024-12-20 05:17:05 -08:00
R-Goc
579484e065 LibCore: Fix compilation of EventLoopImplementationWindows.cpp 2024-12-20 13:57:43 +01:00
R-Goc
9cb397914e Meta: Enable warning for the use of VLAs
This commit enables warnings when using variable length arrays. For
disabling this warning locally use -Wno-vla, as it will work both across
Clang and GCC.
2024-12-20 09:37:56 +01:00