Commit graph

20 commits

Author SHA1 Message Date
sideshowbarker
db7aa68340 LibWeb: Implement checkValidity() for HTMLSelectElement
This change adds an implementation of the checkValidity() method for
HTMLSelectElement.
2025-02-26 14:07:39 +00:00
devgianlu
b8f234719d LibWeb: Support autocomplete attribute on form elements
Implement proper support for the `autocomplete` attribute in `input`,
`select` and `textarea` elements.
2025-02-26 07:01:14 +00:00
sideshowbarker
e79319ad85 LibWeb: Implement the form-control willValidate property
This change — part of the HTML constraint-validation API (aka
“client-side form validation”) — implements the willValidate IDL/DOM
attribute/property for all form controls that support it.
2025-02-26 05:45:06 +00:00
Tim Ledbetter
8b2de413ae LibWeb: Ensure selected options collection is created prior to access 2025-02-08 07:32:24 -05:00
Psychpsyo
bad7324307 LibWeb: Implement CSS validity pseudo-classes 2025-02-05 12:38:55 +00:00
Shannon Booth
ebd6d49415 LibWeb/HTML: Add fastpath to skip selectedness update on option insert
This extends the optimization introduced in the previous commit to
also apply to the inserted steps for an option element. This makes
the test:

https://wpt.live/html/select/options-length-too-large.html

Go from not ever completing due to how slow it was to running, to
finishing in 800ms on my PC :^)
2025-01-30 13:55:40 -07:00
Shannon Booth
075c7ea63e LibWeb/HTML: Add fastpath to skip selectedness update on children change
We can definitely expand on this a bunch more, but using the metadata
provided in the children change notification we are able to skip
runnning the expensive selectedness algorithm on the <select> element.

This removes children changed from appearing in the profile of:

https://wpt.live/html/select/options-length-too-large.html
2025-01-30 13:55:40 -07:00
Shannon Booth
903c8860f8 LibWeb: Add metadata to children update steps invocation
Currently, this metadata is only provided on the insertion steps,
though I believe it would be useful to extend to the other cases
as well. This metadata can aid in making optimizations for these
steps by providing extra context into the type of change which
was made on the child.
2025-01-30 13:55:40 -07:00
Shannon Booth
5b6b4d93a3 LibWeb/HTML: Add a cache for the list of Options for HTMLSelectElement
This is still called _way_ too often, and we need to be much smarter
about when this needs to run. But we get two wins from this very
naive implementation:

  1. There is a inner text setter nested within the selectedness
     steps uses this list of elements. This saves us building
     up a list of elements again within these steps.
  2. More importantly, it caches the number of selected elements.
     This already allows us to skip a minor amount of work iterating
     over the children again. But in future commits, this will serve
     as one of the criteria for skipping running the selectedness
     algorithm altogether for certain cases, which is a very big win.

A example future idea might be to append to this list directly when
something like appendChild is run instead of iterating over all of
the children again. But that's left as future work.
2025-01-30 13:55:40 -07:00
Psychpsyo
8f11dfc08a LibWeb: Make select element use option's label, not text content 2025-01-04 11:44:03 +00:00
Andreas Kling
74469a0c1f LibWeb: Make CSS::ComputedProperties GC-allocated 2024-12-22 10:12:49 +01:00
Andreas Kling
c1cad8fa0e LibWeb: Rename CSS::StyleProperties => CSS::ComputedProperties
Now that StyleProperties is only used to hold computed properties, let's
name it ComputedProperties.
2024-12-22 10:12:49 +01:00
Tim Ledbetter
6218f1a609 LibWeb: Limit HTMLSelectElement.size to allowed values
This change ensures that the correct default value of 0 is used and
that values greater than 2147483647 will fall back to the default value.

It also splits the display size concept into a separate method, as
this isn't supposed to be used when getting the IDL property.
2024-11-29 13:30:57 +01:00
Shannon Booth
f87041bf3a LibGC+Everywhere: Factor out a LibGC from LibJS
Resulting in a massive rename across almost everywhere! Alongside the
namespace change, we now have the following names:

 * JS::NonnullGCPtr -> GC::Ref
 * JS::GCPtr -> GC::Ptr
 * JS::HeapFunction -> GC::Function
 * JS::CellImpl -> GC::Cell
 * JS::Handle -> GC::Root
2024-11-15 14:49:20 +01:00
Andreas Kling
dc9179bb1b LibWeb: Keep track of the order in which option elements are selected
This allows us to locate the most-recently-selected when running the
selectedness update algorithm.
2024-11-14 23:06:30 +01:00
Timothy Flynn
93712b24bf Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
Andreas Kling
13d7c09125 Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
Andreas Kling
865f524d5b AK+LibGUI+LibWeb: Remove AK::TypeTraits in favor of RTTI-based helpers
Now that we have RTTI in userspace, we can do away with all this manual
hackery and use dynamic_cast.

We keep the is<T> and downcast<T> helpers since they still provide good
readability improvements. Note that unlike dynamic_cast<T>, downcast<T>
does not fail in a recoverable way, but will assert if the object being
casted is not a T.
2021-01-01 15:33:30 +01:00
Luke
e8a9e8aed5 LibWeb: Add namespace to Element 2020-10-22 15:24:42 +02:00
Luke
be5a62d5d7 LibWeb: Add all HTML elements between S and V 2020-08-09 21:14:51 +02:00