summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-02-10 08:58:26 +0100
committerAndreas Kling <kling@serenityos.org>2021-02-10 09:13:30 +0100
commit5e91e61900f6d53d08b2420aa5a50069b2fa1e16 (patch)
tree97bd5fe9e538f535975b634e146133f7ff9cd4a3 /Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
parent1ad65b173b71271bbe91f154478c77e0ee607242 (diff)
downloadserenity-5e91e61900f6d53d08b2420aa5a50069b2fa1e16.zip
LibWeb: Remove WidgetBox layout node
The approach of attaching sub-widgets to the web view widget was only ever going to work in single-process mode, and that's not what we're about anymore, so let's just get rid of WidgetBox so we don't have the dead-end architecture hanging over us. The next step here is to re-implement <input type=text> using LibWeb primitives.
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp')
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp26
1 files changed, 1 insertions, 25 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
index 48a41defdd..27db0a94c9 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
@@ -24,8 +24,6 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibGUI/Button.h>
-#include <LibGUI/TextBox.h>
#include <LibGfx/FontDatabase.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Event.h>
@@ -35,7 +33,6 @@
#include <LibWeb/InProcessWebView.h>
#include <LibWeb/Layout/ButtonBox.h>
#include <LibWeb/Layout/CheckBox.h>
-#include <LibWeb/Layout/WidgetBox.h>
#include <LibWeb/Page/Frame.h>
namespace Web::HTML {
@@ -64,10 +61,6 @@ void HTMLInputElement::did_click_button(Badge<Layout::ButtonBox>)
RefPtr<Layout::Node> HTMLInputElement::create_layout_node()
{
- ASSERT(document().page());
- auto& page = *document().page();
- auto& page_view = const_cast<InProcessWebView&>(static_cast<const InProcessWebView&>(page.client()));
-
if (type() == "hidden")
return nullptr;
@@ -82,24 +75,7 @@ RefPtr<Layout::Node> HTMLInputElement::create_layout_node()
return adopt(*new Layout::CheckBox(document(), *this, move(style)));
// FIXME: Implement <input type=text> in terms of LibWeb primitives.
- if (page.client().is_multi_process())
- return nullptr;
-
- auto& text_box = page_view.add<GUI::TextBox>();
- text_box.set_text(value());
- text_box.on_change = [this] {
- auto& widget = downcast<Layout::WidgetBox>(layout_node())->widget();
- const_cast<HTMLInputElement*>(this)->set_attribute(HTML::AttributeNames::value, static_cast<const GUI::TextBox&>(widget).text());
- };
- int text_width = Gfx::FontDatabase::default_font().width(value());
- auto size_value = attribute(HTML::AttributeNames::size);
- if (!size_value.is_null()) {
- auto size = size_value.to_uint();
- if (size.has_value())
- text_width = Gfx::FontDatabase::default_font().glyph_width('x') * size.value();
- }
- text_box.set_relative_rect(0, 0, text_width + 20, 20);
- return adopt(*new Layout::WidgetBox(document(), *this, text_box));
+ return nullptr;
}
void HTMLInputElement::set_checked(bool checked)