From 6d1c4ae5a9b220cdd4c5bad3fe6fb49bfc42d31f Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 25 Nov 2019 21:21:55 +0100 Subject: [PATCH] LibHTML: Implement basic
and element support 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 , 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! :^) --- Base/home/anon/www/form.html | 10 ++++ Base/home/anon/www/welcome.html | 1 + Libraries/LibHTML/DOM/ElementFactory.cpp | 6 +++ Libraries/LibHTML/DOM/HTMLFormElement.cpp | 58 ++++++++++++++++++++++ Libraries/LibHTML/DOM/HTMLFormElement.h | 20 ++++++++ Libraries/LibHTML/DOM/HTMLInputElement.cpp | 51 +++++++++++++++++++ Libraries/LibHTML/DOM/HTMLInputElement.h | 21 ++++++++ Libraries/LibHTML/Layout/LayoutNode.h | 1 + Libraries/LibHTML/Layout/LayoutWidget.cpp | 28 +++++++++++ Libraries/LibHTML/Layout/LayoutWidget.h | 30 +++++++++++ Libraries/LibHTML/Makefile | 3 ++ 11 files changed, 229 insertions(+) create mode 100644 Base/home/anon/www/form.html create mode 100644 Libraries/LibHTML/DOM/HTMLFormElement.cpp create mode 100644 Libraries/LibHTML/DOM/HTMLFormElement.h create mode 100644 Libraries/LibHTML/DOM/HTMLInputElement.cpp create mode 100644 Libraries/LibHTML/DOM/HTMLInputElement.h create mode 100644 Libraries/LibHTML/Layout/LayoutWidget.cpp create mode 100644 Libraries/LibHTML/Layout/LayoutWidget.h diff --git a/Base/home/anon/www/form.html b/Base/home/anon/www/form.html new file mode 100644 index 00000000000..3df9bed4199 --- /dev/null +++ b/Base/home/anon/www/form.html @@ -0,0 +1,10 @@ + + +Form + + + + +
+ + diff --git a/Base/home/anon/www/welcome.html b/Base/home/anon/www/welcome.html index a839738b7d1..d11541fc1ca 100644 --- a/Base/home/anon/www/welcome.html +++ b/Base/home/anon/www/welcome.html @@ -24,6 +24,7 @@ h1 {

Some small test pages: