|
@@ -28,11 +28,12 @@
|
|
|
#include <LibGUI/Button.h>
|
|
|
#include <LibGUI/TextBox.h>
|
|
|
#include <LibWeb/DOM/Document.h>
|
|
|
+#include <LibWeb/DOM/Event.h>
|
|
|
#include <LibWeb/DOM/HTMLFormElement.h>
|
|
|
#include <LibWeb/DOM/HTMLInputElement.h>
|
|
|
#include <LibWeb/Frame.h>
|
|
|
-#include <LibWeb/PageView.h>
|
|
|
#include <LibWeb/Layout/LayoutWidget.h>
|
|
|
+#include <LibWeb/PageView.h>
|
|
|
|
|
|
namespace Web {
|
|
|
|
|
@@ -67,6 +68,14 @@ RefPtr<LayoutNode> HTMLInputElement::create_layout_node(const StyleProperties*)
|
|
|
}
|
|
|
};
|
|
|
widget = button;
|
|
|
+ } else if (type() == "button") {
|
|
|
+ auto& button = page_view.add<GUI::Button>(value());
|
|
|
+ int text_width = Gfx::Font::default_font().width(value());
|
|
|
+ button.set_relative_rect(0, 0, text_width + 20, 20);
|
|
|
+ button.on_click = [this](auto) {
|
|
|
+ const_cast<HTMLInputElement*>(this)->dispatch_event(Event::create("click"));
|
|
|
+ };
|
|
|
+ widget = button;
|
|
|
} else {
|
|
|
auto& text_box = page_view.add<GUI::TextBox>();
|
|
|
text_box.set_text(value());
|