Skip to content

Replace the W3C computed-style cascade with internal types#4122

Draft
vogella wants to merge 3 commits into
eclipse-platform:masterfrom
vogella:css-cascade-internal-types
Draft

Replace the W3C computed-style cascade with internal types#4122
vogella wants to merge 3 commits into
eclipse-platform:masterfrom
vogella:css-cascade-internal-types

Conversation

@vogella

@vogella vogella commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Folds the W3C ViewCSS / DocumentCSS computed-style machinery into the engine: CSSEngineImpl now holds the stylesheet list and a cached flat rule list directly, and the former ViewCSSImpl.getComputedStyle logic becomes CSSEngine.computeStyle.
CSSStyleSheetImpl becomes a plain list of CssRule (a new sealed interface), and ViewCSSImpl, DocumentCSSImpl, StyleSheetListImpl, MediaListImpl and the related W3C rule-mirror classes are deleted.

CSSStyleDeclarationImpl keeps implementing the W3C CSSStyleDeclaration interface, since IStylingEngine.getStyle / IThemeEngine.getStyle are frozen public API returning that type. A deprecated getViewCSS() default method remains as a binary-compatibility bridge.

Stacked on #4120 (the consumer migration it builds on), so the diff currently also shows that commit; it reduces to just this change once #4120 is merged and this branch is rebased.
Part of the CSS engine rework (#3980).

vogella and others added 3 commits June 19, 2026 10:41
Move the property handlers, converters, and SWT helpers off the W3C
CSSValue accessor API (getCssValueType, getPrimitiveType, getFloatValue,
getStringValue, getRGBColorValue) onto pattern matching over the
CssValues records. The records get their final internal shape: a CssUnit
enum and a shared CssNumeric interface replace the raw W3C primitive
type shorts on CssDimension, and CssText carries an explicit Kind
(IDENT, STRING, URI, INHERIT). CSS2FontProperties and CSSBorderProperties
now store CssPrimitive values, which retires the CSS2PrimitiveValueImpl
and CSS2RGBColorImpl shims; CSS2ColorHelper and CSSSWTColorHelper build
CssColor records directly.

The old code distinguished widget-derived font sizes from CSS-set sizes
through a null getCssText() quirk of CSS2PrimitiveValueImpl; that
distinction is now an explicit sizeFromCSS flag on CSS2FontProperties,
so font definitions still supply the height when no CSS size is set.

The records still implement the W3C interfaces as a bridge for the
style-declaration layer; the bridge goes away once the computed-style
cascade is internal. The css.swt test helpers build real value records
instead of Mockito mocks of CSSValueImpl, which the pattern matching
would not recognize.

Contributes to eclipse-platform#3980
Fold the ViewCSS/DocumentCSS machinery into the engine: CSSEngineImpl now
holds the stylesheet list and a cached flat rule list directly, and the
former ViewCSSImpl.getComputedStyle logic becomes CSSEngine.computeStyle.
The rule and stylesheet mirror drops its W3C interfaces: CSSStyleSheetImpl
is a plain list of CssRule (a new sealed interface), CSSStyleRuleImpl and
CSSImportRuleImpl are simple internal classes, and ViewCSSImpl,
DocumentCSSImpl, StyleSheetListImpl, CSSRuleImpl, CSSRuleListImpl,
MediaListImpl, AbstractCSSNode, ExtendedCSSRule, and ExtendedDocumentCSS
are deleted. CSSEngine.parseStyleSheet now returns the internal stylesheet
type and getDocumentCSS()/getViewCSS() are replaced by computeStyle; a
deprecated getViewCSS() default method remains as a binary-compatibility
bridge for bundles compiled against the old accessor.

CSSStyleDeclarationImpl keeps implementing the W3C CSSStyleDeclaration
interface because IStylingEngine.getStyle and IThemeEngine.getStyle are
frozen public API returning that type; its parent rule is now the internal
CSSStyleRuleImpl, reachable via getParentStyleRule(), and the W3C
getParentRule() returns null. In-tree callers (ThemeEngine, the font
handler, CSSRenderingUtils, PartRenderingEngine) and the css.core parser
tests move to the internal API.

Contributes to eclipse-platform#3980
@eclipse-platform-bot

Copy link
Copy Markdown
Contributor

This pull request changes some projects for the first time in this development cycle.
Therefore the following files need a version increment:

bundles/org.eclipse.e4.ui.workbench.swt/META-INF/MANIFEST.MF

An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the git patch.

Git patch
From e3856411752e7395e0f6481eaf2e2df7b869c813 Mon Sep 17 00:00:00 2001
From: Eclipse Platform Bot <platform-bot@eclipse.org>
Date: Fri, 19 Jun 2026 09:15:12 +0000
Subject: [PATCH] Version bump(s) for 4.41 stream


diff --git a/bundles/org.eclipse.e4.ui.workbench.swt/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.ui.workbench.swt/META-INF/MANIFEST.MF
index 37a7e9d1ea..75d82205e6 100644
--- a/bundles/org.eclipse.e4.ui.workbench.swt/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.e4.ui.workbench.swt/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
 Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-SymbolicName: org.eclipse.e4.ui.workbench.swt;singleton:=true
-Bundle-Version: 0.18.100.qualifier
+Bundle-Version: 0.18.200.qualifier
 Bundle-Name: %pluginName
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
-- 
2.54.0

Further information are available in Common Build Issues - Missing version increments.

@github-actions

Copy link
Copy Markdown
Contributor

Test Results

   855 files  ±0     855 suites  ±0   56m 3s ⏱️ + 4m 38s
 8 075 tests ±0   7 830 ✅  - 2  243 💤 ±0  2 ❌ +2 
20 127 runs  ±0  19 471 ✅  - 2  654 💤 ±0  2 ❌ +2 

For more details on these failures, see this check.

Results for commit 7e79e30. ± Comparison against base commit 552c9e4.

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.

2 participants