summaryrefslogtreecommitdiff
path: root/Libraries/LibWeb/Dump.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-06-14 18:47:21 +0200
committerAndreas Kling <kling@serenityos.org>2020-06-14 18:47:21 +0200
commit2b47ba6c3fe4a161a531d8f5963676b76a51106f (patch)
tree4ddf7eebcb0d078d3b6b04d7da9566efad139c07 /Libraries/LibWeb/Dump.cpp
parent332c4713010c45729236141e353c8d623f28c43f (diff)
downloadserenity-2b47ba6c3fe4a161a531d8f5963676b76a51106f.zip
LibWeb: Dump layout node style properties in alphabetical order
Diffstat (limited to 'Libraries/LibWeb/Dump.cpp')
-rw-r--r--Libraries/LibWeb/Dump.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/Libraries/LibWeb/Dump.cpp b/Libraries/LibWeb/Dump.cpp
index b81491f4b4..99b12ead93 100644
--- a/Libraries/LibWeb/Dump.cpp
+++ b/Libraries/LibWeb/Dump.cpp
@@ -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) {