diff options
author | Andreas Kling <kling@serenityos.org> | 2021-01-01 16:42:44 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-01-01 16:42:44 +0100 |
commit | fc86717f4371e02127709ae0f5db0ef9dc527809 (patch) | |
tree | 71342c6225835e972c220b596355958d3aa52fe3 | |
parent | 730af2c5247d6d39841ae26644a702412d332915 (diff) | |
download | serenity-fc86717f4371e02127709ae0f5db0ef9dc527809.zip |
LibWeb: Demangle the names returned by Layout::Node::class_name()
Note that these are only used in debugging/test output so it's not
performance sensitive.
-rw-r--r-- | Libraries/LibWeb/Layout/Node.cpp | 5 | ||||
-rw-r--r-- | Libraries/LibWeb/Layout/Node.h | 3 | ||||
-rw-r--r-- | Libraries/LibWeb/Painting/StackingContext.cpp | 7 |
3 files changed, 10 insertions, 5 deletions
diff --git a/Libraries/LibWeb/Layout/Node.cpp b/Libraries/LibWeb/Layout/Node.cpp index 4ff5247836..4376e3bb36 100644 --- a/Libraries/LibWeb/Layout/Node.cpp +++ b/Libraries/LibWeb/Layout/Node.cpp @@ -24,6 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <AK/Demangle.h> #include <LibGUI/Painter.h> #include <LibWeb/DOM/Document.h> #include <LibWeb/DOM/Element.h> @@ -297,9 +298,9 @@ bool Node::is_root_element() const return is<HTML::HTMLHtmlElement>(*dom_node()); } -const char* Node::class_name() const +String Node::class_name() const { - return typeid(*this).name(); + return demangle(typeid(*this).name()); } } diff --git a/Libraries/LibWeb/Layout/Node.h b/Libraries/LibWeb/Layout/Node.h index 21798c80c4..4ae2da141a 100644 --- a/Libraries/LibWeb/Layout/Node.h +++ b/Libraries/LibWeb/Layout/Node.h @@ -93,7 +93,8 @@ public: bool is_root_element() const; - const char* class_name() const; + String class_name() const; + virtual bool is_initial_containing_block() const { return false; } virtual bool is_text() const { return false; } virtual bool is_block() const { return false; } diff --git a/Libraries/LibWeb/Painting/StackingContext.cpp b/Libraries/LibWeb/Painting/StackingContext.cpp index 35021ecf13..fe24a4c642 100644 --- a/Libraries/LibWeb/Painting/StackingContext.cpp +++ b/Libraries/LibWeb/Painting/StackingContext.cpp @@ -25,6 +25,7 @@ */ #include <AK/QuickSort.h> +#include <AK/StringBuilder.h> #include <LibWeb/DOM/Node.h> #include <LibWeb/Layout/Box.h> #include <LibWeb/Layout/InitialContainingBlockBox.h> @@ -82,9 +83,11 @@ HitTestResult StackingContext::hit_test(const Gfx::IntPoint& position, HitTestTy void StackingContext::dump(int indent) const { + StringBuilder builder; for (int i = 0; i < indent; ++i) - dbgprintf(" "); - dbgprintf("SC for %s{%s} %s [children: %zu]\n", m_box.class_name(), m_box.dom_node() ? m_box.dom_node()->node_name().characters() : "(anonymous)", m_box.absolute_rect().to_string().characters(), m_children.size()); + builder.append(' '); + builder.appendff("SC for {}({}) {} [children: {}]", m_box.class_name(), m_box.dom_node() ? m_box.dom_node()->node_name().characters() : "(anonymous)", m_box.absolute_rect().to_string().characters(), m_children.size()); + dbgln("{}", builder.string_view()); for (auto& child : m_children) child->dump(indent + 1); } |