Commit graph

59 commits

Author SHA1 Message Date
Gingeh
7b8af4d84c LibWeb: Remove a popover AD-HOC comment after spec update
See https://github.com/whatwg/html/pull/11197
2025-04-23 10:13:29 +01:00
Andreas Kling
a6dfc74e93 LibWeb: Only set prototype once for object with IDL interface
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.
2025-04-20 18:43:11 +02:00
Shannon Booth
3e17b1c9ae LibWeb: Make Node::parent_element return GC::Ptr
This is useful for people like myself who run with debug mode to
more reliably get stacktraces without spinning up a debugger.
2025-04-18 10:49:02 +02:00
Viktor Szépe
5cc371d54c LibWeb: Fix typos - act II 2025-04-09 15:05:20 +01:00
Andreas Kling
53da8893ac LibJS: Replace PropertyKey(char[]) with PropertyKey(FlyString)
...and deal with the fallout.
2025-03-24 22:27:17 +00:00
Andreas Kling
c333042e63 LibWeb: Add opt-in tracing of update_layout() calls with reason 2025-03-08 03:37:38 +01:00
InvalidUsernameException
f7276bfab3 LibWeb: Reduced number of recompiled files for CSS property headers
Some checks are pending
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
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
2025-02-23 10:14:39 -05:00
Tim Ledbetter
a9ffc6359a LibWeb: Set inertness of HTMLElement when inert attribute is changed 2025-02-21 12:41:57 +00:00
Gingeh
91e4fb248b LibWeb: Hide unrelated popovers when showing popovers
Also hides decendant popovers when hiding.
Also hides unrelated popovers when showing dialogs.
2025-02-16 19:40:07 +00:00
Psychpsyo
f839f1b44b LibWeb: Make a elements honor base element's target 2025-02-16 09:21:52 +01:00
Aliaksandr Kalenik
da579e11b0 LibWeb: Start implementing render-blocking mechanism from HTML spec
This change implements enough spec steps to block rendering until
execution of sync scripts inserted from HTML parser is complete.
2025-02-05 18:28:46 +01:00
Sam Atkins
1bd73184da LibWeb/HTML: Update get_an_elements_noopener() to current spec
Note that this preemptively includes this fix to step 3:
https://github.com/whatwg/html/pull/10962
2025-01-31 17:27:03 +00:00
Sam Atkins
9254994687 LibWeb/HTML: Update get_an_elements_target() to current spec 2025-01-31 17:27:03 +00:00
Luke Warlow
dd37d1c536 LibWeb: Implement dialog.requestClose() 2025-01-30 15:50:06 -07:00
Gingeh
b056e27afd LibWeb: Hide visible popover when type is changed 2025-01-30 15:46:52 -07:00
Gingeh
e670caeb0c LibWeb: Ignore DOM state when hiding removed popovers
Using https://github.com/whatwg/html/pull/9457
(with some changes made to catch up with the current spec)
to fix a spec bug and a crash when removing a visible popover.
2025-01-30 15:46:52 -07:00
Luke Warlow
391a08bf17 LibWeb: Update spec comments for dialog, popover and close watcher 2025-01-25 03:40:08 +00:00
Luke Warlow
f5860a3b7d LibWeb: Implement hidden="until-found" IDL support
Follow-ups will implement the actual behaviour.
2025-01-24 09:08:37 +01:00
Andreas Kling
7269fc3e52 LibWeb: Pass old parent's root to Node::removed_from()
This will allow nodes to access the root they've just been removed from.
2025-01-23 21:38:31 +01:00
Jelle Raaijmakers
336684bc5c LibWeb: Support inserting non-inline elements into inline elements
Our layout tree requires that all containers either have inline or
non-inline children. In order to support the layout of non-inline
elements inside inline elements, we need to do a bit of tree
restructuring. It effectively simulates temporarily closing all inline
nodes, appending the block element, and resumes appending to the last
open inline node.

The acid1.txt expectation needed to be updated to reflect the fact that
we now hoist its <p> elements out of the inline <form> they were in.
Visually, the before and after situations for acid1.html are identical.
2025-01-23 09:33:10 +01:00
Timothy Flynn
85b424464a AK+Everywhere: Rename verify_cast to as
Follow-up to fc20e61e72.
2025-01-21 11:34:06 -05:00
Tim Ledbetter
a467005855 LibWeb: Make node cloning methods const 2025-01-11 23:10:09 +01:00
sideshowbarker
56c7857053 LibWeb: Return true for is_focusable() elements with non-null tabindex
This change implements the requirements stated in the HTML spec at
https://html.spec.whatwg.org/multipage/interaction.html#tabindex-value
that UAs must allow HTML elements with non-null tabindex values to be
considered as focusable areas.
2025-01-09 14:08:23 +00:00
Shannon Booth
44bb2b7e32 LibWeb/HTML: Use paintable box for 'associated CSS layout box' check
This is consistent with other functions such as
HTMLElement::offset_width and fixes a crash for the included test.
Returning an offset of zero is not correct for this case, but this is
still an improvement to not crash.
2025-01-02 11:28:37 +01:00
Shannon Booth
372f2dd7a1 LibWeb/HTML: Remove uneeded handling for non-box paintable HTMLElements
All inline nodes are now PaintableBoxes, so we do not need to handle the
non box case any more :^)
2025-01-02 11:28:37 +01:00
sideshowbarker
5ba847b1c4 LibWeb: Minor code cleanup: Replace some first_is_one_of with is_one_of 2024-12-27 17:16:34 -08: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
Sam Atkins
4c5a40579a LibWeb: Match spec changes to "create an element" algorithm
Corresponds to https://github.com/whatwg/html/pull/10857

No code changes, only comments.
2024-12-18 19:22:44 +00:00
Luke Warlow
0a02eb639d LibWeb: Implement popover's close watcher
Auto popovers now correctly establish a close watcher when shown.

This means popovers now correctly close with an escape key press.

Also correctly hide open popovers when removed from the document.
2024-12-17 04:55:55 +01:00
sideshowbarker
1b165d887b LibWeb: Support the ARIA “sectionheader” & “sectionfooter” roles 2024-12-16 06:56:31 -08:00
Andrew Kaster
7ee3727074 LibWeb: Fix compile error for popover element internal lambdas
These were converted to lambdas in
6b921e91d4
But I merged fcf6cc27f2 without checking
that the code had responded to the change.
2024-12-12 15:56:55 -07:00
Luke Warlow
fcf6cc27f2 LibWeb: Implement popover beforetoggle and toggle events 2024-12-12 15:10:33 -07:00
sideshowbarker
50e7e9f58d LibWeb: Assign “dir”, “dd”, “dt” default ARIA roles per-spec
Also, import http://wpt.live/html-aam/dir-role.tentative.html (which
provides test/regression coverage for the “dir” change).
2024-12-12 05:13:45 -08:00
sideshowbarker
6e24f23aa0 LibWeb: Add support for the “mark” ARIA role 2024-12-12 05:13:45 -08:00
Jelle Raaijmakers
1c55153d43 LibWeb: Refactor "editable" and "editing host" concepts
The DOM spec defines what it means for an element to be an "editing
host", and the Editing spec does the same for the "editable" concept.
Replace our `Node::is_editable()` implementation with these
spec-compliant algorithms.

An editing host is an element that has the properties to make its
contents effectively editable. Editable elements are descendants of an
editing host. Concepts like the inheritable contenteditable attribute
are propagated through the editable algorithm.
2024-12-10 14:54:19 +01:00
Andrew Kaster
31d21570bf LibWeb: Don't store local functions in GC Function
If a function isn't going to be escaped from the current context,
there's no need to wrap the lambda in a GC allocation.
2024-12-10 07:13:00 +01:00
sideshowbarker
68894306e2 LibWeb: Compute default ARIA roles context-sensitively where required
This change implements spec-conformant computation of default ARIA roles
for elements whose expected default role depends on the element’s
context — specifically, either on the element’s ancestry, or on whether
the element has an accessible name, or both. This affects the “aside”,
“footer”, “header”, and “section” elements.

Otherwise, without this change, “aside”, “footer”, “header”, and
“section” elements may unexpectedly end up with the wrong default roles.
2024-12-06 18:31:45 +00:00
Luke Warlow
eb1c60f37b LibWeb: Implement popover methods
Implements basics of showPopover, hidePopover and togglePopover.
2024-12-06 12:39:14 +00:00
Jelle Raaijmakers
217567981a LibWeb: Implement "plaintext-only" state for contenteditable 2024-12-03 00:18:03 +01:00
Psychpsyo
f09ed59351 LibWeb: Add the search element 2024-11-19 23:30:43 +00: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
Timothy Flynn
d4f8b598cb LibWeb: Consolidate the attribute change handlers
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.
2024-11-14 15:39:02 +01:00
Shannon Booth
9b79a686eb LibJS+LibWeb: Use realm.create<T> instead of heap.allocate<T>
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.
2024-11-13 16:51:44 -05:00
Michael Watt
3b1d1d4582 LibWeb: Compute display: contents as none for unusual elements
https://drafts.csswg.org/css-display-3/#unbox-html specifies certain
elements that have their `display` style computed as `none` when
specified as `contents`.

This fixes at least one WPT test:
http://wpt.live/css/css-display/display-contents-suppression-dynamic-001.html
2024-11-13 11:11:07 +01:00
Shannon Booth
653c8f231d LibWeb: Implement HTMLElement.innerText setter 2024-11-10 21:31:30 +01:00
Shannon Booth
a1a740bb3e LibWeb: Make rendered_text_fragment return a DocumentFragment
This closer matches the spec and is needed in the implementation of the
innerText setter.
2024-11-10 21:31: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
07dd73c351 LibWeb: Remove hand-rolled is_foo() helpers in Layout::Node classes 2021-01-01 18:56:49 +01:00
Andreas Kling
3c9dcec442 LibWeb: Merge Document::layout() and Document::update_layout()
There is now only Document::update_layout().
2020-12-14 10:39:57 +01:00