Parcourir la source

TFresnelCssAttribute: added cursor

mattias il y a 1 an
Parent
commit
aaacba6c32
1 fichiers modifiés avec 50 ajouts et 2 suppressions
  1. 50 2
      src/base/fresnel.dom.pas

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

@@ -126,7 +126,8 @@ type
     fcaVisibility,
     fcaBackground, // shorthand for background-[attachment,clip,color,image,origin,position,repeat,size]
     fcaBackgroundColor,
-    fcaColor     // text color
+    fcaColor,     // text color
+    fcaCursor
     );
   TFresnelCSSAttributes = set of TFresnelCSSAttribute;
 
@@ -211,7 +212,8 @@ const
     'visibility',
     'background',
     'background-color',
-    'color'
+    'color',
+    'cursor'
     );
 
 type
@@ -454,6 +456,7 @@ type
     function CheckCSSBackgroundColor(const AValue: string): boolean; virtual;
     function CheckCSSColor(const AValue: string): boolean; virtual; // check the "color" attribute, for general check use CheckCSSColorValue
     function CheckCSSColorValue(AValue: string): boolean; virtual;
+    function CheckCSSCursor(const AValue: string): boolean; virtual;
     function GetComputedCSSValue(AttrID: TCSSNumericalID): TCSSString; virtual;
     procedure SetComputedCSSValue(AttrID: TCSSNumericalID; const Value: TCSSString); virtual;
     procedure SetCSSClasses(const AValue: TStrings); virtual;
@@ -2705,6 +2708,50 @@ begin
   if aColor.Alpha=alphaOpaque then ;
 end;
 
+function TFresnelElement.CheckCSSCursor(const AValue: string): boolean;
+begin
+  case AValue of
+  '',
+  'auto',
+  'default',
+  'none',
+  'context-menu',
+  'help',
+  'pointer',
+  'progress',
+  'wait',
+  'cell',
+  'crosshair',
+  'text',
+  'vertical-text',
+  'alias',
+  'copy',
+  'move',
+  'no-drop',
+  'not-allowed',
+  'grab',
+  'grabbing',
+  'e-resize',
+  'n-resize',
+  'ne-resize',
+  'nw-resize',
+  's-resize',
+  'se-resize',
+  'sw-resize',
+  'w-resize',
+  'ew-resize',
+  'ns-resize',
+  'nesw-resize',
+  'nwse-resize',
+  'col-resize',
+  'row-resize',
+  'all-scroll',
+  'zoom-in',
+  'zoom-out': Result:=true;
+  else Result:=false;
+  end;
+end;
+
 function TFresnelElement.GetComputedCSSValue(AttrID: TCSSNumericalID
   ): TCSSString;
 var
@@ -4109,6 +4156,7 @@ begin
     fcaBackground: Result:=CheckOrSetCSSBackground(s,true);
     fcaBackgroundColor: Result:=CheckCSSBackgroundColor(s);
     fcaColor: Result:=CheckCSSColor(s);
+    fcaCursor: Result:=CheckCSSCursor(s);
     end;
   finally
     FCSSPosElement:=nil;