1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-22 14:55:07 +00:00

LibWeb: Use the specified CSS values from element in more places

Instead of using the specified style stored on Layout::Node, use the
specified CSS values kept by the DOM::Element in more places.
This commit is contained in:
Andreas Kling 2021-01-06 12:44:58 +01:00
parent 63046d82f4
commit 981758a8b1
2 changed files with 14 additions and 13 deletions

View file

@ -242,13 +242,13 @@ void dump_tree(StringBuilder& builder, const Layout::Node& layout_node, bool sho
}
}
if (show_specified_style) {
if (show_specified_style && layout_node.dom_node() && layout_node.dom_node()->is_element() && downcast<DOM::Element>(layout_node.dom_node())->specified_css_values()) {
struct NameAndValue {
String name;
String value;
};
Vector<NameAndValue> properties;
layout_node.specified_style().for_each_property([&](auto property_id, auto& value) {
downcast<DOM::Element>(*layout_node.dom_node()).specified_css_values()->for_each_property([&](auto property_id, auto& value) {
properties.append({ CSS::string_from_property_id(property_id), value.to_string() });
});
quick_sort(properties, [](auto& a, auto& b) { return a.name < b.name; });