We were unnecessarily discarding the shadow trees of various elements
when they were removed or detached from the DOM.
This especially caused a *lot* of churn when creating input elements via
setting .innerHTML on something. We ended up building each input
element's shadow tree 3 times instead of 1.
The original issue that we were trying to solve by discarding shadow
trees appears to have been solved elsewhere, and nothing else seems to
break by just allowing them to remain in place.
1.05x speedup on Speedometer's TodoMVC-jQuery.
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.
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
We currently have 2 virtual methods to inform DOM::Element subclasses
when an attribute has changed, one of which is spec-compliant. This
patch removes the non-compliant variant.
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.