mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:38:10 +00:00
LibWeb: Update hit_test for CSS Transforms
This now also takes a FloatPoint instead of an IntPoint to avoid excessive rounding when multiple transforms apply on top of each other.
This commit is contained in:
parent
a2331e8dd3
commit
48efdaa8c4
7 changed files with 28 additions and 23 deletions
|
@ -526,7 +526,7 @@ void PaintableBox::for_each_child_in_paint_order(Callback callback) const
|
|||
});
|
||||
}
|
||||
|
||||
HitTestResult PaintableBox::hit_test(Gfx::IntPoint const& position, HitTestType type) const
|
||||
HitTestResult PaintableBox::hit_test(Gfx::FloatPoint const& position, HitTestType type) const
|
||||
{
|
||||
if (layout_box().is_initial_containing_block_box())
|
||||
return stacking_context()->hit_test(position, type);
|
||||
|
@ -542,7 +542,7 @@ HitTestResult PaintableBox::hit_test(Gfx::IntPoint const& position, HitTestType
|
|||
return result;
|
||||
}
|
||||
|
||||
HitTestResult PaintableWithLines::hit_test(const Gfx::IntPoint& position, HitTestType type) const
|
||||
HitTestResult PaintableWithLines::hit_test(const Gfx::FloatPoint& position, HitTestType type) const
|
||||
{
|
||||
if (!layout_box().children_are_inline())
|
||||
return PaintableBox::hit_test(position, type);
|
||||
|
@ -552,7 +552,7 @@ HitTestResult PaintableWithLines::hit_test(const Gfx::IntPoint& position, HitTes
|
|||
for (auto& fragment : line_box.fragments()) {
|
||||
if (is<Layout::Box>(fragment.layout_node()) && static_cast<Layout::Box const&>(fragment.layout_node()).paint_box()->stacking_context())
|
||||
continue;
|
||||
if (enclosing_int_rect(fragment.absolute_rect()).contains(position)) {
|
||||
if (fragment.absolute_rect().contains(position)) {
|
||||
if (is<Layout::BlockContainer>(fragment.layout_node()) && fragment.layout_node().paintable())
|
||||
return fragment.layout_node().paintable()->hit_test(position, type);
|
||||
return { fragment.layout_node().paintable(), fragment.text_index_at(position.x()) };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue