Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-pick 29.75 Ladybird PRs #25345

Merged
merged 43 commits into from
Nov 10, 2024
Merged

Cherry-pick 29.75 Ladybird PRs #25345

merged 43 commits into from
Nov 10, 2024

Conversation

awesomekling and others added 30 commits November 9, 2024 18:57
Before this change, we were cascading custom properties for each layer,
and then replacing any previously cascaded properties for the element
with only the set from this latest layer.

The patch fixes the issue by making each pass of the custom property
cascade add to the same set, and then finally assigning that set of
properties to the element.

(cherry picked from commit 95bd0602ba079e0bd7608e39bcbc3b0403ed89d1)
The current min/max zoom levels are supposed to be: 30% and 500%.
Before, due to floating point error accumulation in incremental addition
of zoom-step into zoom-level, one extra zoom step would get allowed,
enabling user to zoom 20%-to-510%.

Now, using rounding, the intermediate zoom-level values should be as
close to the theoretical value as FP32 can represent. E.g. zoom-level of
70% (theoretical multiplier 0.7) is 0.69... .

(cherry picked from commit 96335f31d5a8c6180a4cc0254585bc01ba6742fa)
This patch implements `Range::getClientRects` and
`Range::getBoundingClientRect`. Since the rects returned by invoking
getClientRects can be accessed without adding them to the Selection,
`ViewportPaintable::recompute_selection_states` has been updated to
accept a Range as a parameter, rather than acquiring it through the
Document's Selection.

With this change, the following tests now pass:

- wpt[css/cssom-view/range-bounding-client-rect-with-nested-text.html]
- wpt[css/cssom-view/DOMRectList.html]

Note: The test
"css/cssom-view/range-bounding-client-rect-with-display-contents.html"
still fails due to an issue with Element::getClientRects, which will
be addressed in a future commit.

(cherry picked from commit 75c7dbc5d2dd045733a4c319aeab6644b5b7b36d)
Let's do this instead of making embedders visit every field of this
helper class.

(cherry picked from commit 2064be708f7318f72553fb210f918fe167e08257)
Instead of trying to locate the relevant StyleSheetList on style element
removal from the DOM, we now simply keep a pointer to the list instead.

This fixes an issue where using attachShadow() on an element that had
a declarative shadow DOM would cause any style elements present to use
the wrong StyleSheetList when removing themselves from the tree.

(cherry picked from commit 8543b8ad6a4d96bd0c247052572b8c2abf3929a7)
This aligns our implementation with the most recent specification steps.

(cherry picked from commit 089139f09dbc78455c5c09916cbc97e33f823ca0)
This fixes an issue where document.write() with only text input would
leave all the character data as unflushed text in the parser.

This fixes many of the WPT tests for document.write().

(cherry picked from commit a0ed12e839f14b3ac80caca0e18a09ca256fd99d)
We now expand shorthands into their respective longhand values when
assigning to a shorthand named property on a CSSStyleDeclaration.

We also make sure that shorthands can be round-tripped by correctly
routing named property access through the getPropertyValue() AO,
and expanding it to handle shorthands as well.

A lot of WPT tests for CSS parsing rely on these mechanisms and should
now start working. :^)

Note that multi-level recursive shorthands like `border` don't work
100% correctly yet. We're going to need a bunch more logic to properly
serialize e.g `border-width` or `border` itself.

(cherry picked from commit e40ad73ae79023f64e250f854d0730c21e0f54fc)
When an element is invalidated, it's possible for any subsequent sibling
or any of their descendants to also need invalidation. (Due to the CSS
sibling combinators, `+` and `~`)

For DOM node insertion/removal, we must also invalidate preceding
siblings, since they could be affected by :first-child, :last-child or
:nth-child() selectors.

This increases the amount of invalidation we do, but it's more correct.

In the future, we will implement optimizations that drastically reduce
the number of elements invalidated.

(cherry picked from commit df048e10f5a84d7fd90b1115c6bb90f45acd75ec)
As useful as they may be to web developers, :has() selectors complicate
the style invalidation process quite a lot.

