diff options
author | Andreas Kling <kling@serenityos.org> | 2020-03-20 12:41:31 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-03-20 12:41:31 +0100 |
commit | 03ec57b271313e877352671fd7ccc234670c8ef0 (patch) | |
tree | f58221a865ae2fadb6afc02ff81d59cd641f2692 /Libraries/LibWeb | |
parent | 9e6e731a78e52847fbca52b4847cd5900dfcc6cf (diff) | |
download | serenity-03ec57b271313e877352671fd7ccc234670c8ef0.zip |
LibWeb: Make hit testing better for blocks with inline children
If we don't hit one of the inline children, we should still report that
we've hit the block itself.
Diffstat (limited to 'Libraries/LibWeb')
-rw-r--r-- | Libraries/LibWeb/Layout/LayoutBlock.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Libraries/LibWeb/Layout/LayoutBlock.cpp b/Libraries/LibWeb/Layout/LayoutBlock.cpp index 38d1e818ad..013f9f3d1b 100644 --- a/Libraries/LibWeb/Layout/LayoutBlock.cpp +++ b/Libraries/LibWeb/Layout/LayoutBlock.cpp @@ -359,7 +359,10 @@ HitTestResult LayoutBlock::hit_test(const Gfx::Point& position) const } } } - return {}; + + // FIXME: This should be smarter about the text position if we're hitting a block + // that has text inside it, but `position` is to the right of the text box. + return { rect().contains(position.x(), position.y()) ? this : nullptr }; } NonnullRefPtr<StyleProperties> LayoutBlock::style_for_anonymous_block() const |