Skip to content

Fix issue #14: OSR mouse wheel scroll direction is inverted - #37

Merged
Thrameos merged 2 commits into
masterfrom
backport/osr-wheel-direction
Sep 6, 2026
Merged

Thrameos merged 2 commits into
masterfrom
backport/osr-wheel-direction

Conversation

@Thrameos

@Thrameos Thrameos commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Closes #14 (matches upstream chromiumembedded#26)

Summary

  • N_SendMouseWheelEvent (native/CefBrowser_N.cpp) passed the raw AWT MouseWheelEvent.getWheelRotation()/getUnitsToScroll() value straight through as CefMouseEvent's deltaX/deltaY with no sign adjustment.
  • AWT's convention (positive rotation/units = scroll content down/right) is the opposite of CefMouseEvent's deltaX/deltaY convention for the same gesture.
  • Fixed by negating delta before assigning it, covering both the vertical (WHEEL_UNIT_SCROLL/WHEEL_BLOCK_SCROLL) and Shift-held horizontal paths.

Test plan

  • Added OsrMouseWheelDirectionTest: dispatches a synthetic AWT wheel event with a positive rotation against an OSR browser and asserts window.scrollY increases. master has no shared-browser test harness, so this is a minimal standalone test built directly on TestFrame rather than depending on that infrastructure.
  • Rebuilt libjcef.so cleanly (ninja jcef), zero compile errors.
  • Full local suite run: 124/124 tests passing, including the new regression test.

Small, focused backport of a single self-contained fix (no other changes bundled in), following the same shape as PR #1 and #36.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HBFmQs6JDypYP5qdC99yDq

Comment thread java/tests/junittests/OsrMouseWheelDirectionTest.java Fixed
Comment thread java/tests/junittests/OsrMouseWheelDirectionTest.java Fixed
@codecov

codecov Bot commented Sep 5, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.48780% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.25%. Comparing base (be68fe1) to head (47c4bb9).

Files with missing lines Patch % Lines
...a/tests/junittests/OsrMouseWheelDirectionTest.java 82.05% 4 Missing and 3 partials ⚠️
native/CefBrowser_N.cpp 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master      #37      +/-   ##
============================================
+ Coverage     38.01%   38.25%   +0.24%     
- Complexity      735      736       +1     
============================================
  Files           243      244       +1     
  Lines         14863    14902      +39     
  Branches       2449     2453       +4     
============================================
+ Hits           5650     5701      +51     
+ Misses         8011     7983      -28     
- Partials       1202     1218      +16     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Thrameos Thrameos mentioned this pull request Sep 5, 2026
3 tasks done
Thrameos and others added 2 commits September 5, 2026 14:23
N_SendMouseWheelEvent passed the raw AWT MouseWheelEvent.getWheelRotation()/
getUnitsToScroll() value straight through as CefMouseEvent's deltaX/deltaY
with no sign adjustment. AWT's convention (positive rotation/units =
scroll content down/right) is the opposite of CefMouseEvent's deltaX/
deltaY convention for the same gesture. Negate delta before assigning
it to deltaX/deltaY, covering both the vertical (WHEEL_UNIT_SCROLL/
WHEEL_BLOCK_SCROLL) and Shift-held horizontal paths.

Adds OsrMouseWheelDirectionTest, a minimal standalone regression test
(master has no shared-browser test harness, so this uses TestFrame
directly rather than depending on that infrastructure): dispatches a
synthetic AWT wheel event with a positive rotation against an OSR
browser and asserts window.scrollY increases. Verified against a full
local suite run (124/124 passing).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HBFmQs6JDypYP5qdC99yDq
CodeQL flagged both Double.parseDouble() calls in the onTitleChange
callback as an uncaught-NumberFormatException risk (chromiumembedded#263, chromiumembedded#264). An
exception there would escape on CEF's native callback thread instead of
failing the test cleanly. Catch it and leave the corresponding flag
unset so the existing post-awaitCompletion assertions report a normal
test failure instead.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HBFmQs6JDypYP5qdC99yDq
@Thrameos
Thrameos force-pushed the backport/osr-wheel-direction branch from 17baafc to 47c4bb9 Compare September 5, 2026 21:23
@Thrameos Thrameos added the bug Something isn't working label Sep 6, 2026
@Thrameos
Thrameos merged commit dbb3240 into master Sep 6, 2026
9 checks passed
@Thrameos
Thrameos deleted the backport/osr-wheel-direction branch September 6, 2026 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OSR mouse wheel scroll direction is inverted (matches upstream #26)

2 participants