Commit Graph

1356 Commits

Author SHA1 Message Date
Andreas Kling
ff63b2603d LibWeb: Use cached Element id attribute in HTMLCollection 2023-12-24 22:49:19 +01:00
Andreas Kling
41f56b0df9 LibWeb: Let supported_property_names() return Vector<FlyString>
Ultimately, this API should probably be replaced with something that
updates a cache on relevant DOM mutations instead of regenerating
the list of property names again and again.
2023-12-24 22:49:19 +01:00
Andreas Kling
75d5429d66 LibWeb: Add fast_is<T> for form, embed, image, and object elements
These are used by Window::supported_property_names(), which can get
very hot.
2023-12-24 22:49:19 +01:00
Shannon Booth
020839ad7a LibWeb: Remove ByteString usage in NamedNodeMap
We now have a FlyString version of get_attribute_ns, so this conversion
is no longer needed any more.
2023-12-24 13:26:50 +01:00
Shannon Booth
562e0d710c LibWeb: Port ProcessingInstruction from ByteString 2023-12-24 13:26:50 +01:00
Andreas Kling
fe04d83ef5 LibWeb: Process all pending lazy loading intersection observations
This fixes an issue where images outside the viewport could prevent
loading of images inside the viewport, depending on DOM order.
2023-12-24 13:23:40 +01:00
Shannon Booth
ec2b4c271f LibWeb: Support RadioNodeList named items in HTMLFormControlsCollection
We would previously not return a RadioNodeList in the curious case where
a named item resolves to two different elements within the form.

This was not a problem when calling namedItem directly in the IDL as
named_item_or_radio_node_list shadows named_item but is exposed when
calling the property through array bracket notation (as an example).

Fix this, and add a bunch more tests to cover
HTMLFormControlsCollection.
2023-12-23 20:53:11 +01:00
Shannon Booth
1defc4595b LibWeb: Make LiveNodeList store a NonnullGCPtr<Node const> root
This allows us to improve the const-correctness in RadioNodeList, which
has been made possible as of: 5f0ccfb499 now that a GC-visit accepts a
const GC pointer.
2023-12-23 20:53:11 +01:00
Shannon Booth
d8759d9656 LibWeb: Use UTF-16 code unit offsets and lengths in CharacterData
We were previously assuming that the input offsets and lengths were all
in raw byte offsets into a UTF-8 string. While internally our String
representation may be in UTF-8 from the external world it is seen as
UTF-16, with code unit offsets passed through, and used as the returned
length.

Beforehand, the included test included in this commit would crash
ladybird (and otherwise return wrong values).

The implementation here is very inefficient, I am sure there is a
much smarter way to write it so that we would not need a conversion
from UTF-8 to a UTF-16 string (and then back again).

Fixes: #20971
2023-12-23 20:41:41 +01:00
Bastiaan van der Plaat
c30911ab10 LibWeb: Hide select chevron icon when appearance: none; 2023-12-23 10:12:36 +01:00
Aliaksandr Kalenik
cfcec5e18e LibWeb: Scroll to the top after navigating to a new document
This change fixes a bug with running tests where, if one of the
previous tests changes the scroll position, all subsequent tests that
rely on the scroll position will fail. This is because the headless
browser never resets the viewport offset.
2023-12-20 09:48:06 -07:00
Aliaksandr Kalenik
41b065dec9 LibWeb: Do not crash for empty fragment in determine_the_indicated_part
The way this method is used in spec implies it should return
`TopOfTheDocument` if fragment is missing.
2023-12-20 09:48:06 -07:00
MacDue
809c5b0b03 LibWeb: Add initial support for SVG <textPath>
This patch adds basic support for the SVG `<textPath>`, so it supports
placing text along a path, but none of the extra attributes for
controlling the layout of the text. This is enough to correctly display
the MDN example.
2023-12-19 21:29:03 +01:00
Aliaksandr Kalenik
c5d91dce8b LibWeb: Scroll to the "start" in Document::scroll_to_fragment()
Implements spec comment.
2023-12-19 20:59:52 +01:00
Aliaksandr Kalenik
f6f80a1a72 LibWeb: Scroll to "nearest" instead of "start" in set_focused_element()
Fixes a bug when after clicking on a button/click the page is scrolled
to start of the element.
2023-12-19 10:45:07 +01:00
Aliaksandr Kalenik
cda1d886df LibWeb: Fix not working Element::scroll_an_element_into_view()
Fixes following mistakes:
- "scrolling box" for a document is not `scrollable_overflow_rect()`
   but size of viewport (initial containing block, like spec says).
- comparing edges of "scrolling box" with edges of target element
  does not make any sense because "scrolling box" edges are relative
  to page while result of `get_bounding_client_rect()` is relative
  to viewport.
2023-12-19 10:45:07 +01:00
Ali Mohammad Pur
5e1499d104 Everywhere: Rename {Deprecated => Byte}String
This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).

This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
2023-12-17 18:25:10 +03:30
Aliaksandr Kalenik
7d757fefeb LibWeb: Remove FIXME if paintable is missing in getBoundingClientRect()
We should not print FIXME when paintable is missing (display: none)
because that means actually we can't to get a rect.
2023-12-16 16:11:15 +01:00
Aliaksandr Kalenik
8f8ec37d58 LibWeb: Add missing paintable null check in get_bounding_client_rect()
Fixes crashing on https://github.com/
2023-12-16 16:11:15 +01:00
Andreas Kling
7c95ebc302 LibWeb: Make Document::page() return a Page&
Now that Document always has a Page, and always keeps it alive, we can
make this return a Page&, exposing various unnecessary null checks.
2023-12-15 22:04:46 +01:00
Andreas Kling
70193c0009 LibWeb: Let Document have a direct GCPtr to its containing Web::Page
With this change, Document now always has a Web::Page. This means we no
longer rely on the breakable link between Document and BrowsingContext
to find a relevant Web::Page.

Fixes #22290
2023-12-15 22:04:46 +01:00
Andreas Kling
8730e56f62 LibWeb: Fix uninitialized value in find_a_potential_indicated_element() 2023-12-15 16:02:52 +01:00
Aliaksandr Kalenik
e464d484c4 LibWeb: Implement getBoundingClientRect() for inline paintables
This fixes the issue that occurred when, after clicking an inline
paintable page would always scroll to the top. The problem was that
`scroll_an_element_into_view()` relies on `get_bounding_client_rect()`
to produce the correct scroll position and for inline paintables we
were always returning zero rect before this change.
2023-12-14 16:25:27 +01:00
Aliaksandr Kalenik
41a3c19cfe LibWeb: Make HTML::DecodedImageData to be GC-allocated
This change fixes GC-leak caused by following mutual dependency:
- SVGDecodedImageData owns JS::Handle for Page.
- SVGDecodedImageData is owned by visited objects.
by making everything inherited from HTML::DecodedImageData and
ListOfAvailableImages to be GC-allocated.

Generally, if visited object has a handle, very likely we leak
everything visited from object in a handle.
2023-12-12 23:01:08 +01:00
Andreas Kling
5204020d42 LibWeb: Add missing DOM::Position::visit_edges()
Caught by running the test suite under ASAN.
2023-12-12 01:08:07 +01:00
Aliaksandr Kalenik
6ac43274b2 LibWeb+LibJS: Use JS::GCPtr for pointers to GC-allocated objects
Fixes warnings found by LibJSGCVerifier
2023-12-11 16:55:25 +01:00
Shannon Booth
ed97946975 LibWeb: Support obsolete but required -webkit- CSS parsing quirk
As outlined in: https://www.w3.org/TR/selectors-4/#compat

We now do not treat unknown webkit pseudo-elements as invalid at parse
time, and also support serializing these elements.

Fixes: #21959
2023-12-11 16:54:59 +01:00
Shannon Booth
83758d4cdd LibWeb: Wrap PseudoElements stored in SimpleSelector in a class
No functional impact intended. This is just a more complicated way of
writing what we have now.

The goal of this commit is so that we are able to store the 'name' of a
pseudo element for use in serializing 'unknown -webkit-
pseudo-elements', see:

https://www.w3.org/TR/selectors-4/#compat

This is quite awkward, as in pretty much all cases just the selector
type enum is enough, but we will need to cache the name for serializing
these unknown selectors. I can't figure out any reason why we would need
this name anywhere else in the engine, so pretty much everywhere is
still just passing around this raw enum. But this change will allow us
to easily store the name inside of this new struct for when it is needed
for serialization, once those webkit unknown elements are supported by
our engine.
2023-12-11 16:54:59 +01:00
Aliaksandr Kalenik
2cb0039a13 LibGfx+LibWeb: Produce font cascade list in CSS font matching algorithm
According to the CSS font matching algorithm specification, it is
supposed to be executed for each glyph instead of each text run, as is
currently done. This change partially implements this by having the
font matching algorithm produce a list of fonts against which each
glyph will be tested to find its suitable font.

Now, it becomes possible to have per-glyph fallback fonts: if the
needed glyph is not present in a font, we can check the subsequent
fonts in the list.
2023-12-10 17:32:04 +01:00
Bastiaan van der Plaat
f621dc464b LibWeb: Add internal use_pseudo_element to DOM Element 2023-12-10 16:44:12 +01:00
Andreas Kling
20da5b6153 LibWeb: Remove an unnecessary (and unsafe) cast from Node to Element
Fixes #22170
2023-12-05 09:41:22 +01:00
Shannon Booth
0cb0d60ac5 LibWeb: Make BrowsingContextGroup & TraversableNavigable return a Page&
Removing another batch of uneeded null checks :^)
2023-12-05 09:38:32 +01:00
Shannon Booth
88f8ea7c60 LibWeb: Make BrowsingContex::page() return a Page&
This exposed a whole slew of now-unnecessary null checks. :^)

