mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 01:45:07 +00:00
LibHTML: Build some foundation for text selection
Add LayoutPosition and LayoutRange classes. The layout tree root node now has a selection() LayoutRange. It's essentially a start and end LayoutPosition. A LayoutPosition is a LayoutNode, and an optional index into that node. The index is only relevant for text nodes, where it's the character index into the rendered text. HtmlView now updates the selection start/end of the LayoutDocument when clicking and dragging with the left mouse button. We don't paint the selection yet, and there's no way to copy what's selected. It only exists as a LayoutRange.
This commit is contained in:
parent
2755184e11
commit
f3f0b08d43
8 changed files with 119 additions and 2 deletions
|
@ -43,12 +43,15 @@ protected:
|
|||
virtual void paint_event(GPaintEvent&) override;
|
||||
virtual void mousemove_event(GMouseEvent&) override;
|
||||
virtual void mousedown_event(GMouseEvent&) override;
|
||||
virtual void mouseup_event(GMouseEvent&) override;
|
||||
virtual void keydown_event(GKeyEvent&) override;
|
||||
|
||||
private:
|
||||
void layout_and_sync_size();
|
||||
void dump_selection(const char* event_name);
|
||||
|
||||
RefPtr<Frame> m_main_frame;
|
||||
|
||||
bool m_should_show_line_box_borders { false };
|
||||
bool m_in_mouse_selection { false };
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue