mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 06:48:49 +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:
parent
fd2414ba35
commit
bfd7ac1204
Notes:
github-actions[bot]
2025-02-28 12:51:27 +00:00
Author: https://github.com/AtkinsSJ
Commit: bfd7ac1204
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3644
20 changed files with 297 additions and 170 deletions
|
@ -123,16 +123,11 @@ void WebContentClient::did_request_refresh(u64 page_id)
|
|||
view->reload();
|
||||
}
|
||||
|
||||
void WebContentClient::did_request_cursor_change(u64 page_id, i32 cursor_type)
|
||||
void WebContentClient::did_request_cursor_change(u64 page_id, Gfx::Cursor const& cursor)
|
||||
{
|
||||
if (cursor_type < 0 || cursor_type >= (i32)Gfx::StandardCursor::__Count) {
|
||||
dbgln("DidRequestCursorChange: Bad cursor type");
|
||||
return;
|
||||
}
|
||||
|
||||
if (auto view = view_for_page_id(page_id); view.has_value()) {
|
||||
if (view->on_cursor_change)
|
||||
view->on_cursor_change(static_cast<Gfx::StandardCursor>(cursor_type));
|
||||
view->on_cursor_change(cursor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue