mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:57:43 +00:00
LibWeb: Make hit-testing work with display: inline-block;
When hit testing encountered a block with inline children, we assumed that the inline children are nothing but text boxes. An inline-block box is actually a block child of a block with inline children, so we have to handle that scenario as well. :^) Fixes #2353.
This commit is contained in:
parent
a01fd7ecc5
commit
634ce37663
3 changed files with 18 additions and 0 deletions
|
@ -391,6 +391,8 @@ HitTestResult LayoutBlock::hit_test(const Gfx::Point& position) const
|
|||
for (auto& line_box : m_line_boxes) {
|
||||
for (auto& fragment : line_box.fragments()) {
|
||||
if (enclosing_int_rect(fragment.rect()).contains(position)) {
|
||||
if (fragment.layout_node().is_block())
|
||||
return to<LayoutBlock>(fragment.layout_node()).hit_test(position);
|
||||
return { fragment.layout_node(), fragment.text_index_at(position.x()) };
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue