1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-10 11:47:35 +00:00

LibWeb: Use "namespace Web::Foo {" since C++20 allows it :^)

Thanks @nico for teaching me about this!
This commit is contained in:
Andreas Kling 2020-07-21 16:23:08 +02:00
parent 4065182811
commit 685e006e27
15 changed files with 22 additions and 46 deletions

View file

@ -31,8 +31,7 @@
#include <LibJS/Runtime/GlobalObject.h> #include <LibJS/Runtime/GlobalObject.h>
#include <LibWeb/Forward.h> #include <LibWeb/Forward.h>
namespace Web { namespace Web::Bindings {
namespace Bindings {
class Wrappable { class Wrappable {
public: public:
@ -56,4 +55,3 @@ inline Wrapper* wrap_impl(JS::GlobalObject& global_object, NativeObject& native_
} }
} }
}

View file

@ -31,8 +31,7 @@
#include <LibJS/Runtime/Object.h> #include <LibJS/Runtime/Object.h>
#include <LibWeb/Forward.h> #include <LibWeb/Forward.h>
namespace Web { namespace Web::Bindings {
namespace Bindings {
class Wrapper class Wrapper
: public JS::Object : public JS::Object
@ -48,4 +47,3 @@ protected:
}; };
} }
}

View file

@ -33,8 +33,7 @@
#include <LibWeb/Bindings/XMLHttpRequestWrapper.h> #include <LibWeb/Bindings/XMLHttpRequestWrapper.h>
#include <LibWeb/DOM/XMLHttpRequest.h> #include <LibWeb/DOM/XMLHttpRequest.h>
namespace Web { namespace Web::Bindings {
namespace Bindings {
XMLHttpRequestConstructor::XMLHttpRequestConstructor(JS::GlobalObject& global_object) XMLHttpRequestConstructor::XMLHttpRequestConstructor(JS::GlobalObject& global_object)
: NativeFunction(*global_object.function_prototype()) : NativeFunction(*global_object.function_prototype())
@ -69,4 +68,3 @@ JS::Value XMLHttpRequestConstructor::construct(JS::Interpreter& interpreter, Fun
} }
} }
}

View file

@ -28,8 +28,7 @@
#include <LibJS/Runtime/NativeFunction.h> #include <LibJS/Runtime/NativeFunction.h>
namespace Web { namespace Web::Bindings {
namespace Bindings {
class XMLHttpRequestConstructor final : public JS::NativeFunction { class XMLHttpRequestConstructor final : public JS::NativeFunction {
public: public:
@ -46,4 +45,3 @@ private:
}; };
} }
}

View file

@ -32,8 +32,7 @@
#include <LibWeb/Bindings/XMLHttpRequestWrapper.h> #include <LibWeb/Bindings/XMLHttpRequestWrapper.h>
#include <LibWeb/DOM/XMLHttpRequest.h> #include <LibWeb/DOM/XMLHttpRequest.h>
namespace Web { namespace Web::Bindings {
namespace Bindings {
XMLHttpRequestPrototype::XMLHttpRequestPrototype(JS::GlobalObject& global_object) XMLHttpRequestPrototype::XMLHttpRequestPrototype(JS::GlobalObject& global_object)
: Object(*global_object.object_prototype()) : Object(*global_object.object_prototype())
@ -112,4 +111,3 @@ JS_DEFINE_NATIVE_GETTER(XMLHttpRequestPrototype::response_text_getter)
} }
} }
}

View file

@ -28,8 +28,7 @@
#include <LibJS/Runtime/Object.h> #include <LibJS/Runtime/Object.h>
namespace Web { namespace Web::Bindings {
namespace Bindings {
class XMLHttpRequestPrototype final : public JS::Object { class XMLHttpRequestPrototype final : public JS::Object {
JS_OBJECT(XMLHttpRequestPrototype, JS::Object); JS_OBJECT(XMLHttpRequestPrototype, JS::Object);
@ -48,4 +47,3 @@ private:
}; };
} }
}

View file

@ -32,8 +32,7 @@
#include <LibWeb/Bindings/XMLHttpRequestWrapper.h> #include <LibWeb/Bindings/XMLHttpRequestWrapper.h>
#include <LibWeb/DOM/XMLHttpRequest.h> #include <LibWeb/DOM/XMLHttpRequest.h>
namespace Web { namespace Web::Bindings {
namespace Bindings {
XMLHttpRequestWrapper* wrap(JS::GlobalObject& global_object, XMLHttpRequest& impl) XMLHttpRequestWrapper* wrap(JS::GlobalObject& global_object, XMLHttpRequest& impl)
{ {
@ -61,4 +60,3 @@ const XMLHttpRequest& XMLHttpRequestWrapper::impl() const
} }
} }
}

View file

@ -28,8 +28,7 @@
#include <LibWeb/Bindings/EventTargetWrapper.h> #include <LibWeb/Bindings/EventTargetWrapper.h>
namespace Web { namespace Web::Bindings {
namespace Bindings {
class XMLHttpRequestWrapper final : public EventTargetWrapper { class XMLHttpRequestWrapper final : public EventTargetWrapper {
public: public:
@ -46,4 +45,3 @@ private:
XMLHttpRequestWrapper* wrap(JS::GlobalObject&, XMLHttpRequest&); XMLHttpRequestWrapper* wrap(JS::GlobalObject&, XMLHttpRequest&);
} }
}

View file

@ -26,8 +26,7 @@
#include <LibWeb/CSS/StyleSheetList.h> #include <LibWeb/CSS/StyleSheetList.h>
namespace Web { namespace Web::CSS {
namespace CSS {
void StyleSheetList::add_sheet(NonnullRefPtr<StyleSheet> sheet) void StyleSheetList::add_sheet(NonnullRefPtr<StyleSheet> sheet)
{ {
@ -40,4 +39,3 @@ StyleSheetList::StyleSheetList(Document& document)
} }
} }
}

View file

@ -29,8 +29,7 @@
#include <AK/RefCounted.h> #include <AK/RefCounted.h>
#include <LibWeb/CSS/StyleSheet.h> #include <LibWeb/CSS/StyleSheet.h>
namespace Web { namespace Web::CSS {
namespace CSS {
class StyleSheetList : public RefCounted<StyleSheetList> { class StyleSheetList : public RefCounted<StyleSheetList> {
public: public:
@ -51,4 +50,3 @@ private:
}; };
} }
}

View file

@ -36,13 +36,11 @@
#include <LibGfx/Color.h> #include <LibGfx/Color.h>
#include <LibWeb/CSS/Length.h> #include <LibWeb/CSS/Length.h>
#include <LibWeb/CSS/PropertyID.h> #include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/Forward.h>
#include <LibWeb/Loader/ImageResource.h> #include <LibWeb/Loader/ImageResource.h>
namespace Web { namespace Web::CSS {
class Document;
namespace CSS {
enum class ValueID { enum class ValueID {
Invalid, Invalid,
VendorSpecificLink, VendorSpecificLink,
@ -153,6 +151,8 @@ enum class Float {
} }
namespace Web {
class StyleValue : public RefCounted<StyleValue> { class StyleValue : public RefCounted<StyleValue> {
public: public:
virtual ~StyleValue(); virtual ~StyleValue();

View file

@ -61,8 +61,7 @@ int main(int argc, char** argv)
out() << "#include <AK/Assertions.h>"; out() << "#include <AK/Assertions.h>";
out() << "#include <LibWeb/CSS/PropertyID.h>"; out() << "#include <LibWeb/CSS/PropertyID.h>";
out() << "namespace Web {"; out() << "namespace Web::CSS {";
out() << "namespace CSS {";
out() << "PropertyID property_id_from_string(const StringView& string) {"; out() << "PropertyID property_id_from_string(const StringView& string) {";
@ -88,7 +87,6 @@ int main(int argc, char** argv)
out() << " }"; out() << " }";
out() << "}"; out() << "}";
out() << "}"; out() << "}";
out() << "}";
return 0; return 0;
} }

View file

@ -63,8 +63,7 @@ int main(int argc, char** argv)
out() << "#include <AK/StringView.h>"; out() << "#include <AK/StringView.h>";
out() << "#include <AK/Traits.h>"; out() << "#include <AK/Traits.h>";
out() << "namespace Web {"; out() << "namespace Web::CSS {";
out() << "namespace CSS {";
out() << "enum class PropertyID {"; out() << "enum class PropertyID {";
out() << " Invalid,"; out() << " Invalid,";
@ -77,7 +76,6 @@ int main(int argc, char** argv)
PropertyID property_id_from_string(const StringView&);\n\ PropertyID property_id_from_string(const StringView&);\n\
const char* string_from_property_id(PropertyID);\n\ const char* string_from_property_id(PropertyID);\n\
}\n\ }\n\
}\n\
\n\ \n\
namespace AK {\n\ namespace AK {\n\
template<>\n\ template<>\n\

View file

@ -75,7 +75,9 @@ class Window;
class XMLHttpRequest; class XMLHttpRequest;
enum class QuirksMode; enum class QuirksMode;
namespace Bindings { }
namespace Web::Bindings {
class CanvasRenderingContext2DWrapper; class CanvasRenderingContext2DWrapper;
class DocumentWrapper; class DocumentWrapper;
@ -99,5 +101,3 @@ class XMLHttpRequestPrototype;
class XMLHttpRequestWrapper; class XMLHttpRequestWrapper;
} }
}

View file

@ -29,9 +29,7 @@
#include <AK/NonnullRefPtr.h> #include <AK/NonnullRefPtr.h>
#include <LibWeb/CSS/StyleSheet.h> #include <LibWeb/CSS/StyleSheet.h>
namespace Web { namespace Web::CSS {
namespace CSS {
class ParsingContext { class ParsingContext {
public: public:
ParsingContext(); ParsingContext();
@ -44,6 +42,8 @@ private:
}; };
} }
namespace Web {
RefPtr<StyleSheet> parse_css(const CSS::ParsingContext&, const StringView&); RefPtr<StyleSheet> parse_css(const CSS::ParsingContext&, const StringView&);
RefPtr<StyleDeclaration> parse_css_declaration(const CSS::ParsingContext&, const StringView&); RefPtr<StyleDeclaration> parse_css_declaration(const CSS::ParsingContext&, const StringView&);
RefPtr<StyleValue> parse_css_value(const CSS::ParsingContext&, const StringView&); RefPtr<StyleValue> parse_css_value(const CSS::ParsingContext&, const StringView&);