1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:18:12 +00:00

LibWeb: Add a "select all" action to the Web::PageView

This works by finding the very first and very last LayoutText nodes
in the layout tree and then setting the selection bounds to those two
nodes. For some reason it gets glitchy if we set the very first and
very last *LayoutNode* as the selection bounds, but I didn't feel like
investigating that too closely right now.
This commit is contained in:
Andreas Kling 2020-07-03 20:54:53 +02:00
parent eec22acb8e
commit f7ef6c65b4
2 changed files with 43 additions and 0 deletions

View file

@ -73,8 +73,11 @@ public:
virtual bool accepts_focus() const override { return true; }
GUI::Action& select_all_action() { return *m_select_all_action; }
GUI::Action& copy_action() { return *m_copy_action; }
String selected_text() const;
void select_all();
private:
PageView();
@ -119,6 +122,7 @@ private:
NonnullOwnPtr<Page> m_page;
RefPtr<GUI::Action> m_copy_action;
RefPtr<GUI::Action> m_select_all_action;
};
}