Skip to content

Make the layout spy report readable and its warnings trustworthy - #2423

Open
vogella wants to merge 2 commits into
eclipse-pde:masterfrom
vogella:layout-spy-report
Open

Make the layout spy report readable and its warnings trustworthy#2423
vogella wants to merge 2 commits into
eclipse-pde:masterfrom
vogella:layout-spy-report

Conversation

@vogella

@vogella vogella commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

The widget report copied out of the layout spy was mostly boilerplate, and the warnings next to it fired on intended states often enough that they could not be followed. This reworks both sides.

Warnings now only appear where something is actually wrong: isVisible() is transitive, so one hidden ancestor used to stamp its warning onto every descendant and is now reported once at the node that is really hidden; a control excluded from its layout or sitting behind the topControl of a StackLayout becomes a note rather than three warnings; and a vertically scrollable control is no longer warned about being smaller than its content. All applicable reasons are collected instead of only the first, and the geometric warnings name the sibling they overlap and the bounds they fall outside of. The lines that repeated on every node (font, hint adjustments, the three computeSize lines, null layout data under a FillLayout) only appear when they carry information.

Every composite additionally reports what its children ask for against the room they get. That is where a layout error becomes visible first, it names the composite to fix instead of the widget that came out wrong, and it is the only check that works for a manually positioned composite, whose own computeSize says nothing about its content.

The report also gained the things a reader needs to act on it: an environment header, because pixel values mean nothing without the scaling factor and the windowing backend, a summary with the control count and the warnings grouped by kind, and an address per node such as @.3.1 that the summary points at. Widgets are identifiable through their text, the owning e4 model element and their CSS class and id, tab folders and tool bars list their items, and style bits are rendered as SWT constant names, looked up per widget class because the bits are not globally unique.

Builds on #2422 and should be merged after it.

The layout section of the widget details and of the copied widget tree
stayed empty for composites without a layout, which reads like a defect
in the spy rather than like information about the widget. Print
getLayout() == null instead, mirroring the getLayoutData() == null line
right above it, and leave the section out entirely for leaf controls,
where it only repeated that the control is not a composite.

Also fix the truncation check for grid layouts, which intersected the
parent bounds with themselves instead of with the child bounds. The
intersection was therefore always equal to the child rectangle and the
warnings about missing grab flags could never appear.
@github-actions

github-actions Bot commented Aug 16, 2026

Copy link
Copy Markdown

Test Results

  125 files  ±0    125 suites  ±0   35m 47s ⏱️ + 6m 39s
3 534 tests ±0  3 479 ✅ ±0   54 💤 ±0  1 ❌ ±0 
7 266 runs  ±0  7 159 ✅ ±0  106 💤 ±0  1 ❌ ±0 

For more details on these failures, see this check.

Results for commit 48492f1. ± Comparison against base commit ae96885.

♻️ This comment has been updated with latest results.

The copied widget report was dominated by lines that repeat on every
node, and the warnings next to them fired often enough on intended
states that they could not be followed. Both together made the report
hard to use for the bug reports it exists for.

Warnings now only fire where something is actually wrong. isVisible()
is transitive, so a single hidden ancestor used to stamp its warning
onto every descendant; it is now reported once at the node that is
really hidden. A control excluded from its layout or sitting behind the
topControl of a StackLayout is reported as a note instead of as three
warnings about being invisible, having no size and being smaller than
its preferred size. A vertically scrollable control is no longer warned
about being smaller than its content, which is what scrolling means.
All applicable reasons are collected instead of only the first, and the
geometric warnings name the sibling they overlap and the bounds they
fall outside of.

Every composite now reports what its children ask for against the room
they are given. A layout error shows up there before it shows up on any
single control, and unlike the per-control checks it names the
composite to fix rather than the widget that came out wrong. It is also
the only check that works for a manually positioned composite, whose
computeSize says nothing about its content.

The repeated lines are gone: the font only when it differs from the
parent, the hint adjustments only when non-zero, the three computeSize
lines only when they disagree with the assigned bounds, and the layout
data only when the layout of the parent actually reads it.

The report starts with the environment it was taken in, because pixel
values cannot be interpreted without the scaling factor and the
windowing backend, followed by the control count and the warnings
grouped by kind. Every node carries an address such as @.3.1 that the
summary points at.

Widgets are identifiable now: the node line carries the widget text,
the owning e4 model element and the CSS class and id, tab folders and
tool bars list their items, and style bits are rendered as SWT constant
names. Names are looked up per widget class because the bits are not
globally unique, for example SWT.H_SCROLL and SWT.HORIZONTAL share one
bit. Layout references such as StackLayout.topControl resolve to a
child index, orientation constants are named, and identity hashes are
stripped so two reports can be compared with a diff.
@vogella
vogella force-pushed the layout-spy-report branch from 4043ae7 to 48492f1 Compare August 16, 2026 08:24
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.

1 participant