mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:57:45 +00:00
Browser: Replace inspector's dom_node_id with a Selection struct
This commit is contained in:
parent
6de2b62906
commit
2c970b9516
3 changed files with 54 additions and 41 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
|
||||
* Copyright (c) 2021-2022, Sam Atkins <atkinssj@serenityos.org>
|
||||
* Copyright (c) 2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
|
@ -18,20 +18,34 @@ namespace Browser {
|
|||
class InspectorWidget final : public GUI::Widget {
|
||||
C_OBJECT(InspectorWidget)
|
||||
public:
|
||||
struct Selection {
|
||||
i32 dom_node_id { 0 };
|
||||
|
||||
bool operator==(Selection const& other) const
|
||||
{
|
||||
return dom_node_id == other.dom_node_id;
|
||||
}
|
||||
|
||||
String to_string() const
|
||||
{
|
||||
return String::formatted("id: {}", dom_node_id);
|
||||
}
|
||||
};
|
||||
|
||||
virtual ~InspectorWidget() = default;
|
||||
|
||||
void set_web_view(NonnullRefPtr<Web::OutOfProcessWebView> web_view) { m_web_view = web_view; }
|
||||
void set_dom_json(String);
|
||||
void clear_dom_json();
|
||||
void set_dom_node_properties_json(i32 node_id, String specified_values_json, String computed_values_json, String custom_properties_json, String node_box_sizing_json);
|
||||
void set_dom_node_properties_json(Selection, String specified_values_json, String computed_values_json, String custom_properties_json, String node_box_sizing_json);
|
||||
|
||||
void set_inspected_node(i32 node_id);
|
||||
void set_selection(Selection);
|
||||
void select_default_node();
|
||||
|
||||
private:
|
||||
InspectorWidget();
|
||||
|
||||
void set_inspected_node(GUI::ModelIndex);
|
||||
void set_selection(GUI::ModelIndex);
|
||||
void load_style_json(String specified_values_json, String computed_values_json, String custom_properties_json);
|
||||
void update_node_box_model(Optional<String> node_box_sizing_json);
|
||||
void clear_style_json();
|
||||
|
@ -46,13 +60,12 @@ private:
|
|||
|
||||
Web::Layout::BoxModelMetrics m_node_box_sizing;
|
||||
|
||||
// Multi-process mode
|
||||
Optional<i32> m_pending_inspect_node_id;
|
||||
i32 m_inspected_node_id;
|
||||
Optional<String> m_dom_json;
|
||||
Optional<String> m_inspected_node_specified_values_json;
|
||||
Optional<String> m_inspected_node_computed_values_json;
|
||||
Optional<String> m_inspected_node_custom_properties_json;
|
||||
Optional<Selection> m_pending_selection;
|
||||
Selection m_selection;
|
||||
Optional<String> m_selection_specified_values_json;
|
||||
Optional<String> m_selection_computed_values_json;
|
||||
Optional<String> m_selection_custom_properties_json;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue