|
@@ -189,7 +189,7 @@ const
|
|
|
|
|
|
type
|
|
|
TFresnelCSSUnit = (
|
|
|
- fcuPercent,
|
|
|
+ fcuPercent, // % relative to 1% of the containing block's width/height
|
|
|
fcu_cm, // centimeters
|
|
|
fcu_mm, // milimeters
|
|
|
fcu_ch, // relative to the width of the "0" (zero)
|
|
@@ -941,7 +941,6 @@ end;
|
|
|
|
|
|
procedure TFresnelViewport.StylesheetChanged;
|
|
|
begin
|
|
|
- // ToDo: call async
|
|
|
UpdateStylesheetElements;
|
|
|
end;
|
|
|
|
|
@@ -949,16 +948,39 @@ procedure TFresnelViewport.UpdateStylesheetElements;
|
|
|
var
|
|
|
ss: TStringStream;
|
|
|
aParser: TCSSParser;
|
|
|
+ NewStyleElements: TCSSElement;
|
|
|
begin
|
|
|
- if FStylesheetElements<>nil then exit;
|
|
|
+ //if FStylesheetElements<>nil then exit;
|
|
|
aParser:=nil;
|
|
|
ss:=TStringStream.Create(Stylesheet.Text);
|
|
|
try
|
|
|
aParser:=TCSSParser.Create(ss);
|
|
|
- FStylesheetElements:=aParser.Parse;
|
|
|
+ NewStyleElements:=nil;
|
|
|
+ try
|
|
|
+ NewStyleElements:=aParser.Parse;
|
|
|
+ except
|
|
|
+ on CSSE: ECSSException do begin
|
|
|
+ debugln(['TFresnelViewport.UpdateStylesheetElements ',Name,':',ClassName,' ',CSSE.Message]);
|
|
|
+ exit;
|
|
|
+ end;
|
|
|
+ on FresnelE: EFresnel do begin
|
|
|
+ debugln(['TFresnelViewport.UpdateStylesheetElements ',Name,':',ClassName,' ',FresnelE.Message]);
|
|
|
+ exit;
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+ if (FStylesheetElements=nil) then
|
|
|
+ begin
|
|
|
+ if NewStyleElements=nil then exit;
|
|
|
+ end else begin
|
|
|
+ if (NewStyleElements<>nil)
|
|
|
+ and FStylesheetElements.Equals(NewStyleElements) then exit;
|
|
|
+ end;
|
|
|
+ FreeAndNil(FStylesheetElements);
|
|
|
+ FStylesheetElements:=NewStyleElements;
|
|
|
finally
|
|
|
aParser.Free;
|
|
|
end;
|
|
|
+ DomChanged;
|
|
|
end;
|
|
|
|
|
|
procedure TFresnelViewport.FPOObservedChanged(ASender: TObject;
|