浏览代码

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.)
Andreas Kling 4 年之前
父节点
当前提交
74c8490acd

+ 4 - 0
Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp

@@ -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] {

+ 1 - 0
Userland/Libraries/LibWeb/InProcessWebView.h

@@ -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;

+ 1 - 0
Userland/Libraries/LibWeb/Page/Page.h

@@ -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&) { }

+ 1 - 0
Userland/Services/WebContent/PageHost.h

@@ -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;