ladybird/Meta
Aliaksandr Kalenik a8077f79cc LibWeb: Separate text control input events handling from contenteditable
This input event handling change is intended to address the following
design issues:
- Having `DOM::Position` is unnecessary complexity when `Selection`
  exists because caret position could be described by the selection
  object with a collapsed state. Before this change, we had to
  synchronize those whenever one of them was modified, and there were
  already bugs caused by that, i.e., caret position was not changed when
  selection offset was modified from the JS side.
- Selection API exposes selection offset within `<textarea>` and
  `<input>`, which is not supposed to happen. These objects should
  manage their selection state by themselves and have selection offset
  even when they are not displayed.
- `EventHandler` looks only at `DOM::Text` owned by `DOM::Position`
  while doing text manipulations. It works fine for `<input>` and
  `<textarea>`, but `contenteditable` needs to consider all text
  descendant text nodes; i.e., if the cursor is moved outside of
  `DOM::Text`, we need to look for an adjacent text node to move the
  cursor there.

With this change, `EventHandler` no longer does direct manipulations on
caret position or text content, but instead delegates them to the active
`InputEventsTarget`, which could be either
`FormAssociatedTextControlElement` (for `<input>` and `<textarea>`) or
`EditingHostManager` (for `contenteditable`). The `Selection` object is
used to manage both selection and caret position for `contenteditable`,
and text control elements manage their own selection state that is not
exposed by Selection API.

This change improves text editing on Discord, as now we don't have to
refocus the `contenteditable` element after character input. The problem
was that selection manipulations from the JS side were not propagated
to `DOM::Position`.

I expect this change to make future correctness improvements for
`contenteditable` (and `designMode`) easier, as now it's decoupled from
`<input>` and `<textarea>` and separated from `EventHandler`, which is
quite a busy file.
2024-10-30 19:29:56 +01:00
..
CMake Meta: Use release builds as the basis for Sanitizer builds 2024-10-26 22:58:40 +02:00
gn LibWeb: Separate text control input events handling from contenteditable 2024-10-30 19:29:56 +01:00
Lagom IPCCompiler: Transfer DevicePixelRect by value 2024-10-29 11:03:20 +00:00
check-debug-flags.sh Meta: Make check-debug-flags.sh runnable in Bash 3.2 2024-07-16 09:13:14 -06:00
check-idl-files.py Meta: Add script for checking WebIDL files 2024-09-10 21:16:53 +01:00
check-markdown.sh Everywhere: Replace SERENITY_SOURCE_DIR with LADYBIRD_SOURCE_DIR 2024-06-03 15:57:59 +02:00
check-newlines-at-eof.py Meta: Ignore LibWeb text tests for newline-at-eof check 2024-10-27 13:33:46 +01:00
check-png-sizes.sh Meta: Add a PNG size check to CI and pre-commit checks 2022-06-18 21:58:43 +04:30
check-style.py Everywhere: Remove a lot more things we don't need 2024-06-03 10:53:53 +02:00
configure-clangd.sh Meta: Script to configure clangd according to build type 2024-08-05 23:44:03 -06:00
debug.plist CMake: Add a command for codesigning with the get-task-allow entitlement 2024-07-02 16:57:51 -06:00
embed_as_string.py Meta: Make embed_as_string_view.py produce Strings instead 2024-09-03 10:12:07 +01:00
find_compiler.sh Meta: Fix detection of default compiler versions 2024-05-23 00:56:37 -06:00
generate-libwasm-spec-test.py LibWasm: Ignore tests that check that we don't support 2+ memories 2024-07-14 11:26:52 +02:00
generate-libwasm-spec-test.sh Meta: Run the Wasm spec tests in CI 2021-05-27 17:28:41 +04:30
generate_clang_module_map.py Meta+Libraries+AK: Append Cxx to imported library module names in swift 2024-08-27 17:22:31 -06:00
import-wpt-test.py Meta: Add a script to import WPT tests 2024-10-30 17:29:03 +01:00
ladybird.sh Meta: Clean up generated CMake uservars 2024-10-12 15:37:26 -06:00
lint-ci.sh Meta: Add swift-format linter script 2024-10-01 13:33:05 -06:00
lint-clang-format.sh Meta: Warn before attempting to use clang-format 19 2024-10-14 15:54:53 -06:00
lint-commit.sh CI: Add a check to report git merge commit 2022-12-10 12:07:06 +00:00
lint-executable-resources.sh Tests: Prevent executable images or html files during lint 2024-10-25 09:00:52 +02:00
lint-gn.sh Meta: Make all pre-commit CI scripts work with Bash 3.2 2024-07-16 08:56:22 -06:00
lint-prettier.sh Meta: Make all pre-commit CI scripts work with Bash 3.2 2024-07-16 08:56:22 -06:00
lint-python.sh Meta: Make all pre-commit CI scripts work with Bash 3.2 2024-07-16 08:56:22 -06:00
lint-shell-scripts.sh Meta: Make all pre-commit CI scripts work with Bash 3.2 2024-07-16 08:56:22 -06:00
lint-swift.sh Meta: Add swift-format linter script 2024-10-01 13:33:05 -06:00
refresh-ladybird-qtcreator.sh Documentation: Update instruction for building with QtCreator 2024-06-03 13:19:00 -06:00
shell_include.sh Meta: Add cross-platform function for absolutizing paths 2024-10-29 07:30:32 -04:00
WPT.sh Meta: Set LADYBIRD_GIT_VERSION environment variable in WPT.sh 2024-10-29 13:30:12 +00:00