mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 12:05:15 +00:00
WebContent: Stop crashing when inspecting pseudo-elements without style
We only cache pseudo-element computed style for ::before and ::after currently, so avoid dereferencing a null ComputedProperties pointer.
This commit is contained in:
parent
5c5e9b3d1b
commit
28a1297360
Notes:
github-actions[bot]
2025-02-12 13:49:59 +00:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/LadybirdBrowser/ladybird/commit/28a1297360e Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3529
1 changed files with 12 additions and 4 deletions
|
@ -616,12 +616,20 @@ void ConnectionFromClient::inspect_dom_node(u64 page_id, Web::UniqueNodeID const
|
|||
}
|
||||
|
||||
auto pseudo_element_style = element.pseudo_element_computed_properties(pseudo_element.value());
|
||||
ByteString computed_values = serialize_json(*pseudo_element_style);
|
||||
ByteString resolved_values = serialize_json(element.resolved_css_values(pseudo_element.value()));
|
||||
|
||||
ByteString computed_values;
|
||||
ByteString fonts_json;
|
||||
ByteString resolved_values;
|
||||
if (pseudo_element_style) {
|
||||
computed_values = serialize_json(*pseudo_element_style);
|
||||
fonts_json = serialize_fonts_json(*pseudo_element_style);
|
||||
resolved_values = serialize_json(element.resolved_css_values(pseudo_element.value()));
|
||||
} else {
|
||||
dbgln("Inspected pseudo-element has no computed style.");
|
||||
}
|
||||
|
||||
ByteString custom_properties_json = serialize_custom_properties_json(element, pseudo_element);
|
||||
ByteString node_box_sizing_json = serialize_node_box_sizing_json(pseudo_element_node.ptr());
|
||||
ByteString fonts_json = serialize_fonts_json(*pseudo_element_style);
|
||||
|
||||
async_did_inspect_dom_node(page_id, true, move(computed_values), move(resolved_values), move(custom_properties_json), move(node_box_sizing_json), {}, move(fonts_json));
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue