mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-18 08:20:44 +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
|
@ -127,8 +127,8 @@ public:
|
|||
bool is_in_tooltip_area() const { return m_is_in_tooltip_area; }
|
||||
void set_is_in_tooltip_area(bool b) { m_is_in_tooltip_area = b; }
|
||||
|
||||
Gfx::StandardCursor current_cursor() const { return m_current_cursor; }
|
||||
void set_current_cursor(Gfx::StandardCursor cursor) { m_current_cursor = cursor; }
|
||||
Gfx::Cursor current_cursor() const { return m_current_cursor; }
|
||||
void set_current_cursor(Gfx::Cursor cursor) { m_current_cursor = move(cursor); }
|
||||
|
||||
DevicePixelPoint window_position() const { return m_window_position; }
|
||||
void set_window_position(DevicePixelPoint position) { m_window_position = position; }
|
||||
|
@ -258,7 +258,7 @@ private:
|
|||
bool m_is_hovering_link { false };
|
||||
bool m_is_in_tooltip_area { false };
|
||||
|
||||
Gfx::StandardCursor m_current_cursor { Gfx::StandardCursor::Arrow };
|
||||
Gfx::Cursor m_current_cursor { Gfx::StandardCursor::Arrow };
|
||||
|
||||
DevicePixelPoint m_window_position {};
|
||||
DevicePixelSize m_window_size {};
|
||||
|
@ -338,7 +338,7 @@ public:
|
|||
virtual void page_did_create_new_document(Web::DOM::Document&) { }
|
||||
virtual void page_did_change_active_document_in_top_level_browsing_context(Web::DOM::Document&) { }
|
||||
virtual void page_did_finish_loading(URL::URL const&) { }
|
||||
virtual void page_did_request_cursor_change(Gfx::StandardCursor) { }
|
||||
virtual void page_did_request_cursor_change(Gfx::Cursor const&) { }
|
||||
virtual void page_did_request_context_menu(CSSPixelPoint) { }
|
||||
virtual void page_did_request_link_context_menu(CSSPixelPoint, URL::URL const&, [[maybe_unused]] ByteString const& target, [[maybe_unused]] unsigned modifiers) { }
|
||||
virtual void page_did_request_image_context_menu(CSSPixelPoint, URL::URL const&, [[maybe_unused]] ByteString const& target, [[maybe_unused]] unsigned modifiers, Optional<Gfx::Bitmap const*>) { }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue