ladybird/Tests/LibWeb/Text/input
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
..
base LibWeb: Convert some sync tests to be async 2024-10-03 07:07:28 -04:00
canvas LibWeb: Implement CanvasRenderingContext2D.createImageData(ImageData) 2024-10-14 09:33:49 +01:00
console LibJS: Set empty prototype for console object 2024-08-12 17:21:01 +01:00
Crypto LibWeb: Omit padding in WebCrypto AES-CBC exportKey 2024-10-28 21:15:59 +01:00
css LibWeb/CSS: Return 0 from CSSRule.type for non-spec types 2024-10-30 17:30:58 +01:00
CSSOMView LibWeb: Don't crash on getClientRects() in document without navigable 2024-08-05 14:56:04 +02:00
DOM LibXML: Set the doctype when parsing via Parser::parse_with_listener 2024-10-30 14:53:36 +01:00
Editing LibWeb: Separate text control input events handling from contenteditable 2024-10-30 19:29:56 +01:00
Encoding LibWeb: Add TextEncoder encodeInto 2023-10-29 21:44:53 +01:00
Fetch LibWeb: Convert some sync tests to be async 2024-10-03 07:07:28 -04:00
FileAPI LibWeb: Make FileReader fire progress event 2024-10-15 08:42:37 +02:00
geometry LibWeb/Geometry: Make DOMRect doubles unrestricted 2024-07-01 21:30:52 +01:00
hit_testing LibWeb: Replace InlinePaintable with PaintableWithLines created per line 2024-10-16 20:25:42 +02:00
HTML LibWeb: Pageshow event dispatched by the user agent should be trusted 2024-10-30 10:27:20 +01:00
IntersectionObserver LibWeb+WebContent: Do not include DOM HTML in text test expectations 2024-10-03 07:07:28 -04:00
Messaging LibWeb: Ignore MessagePort.start() on already-closed port 2024-03-12 16:30:39 +01:00
MutationObserver LibWeb: Fix null pointer dereference in DOM::Node::remove() 2023-11-20 20:50:53 +01:00
navigation LibWeb: Port some manually async tests to use asyncTest 2024-10-03 07:07:28 -04:00
PerformanceObserver LibWeb: Implement PerformanceObserver.supportedEntryTypes 2024-04-03 07:55:51 +02:00
regress Revert "LibGfx: Use actual vector size as indicated by HarfBuzz" 2024-10-21 12:09:11 +02:00
ResizeObserver LibWeb: Null layout and paintable pointers of removed DOM::Node 2024-02-20 10:55:10 +01:00
ServiceWorker LibWeb: Add most of ServiceWorker Update algorithm 2024-10-23 11:33:28 -06:00
ShadowDOM LibWeb/CSS: Evaluate media queries in shadow roots 2024-10-20 07:57:09 +01:00
Streams Tests: Mark test-files (images and html) as non-executable 2024-10-25 09:00:52 +02:00
SVG LibWeb: Don't crash when calling getBBox() on the outermost SVG element 2024-09-07 14:35:02 +02:00
UIEvents LibWeb: Implement KeyboardEvent.charCode according to spec 2024-10-22 12:48:58 +02:00
URL LibURL: Do not treat port of 0 as a null port in Origin 2024-10-05 10:46:30 +02:00
Wasm LibWeb: Add a basic test for [EnforceRange] 2024-03-30 21:21:23 +01:00
WebAnimations LibWeb: Make sure style is up-to-date in getAnimations() 2024-10-02 16:28:37 +01:00
WebAudio LibAudio: Manage channelCountMode in DynamicsCompressorNode 2024-10-29 13:31:52 +00:00
Worker LibWeb: Implement DedicatedWorkerGlobalScope postMessage(msg, transfer) 2024-10-28 22:56:39 +01:00
wpt-import Tests: Import a bunch of WPT tests from /css/css-flexbox 2024-10-30 10:17:21 +01:00
XHR LibWeb/XHR: Parse URL to resolve blob 2024-10-20 07:58:22 -04:00
XHTML LibWeb: Added tests for missing xmlns during XHMTL parsing 2024-10-13 00:24:25 +02:00
XML LibWeb: Generate a simple error page when XML decode/parse fails 2024-04-19 11:44:32 +02:00
abortsignal-abort.html LibWeb: Implement AbortSignal.abort() 2024-02-21 10:34:44 +01:00
abortsignal-any.html LibWeb: Implement AbortSignal.any() 2024-03-12 09:31:41 +01:00
abortsignal-timeout.html LibWeb: Mark abort event as trusted before dispatching it 2024-03-12 09:31:41 +01:00
all-window-properties.html Tests/LibWeb: Add test that dumps all global JS constructors 2024-06-28 17:10:52 +02:00
anchor-element-with-javascript-url-href.html LibWeb: Remove exit for javascript urls in anchor activation_behavior() 2023-11-25 16:33:54 +01:00
append-child-must-update-layout-tree.html
Attr-cloneNode.html
background-position-xy.html
basic.html
body-background-color-red.css
border-radius-div-containing-iframe-with-border-radius-svg.html LibWeb: Do not shrink the CPU painter's corner clipping vector 2024-03-10 00:39:49 +01:00
clipboard.html Revert "LibWeb: Allow bypassing transient activation checks for tests" 2024-02-25 12:35:49 -05:00
close-non-modal-dialog.html LibWeb: Implement HTMLDialogElement::close() for non-modal dialogs 2024-02-14 22:20:44 -05:00
collapse-selection-inside-shadow-root.html LibWeb: Update Selection.collapse algorithm 2024-09-03 17:42:13 +02:00
contenteditable-should-insert-into-nested-node.html LibWeb: Put cursor in last text node when contenteditable is focused 2024-10-22 08:44:51 -04:00
cookie.html LibWeb: Implement the document.cookie setter/getter according to spec 2024-10-23 09:05:33 +02:00
createBitmap.html LibWeb: Convert callers of ImageCodecPlugin to the async API 2024-04-23 12:32:04 -06:00
document-adopted-style-sheets.html LibWeb: Implement adoptedStyleSheets attribute for Document 2024-03-08 16:31:21 +01:00
document-scrollingElement-quirks-mode.html LibWeb: Implement document.scrollingElement 2024-02-15 22:51:15 -05:00
document-scrollingElement.html LibWeb: Implement document.scrollingElement 2024-02-15 22:51:15 -05:00
DOMTokenList-supports.html LibWeb: Flesh out DOMTokenList::supports() implementation 2024-05-16 20:31:23 +02:00
element-get-bounding-client-rect-css-transform.html LibWeb: Apply transform origin in Element::get_client_rects() 2024-03-07 00:28:29 +01:00
element-get-bounding-client-rect-of-sticky.html LibWeb: Don't re-invent println for sticky element test 2024-10-24 20:41:30 -04:00
element-get-bounding-client-rect-scroll-offset.html LibWeb: Account for scroll offset in Element::get_client_rects() 2024-03-17 13:32:04 +01:00
element-get-client-rects.html LibWeb: Follow the spec more precisely in Element::getClientRects() 2024-01-30 14:50:25 +01:00
Element-offsetParent-of-iframe.html LibWeb: Don't crash in offset_parent() if no ancestor element found 2024-02-29 21:54:53 -05:00
element-scroll-event.html LibWeb: Fire "scroll" events on DOM elements 2024-04-23 11:00:35 +02:00
element-scrollby-event.html LibWeb: Implement Element::scroll(HTML::ScrollToOptions) 2024-05-07 17:21:52 -06:00
Element-scrollby-negative-scroll-offset-crash.html LibWeb: Clamp paintable box maximum scroll offset to 0 2024-07-22 09:13:25 +02:00
Element-toggleAttribute-invalid-name.html LibWeb/DOM: Check if name is valid in Element.toggleAttribute 2024-07-25 06:46:28 +02:00
failed-img-should-not-delay-load-event-forever.html
favicon-in-inactive-document.html LibWeb: Skip HTMLLinkElement resource fetching for documents without BC 2024-04-25 09:31:01 +02:00
fieldset-elements.html LibWeb: Add fieldset elements property 2023-12-10 08:07:41 -05:00
focus-contenteditable.html LibWeb: Allow HTMLElement with contenteditable=true to be focusable 2024-02-24 00:19:55 +01:00
focus-events.html LibWeb: Implement the "fire a focus event" spec 2024-08-14 20:53:33 +01:00
form-formEnctype-attribute.html LibWeb: Fixed IDL for HTMLInputElement 2024-10-21 15:41:00 -06:00
form-formMethod-attribute.html LibWeb: Fixed IDL for HTMLInputElement 2024-10-21 15:41:00 -06:00
form-method-attribute.html LibWeb: Use correct IDL for HTTPFormElement's method attribute 2024-10-21 15:41:00 -06:00
form-method-dialog.html Tests/LibWeb: Verify dialog return value is correct in dialog test 2024-02-16 17:21:48 -05:00
form-requestSubmit.html LibWeb: Implement HTMLFormElement.requestSubmit() 2024-02-16 17:21:48 -05:00
get-bounding-client-rect-display-none.html LibWeb: Add null check for get_client_rects() on non paintable elements 2024-04-24 18:04:28 +02:00
get-bounding-client-rect.html LibWeb: Prevent calling test() twice 2023-12-22 16:49:06 +01:00
getComputedStyle-grid-template-rows-columns.html LibWeb: Return computed grid-template-rows/columns if there's no used 2024-09-09 20:12:20 +02:00
global-performance-property.html LibWeb: Handle scenario when Window property setter is called on global 2024-02-25 12:55:30 +01:00
html-form-controls-collection.html LibWeb: Support RadioNodeList named items in HTMLFormControlsCollection 2023-12-23 20:53:11 +01:00
html-parser-duplicate-attributes.html LibWeb: Deduplicate attributes when emitting start and end tags 2024-10-01 11:04:28 +02:00
html-parser-text-in-table-hoisting.html LibWeb+WebContent: Do not include DOM HTML in text test expectations 2024-10-03 07:07:28 -04:00
HTMLLinkElement-disabled.html LibWeb: Unset stylesheet properties when removing from a StyleSheetList 2024-04-16 07:41:33 +02:00
HTMLLinkElement-explicitly-enabled-alternative-stylesheets.html LibWeb: Support loading alternative style sheets 2024-04-17 07:12:44 +02:00
idl-handling-of-null-attribute.html LibWeb: Support [Reflect] on IDL String attributes that may return null 2023-09-05 20:36:09 -04:00
iframe-load-event-for-xml-src.html Tests/LibWeb: Add a test for iframe load event when src has xml type 2024-04-18 08:10:05 +00:00
iframe-removed-asyncronously.html LibWeb: Do not spin the event loop on processing iframe attributes 2024-10-07 15:10:41 +02:00
include.js LibWeb: Add a feature to LibWeb tests to fail on unhandled exceptions 2024-10-05 09:18:32 +02:00
input-blur.html LibWeb: Focus the document element when unfocusing an element 2023-12-04 01:33:57 +01:00
input-click-to-unfocus.html LibWeb: Run the unfocusing steps when a click does not focus anything 2023-12-04 01:33:57 +01:00
input-commit-on-unfocus.html LibWeb: Fire a change event on input elements in the focus update steps 2023-12-04 01:33:57 +01:00
input-commit.html LibWeb: Fire the change event synchronously when committing changes 2023-12-04 01:33:57 +01:00
input-date.html LibWeb: Add input element valueAsDate property 2024-01-06 09:59:30 -07:00
input-element-file-value.html
input-file-accept.html Ladybird+LibWeb+WebContent: Parse the <input type=file> accept attribute 2024-03-16 08:42:33 +01:00
input-file.html LibWeb: Set the MIME type when creating an <input> element's File list 2024-03-14 10:10:33 +01:00
input-image.html LibWeb: Change attribute type to USVString where applicable 2024-08-17 07:45:00 +02:00
input-maxlength.html LibWeb+WebContent: Do not include DOM HTML in text test expectations 2024-10-03 07:07:28 -04:00
input-number-float.html LibWeb: Implement HTML spec-compliant rules for floating-point parsing 2024-10-30 10:47:41 +01:00
input-number.html LibWeb: Add input stepUp and stepDown functions 2023-12-07 16:46:28 -05:00
input-readonly.html LibWeb+WebContent: Do not include DOM HTML in text test expectations 2024-10-03 07:07:28 -04:00
input-value.html LibWeb: Fully implement the HTMLInputElement value setter and getter 2024-02-18 18:44:45 +01:00
internals.html
interpolation-longhand-properties.html LibWeb: Begin adding a longhand properties test 2024-03-03 19:50:25 +01:00
invalid-transform-interpolation-does-not-crash.html LibWeb: Prevent transform interpolations from failing 2024-03-06 07:45:56 +01:00
is-collapsed.html LibWeb: Compare anchor/focus offsets in selection.isCollapsed 2024-10-12 15:00:35 +02:00
iterating-over-storage.html LibWeb: Fix infinite loop in Storage::internal_own_property_keys 2024-10-25 12:42:29 +02:00
js-export-rename-helper.js LibJS: Fix mix-up when re-exporting an imported symbol with a new name 2024-09-02 17:14:21 +02:00
js-export-rename-module.js LibJS: Fix mix-up when re-exporting an imported symbol with a new name 2024-09-02 17:14:21 +02:00
js-export-rename.html LibJS: Fix mix-up when re-exporting an imported symbol with a new name 2024-09-02 17:14:21 +02:00
link-element-media-attribute.html LibWeb: Convert some sync tests to be async 2024-10-03 07:07:28 -04:00
link-element-media-change-off.html LibWeb: Convert some sync tests to be async 2024-10-03 07:07:28 -04:00
link-element-media-change.html LibWeb: Convert some sync tests to be async 2024-10-03 07:07:28 -04:00
link-element-onload-attribute.html LibWeb: Convert some sync tests to be async 2024-10-03 07:07:28 -04:00
link-element-rel-preload-load-event.html LibWeb: Convert some sync tests to be async 2024-10-03 07:07:28 -04:00
link-element-search.html LibWeb+WebContent+headless-browser: Support async text tests 2023-09-15 08:52:25 +02:00
link_as.html LibWeb: Added HTMLLinkElement.as Tests 2024-06-13 07:58:11 +02:00
localStorage.html LibWeb/Storage: Return undefined for non-existent key/index access 2024-10-23 11:31:47 -06:00
math-with-inline-child.html LibWeb: Layout all math elements using InternalDummy context 2024-10-16 19:51:36 +02:00
module-script-in-head.html LibWeb+WebContent: Do not include DOM HTML in text test expectations 2024-10-03 07:07:28 -04:00
namespace-object-prototype.html IDLGenerators: Set namespace object prototype to Object.prototype 2024-04-26 20:02:42 +02:00
no-window-resize-on-load.html LibWeb: Don't fire resize event until document actually resizes once 2024-07-10 10:27:31 +02:00
object-with-unsupported-type-in-data-attribute.html LibWeb+WebContent: Do not include DOM HTML in text test expectations 2024-10-03 07:07:28 -04:00
output-value.html LibWeb: Add output element value 2023-12-09 21:50:17 +01:00
overflow-with-zero-sized-box.html LibWeb: Avoid division by zero when calculating scrollbar rect 2024-03-17 12:54:02 +01:00
parse-document-from-string-in-fetch-callback.html LibWeb: Add test when networking task is interrupted by networking task 2024-04-13 12:07:33 +02:00
performance-navigation.html LibWeb: Add stub implementation of performance.navigation 2024-08-04 10:38:42 +02:00
ProcessingInstruction-cloneNode.html
query-scroll-size-of-inline-node.html LibWeb: Add missing check if scrollable overflow defined for paintable 2024-10-21 15:57:19 +02:00
quirks-mode-case-insensitive-class-selector.html LibWeb: Match class selectors case insensitively in quirks mode 2024-08-03 16:45:23 +02:00
radio-node-list.html
request-animation-frame-order.html LibWeb: Make request-animation-frame-order test async 2024-03-30 19:26:58 +01:00
reset-input-element.html LibWeb: Implement activation behavior on input[type=reset] 2024-10-11 07:40:49 +01:00
resize-scrollable-box.html LibWeb: Clamp scroll offset into valid range after relayout 2024-02-22 07:35:30 +01:00
resolve-css-overflow-effective-value.html LibWeb: Resolve effective overflow-x and overflow-y according to spec 2024-02-06 08:39:06 +01:00
sameobject-behavior-for-htmlcollection-properties.html
script-src-set-after-insertion.html LibWeb: Prepare script when src is set the first time 2024-07-09 20:30:27 +01:00
script-src-set-after-insertion.js LibWeb: Prepare script when src is set the first time 2024-07-09 20:30:27 +01:00
scripted-dom-insertion-during-html-parse.html LibWeb+WebContent: Do not include DOM HTML in text test expectations 2024-10-03 07:07:28 -04:00
scroll-into-view-center.html LibWeb: Implement scrollIntoView with 'center' block position 2024-05-19 07:22:17 +02:00
scroll-into-view-end.html LibWeb: Fix not working Element::scroll_an_element_into_view() 2023-12-19 10:45:07 +01:00
scroll-into-view-start.html LibWeb: Fix not working Element::scroll_an_element_into_view() 2023-12-19 10:45:07 +01:00
scroll-left-and-top-on-colgroup.html LibWeb: Return a scroll offset of 0 for colgroup elements 2023-11-23 13:06:48 +01:00
scroll-to-fragment.html LibWeb: Scroll to the "start" in Document::scroll_to_fragment() 2023-12-19 20:59:52 +01:00
scroll-window-using-wheel-event.html LibWeb: Ignore mousewheel events in ViewportPaintable 2024-04-18 12:27:24 +02:00
select-options-limit.html LibWeb: Add support for indexed setter of HTMLOptionsCollection 2024-07-16 10:59:59 +01:00
select.html LibWeb: Add select selected options collection getter 2024-04-09 09:23:57 +02:00
selection-extend-across-siblings.html LibWeb: Use correct boundary point comparison in Selection.extend 2024-10-13 15:11:49 +02:00
selection-extend-backwards.html LibWeb: Use correct boundary point comparison in Selection.extend 2024-10-13 15:11:49 +02:00
Selection-setBaseAndExtent-without-common-root.html LibWeb: Don't try to set selection with anchor/focus in different roots 2024-07-20 06:41:25 +02:00
selectionchange-event.html LibWeb: Emit "selectionchange" event on document 2024-02-25 10:17:25 +01:00
set-selection-inside-shadow-root.html LibWeb: Update Range::set_base_and_extent() to the latest spec text 2024-07-04 14:38:56 +02:00
set-timeout-with-no-active-script.html LibWeb: Fix setTimeout() when there's no active script 2023-09-15 08:53:21 +02:00
setInterval.html Tests/LibWeb: Add basic tests for setTimeout and setInterval 2023-09-26 19:42:59 +02:00
setTimeout.html Tests/LibWeb: Add basic tests for setTimeout and setInterval 2023-09-26 19:42:59 +02:00
setting-display-none-should-nuke-subtree.html
shadow-root-adopted-style-sheets.html LibWeb: Apply shadow root style sheets in StyleComputer 2024-03-09 16:13:32 +01:00
shadow-root-style-sheets.html LibWeb: Add style sheets to the shadow root if applicable 2024-03-09 16:13:32 +01:00
show-non-modal-dialog.html LibWeb: Implement HTMLDialogElement::show() 2024-02-14 22:20:44 -05:00
subtle-crypto-hkdf-salt-empty-or-none.html LibWeb: Test subtleties in HKDF 'salt' interpretation 2024-10-23 11:33:58 -06:00
synthetic-event-constructor-istrusted-check.html LibWeb: Make “create an event” set the event’s isTrusted to true 2024-09-03 00:14:31 -06:00
table-cell-without-table-ancestor.html LibWeb: Don't assume HTMLTableCellElement always has table ancestor 2024-03-11 18:29:10 +01:00
textarea-maxlength.html LibWeb+WebContent: Do not include DOM HTML in text test expectations 2024-10-03 07:07:28 -04:00
textarea-readonly.html LibWeb+WebContent: Do not include DOM HTML in text test expectations 2024-10-03 07:07:28 -04:00
textarea-selection-start-selection-end.html LibWeb: Partially implement <textarea>'s selectionStart and selectionEnd 2024-03-16 13:11:57 +01:00
textarea-value.html LibWeb: Use the <textarea>'s API value, not its raw value, where needed 2024-03-16 13:11:57 +01:00
title-with-meta-title.html LibWeb: Implement Document's supported property names closer to the spec 2024-03-29 08:52:01 -04:00
title.html LibWeb/HTML: Implement text attribute in HTMLTitleElement 2023-12-02 10:35:43 +01:00
unclosed-body-element.html LibWeb: Use an infallible method to add attributes to nodes 2024-07-30 09:41:35 +02:00
unclosed-html-element.html LibWeb: Append attributes to the correct element 2024-07-30 09:41:35 +02:00
usvstring-url-reflection.html LibWeb: Add URL reflection to obsolete HTMLImageElement lowsrc property 2024-08-17 17:31:14 +01:00
valid.css
video-canceled-load.html LibWeb: Change attribute type to USVString where applicable 2024-08-17 07:45:00 +02:00
video-failed-load.html Tests: Use .invalid TLD for invalid requests 2024-10-02 16:04:17 -04:00
video-gc.html LibWeb: Bring back the test video for LibWeb tests 2024-10-10 17:52:58 -04:00
wheel-events-consumed-by-scrollable-should-not-be-propagated-to-body-2.html LibWeb: Skip page scrolling for wheel events consumed by scrollable box 2024-03-17 09:33:16 +01:00
wheel-events-consumed-by-scrollable-should-not-be-propagated-to-body.html LibWeb: Skip page scrolling for wheel events consumed by scrollable box 2024-02-29 13:18:57 +01:00
window-event-property-setter.html LibWeb: Add special handling for WindowProxy in [Replaceable] setters 2024-02-24 08:05:55 +01:00
window-proxy-numeric-own-property.html
window-proxy-property-inline-cache.html
window-scroll-while-parsing.html LibWeb: Port some manually async tests to use asyncTest 2024-10-03 07:07:28 -04:00
window-scrollTo.html LibWeb: Limit scroll position by overflow area in Window::scroll() 2023-12-24 23:22:35 +01:00