summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h
AgeCommit message (Collapse)Author
2022-11-07LibWeb: Implement HTMLOrSVGElement.tabIndexLuke Wilde
2022-10-20LibWeb: Make the layout tree GC-allocatedAndreas Kling
This removes a set of complex reference cycles between DOM, layout tree and browsing context. It also makes lifetimes much easier to reason about, as the DOM and layout trees are now free to keep each other alive.
2022-10-04LibWeb: Implement <input type=file> behaviorAndrew Kaster
This includes punting on the actual file picker implementation all the way out to the PageClient. It's likely that some of the real details should be implemented somewhere closer, like the BrowsingContext or the Page, but we'll get there. For now, this allows https://copy.sh/v86 to load the emulation of the preselected images all the way until it hits a call to URL.createObjectURL.
2022-09-21LibWeb: Remove WRAPPER_HACK() macroLinus Groh
We no longer access Bindings::FooWrapper anywhere for a Foo platform object, so these can be removed :^)
2022-09-06LibWeb+LibJS: Make the EventTarget hierarchy (incl. DOM) GC-allocatedAndreas Kling
This is a monster patch that turns all EventTargets into GC-allocated PlatformObjects. Their C++ wrapper classes are removed, and the LibJS garbage collector is now responsible for their lifetimes. There's a fair amount of hacks and band-aids in this patch, and we'll have a lot of cleanup to do after this.
2022-03-26LibWeb: Make any HTMLInputElement with type != hidden focusableLinus Groh
From the HTML spec: Modulo platform conventions, it is suggested that the following elements should be considered as focusable areas and be sequentially focusable: ... - input elements whose type attribute are not in the Hidden state ...
2022-03-26LibWeb: Make HTMLInputElement::TypeAttributeState an enum classLinus Groh
2022-03-24LibWeb: Remove inheritance of FormAssociatedElement from HTMLElementTimothy Flynn
HTMLObjectElement will need to be both a FormAssociatedElement and a BrowsingContextContainer. Currently, both of these classes inherit from HTMLElement. This can work in C++, but is generally frowned upon, and doesn't play particularly well with the rest of LibWeb. Instead, we can essentially revert commit 3bb5c62 to remove HTMLElement from FormAssociatedElement's hierarchy. This means that objects such as HTMLObjectElement individually inherit from FormAssociatedElement and HTMLElement now. Some caveats are: * FormAssociatedElement still needs to know when the HTMLElement is inserted into and removed from the DOM. This hook is automatically injected via a macro now, while still allowing classes like HTMLInputElement to also know when the element is inserted. * Casting from a DOM::Element to a FormAssociatedElement is now a sideways cast, rather than directly following an inheritance chain. This means static_cast cannot be used here; but we can safely use dynamic_cast since the only 2 instances of this already use RTTI to verify the cast.
2022-03-22LibWeb: Handle input element value setting & getting closer to the specTimothy Flynn
We should not set the 'value' attribute when an input element's value is changed (by the user or programmatically). Instead, we should track the value internally and mark it with a dirty flag when it is changed.
2022-03-16LibWeb: Use the cached HTMLInputElement type within associated gettersTimothy Flynn
2022-03-16LibWeb: Cache HTMLInputElement's parsed type attribute when it changesTimothy Flynn
This will let us avoid parsing the type each time type() or type_state() are invoked.
2022-03-16LibWeb: Ensure that radio group is updated when radio is checked from JSsin-ack
Fixes test 56 in Acid3. Farewell, radio eyes, you will be missed. :^(
2022-03-16LibWeb: Refactor all LabelableNode subclasses + input event handling :^)sin-ack
This commit is messy due to the Paintable and Layout classes being tangled together. The RadioButton, CheckBox and ButtonBox classes are now subclasses of FormAssociatedLabelableNode. This subclass separates these layout nodes from LabelableNode, which is also the superclass of non-form associated labelable nodes (Progress). ButtonPaintable, CheckBoxPaintable and RadioButtonPaintable no longer call events on DOM nodes directly from their mouse event handlers; instead, all the functionality is now directly in EventHandler, which dispatches the related events. handle_mousedown and related methods return a bool indicating whether the event handling should proceed. Paintable classes can now return an alternative DOM::Node which should be the target of the mouse event. Labels use this to indicate that the labeled control should be the target of the mouse events. HTMLInputElement put its activation behavior on run_activation_behavior, which wasn't actually called anywhere and had to be manually called by other places. We now use activation_behavior which is used by EventDispatcher. This commit also brings HTMLInputElement closer to spec by removing the did_foo functions that did ad-hoc event dispatching and unifies the behavior under run_input_activation_behavior.
2022-03-15LibWeb: Create HTMLInputElement UA shadow tree when inserted into DOMAndreas Kling
Previously, we were creating a user-agent shadow tree when constructing a layout tree. This meant that we did DOM manipulation (and consequently style invalidation) during layout tree construction, which made things very hard to reason about in Layout::TreeBuilder. Simply everything by simply creating the UA shadow tree when the input element inserted into a parent node instead.
2022-03-11LibWeb: Move mouse event and label logic from layout to painting treeAndreas Kling
Input events have nothing to do with layout, so let's not send them to layout nodes. The job of Paintable starts to become clear. It represents a paintable item that can be rendered into the viewport, which means it can also be targeted by the mouse cursor.
2022-03-01LibWeb: Associate form elements with a form in parsing and dynamicallyLuke Wilde
This makes it available for all form associated elements and not just select and input elements. It also makes it more spec compliant, especially around the form attribute. The main thing missing is re-associating form elements with a form attribute when the form attribute changes or an element with an ID is inserted/removed or has its ID changed.
2022-03-01LibWeb: Add form associated element categoriesLuke Wilde
2022-03-01LibWeb: Move enabled() to FormAssociatedElement and follow the specLuke Wilde
2022-02-19LibWeb: Move QualifiedName into the Web::DOM namespaceAndreas Kling
2022-02-18LibWeb: Add <input> value sanitiztion algorithmAdam Hodgen
The value sanitiztion algorithm is defined for some states of the type attribute, and sanitizes the value of the 'value' attribute
2022-02-18LibWeb: Reflect only known values for <input> element's type attributeAdam Hodgen
2022-02-17LibWeb: Make <input type=checkbox> fire click events when clicked :^)Andreas Kling
This makes React react to checkboxes. Apparently they ignore the "change" event in favor of "click" on checkboxes. This is a compatibility hack for IE8.
2022-02-17LibWeb: Add the HTMLInputElement.type attributeAndreas Kling
This makes React react to change events on text <input> elements. :^)
2022-02-17LibWeb: Fire "input" and "change" events when editing a text <input>Andreas Kling
This isn't entirely on-spec, but will hopefully allow us to make progress in other areas.
2022-02-15LibWeb: Make <input type=checkbox> honor the "checked" attributeAndreas Kling
Implemented according to spec, although it's very possible that I missed one or two details. :^)
2022-02-08LibWeb: Make FormAssociatedElement inherit from HTMLElementLuke Wilde
The new event target implementation requires us to downcast an EventTarget to a FormAssociatedElement to check if the current Element EventTarget has a form owner to setup a with scope for the form owner. This also makes all form associated elements inherit from FormAssociatedElement where it was previously missing. https://html.spec.whatwg.org/#form-associated-element
2022-02-06LibWeb: Make HTMLInputElement move cursor into text node when focusedAndreas Kling
This mechanism feels rather awkward, but it's better than nothing.
2022-02-05LibWeb: Compute element style in Layout::TreeBuilderAndreas Kling
Instead of making each Layout::Node compute style for itself, we now compute it in TreeBuilder before even calling create_layout_node(). For non-element DOM nodes, we create the style and layout tree node in TreeBuilder. This allows us to move create_layout_node() from DOM::Node to DOM::Element.
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-20LibWeb: Register FormAssociatedElement with their owner formAndreas Kling
This will eventually allow us to implement HTMLFormControlsCollection.
2021-04-20LibWeb: Add basic support for HTMLInputElement.formAndreas Kling
HTMLInputElement now inherits from FormAssociatedElement, which will be a common base for the handful of elements that need to track their owner form (and register with it for the form.elements collection.) At the moment, the owner form is assigned during DOM insertion/removal of an HTMLInputElement. I didn't implement any of the legacy behaviors defined by the HTML parsing spec yet.
2021-02-10LibWeb: Start implementing <input type=text> using a shadow DOMAndreas Kling
Text <input> fields will now generate a basic shadow DOM and attach it to the input element. The shadow DOM contains a <div> with some inline style, and an always- editable text node inside it. Accessing the "value" attribute on such an input element will get/set the value from that text node. This is really cool, although not super stable since HTML editing is not super stable. But it's a start! :^)
2021-02-07LibWeb: Use move semantics for QualifiedName more oftenAndreas Kling
2021-01-12Libraries: Move to Userland/Libraries/Andreas Kling