Commit Graph

64028 Commits

Author SHA1 Message Date
Timothy Flynn
fb4e032c8f LibWeb: Update spec steps for destroying a DOM document
This just updates our copied spec steps - new steps are not implemented
here. This is mostly just to highlight new steps we are missing around
MessagePorts.

No behavior change, but this does resolve an outstanding FIXME around
spec step ordering.

(cherry picked from commit 83be2606dba7ac430bab4d61a70e926d12d452ee)
2024-11-21 09:41:42 -05:00
Timothy Flynn
cc4c7917d5 LibWeb: Move StructuredSerializeOptions to its own header
This largely reduces the number of files needed to be compiled when we
change the MessagePort header.

(cherry picked from commit 32a22c49e3e999e681e2d1de1ebabd092a7f9b47)
2024-11-21 09:41:42 -05:00
Timothy Flynn
ca8332d01e LibWeb: Sort the forwarding header
(cherry picked from commit 5ed702e211a3db4055718ac000aea8c26ef79c46)
2024-11-21 09:41:42 -05:00
Julius Elshoff
15e1590def LibWeb: Rename 'cross-origin opener policy' to 'opener policy'
(cherry picked from commit de31ea5852e3fc0aca1e86e06c6bc019f27824de)
2024-11-21 07:32:56 -05:00
Sönke Holz
b0503607d9 Meta: Try to download files with gzip compression in download_file.py
This makes downloading emoji-test.txt a lot faster.
2024-11-21 10:08:16 +01:00
Sönke Holz
be9c0921ff Meta: Use download_file.py for the CMake build
This required making the `-v` and `-f` arguments optional.
2024-11-21 10:08:16 +01:00
Andreas Kling
a65b5cb135 LibWeb: Mark image elements for layout before firing their load event
This removes a long-standing source of flakiness seen for example in
WPT's /referrer-policy/ tests.

(cherry picked from commit 063cd68bf472061ec35cf9b8970aa6e614632c9b)
2024-11-20 22:51:34 -05:00
Luke Wilde
27c1ce5299 LibWeb: Make default document readiness be "complete"
This is required by mini Cloudflare invisible challenges, as it will
only run if the readyState is not "loading". If it is "loading", then
it waits for readystatechange to check that it's not "loading" anymore.

Initial about:blank iframes do not go through the full navigation and
thus don't go through HTMLParser::the_end, which sets the ready state
to something other than "loading". Therefore, the challenge would never
run, as readyState would never change.

Seen on https://discord.com/login

(cherry picked from commit f638f84185938c74a47f5691e8d7c5e1d4dca07c)
2024-11-20 22:51:34 -05:00
Pavel Shliak
3c7d6a7f80 LibCompress: Clean up #include directives
This change aims to improve the speed of incremental builds.

(cherry picked from commit d0c0db5bb3bf0e20b8a959dc4aec26a93a4ce4e7)
2024-11-20 22:51:34 -05:00
rmg-x
81d786d9e1 LibJS: Parse dates like "Wed Nov 20 2024"
(cherry picked from commit 74b27d620daa80f94e67e6a76a83149c7266c710)
2024-11-20 22:51:34 -05:00
Tim Ledbetter
4dd2c42239 LibWeb: Use correct specifier to pad font language override value
(cherry picked from commit 7fe110225b7de2177e3463424ab437ffd9d7d5cd)
2024-11-20 22:51:34 -05:00
Sam Atkins
4323e0fce8 LibWeb/CSS: Use writing-mode enum for writing-mode property
(cherry picked from commit 0a569a9034298d4735eec0fe5163232944590640)
2024-11-20 22:51:34 -05:00
implicitfield
b765ee22d3 Kernel/FATFS: Fix a typo 2024-11-20 20:47:46 -05:00
implicitfield
70f29d064f Kernel/FATFS: Use last() and take_last() where possible 2024-11-20 20:47:46 -05:00
implicitfield
423e80d22f Kernel/FATFS: Handle the "." and ".." entries correctly in remove_child 2024-11-20 20:47:46 -05:00
implicitfield
c74ee7d36a Kernel/FATFS: Fill in first cluster metadata for new ".." entries 2024-11-20 20:47:46 -05:00
implicitfield
b83be2b754 Kernel/FATFS: Fix an off-by-one in create_sfn_from_lfn
With this change, we no longer crash after finding more than one period
in a filename.
2024-11-20 20:47:46 -05:00
implicitfield
af83d756f5 Tests: Add tests for SFN utilities 2024-11-20 20:47:46 -05:00
implicitfield
ce871de432 Kernel/FATFS: Abstract out SFN helpers and make them usable in userspace 2024-11-20 20:47:46 -05:00
Nico Weber
f2feaccdcf Tests: Port dash-related paths.pdf changes to svg-stroke-styles.html 2024-11-19 22:21:24 -05:00
Nico Weber
b00cfb54e8 AK: Don't define IsFloatingPoint and the FloatingPoint concept in KERNEL
We build KERNEL without floats, so that context switches don't have
to save float registers. As a side effect of that, _Float16 results
in a "_Float16 is not supported on this target" diagnostic.

