mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-05 00:56:39 +00:00
LibWeb/CSS: Return 0 from CSSRule.type for non-spec types
We use the CSSRule::Type enum for identifying the type of a CSSRule, but the spec requires that only some of these types are exposed via the `type` attribute. For the rest, we're required to return 0, so let's do so. :^)
This commit is contained in:
parent
4998385c7a
commit
51fc87bc1b
Notes:
github-actions[bot]
2024-10-30 17:46:59 +00:00
Author: https://github.com/AtkinsSJ
Commit: 51fc87bc1b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2058
5 changed files with 50 additions and 3 deletions
|
@ -12,6 +12,7 @@
|
|||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <LibWeb/CSS/CSSStyleDeclaration.h>
|
||||
#include <LibWeb/CSS/Selector.h>
|
||||
#include <LibWeb/WebIDL/Types.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
|
@ -22,7 +23,7 @@ public:
|
|||
virtual ~CSSRule() = default;
|
||||
|
||||
// https://drafts.csswg.org/cssom/#dom-cssrule-type
|
||||
enum class Type : u16 {
|
||||
enum class Type : WebIDL::UnsignedShort {
|
||||
Style = 1,
|
||||
Import = 3,
|
||||
Media = 4,
|
||||
|
@ -35,10 +36,11 @@ public:
|
|||
LayerBlock = 100,
|
||||
LayerStatement = 101,
|
||||
NestedDeclarations = 102,
|
||||
Property = 103, // FIXME: This should return `0` as a type, but type is used for a lot of dispatching
|
||||
Property = 103,
|
||||
};
|
||||
|
||||
Type type() const { return m_type; }
|
||||
WebIDL::UnsignedShort type_for_bindings() const;
|
||||
|
||||
String css_text() const;
|
||||
void set_css_text(StringView);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue