Previously, we were searching for other radio buttons from the document
root, rather than the element root.
(cherry picked from commit 67981af276cf55d69d51a872ec83e5b59d793b6c)
When the user clicks on a text node, the event handler sets the cursor
position to the location that was clicked. But it would then be set back
to 0 in the DOM node's focus handler. Leave the cursor alone, unless the
the DOM node was never set as the cursor position node (which will occur
when the user clicks on the DOM node, but outside the shadow text node).
In that case, move the cursor to the end of the text node.
The end result here is that the cursor is placed where the user clicked,
or set to the end of node if the user clicked outside of the shadow text
node.
(cherry picked from commit fc37c4ad40beba249a7ea5452f11014d43da68f6)
Per css-ui-4, setting `appearance: none` is supposed to suppress the
creation of a native-looking widget for stuff like checkboxes, radio
buttons, etc.
This patch implements this behavior by simply falling back to creating
a layout node based on the CSS `display` property in such cases.
This fixes an issue on the hey.com imbox page where we were rendering
checkboxes on top of sender profile photos.
(cherry picked from commit 58c523ae46af90ab17d6b98966d97fa776ae2bf4)
In particular, there was an assertion failure due to the temporary
parser document's "about base URL" being empty when trying to "parse a
URL" during parsing.
We fix this by copying the context element's document's about base URL
to the temporary parsing document while parsing a fragment.
This fixes a crash when loading search results on https://amazon.com/
(cherry picked from commit b64df59cc61f31b8a0aab91abb4630b3ecb1dcee)
The spec requires that "multipart/form-data" Content-Type headers also
include a boundary directive. This allows the content server to validate
the submitted form data.
Google Lens, for example, rejects forms missing this directive.
(cherry picked from commit b16b9709b99c51d288d1e514c3c0012c79ea16d2)
When scripts receive a DataTransferItem from any IDL method, the spec
requires we return the same DataTransferItem for a particular item in
the drag data store. Meaning, we cannot just create these on the fly as
needed.
To do this, we store a list of DataTransferItem on the DataTransfer
object. We will return one of these objects any time one is requested by
a script.
It feels a bit weird to have the DataTransfer object store: the drag
data store, a DataTransferItemList, and a list of DataTransferItem. But
this is how other engines implement this as well. It basically has to be
this way as DataTransferItemList is just a proxy to the DataTransfer -
meaning, DataTransfer is the source of truth for all IDL access.
(cherry picked from commit b3bfd02e64b4e5a0754c157b18dd42427c931923)
A DataTransferItem is associated with a DataTransfer, and points to an
item in the drag data store. We don't yet support removing items from
the store, but when we do, we will clear the index stored here to set
the DataTransferItem's mode to "disabled".
(cherry picked from commit c82fec0a8cc871aa331de5a557db1adddca7711c)
The IDL constructor has to take separate steps than a DataTransfer that
is internally constructed. Notably, an IDL-created object has its own
drag data store, and that store is placed in a read-write mode.
(cherry picked from commit 5c9287aa99e52886a3d144c26de6a54980a53db6)
Ownership of the drag data store is a bit weird. In a normal drag-and-
drop operation, the DragAndDropEventHandler owns the store. When events
are fired for the operation, the DataTransfer object assigned to those
events are "associated" with the store. We currently represent that with
an Optional<DragDataStore&>.
However, it's also possible to create DataTransfer objects from scripts.
Those objects create their own drag data store. This puts DataTransfer
in a weird situation where it may own a store or just reference one.
Rather than coming up with something like Variant<DDS, DDS&> or using
MaybeOwned<DDS> here, we can get by with just making the store reference
counted.
(cherry picked from commit f7c4165dde9cc1f3c84fbc49c8496dea3a898491)
This is used by Google Lens. It will always return the empty string when
dragging an image onto the Google Lens search field.
(cherry picked from commit 535f03b6cf664071e03b7f3c95116fa89c33122b)
The popover property now reflects the attribute.
It cannot currently use the Reflect IDL concept because the empty string
value is special cased.
(cherry picked from commit a9669639cee27e81640fe7a37d9d1f319db6b666;
amended to undo unintentional -- and conflicting -- change to
Tests/LibWeb/rebaseline-libweb-test)
This factory forced callers to make a list of GC-allocated FileAPI::File
objects. This isn't safe - this opens a window for these files to be
garbage collected before the FileList object stores / visits the list.
Instead, only allow creating an empty FileList and incrementally adding
files to that list.
(cherry picked from commit 8b4d28b5fd7857e3ee47a8d50aa9c01920dcfb4b)
If the user presses ctrl+a inside an <input> element, for example, we
now select that element's text only.
(cherry picked from commit 7ae7e3eef3d239d27855af02f455c2f61abfbe4e)
This is a non-standard API that other browsers implement, which
highlights matching text in the current window.
This is just a thin wrapper around our find in page functionality, the
main motivation for adding this API is that it allows us to write tests
for our find in page implementation.
(cherry picked from commit c4d5ae28ea40ae0a0c783f34d840fb94662780fb)
This makes several calling sites shorter, and makes it easier
to add a miter limit with less plumbing in the future.
This also exposed a bug in AffineDisplayListPlayerCPU.cpp: We weren't
passing path linecap style on. I added a FIXME for that for now.
No intended behavior change.
CSS Fonts level 4 renames font-stretch to font-width, with font-stretch
being left as a legacy alias. Unfortunately the other specs have not yet
been updated, so both terms are used in different places.
(cherry picked from commit 4a67b28600437901e6d8a366c56a5ddd8665deb1)
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.)
Made easier now that URL percent encode after encoding is also not
throwing any errors. This simplfies a bunch of error handling.
(cherry picked from commit df4739d7ced4159deb2b3e40ba6a1a08b7e7dd5b)
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)
Now that the implementation is in FormAssociatedElement, the
implementation in HTMLInputElement is effectively just a passthrough,
with some minor differences to handle small behavioural quirks between
the two (such as the difference in nullability of types).
(cherry picked from commit 9f24176cac862c42c9cf4d3ac0e757397a5f6ae1)
This will allow us to more closely follow the spec and share these
functions with HTMLInputElement.
(cherry picked from commit 62bf428a7f57b585e6d0b8c01af2c0aca336fe2c)
Put the const cast in a common location to make the helper more
convenient to use.
(cherry picked from commit 28ed8e5d0f79fc9d961f746367127e137faaf46b)
(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)
This simplifies a bunch of places which were needing to error check and
convert from a ByteString to String.
(cherry picked from commit 84a7fead0eefd967d4319f4d71c0a0ca3095d2d1)