Let's have StyleComputer keep track of whether they are present at all
in the current set of active style sheets. This will allow us to
implement fast-path optimizations when there are no :has() selectors.

(cherry picked from commit 8beb7c77002a3359ad2fe73969fc6bb2dbc75413)
Character data nodes like text and HTML comments don't have style,
so let's just exit invalidation immediately for those.

(cherry picked from commit f351f75a34619ad969f660312a2e5486f742f685)
(cherry picked from commit 7d644ecd50c57454dfb73b92e59d7112d54a1b1d)
...unless there are :has() selectors present. Then we have to invalidate
everything for now.

(cherry picked from commit b8ce34068f5bf8ab8cf049d56b864bff52ef3dff)
If we decide to fetch another linked resource, we don't care about the
earlier fetch and can safely abort it.

This fixes an issue on GitHub where we'd load the same style sheet
multiple times and invalidate style for the entire document every time
it finished fetching.

By aborting the ongoing fetch, no excess invalidation happens.

(cherry picked from commit 57e26ed6b9b2c0cf1e4f5ac3e85ca0c7f3647caa)
(cherry picked from commit 7a2d837c8ab137d8d31b3789dfe7ef377b3b225e)
(cherry picked from commit 583eef265fe9ba4f91a08e5ef1b7c7339f2371d7)
Previously, we would crash when attempting to establish a web socket
connection from inside a worker, as we were assuming that the ESO's
global object was a `Window`.

(cherry picked from commit 0c0595bb31db827fc14b5d16b8645bc6aa912d60)
This mainly uses forward declarations as appropriate for input element
related files. This reduces the number of targets being built when we
change HTMLInputElement.h from 430 to 44.

(cherry picked from commit 57e4fb0caebb0074a23bef70d7558ce5e8a5f357)
The only real change here is that we make the document unsalvageable.
Everything else is fixing up spec comments.

(cherry picked from commit faf097bb4168208a7c0250280ff07e638be8058a)
(cherry picked from commit 8b4dde0b0911f59512e1c40d19f33f49bdeeb10c)
This updates our implementation of
[attempt-to-populate-the-history-entry's-document](https://html.spec.whatwg.org/multipage/browsing-the-web.html#attempt-to-populate-the-history-entry's-document)
after fixes were made to the logic inside the queued task in
whatwg/html@cdd014a#diff-41cf6794ba4200b839c53531555f0f3998df4cbb01a4d5cb0b94e3ca5e23947dL99534.

(cherry picked from commit ed04124cbffbfe8b850e8e3a1bc0788513ce6a4d)
whatwg/console#240 is an editorial change to use
the term "implementation-defined" more consistently. This seems to be
the only instance in the spec text which we quote verbatim.

(cherry picked from commit 51f82c1d939dd28a3e719d7fa495cf9f30d0921c)
WPT uses Python's http.client.HTTPConnection to send/receive WebDriver
messages. For some reason, on Linux, we see an ~0.04s delay between the
WPT server receiving the WebDriver response headers and its body. There
are tests which make north of 1100 of these requests, which adds up to
~44s.

These connections are almost always going to be over localhost and able
the be sent in a single write. So let's send the response all at once.

On my Linux machine, this reduces the runtime of /cookies/name/name.html
from 45-60s down to 3-4s.

(cherry picked from commit e5877cda61eb53cd9c1eebbfaf3c35d084b2973c)
(cherry picked from commit 0b2449d8d264f58b39ed2a4a69b0afb8eb762011)
(cherry picked from commit cfec88feb312f3fbffe2270009a9ba07e2fd9b3f)
(cherry picked from commit 1a012f279a9791c685781b7189fba6cddb973f96)
(cherry picked from commit 973f774e56b519964f2f43d965035d9076658096)
`revert` is supposed to revert to the previous cascade origin, but we
previously had it reverting to the previous layer. To support both,
track them separately during the cascade.

