|
@@ -436,7 +436,8 @@ type
|
|
|
function CheckCSSVisibility(const AValue: string): boolean; virtual;
|
|
|
function CheckOrSetCSSBackground(const AValue: string; Check: boolean): boolean; virtual;
|
|
|
function CheckCSSBackgroundColor(const AValue: string): boolean; virtual;
|
|
|
- function CheckCSSColor(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 GetComputedCSSValue(AttrID: TCSSNumericalID): TCSSString;
|
|
|
procedure SetComputedCSSValue(AttrID: TCSSNumericalID; const Value: TCSSString);
|
|
|
procedure SetCSSClasses(const AValue: TStrings);
|
|
@@ -1510,7 +1511,9 @@ end;
|
|
|
procedure TFresnelElement.SetCSSElAttribute(Attr: TFresnelCSSAttribute;
|
|
|
const AValue: string);
|
|
|
begin
|
|
|
+ {$IFDEF VerboseCSSResolver}
|
|
|
writeln('TFresnelElement.SetCSSAttribute ',Name,' ',Attr,' ',AValue);
|
|
|
+ {$ENDIF}
|
|
|
if FCSSAttributes[Attr]=AValue then exit;
|
|
|
FCSSAttributes[Attr]:=AValue;
|
|
|
case AValue of
|
|
@@ -2012,12 +2015,9 @@ end;
|
|
|
|
|
|
function TFresnelElement.CheckCSSBorderXColor(Attr: TFresnelCSSAttribute;
|
|
|
const AValue: string): boolean;
|
|
|
-var
|
|
|
- aColor: TFPColor;
|
|
|
begin
|
|
|
if Attr=fcaBorderLeftColor then ;
|
|
|
- Result:=CSSToFPColor(AValue,aColor);
|
|
|
- if aColor=colBlack then ;
|
|
|
+ Result:=CheckCSSColorValue(AValue);
|
|
|
end;
|
|
|
|
|
|
function TFresnelElement.CheckOrSetCSSBorderStyle(const AValue: string;
|
|
@@ -2636,22 +2636,30 @@ begin
|
|
|
end;
|
|
|
|
|
|
function TFresnelElement.CheckCSSBackgroundColor(const AValue: string): boolean;
|
|
|
-var
|
|
|
- aColor: TFPColor;
|
|
|
begin
|
|
|
- // ToDo: rgb(r,g,b), rgba(r,g,b,a)
|
|
|
- // ToDo: hsl(), hsla()
|
|
|
- // ToDo: transparent
|
|
|
- // ToDo: currentcolor
|
|
|
- Result:=CSSToFPColor(AValue,aColor);
|
|
|
+ Result:=CheckCSSColorValue(AValue);
|
|
|
end;
|
|
|
|
|
|
function TFresnelElement.CheckCSSColor(const AValue: string): boolean;
|
|
|
+begin
|
|
|
+ Result:=CheckCSSColorValue(AValue);
|
|
|
+end;
|
|
|
+
|
|
|
+function TFresnelElement.CheckCSSColorValue(AValue: string): boolean;
|
|
|
var
|
|
|
aColor: TFPColor;
|
|
|
begin
|
|
|
+ Result:=false;
|
|
|
+ if AValue='' then exit;
|
|
|
+ if (AValue[1]='"') then
|
|
|
+ begin
|
|
|
+ if length(AValue)<3 then exit;
|
|
|
+ if AValue[length(AValue)]<>'"' then exit;
|
|
|
+ AValue:=copy(AValue,2,length(AValue)-2);
|
|
|
+ end;
|
|
|
// ToDo: rgb(r,g,b), rgba(r,g,b,a), ...
|
|
|
Result:=CSSToFPColor(AValue,aColor);
|
|
|
+ if aColor.Alpha=alphaOpaque then ;
|
|
|
end;
|
|
|
|
|
|
function TFresnelElement.GetComputedCSSValue(AttrID: TCSSNumericalID
|
|
@@ -3655,9 +3663,9 @@ begin
|
|
|
raise Exception.Create('TFresnelElement.SetCSSValue invalid AttrID '+IntToStr(AttrID));
|
|
|
Attr:=TFresnelCSSAttribute(AttrID-FFresnelElementBaseAttrID);
|
|
|
s:=Value.AsString;
|
|
|
- {$IFDEF VerboseCSSResolver}
|
|
|
- writeln('TFresnelElement.SetCSSValue ',FresnelAttributeNames[Attr],':="',s,'"');
|
|
|
- {$ENDIF}
|
|
|
+ { $IFDEF VerboseCSSResolver}
|
|
|
+ writeln('TFresnelElement.SetCSSValue ',FresnelCSSAttributeNames[Attr],':="',s,'"');
|
|
|
+ { $ENDIF}
|
|
|
FCSSPosElement:=Value;
|
|
|
try
|
|
|
CSSAttribute[Attr]:=s;
|