summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp
diff options
context:
space:
mode:
authorSimon Wanner <skyrising@pvpctutorials.de>2022-03-18 01:32:50 +0100
committerAndreas Kling <kling@serenityos.org>2022-03-18 18:51:42 +0100
commit48efdaa8c4c0c03a895bc788d46ff0e242be813f (patch)
tree32af1812e92928e082aedd6279065489555e72b8 /Userland/Libraries/LibWeb/Painting/PaintableBox.cpp
parenta2331e8dd387fee7f75f165df740aeb4a3069ab7 (diff)
downloadserenity-48efdaa8c4c0c03a895bc788d46ff0e242be813f.zip
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.
Diffstat (limited to 'Userland/Libraries/LibWeb/Painting/PaintableBox.cpp')
-rw-r--r--Userland/Libraries/LibWeb/Painting/PaintableBox.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp
index e0685a5b07..d1deb1f8da 100644
--- a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp
+++ b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp
@@ -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()) };