
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! :^)
30 lines
685 B
C++
30 lines
685 B
C++
#pragma once
|
|
|
|
#include <LibHTML/Layout/LayoutReplaced.h>
|
|
|
|
class GWidget;
|
|
|
|
class LayoutWidget : public LayoutReplaced {
|
|
public:
|
|
LayoutWidget(const Element&, GWidget&);
|
|
virtual ~LayoutWidget() override;
|
|
|
|
virtual void layout() override;
|
|
virtual void render(RenderingContext&) override;
|
|
|
|
GWidget& widget() { return m_widget; }
|
|
const GWidget& widget() const { return m_widget; }
|
|
|
|
virtual bool is_widget() const final { return true; }
|
|
|
|
private:
|
|
virtual const char* class_name() const override { return "LayoutWidget"; }
|
|
|
|
NonnullRefPtr<GWidget> m_widget;
|
|
};
|
|
|
|
template<>
|
|
inline bool is<LayoutWidget>(const LayoutNode& node)
|
|
{
|
|
return node.is_widget();
|
|
}
|