Skip to content

Commit 4966fa4

Browse files
GingehAtkinsSJ
authored andcommitted
LibWeb: Prevent crash with custom cursor
We don't support custom cursors, use the default instead of crashing. Also clean up a bit of dead code from when Cursor was optional.
1 parent 7be78ec commit 4966fa4

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Libraries/LibWeb/CSS/ComputedProperties.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -953,6 +953,9 @@ ContentVisibility ComputedProperties::content_visibility() const
953953
Cursor ComputedProperties::cursor() const
954954
{
955955
auto const& value = property(PropertyID::Cursor);
956+
// FIXME: We don't currently support custom cursors.
957+
if (value.is_url())
958+
return Cursor::Auto;
956959
return keyword_to_cursor(value.to_keyword()).release_value();
957960
}
958961

Libraries/LibWeb/Page/EventHandler.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,9 @@ static bool parent_element_for_event_dispatch(Painting::Paintable& paintable, GC
8383
return node && layout_node;
8484
}
8585

86-
static Gfx::StandardCursor cursor_css_to_gfx(Optional<CSS::Cursor> cursor)
86+
static Gfx::StandardCursor cursor_css_to_gfx(CSS::Cursor cursor)
8787
{
88-
if (!cursor.has_value()) {
89-
return Gfx::StandardCursor::None;
90-
}
91-
switch (cursor.value()) {
88+
switch (cursor) {
9289
case CSS::Cursor::Crosshair:
9390
case CSS::Cursor::Cell:
9491
return Gfx::StandardCursor::Crosshair;

0 commit comments

Comments
 (0)