Co-Authored-By: Andreas Kling <kling@serenityos.org>
2023-12-05 09:38:32 +01:00
Timothy Flynn
18a4455d43 LibWeb: Do not assume a shadow root has a host
After commit ff48b7333c, we remove shadow
roots from elements that are removed from the DOM. Setting a node's
shadow root to null also sets that shadow root's host to null. Thus, the
comment in Node::is_shadow_including_descendant_of that assumes the host
is always non-null is not true.

The test added here would previously crash when interacting with a node
that is a descendant of a removed shadow root.
2023-12-04 01:33:57 +01:00
Andreas Kling
dbca63a1db LibWeb: Don't get stuck in TreeWalker.nextNode() when current detached
This fixes a hang on https://reddit.com/

Spec bug: https://github.com/whatwg/dom/issues/1102
2023-12-03 23:16:26 +01:00
Shannon Booth
f976ec005c LibWeb: Port DOM::Document from DeprecatedString 2023-12-02 22:54:53 +01:00
Shannon Booth
a8f5ebeddd LibWeb: Port DOM::Node from DeprecatedString 2023-12-02 22:54:53 +01:00
Shannon Booth
a7b8828db2 LibWeb: Port call_user_object_operation from DeprecatedString 2023-12-02 22:54:53 +01:00
Sam Atkins
4ced88b4e5 LibWeb: Make create_a_css_style_sheet() take String arguments 2023-12-01 20:48:13 +01:00
Sam Atkins
ef1e942f3e LibWeb: Use String for getting/setting MediaQueryList media 2023-12-01 20:48:13 +01:00
Sam Atkins
2805e16c1c LibWeb: Let NavigableContainers delay the document load event 2023-12-01 10:28:02 +01:00
Sam Atkins
6c5450f9ce LibWeb: Report if anything is delaying load event, not the count
Some elements that delay the load event are more complicated than a
simple count will allow for. We'll implement those in a bit!
2023-12-01 10:28:02 +01:00
Sam Atkins
cc633123ca LibWeb: Extract shared lazy-loading behavior into a base class
`<iframe>` and `<img>` tags share the same spec for several aspects of
lazy-loading: how the `loading` attribute works, the "will lazy load
element" steps, and a member for storing the lazy-load resumption
steps. So let's share the implementation by using a base class.

This mostly involves moving things around. However, we also change the
`start_intersection_observing_a_lazy_loading_element()` method to take
a LazyLoadingElement, and operate on one, instead of always casting to
HTMLImageElement.

We do unfortunately have to do some shenanigans to make the cast work,
by adding a virtual function stub in DOM::Element.
2023-12-01 10:28:02 +01:00
Timothy Flynn
3cde479416 LibWeb: Add missing visitations to DOM::Document 2023-11-30 08:49:15 +00:00
Shannon Booth
96af80acd1 LibWeb: Port Intrinsics from DeprecatedString 2023-11-28 17:15:27 -05:00
Shannon Booth
629f661e3b LibWeb: Port supported property names from DeprecatedString to String 2023-11-28 17:15:27 -05:00
Timothy Flynn
aa4dcda5dc LibWeb+LibWebView+Ladybird: Scale scroll-to CSS positions in PageHost
The `page_did_request_scroll_to` API takes a CSS position, and thus
callers should not scale to device pixels before invoking it. Instead,
align this API with (most) other PageHost APIs which scale to device
pixels before sending the corresponding IPC message.

In the AppKit chrome, convert the provided device pixel position to a
widget position.
2023-11-24 17:19:08 -05:00
Shannon Booth
decc071060 LibWeb: Return a scroll offset of 0 for colgroup elements
Ideally we would not create a layout node at all for these elements so
that every layout node would always have a paintable associated with it.
But for now, to fix the crash, just leave a FIXME and special case this
element.

Also leave a VERIFY to make it easier to debug this type of crash in the
future.

Fixes a crash seen on codecov.io for my 'patch' project.
2023-11-23 13:06:48 +01:00
Andreas Kling
ef809eea1e LibWeb: Don't assume IO.unobserve() called on observed element
It's perfectly possible for JavaScript to call unobserve() on an element
that hasn't been observed. Let's stop asserting if that happens. :^)

Fixes #22020
2023-11-23 09:37:12 +01:00
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
Andreas Kling
d0d7e5a782 LibWeb: Use Element::id() in getElementById()
This avoids the O(n) walk of element attributes, although there is still
a huge space for improvement here if we start keeping a lookup cache for
elements-by-ID.
2023-11-02 17:09:34 +01:00