Skip to content

Fix #5154: InteractionDialog popup clips content when reserving arrow space#5155

Merged
shai-almog merged 3 commits into
masterfrom
fix-5154-interactiondialog-arrow-squeeze
Jun 3, 2026
Merged

Fix #5154: InteractionDialog popup clips content when reserving arrow space#5155
shai-almog merged 3 commits into
masterfrom
fix-5154-interactiondialog-arrow-squeeze

Conversation

@shai-almog
Copy link
Copy Markdown
Collaborator

Problem

InteractionDialog.showPopupDialog(...) shows content (e.g. a multi-line TextArea) clipped/scrollable — the last line(s) are cut off. The reporter (#5154) noticed that during a slowed-down animation the dialog first appears full size with no room for the pointing arrow, then shrinks to make room for the arrow, but the content is never resized to compensate.

Root cause

In showPopupDialogImpl, the preferred height is measured before any arrow space exists:

  • prefHeight = getPreferredH() is computed with no arrow allowance.
  • Each vertical arrow branch then calls padOrientation(contentPaneStyle, <edge>, 1) to add the arrow inset to the dialog's own style padding, calls show(...), then removes the padding with padOrientation(..., -1).

show() runs getLayeredPane(f).animateLayout(...), which captures the laid-out child bounds as the animation target. With the padding active, the content pane's target is arrowInset px shorter — and that squeezed layout is what gets committed. Removing the padding on the next line does not trigger a relayout, so the content pane stays short. Meanwhile the dialog height handed to show() is min(prefHeight, space), which never included the arrow inset, so the dialog never grew to compensate. Net: the arrow takes its space out of the content pane.

Fix

padOrientation now returns the actual pixel inset it applied (measured via Style.getPadding(rtl, orientation)). Each of the four vertical arrow branches adds that inset to the dialog height (and adjusts y for the bottom-anchored fallback), so the dialog grows by the arrow thickness instead of stealing it from the content. The min(..., space) caps are preserved, so the dialog still can't exceed the available area.

Testing

  • mvn -pl core compile -Plocal-dev-javase → BUILD SUCCESS.

Fixes #5154

🤖 Generated with Claude Code

…'t clipped

showPopupDialogImpl reserves space for the pointing arrow by temporarily
padding the dialog style (padOrientation) around the show() call. show()
bakes the layout into the animation target, so the reserved space sticks --
but the height handed to show() was computed from prefHeight, which never
accounted for the arrow. The dialog therefore stayed at content height while
the content pane lost the arrow inset, clipping the last lines of a TextArea
and making it scrollable.

padOrientation now returns the actual pixel inset it applied, and each of the
four vertical arrow branches adds that inset to the dialog height (adjusting y
where the popup is bottom-anchored). The arrow gets its space by growing the
dialog instead of squeezing the content.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

Cloudflare Preview

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented Jun 3, 2026

Compared 122 screenshots: 122 matched.

Native Android coverage

  • 📊 Line coverage: 12.95% (7720/59625 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 10.49% (38280/364914), branch 4.51% (1550/34402), complexity 5.52% (1820/32974), method 9.67% (1491/15413), class 15.79% (341/2159)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/730 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)
      • kotlinx.coroutines.kotlinx.coroutines.JobSupport – 0.00% (0/423 lines covered)

✅ Native Android screenshot tests passed.

Native Android coverage

  • 📊 Line coverage: 12.95% (7720/59625 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 10.49% (38280/364914), branch 4.51% (1550/34402), complexity 5.52% (1820/32974), method 9.67% (1491/15413), class 15.79% (341/2159)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/730 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)
      • kotlinx.coroutines.kotlinx.coroutines.JobSupport – 0.00% (0/423 lines covered)

Benchmark Results

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 1006.000 ms
Base64 CN1 encode 211.000 ms
Base64 encode ratio (CN1/native) 0.210x (79.0% faster)
Base64 native decode 747.000 ms
Base64 CN1 decode 200.000 ms
Base64 decode ratio (CN1/native) 0.268x (73.2% faster)
Image encode benchmark status skipped (SIMD unsupported)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

✅ Continuous Quality Report

Test & Coverage

Static Analysis

  • SpotBugs [Report archive]
    • ByteCodeTranslator: 0 findings (no issues)
    • android: 0 findings (no issues)
    • codenameone-maven-plugin: 0 findings (no issues)
    • core-unittests: 0 findings (no issues)
    • ios: 0 findings (no issues)
  • PMD: 0 findings (no issues) [Report archive]
  • Checkstyle: 0 findings (no issues) [Report archive]

Generated automatically by the PR CI workflow.

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented Jun 3, 2026

Compared 122 screenshots: 122 matched.
✅ Native Mac screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 160 seconds

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 887.000 ms
Base64 CN1 encode 1777.000 ms
Base64 encode ratio (CN1/native) 2.003x (100.3% slower)
Base64 native decode 531.000 ms
Base64 CN1 decode 1320.000 ms
Base64 decode ratio (CN1/native) 2.486x (148.6% slower)
Base64 SIMD encode 506.000 ms
Base64 encode ratio (SIMD/native) 0.570x (43.0% faster)
Base64 encode ratio (SIMD/CN1) 0.285x (71.5% faster)
Base64 SIMD decode 476.000 ms
Base64 decode ratio (SIMD/native) 0.896x (10.4% faster)
Base64 decode ratio (SIMD/CN1) 0.361x (63.9% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 72.000 ms
Image createMask (SIMD on) 15.000 ms
Image createMask ratio (SIMD on/off) 0.208x (79.2% faster)
Image applyMask (SIMD off) 168.000 ms
Image applyMask (SIMD on) 86.000 ms
Image applyMask ratio (SIMD on/off) 0.512x (48.8% faster)
Image modifyAlpha (SIMD off) 202.000 ms
Image modifyAlpha (SIMD on) 122.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.604x (39.6% faster)
Image modifyAlpha removeColor (SIMD off) 243.000 ms
Image modifyAlpha removeColor (SIMD on) 104.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.428x (57.2% faster)
Image PNG encode (SIMD off) 1995.000 ms
Image PNG encode (SIMD on) 1435.000 ms
Image PNG encode ratio (SIMD on/off) 0.719x (28.1% faster)
Image JPEG encode 977.000 ms

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented Jun 3, 2026

Compared 122 screenshots: 122 matched.
✅ Native iOS Metal screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 304 seconds

Build and Run Timing

Metric Duration
Simulator Boot 100000 ms
Simulator Boot (Run) 1000 ms
App Install 16000 ms
App Launch 4000 ms
Test Execution 309000 ms

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 1021.000 ms
Base64 CN1 encode 2254.000 ms
Base64 encode ratio (CN1/native) 2.208x (120.8% slower)
Base64 native decode 460.000 ms
Base64 CN1 decode 1384.000 ms
Base64 decode ratio (CN1/native) 3.009x (200.9% slower)
Base64 SIMD encode 603.000 ms
Base64 encode ratio (SIMD/native) 0.591x (40.9% faster)
Base64 encode ratio (SIMD/CN1) 0.268x (73.2% faster)
Base64 SIMD decode 541.000 ms
Base64 decode ratio (SIMD/native) 1.176x (17.6% slower)
Base64 decode ratio (SIMD/CN1) 0.391x (60.9% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 96.000 ms
Image createMask (SIMD on) 32.000 ms
Image createMask ratio (SIMD on/off) 0.333x (66.7% faster)
Image applyMask (SIMD off) 275.000 ms
Image applyMask (SIMD on) 172.000 ms
Image applyMask ratio (SIMD on/off) 0.625x (37.5% faster)
Image modifyAlpha (SIMD off) 239.000 ms
Image modifyAlpha (SIMD on) 117.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.490x (51.0% faster)
Image modifyAlpha removeColor (SIMD off) 394.000 ms
Image modifyAlpha removeColor (SIMD on) 133.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.338x (66.2% faster)
Image PNG encode (SIMD off) 3903.000 ms
Image PNG encode (SIMD on) 1772.000 ms
Image PNG encode ratio (SIMD on/off) 0.454x (54.6% faster)
Image JPEG encode 1323.000 ms

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented Jun 3, 2026

Compared 122 screenshots: 122 matched.
✅ Native iOS screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 174 seconds

Build and Run Timing

Metric Duration
Simulator Boot 66000 ms
Simulator Boot (Run) 0 ms
App Install 12000 ms
App Launch 4000 ms
Test Execution 288000 ms

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 665.000 ms
Base64 CN1 encode 1626.000 ms
Base64 encode ratio (CN1/native) 2.445x (144.5% slower)
Base64 native decode 293.000 ms
Base64 CN1 decode 886.000 ms
Base64 decode ratio (CN1/native) 3.024x (202.4% slower)
Base64 SIMD encode 414.000 ms
Base64 encode ratio (SIMD/native) 0.623x (37.7% faster)
Base64 encode ratio (SIMD/CN1) 0.255x (74.5% faster)
Base64 SIMD decode 439.000 ms
Base64 decode ratio (SIMD/native) 1.498x (49.8% slower)
Base64 decode ratio (SIMD/CN1) 0.495x (50.5% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 59.000 ms
Image createMask (SIMD on) 9.000 ms
Image createMask ratio (SIMD on/off) 0.153x (84.7% faster)
Image applyMask (SIMD off) 124.000 ms
Image applyMask (SIMD on) 59.000 ms
Image applyMask ratio (SIMD on/off) 0.476x (52.4% faster)
Image modifyAlpha (SIMD off) 125.000 ms
Image modifyAlpha (SIMD on) 67.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.536x (46.4% faster)
Image modifyAlpha removeColor (SIMD off) 147.000 ms
Image modifyAlpha removeColor (SIMD on) 70.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.476x (52.4% faster)
Image PNG encode (SIMD off) 1022.000 ms
Image PNG encode (SIMD on) 2146.000 ms
Image PNG encode ratio (SIMD on/off) 2.100x (110.0% slower)
Image JPEG encode 555.000 ms

shai-almog and others added 2 commits June 3, 2026 11:18
The InteractionDialog arrow-space fix grows the popup by the arrow inset
instead of stealing it from the content pane, shifting the picker popup
content down by ~one convertToPixels(1). Regenerate the five affected
mac-native goldens (LightweightPickerButtons*, ValidatorLightweightPicker)
from the post-fix CI render of run 26872572558.

These five popup-arrow tests were the only mac-native screenshots that
differed (117/122 matched). build-ios, build-ios-metal, Android and
native-ios all passed unchanged with the combined fix in place, so their
goldens are untouched.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@shai-almog shai-almog merged commit 84a1cb1 into master Jun 3, 2026
26 checks passed
@shai-almog shai-almog deleted the fix-5154-interactiondialog-arrow-squeeze branch June 3, 2026 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

InteractionDialog: resizing to add the arrow seems to happen after sizing the ID content

1 participant