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

LibHTML: Make hit testing work for LayoutText

LayoutText can't simply rely on its LayoutNode::rect() for hit testing.
Instead, we have to iterate over the individual runs and see if we're
hitting any of them.

Also, LayoutNode::hit_test() now always recurses into children, since
we can't trust the rect() to tell the truth (inline rects are wrong.)
This commit is contained in:
Andreas Kling 2019-09-29 11:32:00 +02:00
parent aac8b091a4
commit 13860e4dd8
3 changed files with 46 additions and 12 deletions

View file

@ -26,7 +26,12 @@ public:
const Vector<Run>& runs() const { return m_runs; }
virtual HitTestResult hit_test(const Point&) const override;
private:
template<typename Callback>
void for_each_run(Callback) const;
void load_font();
void compute_runs();