mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 03:55:24 +00:00
LibWeb: Dump layout node style properties in alphabetical order
This commit is contained in:
parent
332c471301
commit
2b47ba6c3f
Notes:
sideshowbarker
2024-07-19 05:39:01 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/2b47ba6c3fe
1 changed files with 13 additions and 2 deletions
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/QuickSort.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <AK/Utf8View.h>
|
||||
#include <LibWeb/CSS/PropertyID.h>
|
||||
|
@ -180,11 +181,21 @@ void dump_tree(const LayoutNode& layout_node)
|
|||
}
|
||||
}
|
||||
|
||||
struct NameAndValue {
|
||||
String name;
|
||||
String value;
|
||||
};
|
||||
Vector<NameAndValue> properties;
|
||||
layout_node.style().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; });
|
||||
|
||||
for (auto& property : properties) {
|
||||
for (size_t i = 0; i < indent; ++i)
|
||||
dbgprintf(" ");
|
||||
dbgprintf(" (%s: %s)\n", CSS::string_from_property_id(property_id), value.to_string().characters());
|
||||
});
|
||||
dbgprintf(" (%s: %s)\n", property.name.characters(), property.value.characters());
|
||||
}
|
||||
|
||||
++indent;
|
||||
layout_node.for_each_child([](auto& child) {
|
||||
|
|
Loading…
Add table
Reference in a new issue