From 2a6e6c42d2e82127c92016e73f36e1acb75ce7fd Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Wed, 30 Jun 2021 08:44:48 -0400 Subject: [PATCH] LibWeb: Define hot DOMTreeJSONModel methods in-line --- .../Libraries/LibWeb/DOMTreeJSONModel.cpp | 17 ----------------- Userland/Libraries/LibWeb/DOMTreeJSONModel.h | 19 ++++++++++++++++--- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/Userland/Libraries/LibWeb/DOMTreeJSONModel.cpp b/Userland/Libraries/LibWeb/DOMTreeJSONModel.cpp index 2ec8991518..47e90f7e07 100644 --- a/Userland/Libraries/LibWeb/DOMTreeJSONModel.cpp +++ b/Userland/Libraries/LibWeb/DOMTreeJSONModel.cpp @@ -157,11 +157,6 @@ void DOMTreeJSONModel::update() did_update(); } -JsonObject const* DOMTreeJSONModel::find_parent_of_child_with_internal_id(size_t internal_id) const -{ - return find_parent_of_child_with_internal_id(m_dom_tree, internal_id); -} - JsonObject const* DOMTreeJSONModel::find_parent_of_child_with_internal_id(JsonObject const& node, size_t internal_id) const { auto const* children = get_children(node); @@ -182,16 +177,4 @@ JsonObject const* DOMTreeJSONModel::find_parent_of_child_with_internal_id(JsonOb return nullptr; } -size_t DOMTreeJSONModel::get_internal_id(JsonObject const& o) -{ - return o.get("internal_id").as_u32(); -} - -JsonArray const* DOMTreeJSONModel::get_children(JsonObject const& o) -{ - if (auto const* maybe_children = o.get_ptr("children"); maybe_children) - return &maybe_children->as_array(); - return nullptr; -} - } diff --git a/Userland/Libraries/LibWeb/DOMTreeJSONModel.h b/Userland/Libraries/LibWeb/DOMTreeJSONModel.h index e8a65800a2..9f209938cf 100644 --- a/Userland/Libraries/LibWeb/DOMTreeJSONModel.h +++ b/Userland/Libraries/LibWeb/DOMTreeJSONModel.h @@ -36,11 +36,24 @@ public: private: explicit DOMTreeJSONModel(JsonObject); - JsonObject const* find_parent_of_child_with_internal_id(size_t) const; + ALWAYS_INLINE JsonObject const* find_parent_of_child_with_internal_id(size_t internal_id) const + { + return find_parent_of_child_with_internal_id(m_dom_tree, internal_id); + } + JsonObject const* find_parent_of_child_with_internal_id(JsonObject const&, size_t) const; - static size_t get_internal_id(const JsonObject& o); - static JsonArray const* get_children(const JsonObject& o); + ALWAYS_INLINE static size_t get_internal_id(const JsonObject& o) + { + return o.get("internal_id").as_u32(); + } + + ALWAYS_INLINE static JsonArray const* get_children(const JsonObject& o) + { + if (auto const* maybe_children = o.get_ptr("children"); maybe_children) + return &maybe_children->as_array(); + return nullptr; + } GUI::Icon m_document_icon; GUI::Icon m_element_icon;