scientificware / jdk

Read-only mirror of https://hg.openjdk.java.net/jdk/jdk
GNU General Public License v2.0
0 stars 0 forks source link

JDK and CSS #14

Open scientificware opened 1 year ago

scientificware commented 1 year ago

Cascading Style Sheets (CSS) is a simple mechanism for adding style (e.g., fonts, colors, spacing) to Web documents.

The state of art

The state of art is defined by CSS Snapshots : The “CSS Snapshot” lists the parts that are ready for implementers.

These snapshots are references to CSS Modules :

Module Names Levels Comments
Syntax 3
Style Attributes
Media Queries
Conditional Rules
Selectors
Namespaces
Cascading and Inheritance
Values and Units
Custom Properties for Cascading Variables
Box Model 3
Color 4
:white_small_square: Color :arrow_forward: rgb and rgba functions :construction:
:white_small_square: Color :arrow_forward: hexadecimal :construction:
:white_small_square: Color :arrow_forward: hsl and hsla functions :thinking:
:white_small_square: Color :arrow_forward: color function :thinking:
Backgrounds and Borders
Images
Fonts
Writing Modes
Multi_column
Flexible Box
User Interface
Containment
Transforms
Compositing and Blending
Easing Functions
Counter Styles
...

JDK CSS Parser : (Documentation comments of CSSParser.java)

A CSS parser. This works by way of a delegate that implements the CSSParserCallback interface. The delegate is notified of the following events:

This will parse much more than CSS 1, and loosely implements the recommendation for Forward-compatible parsing in section 7.1 of the CSS spec found at : http://www.w3.org/TR/REC-CSS1. If an error results in parsing, a RuntimeException will be thrown.

This will preserve case. If the callback wishes to treat certain portions case insensitively (such as selectors), it should use toLowerCase, or something similar. Parsing something like the following : `(@rule | ruleset | block)*` |Terminal||Definition|Comments| |----|----|----|----| | `<@rule>`|` ::=`|` ( \| )*;`| (block with `{` `}` ends @rule)| | ``|` ::=`| |`matching [] () {} (that is, [()] is a block, [(){}{[]}] is a block, ()[] is two blocks)| | ``|` ::=`|` "*" \| '*' \| anything but a [](){} and whitespace`| | ``|` ::=`|` `| | ``|` ::=`|`( (, except block '{}') )*`| | ``|` ::=`|`* *`| | ``|`::=`|` (* stopping when identifier ends with :)` `(* stopping when identifier ends with ;)` | ``|`::=`|` /* */`|` can appear any where, and are stripped.` | ``|`::=`|`- letters, digits, dashes and escaped characters` - block starts with {, ends with matching }, - () [] and {} always occur in matching pairs, `'` `'` and `"` `"` also occur in pairs, except " may be ## Notes : - During the parsing process : - Leading and trailing white-spaces (according to Java) in the argument string were removed. - Inside `()` multiple white-space (according to Java) occurences are replaced by only one space character. - white-spaces (according to Java) between `rgb` or `rgba` and `(` are removed. - Through `WSRead()` method, CSSParser.java strips white spaces. - White space according to Java, see [Character Java specifications](https://docs.oracle.com/en/java/javase/19/docs/api/java.base/java/lang/Character.html#isWhitespace(int)). - Trough `parseDeclaration()`, CSSParser.java make the property name to lower case. ## JDK StyleSheet CSS Parser : (Documentation comments of StyleSheet.CssParser) CssParser is the default parser for CSS specifications that get loaded into the StyleSheet.