Browse Source

dom: started parsing writing-mode

mattias 11 months ago
parent
commit
217cf250f7
1 changed files with 27 additions and 2 deletions
  1. 27 2
      src/base/fresnel.dom.pas

+ 27 - 2
src/base/fresnel.dom.pas

@@ -60,6 +60,7 @@ type
     fcaPosition,
     fcaBoxSizing, // border-box, content-box
     fcaDirection,
+    fcaWritingMode,
     fcaZIndex,
     fcaOverflowX, // visible|hidden|clip|scroll|auto
     fcaOverflowY,
@@ -168,6 +169,7 @@ const
     'position',
     'box-sizing',
     'direction',
+    'writing-mode',
     'z-index',
     'overflow-x',
     'overflow-y',
@@ -376,6 +378,7 @@ type
     function CheckPosition(Resolver: TCSSBaseResolver): boolean; virtual;
     function CheckBoxSizing(Resolver: TCSSBaseResolver): boolean; virtual;
     function CheckDirection(Resolver: TCSSBaseResolver): boolean; virtual;
+    function CheckWritingMode(Resolver: TCSSBaseResolver): boolean; virtual;
     function CheckZIndex(Resolver: TCSSBaseResolver): boolean; virtual;
     function CheckOverflowXY(Resolver: TCSSBaseResolver): boolean; virtual;
     function CheckClear(Resolver: TCSSBaseResolver): boolean; virtual;
@@ -731,6 +734,7 @@ type
     Chk_Position_KeywordIDs: TCSSNumericalIDArray;
     Chk_BoxSizing_KeywordIDs: TCSSNumericalIDArray;
     Chk_Direction_KeywordIDs: TCSSNumericalIDArray;
+    Chk_WritingMode_KeywordIDs: TCSSNumericalIDArray;
     Chk_ZIndex_Dim: TCSSCheckAttrParams_Dimension;
     Chk_OverflowXY_KeywordIDs: TCSSNumericalIDArray;
     Chk_Clear_KeywordIDs: TCSSNumericalIDArray;
@@ -1399,6 +1403,11 @@ begin
   Result:=Resolver.CheckAttribute_Keyword(Chk_Direction_KeywordIDs);
 end;
 
+function TFresnelCSSRegistry.CheckWritingMode(Resolver: TCSSBaseResolver): boolean;
+begin
+  Result:=Resolver.CheckAttribute_Keyword(Chk_WritingMode_KeywordIDs);
+end;
+
 function TFresnelCSSRegistry.CheckZIndex(Resolver: TCSSBaseResolver): boolean;
 begin
   Result:=Resolver.CheckAttribute_Dimension(Chk_ZIndex_Dim);
@@ -3742,6 +3751,10 @@ begin
   Desc.All:=false;
   Chk_Direction_KeywordIDs:=[kwLTR,kwRTL];
 
+  // writing-mode
+  AddFresnelLonghand(fcaWritingMode,true,@CheckWritingMode,'horizontal-tb');
+  Chk_WritingMode_KeywordIDs:=[kwHorizontalTB,kwVerticalRL,kwVerticalLR,kwSidewaysRL,kwSidewaysLR];
+
   // z-index
   AddFresnelLonghand(fcaZIndex,false,@CheckZIndex,'auto');
   Chk_ZIndex_Dim.AllowNegative:=true;
@@ -4005,43 +4018,55 @@ begin
     kwSEResize,kwSWResize,kwWResize,kwEWResize,kwNSResize,kwNESWResize,kwNWSEResize,
     kwColResize,kwRowResize,kwAllScroll,kwZoomIn,kwZoomOut];
 
-  // flex
+  // flex-basis
   AddFresnelLonghand(fcaFlexBasis,false,@CheckFlexBasis,'auto');
   Chk_FlexBasis_Dim.AllowedKeywordIDs:=[kwAuto,kwMaxContent,kwMinContent,kwFitContent,kwContent];
   Chk_FlexBasis_Dim.AllowedUnits:=cuAllLengthsAndPercent;
   Chk_FlexBasis_Dim.AllowFrac:=true;
