|
@@ -496,6 +496,7 @@ type
|
|
FHeight: TFresnelLength;
|
|
FHeight: TFresnelLength;
|
|
FWidth: TFresnelLength;
|
|
FWidth: TFresnelLength;
|
|
FMaxPreferredWidth: TFresnelLength;
|
|
FMaxPreferredWidth: TFresnelLength;
|
|
|
|
+ procedure CSSResolverLog(Sender: TObject; Entry: TCSSResolverLogEntry);
|
|
protected
|
|
protected
|
|
function GetDPI(IsHorizontal: boolean): TFresnelLength; override;
|
|
function GetDPI(IsHorizontal: boolean): TFresnelLength; override;
|
|
function GetHeight: TFresnelLength; virtual;
|
|
function GetHeight: TFresnelLength; virtual;
|
|
@@ -710,6 +711,12 @@ end;
|
|
|
|
|
|
{ TFresnelViewport }
|
|
{ TFresnelViewport }
|
|
|
|
|
|
|
|
+procedure TFresnelViewport.CSSResolverLog(Sender: TObject;
|
|
|
|
+ Entry: TCSSResolverLogEntry);
|
|
|
|
+begin
|
|
|
|
+ debugln(['TFresnelViewport.CSSResolverLog ','['+IntToStr(Entry.ID)+'] '+Entry.Msg+' at '+CSSResolver.GetElPos(Entry.PosEl)]);
|
|
|
|
+end;
|
|
|
|
+
|
|
function TFresnelViewport.GetDPI(IsHorizontal: boolean): TFresnelLength;
|
|
function TFresnelViewport.GetDPI(IsHorizontal: boolean): TFresnelLength;
|
|
begin
|
|
begin
|
|
Result:=FDPI[IsHorizontal];
|
|
Result:=FDPI[IsHorizontal];
|
|
@@ -990,6 +997,7 @@ begin
|
|
|
|
|
|
FCSSResolver:=TCSSResolver.Create(nil);
|
|
FCSSResolver:=TCSSResolver.Create(nil);
|
|
FCSSResolver.OwnsStyle:=false;
|
|
FCSSResolver.OwnsStyle:=false;
|
|
|
|
+ FCSSResolver.OnLog:=@CSSResolverLog;
|
|
FStylesheet:=TStringList.Create(false);
|
|
FStylesheet:=TStringList.Create(false);
|
|
FStylesheet.FPOAttachObserver(Self);
|
|
FStylesheet.FPOAttachObserver(Self);
|
|
end;
|
|
end;
|
|
@@ -1936,15 +1944,36 @@ procedure TFresnelElement.SetStyle(const AValue: string);
|
|
var
|
|
var
|
|
ss: TStringStream;
|
|
ss: TStringStream;
|
|
aParser: TCSSParser;
|
|
aParser: TCSSParser;
|
|
|
|
+ NewStyleElements: TCSSElement;
|
|
begin
|
|
begin
|
|
if FStyle=AValue then Exit;
|
|
if FStyle=AValue then Exit;
|
|
FStyle:=AValue;
|
|
FStyle:=AValue;
|
|
- FreeAndNil(FStyleElements);
|
|
|
|
aParser:=nil;
|
|
aParser:=nil;
|
|
ss:=TStringStream.Create(Style);
|
|
ss:=TStringStream.Create(Style);
|
|
try
|
|
try
|
|
|
|
+ NewStyleElements:=nil;
|
|
aParser:=TCSSParser.Create(ss);
|
|
aParser:=TCSSParser.Create(ss);
|
|
- FStyleElements:=aParser.ParseInline;
|
|
|
|
|
|
+ try
|
|
|
|
+ NewStyleElements:=aParser.ParseInline;
|
|
|
|
+ except
|
|
|
|
+ on CSSE: ECSSException do begin
|
|
|
|
+ debugln(['TFresnelElement.SetStyle ',Name,':',ClassName,' ',CSSE.Message]);
|
|
|
|
+ exit;
|
|
|
|
+ end;
|
|
|
|
+ on FresnelE: EFresnel do begin
|
|
|
|
+ debugln(['TFresnelElement.SetStyle ',Name,':',ClassName,' ',FresnelE.Message]);
|
|
|
|
+ exit;
|
|
|
|
+ end;
|
|
|
|
+ end;
|
|
|
|
+ if (FStyleElements=nil) then
|
|
|
|
+ begin
|
|
|
|
+ if NewStyleElements=nil then exit;
|
|
|
|
+ end else begin
|
|
|
|
+ if (NewStyleElements<>nil)
|
|
|
|
+ and FStyleElements.Equals(NewStyleElements) then exit;
|
|
|
|
+ end;
|
|
|
|
+ FreeAndNil(FStyleElements);
|
|
|
|
+ FStyleElements:=NewStyleElements;
|
|
finally
|
|
finally
|
|
aParser.Free;
|
|
aParser.Free;
|
|
end;
|
|
end;
|