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)
Tiny mistake in the implementation of the spec; fixes 16 FAILs in the
WPT `/dom/ranges/Range-mutations-splitText.html` tests.
(cherry picked from commit dee81f354531c2e49be34279ca31ccc7ad9cbcca)
The spec says to just call the XML serialization algorithm, but it
returns the "outer serialization", and we need the "inner" one. Let's
just concatenate serializations of children; then the result produced is
similar to one from Blink or Gecko.
(cherry picked from commit 9eb568eacbcb36e6c1ffd6e61ebf8242a4422119)
`BrowsingContext::m_parent` has been removed from the spec,
and previously `m_parent` was always null.
`BrowsingContext::is_top_level` was already always returning
true before because of that, and the updated spec algorithm
causes assertions to fail.
This fixes the following example:
```html
<a href="about:blank" target="test">a
<iframe name="test">
```
clicking the link twice no longer causes it to open in a new tab.
(cherry picked from commit e6a668ad913f0755840954c188c255fc5fc66606)
Previously, we set the "needs style update" flag to false at the
beginning of recomputing the style. This meant that if any code within
the cascade set this flag to true, then we would end style computation
thinking the element still needed its style updating. This could occur
when starting a transition, and would make TreeBuilder crash.
By ensuring that we always set the flag to false at the very end of
style computation, this is avoided, along with any similar issues - I
noticed a comment in `Animation::cancel()` which sounds like a
workaround was needed for a similar problem previously.
(cherry picked from commit 8c79edac085ee164aca5ca7cf287e68e93e03217)
DOM nodes that didn't have a layout node before being removed from the
DOM are not going to change the shape of the layout tree after being
removed.
Observing this, we can avoid a full layout tree rebuild on some DOM node
removals.
This avoids a bunch of tree building work when loading https://x.com/
(cherry picked from commit 6f34758947852abae773798ba3ffa8e903fdc3d0)
I believe this is slightly less confusing, since what the function does
is trigger a full layout tree *rebuild*, not just a relayout.
(cherry picked from commit aa8f17aea4d1aa1950a66969fc8b5c431fbc1b7c)
I previously believed there was no way a detached document should have
layout information, but it turns out there is a way: getComputedStyle().
So we need to account for cases where we have a layout node, but no
navigable, since that is a state we can get into at this moment.
Fixes#354
(cherry picked from commit 1e7b17f15024d0618f1a1e17e3e927856febde28)
Previously, unnecessary boundary checks were being done when
constructing the range objects used to represent find in page matches.
These checks are no longer performed leading to a significant speedup
when performing find in page queries on pages containing a lot of text.
(cherry picked from commit e76ad9492e0992f9a6d821240bea2b62f27a03c8)
The first step of the find in page algorithm is to walk the layout tree
of each document on the page and construct a list of strings against
which to search for matches.
Previously, this was being done for each new query, even when the
page content hadn't been updated. The output of this process is now
cached in the viewport node of the associated document. This ensures
that this process is no longer repeated unnceessarily.
(cherry picked from commit 156c1083e9de23a93075ec9e3c55cd5f93c48896)
Elements which are `display: none` or `visibility: hidden` are no
longer included in find in page results.
(cherry picked from commit a3a7a65b1c89af5631436c06d2847fe7ad5c51cb)
Find in page will no longer match text that spans across block elements.
Previously, given the markup `WH<div>F</div>`, the query `WHF` would
find a match. We would now match `WH` and `F` separately, but not `WHF`.
(cherry picked from commit 23166b85d2443cccbdd8fcb1e9d99c9f3f9d04a3)
Previously, the find in page function would fail to find text which was
split across multiple text nodes. For example, given the following
markup: `WH<span>F` the query `WHF` would previously fail to be
matched.
This is done by traversing all of the document's text nodes -
constructing a complete string to query against and keeping track of
the locations where that string is split across multiple nodes.
(cherry picked from commit ec4d29849dc1d0357c73690722aea1a7802dd0bc)
This fixes an issue where clearing the find in page query would not
always visually clear the selection.
(cherry picked from commit 0b33331f3678eb69bc3448949dfc2c1e1e7671e6)
To avoid expensive lookups, we now cache a weak pointer from document to
the last known node navigable. Before using the cache, we validate that
the document is still the navigable's active document.
(cherry picked from commit e746b2b133758b3552ae07941cc6d14332c64d59)
When setting an element attribute to the value it already had, we don't
need to update style or invalidate anything that depends on the DOM
version counter.
This was a source of much pointless busywork.
(cherry picked from commit 7df4365e405410bff267644e0a5c1d7b3d76faac)
You can now build with STYLE_INVALIDATION_DEBUG and get a debug stream
of reasons why style invalidations are happening and where.
I've rewritten this code many times, so instead of throwing it away once
again, I figured we should at least have it behind a flag.
(cherry picked from commit ddbfac38b0074819470766846fca08fd78630eb0;
minorly amended for conflicts in AK/Debug.h.in and
Meta/CMake/all_the_debug_macros.cmake due to us having more debug
macros. Also, downstream got alphabetical order for
STYLE_INVALIDATION_DEBUG wrong.)
Navigables are re-used for navigations within the same tab. Its current
ownership of the cursor position is a bit ad-hoc, so nothing in the spec
indicates when to reset the cursor, nor do we manually do so. So when a
cursor update happens on one page, that cursor is retained on the next
page.
Instead, let's have the document own the cursor. Each navigation results
in a new document, thus we don't need to worry about resetting cursors.
This also makes many of the callsites feel nicer. We were previously
often going from the node, to the document, to the navigable, to the
cursor. This patch removes the navigable hop.
(cherry picked from commit faebbbc281d1267062770b02fc6d962d92a3bd62)
(cherry picked from commit 4a166a45ec9db910542893133f08cc7de4ec974f,
minorly amended to resolve #include conflict due to our LibLocale
and LibUnicode being separate -- we don't want
https://github.com/LadybirdBrowser/ladybird/pull/257)