As part of this, we make `set_property_expanding_shorthands()` fall back
to `initial` if it can't find a previous value to revert to. Previously
we would just shrug and do nothing if that happened, which only works
if the value you want to revert to is whatever is currently in `style`.
That's no longer the case, because `revert` should skip over any layer
styles that have been applied since the previous origin.

(cherry picked from commit bea47a25545adfb96d83a16a3e4f4435bae05e39)
The spec allows us to either treat them as part of the UA origin, or as
its own origin before author styles. This second behaviour turns out to
be what we are currently doing, which is nice!

Funnily enough this was clarified in the spec barely a month after this
original comment was written. :^)

(cherry picked from commit dcf55dd4924e5369d75a3533af2b869033a0ebfd)
See:
- whatwg/fetch#1769
- whatwg/fetch@3153e5e

(cherry picked from commit 84351dfa51dc8bd0046c3a9ec3e574c58fe9f790)
awesomekling and others added 13 commits November 9, 2024 19:12
(cherry picked from commit ef9208047dc8770f6263b483d7a442df703bc42b)
We now use the "report an exception" AO when a script has an execution
error. This has mostly replaced the older "report the exception" AO in
various specifications. Using this newer AO ensures that
`window.onerror` is invoked when a script has an execution error.

(cherry picked from commit 579a289d3db849657987c3310e7b1d71d290b566)
(cherry picked from commit 9d82e8112493575f78f66b1a0dc65ae0e791e70b)
(cherry picked from commit 2e5edcf27e7d2a212043a7ac1b906217b357b964)
This is what the spec tells us to do:

    The root element’s display type is always blockified,
    and its principal box always establishes an independent
    formatting context.

    Additionally, a display of contents computes to block
    on the root element.

Spec link: https://drafts.csswg.org/css-display/#root

Fixes SerenityOS#1562

(cherry picked from commit f1be662f683155705f851bcf440fe30d0e606a87)
(cherry picked from commit 6095aa3cc5a38367a57c3d734129017104498904)
(cherry picked from commit 4ccc52e921a5b17c6f6ec67dec7c0dff46ac7884)
Fixes crashing on https://playbiolab.com/ in
VERIFY(page.client().is_ready_to_paint()) caused by attempting to start
the next repaint before the ongoing repaint is done.

(cherry picked from commit f341af1d7265eee880355f10ef5d479c9ebceaf2)
Applies changes in whatwg/html#10658 and also
whichever previous change split the step for firing the navigateerror
into two parts.

(cherry picked from commit ec15f8fa626e5b0faf5b3e420080e944ab31ff11)
The HTML tokenizer specification says that we're supposed to do this
when leaving the Attribute name or when emitting the token, as
appropriate.

Hopefully 'as appropriate' can mean only when emitting the token, as
that's the easiest place to insert this logic without complicating the
tokenizer any more.

(cherry picked from commit 7aa0165fe75bb94b79bc847484c7913d249ce263)
We are currently creating a signal socket and socket notifier before the
Qt event loop itself has been created. Thus, when we receive a signal,
we are not actually notified when we write that signal number to the
signal socket.

This was also the source of the following error message being displayed
on every launch of the browser:

    QSocketNotifier: Can only be used with threads started with QThread

(cherry picked from commit 3393a7477103cb2dc2fe970e3559abb34b3a0ce8)
The spec moved/added the xml and html checks to the beginning and
removed sniffing resource feeds.

(cherry picked from commit b8a5e18a016dc32ba065417a4d6d32bbc03f101d)
@nico nico requested a review from trflynn89 as a code owner November 10, 2024 02:17
@github-actions github-actions bot added the 👀 pr-needs-review PR needs review from a maintainer or community member label Nov 10, 2024
@nico nico changed the title Testbranch Cherry-pick 29.75 Ladybird PRs Nov 10, 2024
@nico nico merged commit c4bbc08 into SerenityOS:master Nov 10, 2024
27 of 29 checks passed
@nico nico deleted the testbranch branch November 10, 2024 15:46
@github-actions github-actions bot removed the 👀 pr-needs-review PR needs review from a maintainer or community member label Nov 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.