
This patch adds "submit" inputs and default (text box) inputs, as well as form elements that can be submitted. Layout of input elements is implemented via a new LayoutWidget class that allows you to put an arbitrary GWidget in the layout tree. At the moment, the DOM node sets the initial size of the LayoutWidget, and then the positioning is done by the normal layout algorithm. We also now support submitting a <form method="GET">, which does a full replacing load with a URL based on the form's action + a query string built from the name/value of input elements within the submitted form. This is pretty neat! :^)
21 lines
632 B
C++
21 lines
632 B
C++
#pragma once
|
|
|
|
#include <LibHTML/DOM/HTMLElement.h>
|
|
|
|
class HTMLInputElement : public HTMLElement {
|
|
public:
|
|
HTMLInputElement(Document&, const String& tag_name);
|
|
virtual ~HTMLInputElement() override;
|
|
|
|
virtual RefPtr<LayoutNode> create_layout_node(const StyleProperties* parent_style) const override;
|
|
|
|
String type() const { return attribute("type"); }
|
|
String value() const { return attribute("value"); }
|
|
String name() const { return attribute("name"); }
|
|
};
|
|
|
|
template<>
|
|
inline bool is<HTMLInputElement>(const Node& node)
|
|
{
|
|
return is<Element>(node) && to<Element>(node).tag_name().to_lowercase() == "input";
|
|
}
|