Bug 544275 - [Win32] Unreadable overlay treeItem in trees with themes
Summary: [Win32] Unreadable overlay treeItem in trees with themes
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.10   Edit
Hardware: PC Windows 10
: P3 normal with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-08 06:37 EST by Tiago Pocinho CLA
Modified: 2020-05-26 09:50 EDT (History)
0 users

See Also:


Attachments
Overlay element foreground color issue (white on white background) (86.66 KB, image/png)
2019-02-08 06:37 EST, Tiago Pocinho CLA
no flags Details
Overlay element foreground color issue (light blue on white background) (87.04 KB, image/png)
2019-02-08 06:38 EST, Tiago Pocinho CLA
no flags Details
Overlay element foreground painted over with TreeItem (87.66 KB, image/png)
2019-02-08 06:39 EST, Tiago Pocinho CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tiago Pocinho CLA 2019-02-08 06:37:46 EST
Created attachment 277511 [details]
Overlay element foreground color issue (white on white background)

When we specify the css properties for the tree

Tree {
	swt-selection-foreground-color: white;
	swt-selection-background-color: black;
}

we can see that when the tree does not have enough space to render the TreeItem, the overlapping item that appears on mouse over displays the selection foreground, and not the tree foreground, ignoring the background. 
This means that in cases where the foreground is almost the same color as this overlay background we cannot read the text properly.
In some cases it seems that this element takes the border color, others the selection foreground color.

This is visible in eclipse's dark theme as in the attached screenshots.

This seems to be introduced with the AbstractControlSelectionEraseListener (in this case extended by TreeControlSelectionEraseListener).

One hacky workaround is to add two new listeners to the tree:
- A listener with the type SWT.EraseItem that sets a foreground color. This foreground is then used for the selected items and the overlay that appears on mouse over.
- A listener with the type SWT.PaintItem that paints over the text with the correct color in case of a selection.

The foreground color of this overlaying element should be configurable, or the background should be painted with the same color as the treeItem.

There is another strange rendering when the overlay is for the first visible item of the tree that has an arrow. In this case we can see the overlay being painted like the others, but then the treeItem is painted on top of that shifted to the right.
Comment 1 Tiago Pocinho CLA 2019-02-08 06:38:38 EST
Created attachment 277512 [details]
Overlay element foreground color issue (light blue on white background)
Comment 2 Tiago Pocinho CLA 2019-02-08 06:39:26 EST
Created attachment 277513 [details]
Overlay element foreground painted over with TreeItem
Comment 3 Tiago Pocinho CLA 2020-05-26 09:50:16 EDT
Any update on this? Just tested in Eclipse 2020-03 and the issue is still there.