+  // flex-direction
   AddFresnelLonghand(fcaFlexDirection,false,@CheckFlexDirection,'row');
   Chk_FlexDirection_KeywordIDs:=[kwColumn,kwColumnReverse,kwRow,kwRowResize];
+  // flex-grow
   AddFresnelLonghand(fcaFlexGrow,false,@CheckFlexGrow,'0');
   Chk_FlexGrow_Dim.AllowedUnits:=[cuNone];
   Chk_FlexGrow_Dim.AllowFrac:=true;
+  // flex-shrink
   AddFresnelLonghand(fcaFlexShrink,false,@CheckFlexShrink,'1');
   Chk_FlexShrink_Dim.AllowedUnits:=[cuNone];
   Chk_FlexShrink_Dim.AllowFrac:=true;
+  // flex-wrap
   AddFresnelLonghand(fcaFlexWrap,false,@CheckFlexWrap,'nowrap');
   Chk_FlexWrap_KeywordIDs:=[kwNoWrap,kwWrap,kwWrapReverse];
+  // flex-flow
   AddFresnelShorthand(fcaFlexFlow,@CheckFlexFlow,@SplitFlexFlow,@GetFlexFlow,
     [fcaFlexDirection,fcaFlexWrap]);
+  // flex
   AddFresnelShorthand(fcaFlex,@CheckFlex,@SplitFlex,@GetFlex,
     [fcaFlexGrow,fcaFlexShrink,fcaFlexBasis]);
 
   // shared attributes of flex+grid
+  // justify-content
   AddFresnelLonghand(fcaJustifyContent,false,@CheckJustifyContent,'normal');
   Chk_JustifyContent_KeywordIDs:=[kwStart,kwEnd,kwFlexEnd,kwCenter,kwLeft,kwRight,kwNormal,
     kwSpaceBetween,kwSpaceAround,kwSpaceEvenly,kwStretch,kwSafe,kwUnsafe];
+  // justify-items
   AddFresnelLonghand(fcaJustifyItems,false,@CheckJustifyItems,'legacy');
   Chk_JustifyItems_KeywordIDs:=[kwNormal,kwStart,kwEnd,kwFlexStart,kwFlexEnd,
     kwSelfStart,kwSelfEnd,kwCenter,kwLeft,kwRight,kwBaseline,kwFirst,kwLast,kwStretch,
     kwAnchorCenter,kwSafe,kwUnsafe];
+  // justify-self
   AddFresnelLonghand(fcaJustifySelf,false,@CheckJustifySelf,'auto');
   Chk_JustifySelf_KeywordIDs:=[kwAuto,kwNormal,kwStart,kwEnd,kwFlexStart,kwFlexEnd,
     kwSelfStart,kwSelfEnd,kwCenter,kwLeft,kwRight,kwBaseline,kwFirst,kwLast,kwStretch,
     kwAnchorCenter,kwSafe,kwUnsafe];
+  // column-gap
   AddFresnelLonghand(fcaColumnGap,false,@CheckColumnRowGap,'normal');
-  AddFresnelLonghand(fcaRowGap,false,@CheckColumnRowGap,'normal');
   Chk_ColumnRowGap_Dim.AllowedKeywordIDs:=[kwNormal];
   Chk_ColumnRowGap_Dim.AllowedUnits:=cuAllLengthsAndPercent;
   Chk_ColumnRowGap_Dim.AllowFrac:=true;
+  // column-row
+  AddFresnelLonghand(fcaRowGap,false,@CheckColumnRowGap,'normal');
+  // gap
   AddFresnelShorthand(fcaGap,@CheckGap,@SplitGap,@GetGap,[fcaColumnGap,fcaRowGap]);
 
   // pseudo classes - - - - - - - - - - - - - - - - - - - - - -