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)
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)
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)
This API is a relic from the time when it was important for objects to
have easy access to the Window, and to know it was the global object.
We now have more spec-related concepts like relevant_global_object and
current_global_object to pull the Window out of thin air.
(cherry picked from commit 02a56f648000517f191eeaea2abc68783c097486)
This returns the source text of the specified style sheet. StyleComputer
now exposes user agent style sheets so that these can also be requested.
(cherry picked from commit 49b2eb5f51be2ddfd2c6009e7d8064b58d665af3)
This will be used by the inspector, for showing style sheet contents.
Identifying a specific style sheet is a bit tricky. Depending on where
it came from, a style sheet may have a URL, it might be associated with
a DOM element, both, or neither. This varied information is wrapped in
a new StyleSheetIdentifier struct.
(cherry picked from commit 51a426cc0562d12a6e8f7d1d1a38f9ecac77072a)
This only iterates style sheets that are in use, so make this clear by
renaming it to `for_each_active_css_style_sheet()`.
(cherry picked from commit c29f4f69ef9a16bd63a4bf133618120068e96bf3)
(cherry picked from commit 229b64a4b723a391c21f247d72d78cd575ace6ff;
minorly amended to fix conflict in image.cpp due to serenity in the
meantime adding webp writing support, and due to changes in Android and
Vulkan-related files that serenity doesn't have)
I had made a stab at implementing this to determine whether it could
assist in fixing an issue where scroll_to_the_fragment was not getting
called at the appropriate time. It did not fix that issue, and actually
ended up breaking one of our in tree tests. In the meantime, factor out
this method into a standalone function.
(cherry picked from commit 41f574155df89bb5122646a0978fa8821c35fc16)
Before, the new title element got appended instead of prepended, as
nullptr was passed as the "child" argument to the insert_before()
function.
This change makes two WPT tests pass in:
http://wpt.live/html/dom/documents/dom-tree-accessors/document.title-09.html
(cherry picked from commit 3ff613712132bd3d03f44f27986f7ca5aaea8eb5)
Previously, the inclusive descendant, which is the node that
for_each_shadow_including_inclusive_descendant was called on, would not
have it's shadow root traversed if it had one.
This is because the shadow root traversal was in the `for` loop, which
begins with the node's first child. The fix here is to move the shadow
root traversal outside of the loop, and check if the current node is an
element instead.
(cherry picked from commit 6df4e5f5e75d7d6d439d1365ed7bed4fd2a8a1da)
While traversing the DOM tree, looking for nodes that need a style
update, we were recomputing style for every node visited along the way,
even nodes that didn't themselves need a style update (but one of their
descendants did).
This avoids a bunch of completely unnecessary style recomputation on
basically every website.
(cherry picked from commit 5431db8c1c9d366d0a27959cfbf0f146bf4be20d)
We were hard-coding "about:blank" as the document URL for parsed HTML
documents, which was definitely not correct.
This fixes a bunch of WPT tests under /domparsing/ :^)
(cherry picked from commit 55f58eea99c0429dcc39cd0430fafa60eecf5542)
This reverts 6d25bf3aac
Invalidating the style here means that transitions can cause an element
to leave style computation with its "needs style update" flag set to
true. This then causes a VERIFY to fail in the TreeBuilder.
This invalidation does not otherwise seem to have any effect. The
original commit suggests this was to fix a bug, but it's not clear what
bug that was. If it reappears, we can try to solve the issue in a
different way.
(cherry picked from commit 81596b41457d250bac28db37c1390fa46e6532de;
amended test with leading whitespace since we don't have
LadybirdBrowser/ladybird#1603 yet)
The DOM spec gets overridden by both the SVG2 and MathML core specs in
that unknown elements should not inherit DOM::Element, but
SVG::SVGElement and MathML::MathMLElement respectively.
(cherry picked from commit 76e638b4ca10a91983877d6f6e7f037c1a720965)
This change completes handling for all ARIA properties defined in the
current ARIA spec — by adding handling for the following properties:
- aria-braillelabel
- aria-brailleroledescription
- aria-colindextext
- aria-description
- aria-rowindextext
(cherry picked from commit ede6924db8e4440ef3bdb0fbb34d31226568e55a)
This change implements the https://w3c.github.io/accname/#comp_append
step in the “Accessible Name and Description Computation” spec — so that
when an accessible name is computed from multiple sources in a document
subtree, the parts of the computed text are joined together with spaces.
Otherwise without this change, in accessible names computed from
multiple sources in a document subtree, the parts of the computed text
are unexpectedly run together, with no spaces between the parts.
(cherry picked from commit 3ba7c536681e8471e9b53aaf8e5dd32d801e26e4)
These registrations are not meant to keep the observers alive.
This fixes a handful of world leaks on Speedometer.
(cherry picked from commit b397a0d5350fad04f43e3e5d9bdb9c801a4e712a)
These flags always propagate to the root, so once we encounter an
ancestor with the flag set, we can stop traversal since everything above
it will already be set as well.
(cherry picked from commit f106aa9e8a8f3a98b498e0f9324123963fad6ca2)
This is not in the spec, but I did see a null pointer dereference here
while browsing the web, and it seems completely harmless for this
function to skip over navigables without an active document.
(cherry picked from commit 56e1c0e7eec813c311c41696063a3a31b4b14f0d)
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)
The only real change here is that we make the document unsalvageable.
Everything else is fixing up spec comments.
(cherry picked from commit faf097bb4168208a7c0250280ff07e638be8058a)
...unless there are :has() selectors present. Then we have to invalidate
everything for now.
(cherry picked from commit b8ce34068f5bf8ab8cf049d56b864bff52ef3dff)
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)
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)
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 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)
Previously, there was a bug in the specification that would cause an
assertion failure, due to the abort event being fired before all
dependent signals were aborted.
(cherry picked from commit 3ae4ea7b10e5022079d0b203844fc93899c08a09)
This update fixes an issue where the document type was incorrectly set
to XML instead of HTML when initializing text and media documents.
(cherry picked from commit 2565757c7a705758bdd2ddc7ac3f7314a1773ed0)