mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 17:07:35 +00:00
LibWebView: Don't wait for the DOM and a11y trees to load the Inspector
Provides a nicer experience on pages with large trees so that the window isn't just a large blank screen while it is loading. Instead, send the trees to the Inspector WebView once they have arrived and have been transformed to HTML. We Base64 encode the HTML to avoid needing to deal with all kinds of nested quotes that may appear in the HTML. We could instead send the JSON to the WebView, but generating the HTML in C++ feels a bit easier for now.
This commit is contained in:
parent
6c9912c341
commit
353642168a
2 changed files with 69 additions and 61 deletions
|
@ -25,22 +25,19 @@ public:
|
|||
void clear_selection();
|
||||
|
||||
private:
|
||||
void maybe_load_inspector();
|
||||
void generate_dom_tree(StringBuilder&);
|
||||
void generate_accessibility_tree(StringBuilder&);
|
||||
void load_inspector();
|
||||
String generate_dom_tree(JsonObject const&);
|
||||
String generate_accessibility_tree(JsonObject const&);
|
||||
|
||||
void select_node(i32 node_id);
|
||||
|
||||
ViewImplementation& m_content_web_view;
|
||||
ViewImplementation& m_inspector_web_view;
|
||||
|
||||
Optional<JsonValue> m_dom_tree;
|
||||
Optional<JsonValue> m_accessibility_tree;
|
||||
|
||||
Optional<i32> m_body_node_id;
|
||||
Optional<i32> m_pending_selection;
|
||||
|
||||
bool m_inspector_loaded { false };
|
||||
bool m_dom_tree_loaded { false };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue