Skip to content

Commit

Permalink
LibWebView: Fix capitalization in devtools
Browse files Browse the repository at this point in the history
  • Loading branch information
Psychpsyo committed Jan 11, 2025
1 parent 3261f87 commit fcacd97
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 45 deletions.
1 change: 0 additions & 1 deletion Libraries/LibWeb/Bindings/MainThreadVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ ErrorOr<void> initialize_main_thread_vm(HTML::EventLoop::Type type)
HTML::TagNames::initialize_strings();
MathML::TagNames::initialize_strings();
MediaSourceExtensions::EventNames::initialize_strings();
Namespace::initialize_strings();
NavigationTiming::EntryNames::initialize_strings();
PerformanceTimeline::EntryTypes::initialize_strings();
SVG::AttributeNames::initialize_strings();
Expand Down
1 change: 0 additions & 1 deletion Libraries/LibWeb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,6 @@ set(SOURCES
MimeSniff/MimeType.cpp
MimeSniff/Resource.cpp
MixedContent/AbstractOperations.cpp
Namespace.cpp
NavigationTiming/EntryNames.cpp
NavigationTiming/PerformanceNavigation.cpp
NavigationTiming/PerformanceTiming.cpp
Expand Down
3 changes: 3 additions & 0 deletions Libraries/LibWeb/DOM/Node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1544,6 +1544,9 @@ void Node::serialize_tree_as_json(JsonObjectSerializer<StringBuilder>& object) c
MUST(object.add("type"sv, "element"));

auto const* element = static_cast<DOM::Element const*>(this);
if (element->namespace_uri().has_value())
MUST(object.add("namespace"sv, element->namespace_uri().value()));

if (element->has_attributes()) {
auto attributes = MUST(object.add_object("attributes"sv));
element->for_each_attribute([&attributes](auto& name, auto& value) {
Expand Down
28 changes: 0 additions & 28 deletions Libraries/LibWeb/Namespace.cpp

This file was deleted.

19 changes: 6 additions & 13 deletions Libraries/LibWeb/Namespace.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,11 @@

namespace Web::Namespace {

#define ENUMERATE_NAMESPACES \
__ENUMERATE_NAMESPACE(HTML, "http://www.w3.org/1999/xhtml") \
__ENUMERATE_NAMESPACE(MathML, "http://www.w3.org/1998/Math/MathML") \
__ENUMERATE_NAMESPACE(SVG, "http://www.w3.org/2000/svg") \
__ENUMERATE_NAMESPACE(XLink, "http://www.w3.org/1999/xlink") \
__ENUMERATE_NAMESPACE(XML, "http://www.w3.org/XML/1998/namespace") \
__ENUMERATE_NAMESPACE(XMLNS, "http://www.w3.org/2000/xmlns/")

#define __ENUMERATE_NAMESPACE(name, namespace_) extern FlyString name;
ENUMERATE_NAMESPACES
#undef __ENUMERATE_NAMESPACE

void initialize_strings();
FlyString const HTML = "http://www.w3.org/1999/xhtml"_fly_string;
FlyString const MathML = "http://www.w3.org/1998/Math/MathML"_fly_string;
FlyString const SVG = "http://www.w3.org/2000/svg"_fly_string;
FlyString const XLink = "http://www.w3.org/1999/xlink"_fly_string;
FlyString const XML = "http://www.w3.org/XML/1998/namespace"_fly_string;
FlyString const XMLNS = "http://www.w3.org/2000/xmlns/"_fly_string;

}
5 changes: 4 additions & 1 deletion Libraries/LibWebView/InspectorClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <LibCore/Resource.h>
#include <LibJS/MarkupGenerator.h>
#include <LibWeb/Infra/Strings.h>
#include <LibWeb/Namespace.h>
#include <LibWebView/Application.h>
#include <LibWebView/CookieJar.h>
#include <LibWebView/InspectorClient.h>
Expand Down Expand Up @@ -633,7 +634,9 @@ String InspectorClient::generate_dom_tree(JsonObject const& dom_tree)
if (name.equals_ignoring_ascii_case("BODY"sv) || name.equals_ignoring_ascii_case("FRAMESET"sv))
m_body_or_frameset_node_id = node_id;

auto tag = name.to_lowercase();
auto tag = name;
if (node.get_byte_string("namespace"sv) == Web::Namespace::HTML.bytes_as_string_view())
tag = tag.to_lowercase();

builder.appendff("<span class=\"hoverable\" {}>", data_attributes.string_view());
builder.append("<span>&lt;</span>"sv);
Expand Down
1 change: 0 additions & 1 deletion Meta/gn/secondary/Userland/Libraries/LibWeb/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ shared_library("LibWeb") {
public_configs = [ ":configs" ]
sources = [
"Dump.cpp",
"Namespace.cpp",
"PixelUnits.cpp",
]
deps = [
Expand Down

0 comments on commit fcacd97

Please sign in to comment.