Replace Batik with an internal hand-written CSS parser and drop SAC#4092
Replace Batik with an internal hand-written CSS parser and drop SAC#4092vogella wants to merge 1 commit into
Conversation
|
#4091 should be merged before this one to catch potential regressions. |
|
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. |
Test Results 867 files + 3 867 suites +3 44m 26s ⏱️ - 2m 49s For more details on these failures, see this check. Results for commit 5228127. ± Comparison against base commit 8a0d043. ♻️ This comment has been updated with latest results. |
10719f2 to
f284769
Compare
Introduce an internal recursive-descent CSS parser under impl/parser (a tokenizer, a LexicalUnit implementation, and CssParser) and wire it into CSSEngineImpl, removing the Batik/SAC parser stack in the same change so no intermediate state ships an unused parser. The parser produces the same model the SAC/Batik path produced (CSSStyleSheetImpl with CSSStyleRuleImpl / CSSImportRuleImpl rules, internal Selectors selector trees, and CSSValueFactory values). It is scoped to the subset the engine uses: type / class / id / attribute / pseudo selectors, child / descendant / adjacent combinators, length / percentage / number / colour / identifier / string / url() / rgb() values, !important, and @import. @media, @font-face and @page are parsed and discarded. Selector trees mirror the previous SAC translator so specificity and matching are unchanged. parseStyleSheet, parseStyleDeclaration, parsePropertyValue and parseSelectors now go through the internal parser; the InputSource-based overloads are gone, replaced by a parseStyleSheet(InputStream, uri) method that carries the base location for relative @import resolution. Deleted: the vendored SAC plumbing (impl/sac, core/sac), the SAC-backed CSSParser / AbstractCSSParser / parser factories, SacTranslator and SACConstants. The org.apache.batik.css Require-Bundle is removed. The only remaining SAC type is the LexicalUnit interface used by the impl/dom value model, which Phase 4 replaces. ThemeEngine and the test helpers move off InputSource; the css.swt margin/padding handlers throw IllegalArgumentException instead of the SAC CSSException. A malformed, unterminated at-rule block is now rejected. Verified by the full css.core (119) and css.swt (210) test suites, by CssParserTest, and by a differential comparison against Batik over all shipped Eclipse themes.
f284769 to
5228127
Compare
Replaces the Apache Batik CSS parser and the vendored W3C SAC layer with a small internal recursive-descent parser (tokenizer plus parser) scoped to the CSS subset the engine actually uses.
The engine parses through it end to end, the
org.apache.batik.cssRequire-Bundle is removed, and the only remaining SAC type is theLexicalUnitinterface that a later step drops.Parsing in isolation measures about 22% faster and the engine sheds an external runtime dependency, with no change to styling behaviour:
@media,@font-faceand@pageare still parsed and discarded as before.Verified against the full css.core and css.swt test suites and by a differential comparison against the Batik output over all shipped Eclipse themes.
Contributes to #3980.