1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:57:45 +00:00

LibWeb: Parse CSS <position>s

This parses <position> according to the following grammer:

<position> = [
  [ left | center | right ] || [ top | center | bottom ]
|
  [ left | center | right | <length-percentage> ]
  [ top | center | bottom | <length-percentage> ]?
|
  [ [ left | right ] <length-percentage> ] &&
  [ [ top | bottom ] <length-percentage> ]
]

The code is a little hairy and simply tries each alternative in turn,
manually checking the possible orders. There may be a better way to
represent this.
This commit is contained in:
MacDue 2022-10-30 19:23:00 +01:00 committed by Linus Groh
parent e568c93404
commit ee72dcd523
2 changed files with 207 additions and 0 deletions

View file

@ -254,6 +254,7 @@ private:
Optional<GridMinMax> parse_min_max(Vector<ComponentValue> const&);
Optional<GridRepeat> parse_repeat(Vector<ComponentValue> const&);
Optional<ExplicitGridTrack> parse_track_sizing_function(ComponentValue const&);
Optional<PositionValue> parse_position(TokenStream<ComponentValue>&);
enum class AllowedDataUrlType {
None,