summaryrefslogtreecommitdiff
path: root/Userland/Services/WebContent
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2022-03-10 11:29:09 +0000
committerAndreas Kling <kling@serenityos.org>2022-03-10 17:30:09 +0100
commit10429e1043a022339de8b84743caadf2da537a37 (patch)
tree5eb86170276ae04a71add7715479e0c5d67b5167 /Userland/Services/WebContent
parentb5ea14b88455deaee4900311d84f1cdf3baf960b (diff)
downloadserenity-10429e1043a022339de8b84743caadf2da537a37.zip
WebContent: Return empty JSON object if element has no box model
The blank string "" does not parse as JSON, and so the InspectorWidget would fail to update the box-model information when inspecting elements with no box, (for example, `<head>`) showing stale values instead. Now, they show all 0s. You could argue that InspectorWidget should be more resilient when given invalid JSON strings, but making sure we only pass valid ones works too.
Diffstat (limited to 'Userland/Services/WebContent')
-rw-r--r--Userland/Services/WebContent/ConnectionFromClient.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Services/WebContent/ConnectionFromClient.cpp b/Userland/Services/WebContent/ConnectionFromClient.cpp
index 001ffdd3f8..7b9c9cb96f 100644
--- a/Userland/Services/WebContent/ConnectionFromClient.cpp
+++ b/Userland/Services/WebContent/ConnectionFromClient.cpp
@@ -304,7 +304,7 @@ Messages::WebContentServer::InspectDomNodeResponse ConnectionFromClient::inspect
};
auto serialize_node_box_sizing_json = [](Web::Layout::Node const* layout_node) -> String {
if (!layout_node || !layout_node->is_box()) {
- return "";
+ return "{}";
}
auto* box = static_cast<Web::Layout::Box const*>(layout_node);
auto box_model = box->box_model();