mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 09:37:44 +00:00
Browser+WebContent: Fixup some DOM inspector weirdness
This fixes a few things I noticed whilst working on the inspector for Ladybird. 1. The computed and resolved values were being passed swapped around from the inspect_dom_node() IPC call. I.e. computed values were passed as resolved values and vice versa. This was then fixed by swapping them again in the InspectorWidget (two errors canceled out). 2. Resolved values were called "specified values" seemingly only in the inspect_dom_node() IPC calls. This was a little confusing so I've renamed them to back to "resolved values" for consistency. 3. The inspector took and stored the DOM JSON strings unnecessarily, all the models immediately parse the JSON and don't need the strings to hang around.
This commit is contained in:
parent
e3ad5731f7
commit
3de5dcf383
9 changed files with 39 additions and 58 deletions
|
@ -9,12 +9,12 @@
|
|||
#pragma once
|
||||
|
||||
#include "ElementSizePreviewWidget.h"
|
||||
#include <AK/String.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
#include <LibWeb/CSS/Selector.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/Layout/BoxModelMetrics.h>
|
||||
#include <LibWebView/Forward.h>
|
||||
|
||||
namespace Browser {
|
||||
|
||||
class InspectorWidget final : public GUI::Widget {
|
||||
|
@ -29,20 +29,20 @@ public:
|
|||
return dom_node_id == other.dom_node_id && pseudo_element == other.pseudo_element;
|
||||
}
|
||||
|
||||
DeprecatedString to_deprecated_string() const
|
||||
ErrorOr<String> to_string() const
|
||||
{
|
||||
if (pseudo_element.has_value())
|
||||
return DeprecatedString::formatted("id: {}, pseudo: {}", dom_node_id, Web::CSS::pseudo_element_name(pseudo_element.value()));
|
||||
return DeprecatedString::formatted("id: {}", dom_node_id);
|
||||
return String::formatted("id: {}, pseudo: {}", dom_node_id, Web::CSS::pseudo_element_name(pseudo_element.value()));
|
||||
return String::formatted("id: {}", dom_node_id);
|
||||
}
|
||||
};
|
||||
|
||||
virtual ~InspectorWidget() = default;
|
||||
|
||||
void set_web_view(NonnullRefPtr<WebView::OutOfProcessWebView> web_view) { m_web_view = web_view; }
|
||||
void set_dom_json(DeprecatedString);
|
||||
void set_dom_json(StringView);
|
||||
void clear_dom_json();
|
||||
void set_dom_node_properties_json(Selection, DeprecatedString specified_values_json, DeprecatedString computed_values_json, DeprecatedString custom_properties_json, DeprecatedString node_box_sizing_json);
|
||||
void set_dom_node_properties_json(Selection, StringView computed_values_json, StringView resolved_values_json, StringView custom_properties_json, StringView node_box_sizing_json);
|
||||
|
||||
void set_selection(Selection);
|
||||
void select_default_node();
|
||||
|
@ -51,8 +51,8 @@ private:
|
|||
InspectorWidget();
|
||||
|
||||
void set_selection(GUI::ModelIndex);
|
||||
void load_style_json(DeprecatedString specified_values_json, DeprecatedString computed_values_json, DeprecatedString custom_properties_json);
|
||||
void update_node_box_model(Optional<DeprecatedString> node_box_sizing_json);
|
||||
void load_style_json(StringView computed_values_json, StringView resolved_values_json, StringView custom_properties_json);
|
||||
void update_node_box_model(StringView node_box_sizing_json);
|
||||
void clear_style_json();
|
||||
void clear_node_box_model();
|
||||
|
||||
|
@ -66,12 +66,9 @@ private:
|
|||
|
||||
Web::Layout::BoxModelMetrics m_node_box_sizing;
|
||||
|
||||
Optional<DeprecatedString> m_dom_json;
|
||||
Optional<Selection> m_pending_selection;
|
||||
Selection m_selection;
|
||||
Optional<DeprecatedString> m_selection_specified_values_json;
|
||||
Optional<DeprecatedString> m_selection_computed_values_json;
|
||||
Optional<DeprecatedString> m_selection_custom_properties_json;
|
||||
bool m_dom_loaded { false };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue