fcl-css: attribute value integer

This commit is contained in:
mattias 2022-09-14 17:05:12 +02:00
parent a9fb193b1c
commit 843ef82002
2 changed files with 11 additions and 7 deletions

View File

@ -1106,6 +1106,8 @@ begin
SkipWhiteSpace;
// parse value
case CurrentToken of
ctkIDENTIFIER:
Bin.Right:=ParseIdentifier;
ctkSTRING:
begin
StrEl:=TCSSStringElement(CreateElement(TCSSStringElement));
@ -1113,8 +1115,10 @@ begin
Bin.Right:=StrEl;
GetNextToken;
end;
ctkIDENTIFIER:
Bin.Right:=ParseIdentifier;
ctkINTEGER:
Bin.Right:=ParseInteger;
ctkFLOAT:
Bin.Right:=ParseFloat;
else
DoError(SErrUnexpectedToken ,[
GetEnumName(TypeInfo(TCSSToken),Ord(CurrentToken)),

View File

@ -626,7 +626,7 @@ begin
AssertEquals('Button1.Top','',Button1.Top);
AssertEquals('Button1.Width','',Button1.Width);
AssertEquals('Button1.Height','',Button1.Height);
AssertEquals('Button1.Color','#123',Button1.Color);
AssertEquals('Button1.Color','',Button1.Color);
AssertEquals('Button1.Display','',Button1.Display);
end;
@ -692,12 +692,12 @@ begin
Doc.ApplyStyle;
AssertEquals('Root.Left','',Doc.Root.Left);
AssertEquals('Root.Top','',Doc.Root.Top);
AssertEquals('Div1.Left','x',Div1.Left);
AssertEquals('Div1.Left','',Div1.Left);
AssertEquals('Div1.Top','',Div1.Top);
AssertEquals('Div11.Left','1px',Div11.Left);
AssertEquals('Div11.Top','2px',Div11.Top);
AssertEquals('Div2.Left','1px',Div2.Left);
AssertEquals('Div2.Top','',Div2.Top);
AssertEquals('Div2.Top','2px',Div2.Top);
end;
procedure TTestCSSResolver.Test_Selector_FirstChild;
@ -726,7 +726,7 @@ begin
AssertEquals('Root.Left','1px',Doc.Root.Left);
AssertEquals('Root.Top','',Doc.Root.Top);
AssertEquals('Div1.Left','1px',Div1.Left);
AssertEquals('Div1.Top','',Div1.Top);
AssertEquals('Div1.Top','2px',Div1.Top);
AssertEquals('Div11.Left','1px',Div11.Left);
AssertEquals('Div11.Top','2px',Div11.Top);
AssertEquals('Div12.Left','',Div12.Left);
@ -1292,7 +1292,7 @@ var
i: Integer;
begin
i:=GetCSSIndex;
if i>=NodeCount then
if (i<0) or (i+1>=NodeCount) then
Result:=nil
else
Result:=Parent.Nodes[i+1];