mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:28:11 +00:00
LibWeb: Add a blinking text cursor :^)
Each Web::Frame now has a cursor that sits at a DOM::Position. It will blink and look like a nice regular text cursor. It doesn't really do anything yet, but it will eventually.
This commit is contained in:
parent
e496a74bb3
commit
2c679d0c8b
5 changed files with 66 additions and 0 deletions
|
@ -30,9 +30,11 @@
|
|||
#include <AK/Noncopyable.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/WeakPtr.h>
|
||||
#include <LibCore/Timer.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Rect.h>
|
||||
#include <LibGfx/Size.h>
|
||||
#include <LibWeb/DOM/Position.h>
|
||||
#include <LibWeb/Loader/FrameLoader.h>
|
||||
#include <LibWeb/Page/EventHandler.h>
|
||||
#include <LibWeb/TreeNode.h>
|
||||
|
@ -83,10 +85,17 @@ public:
|
|||
Gfx::IntPoint to_main_frame_position(const Gfx::IntPoint&);
|
||||
Gfx::IntRect to_main_frame_rect(const Gfx::IntRect&);
|
||||
|
||||
const DOM::Position& cursor_position() const { return m_cursor_position; }
|
||||
void set_cursor_position(const DOM::Position&);
|
||||
|
||||
bool cursor_blink_state() const { return m_cursor_blink_state; }
|
||||
|
||||
private:
|
||||
explicit Frame(DOM::Element& host_element, Frame& main_frame);
|
||||
explicit Frame(Page&);
|
||||
|
||||
void setup();
|
||||
|
||||
Page& m_page;
|
||||
Frame& m_main_frame;
|
||||
|
||||
|
@ -97,6 +106,10 @@ private:
|
|||
RefPtr<DOM::Document> m_document;
|
||||
Gfx::IntSize m_size;
|
||||
Gfx::IntRect m_viewport_rect;
|
||||
|
||||
DOM::Position m_cursor_position;
|
||||
RefPtr<Core::Timer> m_cursor_blink_timer;
|
||||
bool m_cursor_blink_state { false };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue