Before this change, we were going through the chain of base classes for
each IDL interface object and having them set the prototype to their
prototype.
Instead of doing that, reorder things so that we set the right prototype
immediately in Foo::initialize(), and then don't bother in all the base
class overrides.
This knocks off a ~1% profile item on Speedometer 3.
Instead of bothering the GC heap with a bunch of DOMRect allocations,
we can just pass around CSSPixelRect internally in many cases.
Before this change, we were generating so much DOMRect garbage that
we had to do a garbage collection *every frame* on the Immich demo.
This was due to the large number of intersection observers checked.
We still need to relax way more when idle, but for comparison, before
this change, when doing nothing for 10 seconds on Immich, we'd spend
2.5 seconds updating intersection observers. After this change, we now
spend 600 ms.
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.
This reduces the number of `.cpp` files that need to be recompiled when
one of the below header files changes as follows:
CSS/ComputedProperties.h: 1113 -> 49
CSS/ComputedValues.h: 1120 -> 209
While keyword_to_foo() does return Optional<Foo>, in practice the
invalid keywords get rejected at parse-time, so we don't have to worry
about them here. This simplifies the user code quite a bit.
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 :^)
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
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.
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.
The spec only refers to this property as something that is on a
Window object, and as far as I can tell this API is only ever
exposed on a Window object anyhow.
This is fundametally broken. A microtask only finishes after all
javascript has finished running. The selectedness of a select element
is observable by javascript, so any changes which are made as a result
of children changing associated with a select element should be made
through the children update steps and friends.
It is not cheap to do this, so only do it once within this function.
There is definitely some caching that we can do here, but this will
require some smart invalidation to detect _relevant_ changes in
the children.
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.
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
The main motivation behind this is to remove JS specifics of the Realm
from the implementation of the Heap.
As a side effect of this change, this is a bit nicer to read than the
previous approach, and in my opinion, also makes it a little more clear
that this method is specific to a JavaScript Realm.