From dbece926376adbff23d2879ca3f0cc4db9f892e3 Mon Sep 17 00:00:00 2001 From: Psychpsyo Date: Tue, 6 May 2025 23:32:09 +0200 Subject: [PATCH] LibWeb: Make elements with 'opacity: 0' respond to hit-testing --- Libraries/LibWeb/Painting/PaintableBox.cpp | 2 +- .../css-filters-opacity-hit-testing.txt | 6 ++++++ .../css-filters-opacity-hit-testing.html | 19 +++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 Tests/LibWeb/Text/expected/wpt-import/css/filter-effects/css-filters-opacity-hit-testing.txt create mode 100644 Tests/LibWeb/Text/input/wpt-import/css/filter-effects/css-filters-opacity-hit-testing.html diff --git a/Libraries/LibWeb/Painting/PaintableBox.cpp b/Libraries/LibWeb/Painting/PaintableBox.cpp index bbb0b5ac654..69f9170ee33 100644 --- a/Libraries/LibWeb/Painting/PaintableBox.cpp +++ b/Libraries/LibWeb/Painting/PaintableBox.cpp @@ -1069,7 +1069,7 @@ TraversalDecision PaintableBox::hit_test(CSSPixelPoint position, HitTestType typ auto position_adjusted_by_scroll_offset = position.translated(-cumulative_offset_of_enclosing_scroll_frame()); - if (!is_visible()) + if (computed_values().visibility() != CSS::Visibility::Visible) return TraversalDecision::Continue; if (hit_test_scrollbars(position_adjusted_by_scroll_offset, callback) == TraversalDecision::Break) diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/filter-effects/css-filters-opacity-hit-testing.txt b/Tests/LibWeb/Text/expected/wpt-import/css/filter-effects/css-filters-opacity-hit-testing.txt new file mode 100644 index 00000000000..64395505734 --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/css/filter-effects/css-filters-opacity-hit-testing.txt @@ -0,0 +1,6 @@ +Harness status: OK + +Found 1 tests + +1 Pass +Pass Elements with 'opacity: 0' should respond to hit testing. \ No newline at end of file diff --git a/Tests/LibWeb/Text/input/wpt-import/css/filter-effects/css-filters-opacity-hit-testing.html b/Tests/LibWeb/Text/input/wpt-import/css/filter-effects/css-filters-opacity-hit-testing.html new file mode 100644 index 00000000000..add6959ba97 --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/css/filter-effects/css-filters-opacity-hit-testing.html @@ -0,0 +1,19 @@ + +Elements with 'opacity: 0' should respond to hit testing. + + + + + +
+