mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 17:58:18 +03:00
LibWeb: Add a CustomHasProperty trait to WrapperGenerator
We immediately use this in CSSStyleDeclaration to fix that "background" in element.style did not return true. This is the mechanism used in css3test.com for detecting support of features.
This commit is contained in:
parent
0b74cc4712
commit
e42eaa5d95
Notes:
sideshowbarker
2024-07-18 08:19:17 +09:00
Author: https://github.com/davidot Commit: https://github.com/SerenityOS/serenity/commit/e42eaa5d956 Pull-request: https://github.com/SerenityOS/serenity/pull/9016 Issue: https://github.com/SerenityOS/serenity/issues/8989 Reviewed-by: https://github.com/linusg ✅
@ -11,6 +11,13 @@
|
||||
|
||||
namespace Web::Bindings {
|
||||
|
||||
bool CSSStyleDeclarationWrapper::internal_has_property(JS::PropertyName const& name) const
|
||||
{
|
||||
// FIXME: These should actually use camelCase versions of the property names!
|
||||
auto property_id = CSS::property_id_from_string(name.to_string());
|
||||
return property_id != CSS::PropertyID::Invalid;
|
||||
}
|
||||
|
||||
JS::Value CSSStyleDeclarationWrapper::internal_get(const JS::PropertyName& name, JS::Value receiver) const
|
||||
{
|
||||
// FIXME: These should actually use camelCase versions of the property names!
|
||||
|
@ -1,4 +1,4 @@
|
||||
[CustomGet,CustomSet]
|
||||
[CustomGet,CustomSet,CustomHasProperty]
|
||||
interface CSSStyleDeclaration {
|
||||
|
||||
readonly attribute unsigned long length;
|
||||
|
@ -813,6 +813,12 @@ public:
|
||||
)~~~");
|
||||
}
|
||||
|
||||
if (interface.extended_attributes.contains("CustomHasProperty")) {
|
||||
generator.append(R"~~~(
|
||||
virtual bool internal_has_property(JS::PropertyName const&) const override;
|
||||
)~~~");
|
||||
}
|
||||
|
||||
if (interface.wrapper_base_class == "Wrapper") {
|
||||
generator.append(R"~~~(
|
||||
@fully_qualified_name@& impl() { return *m_impl; }
|
||||
|
Loading…
Reference in New Issue
Block a user