mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
LibWeb+WebContent+UI: Support image cursors
The `cursor` property accepts a list of possible cursors, which behave as a fallback: We use whichever cursor is the first available one. This is a little complicated because initially, any remote images have not loaded, so we need to use the fallback standard cursor, and then switch to another when it loads. So, ComputedValues stores a Vector of cursors, and then in EventHandler we scan down that list until we find a cursor that's ready for use. The spec defines cursors as being `<url>`, but allows for `<image>` instead. That includes functions like `linear-gradient()`. This commit implements image cursors in the Qt UI, but not AppKit.
This commit is contained in:
committed by
Andreas Kling
parent
fd2414ba35
commit
bfd7ac1204
@@ -450,7 +450,15 @@ static void copy_data_to_clipboard(StringView data, NSPasteboardType pasteboard_
|
||||
if (self == nil) {
|
||||
return;
|
||||
}
|
||||
if (cursor == Gfx::StandardCursor::Hidden) {
|
||||
if (!cursor.template has<Gfx::StandardCursor>()) {
|
||||
// FIXME: Implement image cursors in AppKit.
|
||||
[[NSCursor arrowCursor] set];
|
||||
return;
|
||||
}
|
||||
|
||||
auto standard_cursor = cursor.template get<Gfx::StandardCursor>();
|
||||
|
||||
if (standard_cursor == Gfx::StandardCursor::Hidden) {
|
||||
if (!m_hidden_cursor.has_value()) {
|
||||
m_hidden_cursor.emplace();
|
||||
}
|
||||
@@ -460,7 +468,7 @@ static void copy_data_to_clipboard(StringView data, NSPasteboardType pasteboard_
|
||||
|
||||
m_hidden_cursor.clear();
|
||||
|
||||
switch (cursor) {
|
||||
switch (standard_cursor) {
|
||||
case Gfx::StandardCursor::Arrow:
|
||||
[[NSCursor arrowCursor] set];
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user