Timothy Flynn
8600925713
LibWeb: Port HTMLElement innerText/outerText to UTF-16
2025-07-28 18:30:50 +02:00
Timothy Flynn
5c561c1a53
LibWeb: Port node text content to UTF-16
2025-07-28 18:30:50 +02:00
Timothy Flynn
27a4c1eaf6
LibWeb: Remove errant comment from HTMLElement::rendered_text_fragment
...
This became untrue in a1a740bb3e
.
2025-07-28 18:30:50 +02:00
Timothy Flynn
97548f48de
LibWeb: Port rendered text to UTF-16
...
This migrates TextNode::text_for_rendering() to Utf16String and deals
with the fallout. As a consequence, this effectively reverts commit
3df83dade8
.
The layout test expecation file updates are because we now express text
lengths and offsets in UTF-16 code units.
The selection-over-multiple-code-units expectation file update actually
represents a correctness fix. Our result now matches Firefox.
2025-07-25 18:16:22 +02:00
Timothy Flynn
8b6e3cb735
LibWeb+LibUnicode+WebContent: Port DOM:CharacterData to UTF-16
...
This replaces the underlying storage of CharacterData with Utf16String
and deals with the fallout.
2025-07-24 19:00:20 +02:00
Sam Atkins
e74afec9c5
LibWeb: Capitalize "No Popover state" consistently
...
Corresponds partly to 8035a256bf
2025-07-08 17:08:39 +01:00
Andreas Kling
b3d9e39bad
LibWeb: Avoid infinite loop in HTMLElement.scrollParent
...
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
Push notes / build (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / 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
Build Dev Container Image / build (push) Has been cancelled
We were failing to actually climb up the containing block chain,
causing this API to infinite loop for anything but the most
trivial cases.
By fixing the loop structure, we also make a bunch of the already
imported WPT tests pass. :^)
2025-06-30 20:38:21 +01:00
Sam Atkins
423cdd447d
LibWeb+LibGfx: Apply editorial punctuation/whitespace/markup fixes
...
Corresponds to d426109ea1
and fd08f81d06
2025-06-25 03:12:19 +12:00
Andreas Kling
63d862219e
LibWeb: Avoid expensive Vector::insert() in innerText & outerText
...
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / 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
Build Dev Container Image / build (push) Has been cancelled
When expanding "required line breaks", we now write directly into the
final StringBuilder instead of doing a pass of Vector remove/insert
operations first.
This removes a hot profile item on https://serpapi.com/
2025-06-19 17:31:22 +02:00
Gingeh
5e1e0d4e18
LibWeb: Remove some popover AD-HOC comments
...
Spec PR: https://github.com/whatwg/html/pull/11253
2025-06-18 08:51:22 +02:00
Sam Atkins
af9a227ca3
LibWeb/HTML: Implement HTMLElement.scrollParent
...
Corresponds to d3effb701c
What a "fixed position container" is isn't clear to me, and we don't
seem to use that elsewhere, so I've left the steps using that as FIXMEs
for now.
There's no test coverage for this in WPT yet and I'm not confident
enough in the specific behaviour to write one myself. So, waiting on
https://github.com/web-platform-tests/wpt/issues/53214
2025-06-17 12:38:27 +01:00
Sam Atkins
5d5f16845c
LibWeb/HTML: Bring HTMLElement::offset_parent() up to date
2025-06-17 12:38:27 +01:00
Gingeh
fc35229dab
LibWeb: Implement the ToggleEvent.source attribute
...
See: https://github.com/whatwg/html/pull/11186
2025-06-07 04:06:01 +01:00
Shannon Booth
937994cfaa
LibWeb: Make Environment's top level origin nullable
...
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, false, ubuntu-24.04, Linux, GNU) (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 (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, 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 matches the definition in the spec, and is also a step towards
removing the default constructor of URL::Origin.
2025-05-27 14:48:43 +12:00
Callum Law
279913a223
LibWeb: Implement the translate attribute
2025-05-23 14:34:06 +02:00
Gingeh
fbc56f74bd
LibWeb: Move popover invoker reset later
...
See https://github.com/whatwg/html/pull/11304
2025-05-22 07:55:34 +01:00
Noah
85842c1739
LibWeb: Stub out several methods for ElementInternals
...
This begins implementation on form-associated custom elements.
This fixes a few WPT tests which I'm importing.
Co-authored-by: Sam Atkins <sam@ladybird.org>
2025-05-21 15:28:10 +01:00
Shannon Booth
579730d861
LibWeb: Prefer using equals_ignoring_ascii_case
...
Which has an optmization if both size of the string being passed
through are FlyStrings, which actually ends up being the case
in some places during selector matching comparing attribute names.
Instead of maintaining more overloads of
Infra::is_ascii_case_insensitive_match, switch
everything over to equals_ignoring_ascii_case instead.
2025-05-21 13:45:02 +01:00
Gingeh
1f1884da54
LibWeb: Light dismiss popovers on click
2025-04-28 19:41:38 -06:00
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
...
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