mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-10-25 18:34:14 +00:00 
			
		
		
		
	 6d1c4ae5a9
			
		
	
	
		6d1c4ae5a9
		
	
	
	
	
		
			
			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! :^)
		
			
				
	
	
		
			20 lines
		
	
	
	
		
			495 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
	
		
			495 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #include <LibHTML/DOM/HTMLElement.h>
 | |
| 
 | |
| class HTMLFormElement : public HTMLElement {
 | |
| public:
 | |
|     HTMLFormElement(Document&, const String& tag_name);
 | |
|     virtual ~HTMLFormElement() override;
 | |
| 
 | |
|     String action() const { return attribute("action"); }
 | |
|     String method() const { return attribute("method"); }
 | |
| 
 | |
|     void submit();
 | |
| };
 | |
| 
 | |
| template<>
 | |
| inline bool is<HTMLFormElement>(const Node& node)
 | |
| {
 | |
|     return is<Element>(node) && to<Element>(node).tag_name().to_lowercase() == "form";
 | |
| }
 |