Skip to content

Re-apply CSS colors that only match the inherited color - #4499

Open
vogella wants to merge 1 commit into
eclipse-platform:masterfrom
vogella:css-reapply-inherited-colors
Open

vogella wants to merge 1 commit into
eclipse-platform:masterfrom
vogella:css-reapply-inherited-colors

Conversation

@vogella

@vogella vogella commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

After a theme switch, CSSSWTColorHelper skipped setting a control's new background whenever the parent already had the same color, because getBackground() also reports inherited colors. The reset control then owned no color, and children of a Forms Section painted the Section's title gradient image instead, for example the white text fields in the PDE manifest editor after switching from Light to Dark. The helper now remembers the color it applied and only skips when the control really owns it, and the element resets clear colors through the helper. The existing optimization for unchanged colors stays in place for ordinary re-applies, and a regression test covers the reset case.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

   867 files     867 suites   50m 1s ⏱️
 8 548 tests  8 308 ✅ 240 💤 0 ❌
21 516 runs  20 840 ✅ 676 💤 0 ❌

Results for commit 8510b6e.

♻️ This comment has been updated with latest results.

@vogella
vogella force-pushed the css-reapply-inherited-colors branch 2 times, most recently from 32fce3f to ac8a718 Compare October 16, 2026 18:25
@vogella
vogella force-pushed the css-reapply-inherited-colors branch from ac8a718 to 982286c Compare November 1, 2026 16:20
CSSSWTColorHelper skipped setting a color when the control already
reported it, but getBackground() also reports colors inherited from
the parent. After a theme switch reset a control that owned a color,
the new color was skipped whenever the parent had the same one, so the
control owned no color. Children of a Forms Section then painted the
Section's title gradient image.

The helper now remembers that a control lost its own color on reset,
including a color set before styling such as by FormToolkit.adapt, and
then applies the new color even if it equals the inherited one. A reset
compares the control's color with the inherited one, so the engine
resets ancestors first. Controls that never owned a color keep
inheriting, so the Section title label still shows the title bar.

Assisted-by: multiple AI agents and layers of automated tooling 🤖
@vogella
vogella force-pushed the css-reapply-inherited-colors branch from 982286c to 8510b6e Compare November 10, 2026 19:31
@vogella

vogella commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

How to reproduce:
The shipped themes use a flat Section title bar, and since e199306 a flat title bar creates no gradient image, so reproducing needs two themes with a real gradient.

Theme B, on top of the Dark theme CSS (e4-dark_win.css on Windows):

#org-eclipse-e4-ui-compatibility-editor Section {
	background-color: #283040;
	background-color-titlebar: #c00000;
	background-color-gradient-titlebar: #0000c0;
	swt-background-mode: force;
}
#org-eclipse-e4-ui-compatibility-editor Section > Composite {
	background-color: #283040;
	swt-background-mode: force;
}
#org-eclipse-e4-ui-compatibility-editor Section Text,
#org-eclipse-e4-ui-compatibility-editor Section Label {
	background-color: #283040;
}

Theme A is the same with #3a2840 for Section > Composite and #006000 for Section Text, Section Label.
The id prefix is needed, otherwise the Dark theme's background-color: inherit on Section wins.

Steps: open a MANIFEST.MF in the plug-in manifest editor on the Overview page, then switch Dark, A, B.
Without the fix, the General Information text fields in B show the red to blue title gradient; with the fix they stay flat #283040.

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