|
@@ -1117,6 +1117,7 @@ type
|
|
|
function GetRoot: TFresnelElement;
|
|
|
function GetPath: string; virtual;
|
|
|
function AcceptChildrenAtDesignTime: boolean; virtual;
|
|
|
+
|
|
|
// Can this widget handle focus ?
|
|
|
class function HandleFocus : Boolean; virtual;
|
|
|
// Can this widget focus now ?
|
|
@@ -1125,7 +1126,10 @@ type
|
|
|
function IsFocused : Boolean;
|
|
|
// Attempt to set focus to this element. Return true if we got focus.
|
|
|
function Focus : Boolean;
|
|
|
+
|
|
|
procedure DomChanged; virtual;
|
|
|
+ procedure Invalidate; virtual; // queue a redraw
|
|
|
+ procedure InvalidateIfNotDrawing;
|
|
|
property Parent: TFresnelElement read FParent write SetParent;
|
|
|
property NodeCount: integer read GetNodeCount;
|
|
|
property Nodes[Index: integer]: TFresnelElement read GetNodes; default;
|
|
@@ -1179,6 +1183,7 @@ type
|
|
|
procedure ComputeInlineStyle; virtual; // parse inline style
|
|
|
procedure ComputeCSSValues; virtual; // call resolver to collect CSS values and resolve shorthands
|
|
|
procedure ComputeCSSAfterLayoutNode(Layouter: TFresnelLayouter); virtual; // called after layouter node, before layouter traverse children
|
|
|
+ procedure ComputeCSSLayoutFinished; virtual; // called after layout was finished
|
|
|
function GetCSSString(AttrID: TCSSNumericalID; Compute: boolean; out Complete: boolean): string; virtual;
|
|
|
function GetComputedLength(Attr: TFresnelCSSAttribute; UseNaNOnFail: boolean = false; NoChildren: boolean = false): TFresnelLength; virtual; overload;
|
|
|
function GetComputedLength(AttrID: TCSSNumericalID; UseNaNOnFail: boolean = false; NoChildren: boolean = false): TFresnelLength; virtual; overload;
|
|
@@ -1430,6 +1435,7 @@ type
|
|
|
procedure DomChanged; override;
|
|
|
procedure Disconnecting; virtual;
|
|
|
function AllocateFont(const Desc: TFresnelFontDesc): IFresnelFont; virtual;
|
|
|
+ function IsDrawing: boolean; virtual; abstract;
|
|
|
function GetCSSString(AttrID: TCSSNumericalID; Compute: boolean; out Complete: boolean): string; override;
|
|
|
class function CSSTypeID: TCSSNumericalID; override;
|
|
|
class function CSSTypeName: TCSSString; override;
|
|
@@ -5796,6 +5802,19 @@ procedure TFresnelViewport.ApplyCSS;
|
|
|
TraverseCSS(El.PseudoNodes[i]);
|
|
|
end;
|
|
|
|
|
|
+ procedure TraverseLayoutFinished(El: TFresnelElement);
|
|
|
+ var
|
|
|
+ i: Integer;
|
|
|
+ begin
|
|
|
+ El.ComputeCSSLayoutFinished;
|
|
|
+ if fesPseudoElement in FStates then
|
|
|
+ exit;
|
|
|
+ for i:=0 to El.NodeCount-1 do
|
|
|
+ TraverseLayoutFinished(El.Nodes[i]);
|
|
|
+ for i:=0 to El.PseudoNodeCount-1 do
|
|
|
+ TraverseLayoutFinished(El.PseudoNodes[i]);
|
|
|
+ end;
|
|
|
+
|
|
|
begin
|
|
|
//writeln('TFresnelViewport.ApplyCSS ',Name,' Width=',FloatToCSSStr(Width),',Height=',FloatToCSSStr(Height));
|
|
|
DomModified:=false;
|
|
@@ -5808,6 +5827,8 @@ begin
|
|
|
TraverseCSS(Self);
|
|
|
// layout
|
|
|
Layouter.Apply;
|
|
|
+ // notify layout finished
|
|
|
+ TraverseLayoutFinished(Self);
|
|
|
end;
|
|
|
|
|
|
procedure TFresnelViewport.DomChanged;
|
|
@@ -7865,6 +7886,20 @@ begin
|
|
|
FParent.DomChanged;
|
|
|
end;
|
|
|
|
|
|
+procedure TFresnelElement.Invalidate;
|
|
|
+begin
|
|
|
+ if LayoutNode=nil then exit;
|
|
|
+ if LayoutNode.SkipRendering then exit;
|
|
|
+ if (Viewport<>nil) and (Viewport<>Self) then
|
|
|
+ Viewport.Invalidate;
|
|
|
+end;
|
|
|
+
|
|
|
+procedure TFresnelElement.InvalidateIfNotDrawing;
|
|
|
+begin
|
|
|
+ if (Viewport<>nil) and not Viewport.IsDrawing then
|
|
|
+ Invalidate;
|
|
|
+end;
|
|
|
+
|
|
|
function TFresnelElement.HasParent: Boolean;
|
|
|
begin
|
|
|
Result:=Parent<>nil;
|
|
@@ -8497,6 +8532,11 @@ begin
|
|
|
if Layouter<>nil then ;
|
|
|
end;
|
|
|
|
|
|
+procedure TFresnelElement.ComputeCSSLayoutFinished;
|
|
|
+begin
|
|
|
+
|
|
|
+end;
|
|
|
+
|
|
|
{ TPseudoElement }
|
|
|
|
|
|
constructor TPseudoElement.Create(AOwner: TComponent);
|