mirror of
https://github.com/RGBCube/serenity
synced 2025-05-22 19:45:08 +00:00
LibWeb: Dump layout node style properties in alphabetical order
This commit is contained in:
parent
332c471301
commit
2b47ba6c3f
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.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <AK/QuickSort.h>
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <AK/Utf8View.h>
|
#include <AK/Utf8View.h>
|
||||||
#include <LibWeb/CSS/PropertyID.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) {
|
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)
|
for (size_t i = 0; i < indent; ++i)
|
||||||
dbgprintf(" ");
|
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;
|
++indent;
|
||||||
layout_node.for_each_child([](auto& child) {
|
layout_node.for_each_child([](auto& child) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue