implicitfield
ccea69ad40
LibWeb: Add special handling for text-align when applied to tables
...
This matches what other engines do, and stops table content from being
misaligned.
2023-11-21 16:54:02 +01:00
Andreas Kling
cc9de38ea4
LibWeb: Fix null pointer dereference in DOM::Node::remove()
...
Instead of blindly dereferencing m_registered_observer_list, just use
the add_registered_observer() helper.
Fixes #22005
2023-11-20 20:50:53 +01:00
Shannon Booth
c5d3ccca00
LibWeb: Port AriaData from DeprecatedString to String
2023-11-20 15:00:19 +01:00
Shannon Booth
6c42de3e8b
LibWeb: Port XMLSerializer from DeprecatedString to String
2023-11-20 15:00:19 +01:00
Andreas Kling
7ee47d81ca
LibWeb: Allocate custom element reactions queue on demand
...
This shrinks most DOM elements by 16 bytes.
2023-11-20 00:39:42 +01:00
Andreas Kling
ac8bb89f50
LibWeb: Allocate list of registered intersection observers on demand
...
This shrinks most DOM elements by 16 bytes.
2023-11-20 00:39:42 +01:00
Andreas Kling
bdac94870c
LibWeb: Convert Element "attribute change steps" from vector to virtual
...
By using a virtual function and overriding it on HTMLSlotElement, we
shrink every DOM element by 24 bytes. :^)
2023-11-20 00:39:42 +01:00
Andreas Kling
48dbec8a9e
LibWeb: Allocate storage for pseudo element layout nodes on demand
...
This saves us 64 bytes for every element that doesn't have pseudo
elements associated with it. Which is most of them. :^)
2023-11-20 00:39:42 +01:00
Andreas Kling
37505d9746
LibWeb: Allocate storage for pseudo element custom properties on demand
...
Most elements don't have pseudo elements with CSS custom properties.
By only allocating this data structure when it's used, we can shrink
most elements by 208 bytes each. :^)
2023-11-20 00:39:42 +01:00
Andreas Kling
9edfd5e360
LibWeb: Only allocate DOM::Node registered observer list on demand
...
Most DOM nodes don't have registered mutation observers, so let's put
the metadata about them behind an OwnPtr to save space in the common
case.
Saves 16 bytes per DOM node that doesn't have registered observers.
2023-11-20 00:39:42 +01:00
Andreas Kling
c1fd55ce94
LibWeb: Only allocate EventTarget listener/handler storage on demand
...
This shaves 40 bytes off of all EventTargets that don't actually get
listeners or handlers attached (which is most of them).
2023-11-20 00:39:42 +01:00
Andreas Kling
a71eaefdf6
LibWeb: Make EventTarget::activation_behavior a virtual function
...
(Instead of using an AK::Function on EventTarget). This shaves 48 bytes
off of every EventTarget instance.
2023-11-20 00:39:42 +01:00
Andreas Kling
bfd354492e
LibWeb: Put most LibWeb GC objects in type-specific heap blocks
...
With this change, we now have ~1200 CellAllocators across both LibJS and
LibWeb in a normal WebContent instance.
This gives us a minimum heap size of 4.7 MiB in the scenario where we
only have one cell allocated per type. Of course, in practice there will
be many more of each type, so the effective overhead is quite a bit
smaller than that in practice.
I left a few types unconverted to this mechanism because I got tired of
doing this. :^)
2023-11-19 22:00:48 +01:00
Matthew Olsson
979b9b942b
LibWeb: Add Document's pending animation event queue
...
This is needed for Animation's update finished state procedure
2023-11-19 18:54:37 +01:00
Shannon Booth
eca9874e56
LibWeb: Port Element::attribute_changed from DeprecatedString to String
...
Which as you would expect has a bunch of fallout, but also results in a
whole lot of awkward conversions falling away.
2023-11-19 08:16:34 +00:00
Shannon Booth
6a2a7cad61
LibWeb/LibJS: Avoid GC visit of raw pointers where possible
...
This is mostly motivated for aesthetics, but also helps avoid some null
checks when we have a NonnullGCPtr<T> or in some cases a T&.
2023-11-19 08:05:45 +00:00
Aliaksandr Kalenik
6bed27cca9
LibWeb: Use border box rect in getBoundingClientRect()
...
With this change we scroll to correct position on Acid2 :)
2023-11-17 20:46:56 +01:00
Aliaksandr Kalenik
ef71f46da6
LibWeb: Flesh out "scroll a target into view" spec implementation
...
This change fixes regressed Acid2 test and now we at least can see
the face after clicking "Take The Acid2 Test" link.
2023-11-17 20:46:56 +01:00
Idan Horowitz
9677d8eeac
LibWeb: Reject improperly encoded XML documents as not well-formed
2023-11-17 16:02:36 +01:00
Idan Horowitz
278e8afb42
LibWeb: Consider content-type charset when determining XML encoding
2023-11-17 16:02:36 +01:00
Idan Horowitz
07ea3ab306
LibWeb: Display error page when document parsing fails
2023-11-17 16:02:36 +01:00
Andrew Kaster
5586340cf3
LibWeb: Don't set EventTarget prototype on any WindowOrWorkerGlobalScope
...
The same limitations regarding construction of Window apply to all
WorkerGlobalScope classes as well.
2023-11-15 12:56:33 +01:00
Matthew Olsson
1a94241f58
IDL: Add missing #imports
2023-11-11 08:51:51 +01:00
Matthew Olsson
3ff481938e
IDL: Fix syntax errors
...
All attributes must have an "attribute" keyword, and "any?" is invalid
(as "any" includes "null" as well).
2023-11-11 08:51:51 +01:00
Matthew Olsson
26e6c47d0a
IDL: Add missing spec links
...
The only IDL interface without a spec link is Internals
2023-11-11 08:51:51 +01:00
Shannon Booth
45b63b463a
LibWeb: Add Element::for_each_attribute(Function<void(Attr const&)>)
...
This is useful when you are wanting to interate over attributes and need
more information than just the name and value.
2023-11-11 08:50:25 +01:00
Shannon Booth
a8fd4fab00
LibWeb: Port HTMLParser::serialize_html_fragment from DeprecatedString
2023-11-11 08:50:25 +01:00
iliadsh
89da731aa6
LibJS+LibWeb: Devirtualize may_interfere_with_indexed_property_access()
2023-11-10 08:22:44 +01:00
Matthew Olsson
13ae2a4dab
LibWeb: Store all timelines associated with a document on the document
...
This will be required for propagating the current animation time to all
relevant timelines, which each propagate that time to all of their
relevant animations.
2023-11-07 15:17:09 +01:00
Matthew Olsson
2fbb9649e3
LibWeb: Add a default DocumentTimeline object to DOM::Document
2023-11-07 15:17:09 +01:00
Shannon Booth
ea2b733862
LibWeb: Port custom properties to FlyString
2023-11-07 11:33:41 +01:00
Shannon Booth
346825bd78
LibWeb: Remove unused DeprecatedFlyString include from HTMLCollection
2023-11-07 11:33:41 +01:00
Shannon Booth
7e9a40dbad
LibWeb: Port attribute change steps from DeprecatedFlyString
2023-11-07 11:33:41 +01:00
Shannon Booth
b337b4370a
LibWeb: Port validate_and_extract from DeprecatedFlyString
2023-11-07 11:33:41 +01:00
Shannon Booth
2f009d983b
LibWeb: Port Element::get_attribute_value from DeprecatedFlyString
2023-11-07 11:33:41 +01:00
Shannon Booth
673e3ec57d
LibWeb: Port Element::set_attribute_value from DeprecatedString
...
Removing the DeprecatedString / DeprecatedFlyString overloads of this
function.
2023-11-06 11:37:08 +01:00
Shannon Booth
96463e947a
LibWeb: Remove some now unused deprecated functions from QualifiedName
...
And related callers in Element.
2023-11-06 11:37:08 +01:00
Shannon Booth
326b34c7c7
LibWeb: Port all callers of Element::namespace to Element::namespace_uri
...
Removing some more use of DeprecatedFlyString
2023-11-06 11:37:08 +01:00
Shannon Booth
22f6abe5d6
LibWeb: Remove DeprecatedString impls of get_elements_by_tag_name{_ns}
...
No IDL file pulls in these requiring DeprecatedString support, so we
are now able to remove these functions! :^)
Also leave a FIXME while we are at it, as ideally this function would
take an Optional<FlyString> - but the IDL generator does not currently
support this.
2023-11-06 11:37:08 +01:00
Shannon Booth
d00c030fce
LibWeb: Port Element::set_attribute_value namespace to FlyString
2023-11-06 11:37:08 +01:00
Shannon Booth
1812221a2d
LibWeb: Add FlyString versions of NamedNodeMap::get_attribute_ns
...
This is the API for NamedNodeMap which we are wanting to eventually use
instead of taking a StringView. Currently we just end up deferring to
the StringView versions of these functions, but at some stage in the
future, this will allow us to have O(1) comparison when making attribute
lookups.
In the meantime, the advantage of this API is that it makes it much less
awkward to use than the StringView variant when you have an
Optional<FlyString> namespace to pass through.
2023-11-06 11:37:08 +01:00
Shannon Booth
19ca6f68ba
LibWeb: Expose NamedNodeMap::append_attribute in Element
2023-11-05 11:16:16 +00:00
Andreas Kling
3ff81dcb65
LibWeb: Make Web::Namespace::Foo strings be FlyString
...
This required dealing with a *lot* of fallout, but it's all basically
just switching from DeprecatedFlyString to either FlyString or
Optional<FlyString> in a hundred places to accommodate the change.
2023-11-04 21:28:30 +01:00
Andreas Kling
6b20a109c6
LibWeb: Pass DOM namespace strings as FlyString in more places
2023-11-04 21:28:30 +01:00
Andreas Kling
f052823f5f
LibWeb: Use FlyString for create_element() namespace strings
2023-11-04 21:28:30 +01:00
Andreas Kling
8f82bd044b
LibWeb: Use FlyString for create_element() prefix strings
2023-11-04 21:28:30 +01:00
Timothy Flynn
cdbde1765a
LibWeb: Skip assigning slottables for non-shadow roots
...
For example, on https://html.spec.whatwg.org , there are hundreds of
thousands of nodes. This method is invoked as each node is inserted.
Traversing the entire tree each time takes a prohibitively long time,
so let's bail early when we know the operation is a no-op.
2023-11-03 20:50:34 +01:00
Timothy Flynn
f3e14d7f64
LibWeb: Use correct variable when handling slottables in node insertion
...
Errantly copied the variable name from the spec. The `node` variable in
this scope is what we passed to Node::insert_before; `node_to_insert` is
what the spec is actually referring to as `node` here.
2023-11-03 20:50:34 +01:00
Andreas Kling
f9cab320e6
LibWeb: Only propagate CSS overflow to the viewport once per tree build
...
Before this change, we were doing it after every layout, which meant
that already-propagated overflow could be propagated again, which led to
incorrect scrolling behavior.
2023-11-02 20:50:48 +01:00
Andreas Kling
f5771a5789
LibWeb: Check node type first in fast_is<ShadowRoot>()
...
We know that shadow roots are always document fragments, so we can
check that before calling is_shadow_root() to avoid the cost of
a virtual call.
2023-11-02 17:09:34 +01:00