mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 01:37:39 +03:00
521ed0e911
We have two known PlatformObjects that need to implement some of the behavior of LegacyPlatformObjects to date: Window, and HTMLFormElement. To make this not require double (or virtual) inheritance of PlatformObject, move the behavior of LegacyPlatformObject into PlatformObject. The selection of LegacyPlatformObject behavior is done with a new bitfield of feature flags instead of a dozen virtual functions that return bool. This change simplifies every class involved in the diff with the notable exception of Window, which now needs some ugly const casts to implement named property access.
36 lines
817 B
C++
36 lines
817 B
C++
/*
|
|
* Copyright (c) 2023, Luke Wilde <lukew@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibWeb/Bindings/PlatformObject.h>
|
|
|
|
namespace Web::HTML {
|
|
|
|
// https://html.spec.whatwg.org/multipage/system-state.html#mimetype
|
|
class MimeType : public Bindings::PlatformObject {
|
|
WEB_PLATFORM_OBJECT(MimeType, Bindings::PlatformObject);
|
|
JS_DECLARE_ALLOCATOR(MimeType);
|
|
|
|
public:
|
|
virtual ~MimeType() override;
|
|
|
|
String const& type() const;
|
|
String description() const;
|
|
String const& suffixes() const;
|
|
JS::NonnullGCPtr<Plugin> enabled_plugin() const;
|
|
|
|
private:
|
|
MimeType(JS::Realm&, String type);
|
|
|
|
virtual void initialize(JS::Realm&) override;
|
|
|
|
// https://html.spec.whatwg.org/multipage/system-state.html#concept-mimetype-type
|
|
String m_type;
|
|
};
|
|
|
|
}
|