LibWeb: Don't try to create GUI::TextBox inside multi-process web views

This is a workaround until we can implement a proper <input type=text>
in terms of LibWeb primitives.

This makes google.com not crash in multi-process mode (but there is no
search box.)
This commit is contained in:
Andreas Kling 2021-01-30 23:15:40 +01:00
parent 32a363ded5
commit 74c8490acd
Notes: sideshowbarker 2024-07-18 22:43:04 +09:00
4 changed files with 7 additions and 0 deletions
Userland
Libraries/LibWeb
Services/WebContent

View file

@ -81,6 +81,10 @@ RefPtr<Layout::Node> HTMLInputElement::create_layout_node()
if (type() == "checkbox")
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] {

View file

@ -85,6 +85,7 @@ private:
// ^Web::PageClient
virtual Gfx::Palette palette() const override { return GUI::ScrollableWidget::palette(); }
virtual bool is_multi_process() const override { return false; }
virtual void page_did_change_title(const String&) override;
virtual void page_did_set_document_in_main_frame(DOM::Document*) override;
virtual void page_did_start_loading(const URL&) override;

View file

@ -81,6 +81,7 @@ private:
class PageClient {
public:
virtual bool is_multi_process() const = 0;
virtual Gfx::Palette palette() const = 0;
virtual void page_did_set_document_in_main_frame(DOM::Document*) { }
virtual void page_did_change_title(const String&) { }

View file

@ -50,6 +50,7 @@ public:
private:
// ^PageClient
virtual bool is_multi_process() const override { return true; }
virtual Gfx::Palette palette() const override;
virtual void page_did_invalidate(const Gfx::IntRect&) override;
virtual void page_did_change_selection() override;