Replace the W3C computed-style cascade with internal types#4122
Draft
vogella wants to merge 3 commits into
Draft
Replace the W3C computed-style cascade with internal types#4122vogella wants to merge 3 commits into
vogella wants to merge 3 commits into
Conversation
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
Contributor
|
This pull request changes some projects for the first time in this development cycle. 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 patchFurther information are available in Common Build Issues - Missing version increments. |
Contributor
Test Results 855 files ±0 855 suites ±0 56m 3s ⏱️ + 4m 38s For more details on these failures, see this check. Results for commit 7e79e30. ± Comparison against base commit 552c9e4. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Folds the W3C ViewCSS / DocumentCSS computed-style machinery into the engine:
CSSEngineImplnow holds the stylesheet list and a cached flat rule list directly, and the formerViewCSSImpl.getComputedStylelogic becomesCSSEngine.computeStyle.CSSStyleSheetImplbecomes a plain list ofCssRule(a new sealed interface), andViewCSSImpl,DocumentCSSImpl,StyleSheetListImpl,MediaListImpland the related W3C rule-mirror classes are deleted.CSSStyleDeclarationImplkeeps implementing the W3CCSSStyleDeclarationinterface, sinceIStylingEngine.getStyle/IThemeEngine.getStyleare frozen public API returning that type. A deprecatedgetViewCSS()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).