Having IsFloatingPoint<> be false for the upcoming f16 type but
true for other floating point types seems strange, so just stop
having these concepts in kernel code altogether.
2024-11-19 19:20:44 -05:00
BenJilks
de4fe9fcfe LibWeb: Add writing-mode CSS property, and its values
Introduce the `writing-mode` property, as specified in
https://drafts.csswg.org/css-writing-modes/#block-flow

(cherry picked from commit c3f3e93b7e46e2f366fbc904852763af546d3913;
amended to fix conflict on `height:` in expectation)
2024-11-19 11:02:38 -05:00
stelar7
ded4fc8b2f LibWeb: Add debug log message for missing calc() context
(cherry picked from commit 2b65e86ec7fb04d5c0e31256e80bee31a66c6d96)
2024-11-19 11:02:38 -05:00
stelar7
c39fa9a033 LibWeb: Parse the rotate css property
(cherry picked from commit 488436fb54347e69040cfed4f523926241a136a3)
2024-11-19 11:02:38 -05:00
Jelle Raaijmakers
ef09e057ee LibWeb: Fix filter: drop-shadow argument parsing
We were not discarding enough whitespace to actually get to the radius
and color values.

(cherry picked from commit c99fad77e1cfc8789f2a8d33e958d7b5bcf35ea9)
2024-11-19 11:02:38 -05:00
Jelle Raaijmakers
93a8c61fe9 LibWeb: Parse and store filter property
This shares its implementation with `backdrop-filter`.

