1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:07:45 +00:00

LibWeb: Add initial version of pointer-events CSS property

This commit is contained in:
huwdp 2021-10-05 19:47:13 +01:00 committed by Linus Groh
parent fe5c2b7bb9
commit ec43f7a2b0
7 changed files with 53 additions and 7 deletions

View file

@ -33,6 +33,7 @@ public:
static CSS::AlignItems align_items() { return CSS::AlignItems::FlexStart; }
static CSS::Overflow overflow() { return CSS::Overflow::Visible; }
static CSS::BoxSizing box_sizing() { return CSS::BoxSizing::ContentBox; }
static CSS::PointerEvents pointer_events() { return CSS::PointerEvents::Auto; }
};
struct BorderData {
@ -64,6 +65,7 @@ public:
CSS::Float float_() const { return m_noninherited.float_; }
CSS::Clear clear() const { return m_noninherited.clear; }
CSS::Cursor cursor() const { return m_inherited.cursor; }
CSS::PointerEvents pointer_events() const { return m_inherited.pointer_events; }
CSS::Display display() const { return m_noninherited.display; }
Optional<int> const& z_index() const { return m_noninherited.z_index; }
CSS::TextAlign text_align() const { return m_inherited.text_align; }
@ -129,6 +131,7 @@ protected:
struct {
Color color { InitialValues::color() };
CSS::Cursor cursor { InitialValues::cursor() };
CSS::PointerEvents pointer_events { InitialValues::pointer_events() };
CSS::TextAlign text_align { InitialValues::text_align() };
CSS::TextTransform text_transform { InitialValues::text_transform() };
CSS::WhiteSpace white_space { InitialValues::white_space() };
@ -189,6 +192,7 @@ class MutableComputedValues final : public ComputedValues {
public:
void set_color(const Color& color) { m_inherited.color = color; }
void set_cursor(CSS::Cursor cursor) { m_inherited.cursor = cursor; }
void set_pointer_events(CSS::PointerEvents value) { m_inherited.pointer_events = value; }
void set_background_color(const Color& color) { m_noninherited.background_color = color; }
void set_background_repeat_x(CSS::Repeat repeat) { m_noninherited.background_repeat_x = repeat; }
void set_background_repeat_y(CSS::Repeat repeat) { m_noninherited.background_repeat_y = repeat; }

View file

@ -1073,7 +1073,11 @@
},
"pointer-events": {
"inherited": true,
"initial": "auto"
"initial": "auto",
"valid-identifiers": [
"auto",
"none"
]
},
"position": {
"inherited": false,

View file

@ -355,6 +355,22 @@ Optional<CSS::TextAlign> StyleProperties::text_align() const
}
}
Optional<CSS::PointerEvents> StyleProperties::pointer_events() const
{
auto value = property(CSS::PropertyID::PointerEvents);
if (!value.has_value())
return {};
switch (value.value()->to_identifier()) {
case CSS::ValueID::Auto:
return CSS::PointerEvents::Auto;
case CSS::ValueID::None:
return CSS::PointerEvents::None;
default:
return {};
}
}
Optional<CSS::WhiteSpace> StyleProperties::white_space() const
{
auto value = property(CSS::PropertyID::WhiteSpace);

View file

@ -67,6 +67,7 @@ public:
Optional<CSS::Repeat> background_repeat_y() const;
Optional<CSS::BoxShadowData> box_shadow() const;
CSS::BoxSizing box_sizing() const;
Optional<CSS::PointerEvents> pointer_events() const;
Vector<CSS::Transformation> transformations() const;

View file

@ -211,6 +211,11 @@ enum class WhiteSpace {
PreWrap,
};
enum class PointerEvents {
Auto,
None
};
class StyleValue : public RefCounted<StyleValue> {
public:
virtual ~StyleValue();