(cherry picked from commit 29974de852fb14eef78a18232bd36d5c8955a214;
amended to resolve conflict on `height:` in expectations file, and to
remove change to DisplayListPlayerSkia.cpp which serenity doesn't have;
also updated FilterPainting.{h,cpp} for changes since serenity does not
have LadybirdBrowser/ladybird#736 and LadybirdBrowser/ladybird#886)
2024-11-19 11:02:38 -05:00
Lucas CHOLLET
5148cd3122 LibWeb/CSS: Start parsing the color() function
This is really bare bone as we only support the `xyz-d50` color space
for the moment.

It makes us pass the following WPT tests:
 - css/css-color/predefined-016.html
 - css/css-color/xyz-d50-001.html
 - css/css-color/xyz-d50-002.html

(cherry picked from commit 48bbebc636598eca905b8eef984ee2cba548ff64)
2024-11-18 20:22:45 -05:00
Andreas Kling
e1ba881587 AK+LibWeb: Add {Fly,}String::to_ascii_{upper,lower}_case()
These don't have to worry about the input not being valid UTF-8 and
so can be infallible (and can even return self if no changes needed.)

We use this instead of Infra::to_ascii_{upper,lower}_case in LibWeb.

(cherry picked from commit 073bcfd3866852a4c4bcca2bd131bd65ae53541f)
2024-11-18 20:22:45 -05:00
Ali Mohammad Pur
14b6e5b89c LibLine: Add a \n to the DSR request string
This generally yields nicer results around the bottom row of the
terminal.
2024-11-18 21:00:53 +01:00
Ali Mohammad Pur
dbe61c5ea7 LibLine: Defer resize/interrupt handlers when not actively editing
The terminal won't be in any known state, so handling these events
immediately is likely to cause desync or errors.
2024-11-18 21:00:53 +01:00
Ali Mohammad Pur
95df87fbed LibShell: Clear the initial prompt line
This fixes a rendering issue where the first line of the prompt
overwrites a line with "% ...", which leaves the "%" in the terminal
if the prompt starts with "\n".
2024-11-18 21:00:53 +01:00
Psychpsyo
459f13ee74 LibWeb: Prevent checkboxes from firing change events when losing focus
This is because toggling the checkbox is committing the value.

(cherry picked from commit 3856dd946b94b61be2ddac80c8cf60278fcc56ab;
amended to add spaces to expected output due to serenity not yet
having LadybirdBrowser/ladybird#1603, and to add a trailing newline
to the test input file)
2024-11-18 13:21:10 -05:00
Andrew Kaster
6374f8bc7f js: Don't destroy the JS VM on shutdown
This avoids a crash in the fully static distribution build, due to
static init order fiasco.

(cherry picked from commit c898ee90cf2bb64794a583871687e0b08f49ee4b)
2024-11-18 13:21:10 -05:00
Ali Mohammad Pur
0703e4f806 LibRegex: Avoid generating ForkJumps when jumping to the next alt block
Fixes #2398.

(cherry picked from commit 5a4d657a4e842dff01d7b1f03a269c9daf6c1cd7)
2024-11-18 13:21:10 -05:00
Lucas CHOLLET
32830bf961 LibWeb/CSS: Add support for the lch color function
This makes us pass all `css/css-color/lch-00*.html` tests.

(cherry picked from commit f253246a6cd013af2b81d7ab8d24a1baef857c20)
2024-11-18 13:21:10 -05:00
Lucas CHOLLET
12c57e3026 LibWeb/CSS: Introduce a base class for LCH-based color values
This will be used by both CSSLCH and CSSOKLCH.

(cherry picked from commit e8fc731b8cde75a0af9571a3b491f6149038ea21)
2024-11-18 13:21:10 -05:00
Lucas CHOLLET
bbddfc4408 LibWeb/CSS: Factorize the parsing code for lch-like color functions
(cherry picked from commit 7a94709cd2f7a47af8c336fccf3f656bbfeb65bf)
2024-11-18 13:21:10 -05:00
Lucas CHOLLET
d61a8096f4 LibWeb/CSS: Make all children of CSSLabLike share the create() method
Small code deduplication. NFC.

(cherry picked from commit 15121d63adebc18ba6d5432eabe04f56928d9fde)
2024-11-18 13:21:10 -05:00
Jonne Ransijn
f27d50afbc LibWeb: Return Web::CSS::Selector::pseudo_element by reference
This avoids many allocations and deallocations.

(cherry picked from commit 8409178a111424710492a0bcdf692bfa3439b4a5)
2024-11-18 13:21:10 -05:00
Nico Weber
bb2ce8b993 Meta: Add CSSNestedDeclarations to GN 2024-11-18 09:48:28 -05:00
Sam Atkins
4e73ad50df LibWeb/CSS: Process style properties from CSSNestedDeclarations rules
These are created when a style rule has properties listed after another
rule. For example:

```css

.test {
  --a: 1;
  --b: 1;
  --c: 1;

  .thing {
    /* ... */
  }

  /* These are after a rule (.thing) so they're wrapped in a
     CSSNestedDeclarations: */
  --d: 1;
  --e: 1;
  --f: 1;
}
```

They're treated like a nested style rule with the exact same selectors
as their containing style rule.

(cherry picked from commit e4245dc39e68d9376dfb2344c78119a938533319)
2024-11-18 09:48:28 -05:00
Sam Atkins
f157983f10 LibWeb/CSS: Parse and use nested style rules
For example, this:

```css
.foo {
  color: red;
  &:hover {
    color: green;
  }
}
```

now has the same effect as this:

```css
.foo {
  color: red;
}
.foo:hover {
  color: green;
}
```

CSSStyleRule now has "absolutized selectors", which are its selectors
with any `&`s resolved. We use these instead of the "real" selectors
when matching them, meaning the style computer doesn't have to know or
care about where the selector appears in the CSS document.

(cherry picked from commit 53f99e51f8382a20cec7752480d505957a2680b1)
2024-11-18 09:48:28 -05:00
Sam Atkins
40c8607316 LibWeb/CSS: Use SelectorList type instead of Vector<NNRP<Selector>>
(cherry picked from commit 74c448d744f55cde3bddfd2611b629b7535fb8cf)
2024-11-18 09:48:28 -05:00
Sam Atkins
afec5ff003 LibWeb/CSS: Clear CSSRule's cached layer name when it is moved
Through the CSSOM, rules can be moved around, and so anything cached
(for now just the qualified layer name) needs to be recalculated when
that happens. This method is virtual so that other rules will be able
to clear their cached data too.

(cherry picked from commit d935a00413cbfc0d292406a1b97a327715882078)
2024-11-18 09:48:28 -05:00
Sam Atkins
61fae972c6 LibWeb/CSS: Parse nested rules in style blocks
Nested lists of declarations become CSSNestedDeclarations; at-rules are
allowed as long as they are CSSGroupingRules.

(cherry picked from commit 36afff97d18b6c67e718894f2fc9742c3f9d0122)
2024-11-18 09:48:28 -05:00
Sam Atkins
a4c7586337 LibWeb: Implement CSSNestedDeclarations type
This is basically a list of properties, without a block around it. It'll
be part of CSSStyleRules' contents.

(cherry picked from commit 9c66ab356ac96602e5c1dc23906288fa187e9f01)
2024-11-18 09:48:28 -05:00
Sam Atkins
8cd170fba3 LibWeb/CSS: Parse the & nesting selector
(cherry picked from commit 5b4d1b5b05c66cc82590f72451e58055c4df9e65)
2024-11-18 09:48:28 -05:00
Lucas CHOLLET
a683961f24 LibGfx+LibWeb/CSS: Add support for the lab() color function
The support in LibWeb is quite easy as the previous commits introduced
helpers to support lab-like colors.

Now for the methods in Color:
 - The formulas in `from_lab()` are derived from the CIEXYZ to CIELAB
   formulas the "Colorimetry" paper published by the CIE.
 - The conversion in `from_xyz50()` can be decomposed in multiple steps
   XYZ D50 -> XYZ D65 -> Linear sRGB -> sRGB. The two first conversion
   are done with a singular matrix operation. This matrix was generated
   with a Python script [1].

This commit makes us pass all the `css/css-color/lab-00*.html` WPT
tests (0 to 7 at the time of writing).

[1] Python script used to generate the XYZ D50 -> Linear sRGB
conversion:

```python
import numpy as np

m_a = np.array([
    [0.8951000, 0.2664000, -0.1614000],
    [-0.7502000, 1.7135000, 0.0367000],
    [0.0389000, -0.0685000, 1.0296000]
])

chromaticities_source = np.array([0.96422, 1, 0.82521])
chromaticities_destination = np.array([0.9505, 1, 1.0890])

cone_response_source = m_a @ chromaticities_source
cone_response_destination = m_a @ chromaticities_destination

cone_response_ratio = cone_response_destination / cone_response_source
m = np.linalg.inv(m_a) @ np.diagflat(cone_response_ratio) @ m_a

D50_to_D65 = m

xyz_65_to_srgb = np.array([
    [3.2406, - 1.5372, - 0.4986],
    [-0.9689, + 1.8758, 0.0415],
    [0.0557, - 0.2040, 1.0570]
])

xyz_50_to_srgb = xyz_65_to_srgb @ D50_to_D65

print(xyz_50_to_srgb)
```

(cherry picked from commit 3406b69614e27dcb6036a6d2e5ca62833070c0a1;
amended to fix -Wdouble-promotion warnings)
2024-11-18 09:07:51 -05:00
Lucas CHOLLET
b49cc740e8 LibWeb/CSS: Make CSSOKLab inherit from a new CSSLabLike class
This class provides the common base for both CSSOKLab and the future
CSSLab classes.

(cherry picked from commit 8efa046e0c56d970cabe5644e0e8b4eef85013c3)
2024-11-18 09:07:51 -05:00
Lucas CHOLLET
6a77d5687e LibWeb/CSS: Extract code to parse a lab-like color value
This is currently only used for `oklab()` but will soon be also used for
`lab()` as well.

(cherry picked from commit 707bcaf6045b1eb36887bbf3af107b87d3def302)
2024-11-18 09:07:51 -05:00