|
@@ -21,6 +21,7 @@ type
|
|
|
procedure TextOut(const aLeft, aTop: TFresnelLength; const aFont: IFresnelFont; const aColor: TFPColor; const aText: string); virtual; abstract;
|
|
|
procedure MathRoundRect(var r: TFresnelRect);
|
|
|
procedure DrawElement(El: TFresnelElement; const dx, dy: TFresnelLength); virtual;
|
|
|
+ procedure UpdateRenderedAttributes(El: TFresnelElement); virtual;
|
|
|
public
|
|
|
procedure Draw(Viewport: TFresnelViewport); virtual;
|
|
|
property SubPixel: boolean read FSubPixel write FSubPixel;
|
|
@@ -55,29 +56,32 @@ begin
|
|
|
LNode:=TSimpleFresnelLayoutNode(El.LayoutNode);
|
|
|
if LNode.SkipRendering then exit;
|
|
|
|
|
|
- if not (El is TFresnelViewport) then
|
|
|
+ if (El is TFresnelViewport) then
|
|
|
begin
|
|
|
- aLeft:=El.GetComputedCSSLength(fcaLeft,false)+dx;
|
|
|
- aTop:=El.GetComputedCSSLength(fcaTop,false)+dy;
|
|
|
- //aWidth:=El.GetComputedCSSLength(fcaWidth,false);
|
|
|
- //aHeight:=El.GetComputedCSSLength(fcaHeight,false);
|
|
|
- aRight:=El.GetComputedCSSLength(fcaRight,false);
|
|
|
- aBottom:=El.GetComputedCSSLength(fcaBottom,false);
|
|
|
-
|
|
|
- aMarginLeft:=El.GetComputedCSSLength(fcaMarginLeft,false);
|
|
|
- aMarginRight:=El.GetComputedCSSLength(fcaMarginRight,false);
|
|
|
- aMarginTop:=El.GetComputedCSSLength(fcaMarginTop,false);
|
|
|
- aMarginBottom:=El.GetComputedCSSLength(fcaMarginBottom,false);
|
|
|
-
|
|
|
- aBorderLeft:=El.GetComputedCSSLength(fcaBorderLeftWidth,false);
|
|
|
- aBorderRight:=El.GetComputedCSSLength(fcaBorderRightWidth,false);
|
|
|
- aBorderTop:=El.GetComputedCSSLength(fcaBorderTopWidth,false);
|
|
|
- aBorderBottom:=El.GetComputedCSSLength(fcaBorderBottomWidth,false);
|
|
|
-
|
|
|
- aPaddingLeft:=El.GetComputedCSSLength(fcaPaddingLeft,false);
|
|
|
- aPaddingRight:=El.GetComputedCSSLength(fcaPaddingRight,false);
|
|
|
- aPaddingTop:=El.GetComputedCSSLength(fcaPaddingTop,false);
|
|
|
- aPaddingBottom:=El.GetComputedCSSLength(fcaPaddingBottom,false);
|
|
|
+ aLeft:=0;
|
|
|
+ aTop:=0;
|
|
|
+ end else begin
|
|
|
+ aLeft:=El.GetRenderedCSSLength(fcaLeft,false)+dx;
|
|
|
+ aTop:=El.GetRenderedCSSLength(fcaTop,false)+dy;
|
|
|
+ //aWidth:=El.GetRenderedCSSLength(fcaWidth,false);
|
|
|
+ //aHeight:=El.GetRenderedCSSLength(fcaHeight,false);
|
|
|
+ aRight:=El.GetRenderedCSSLength(fcaRight,false);
|
|
|
+ aBottom:=El.GetRenderedCSSLength(fcaBottom,false);
|
|
|
+
|
|
|
+ aMarginLeft:=El.GetRenderedCSSLength(fcaMarginLeft,false);
|
|
|
+ aMarginRight:=El.GetRenderedCSSLength(fcaMarginRight,false);
|
|
|
+ aMarginTop:=El.GetRenderedCSSLength(fcaMarginTop,false);
|
|
|
+ aMarginBottom:=El.GetRenderedCSSLength(fcaMarginBottom,false);
|
|
|
+
|
|
|
+ aBorderLeft:=El.GetRenderedCSSLength(fcaBorderLeftWidth,false);
|
|
|
+ aBorderRight:=El.GetRenderedCSSLength(fcaBorderRightWidth,false);
|
|
|
+ aBorderTop:=El.GetRenderedCSSLength(fcaBorderTopWidth,false);
|
|
|
+ aBorderBottom:=El.GetRenderedCSSLength(fcaBorderBottomWidth,false);
|
|
|
+
|
|
|
+ aPaddingLeft:=El.GetRenderedCSSLength(fcaPaddingLeft,false);
|
|
|
+ aPaddingRight:=El.GetRenderedCSSLength(fcaPaddingRight,false);
|
|
|
+ aPaddingTop:=El.GetRenderedCSSLength(fcaPaddingTop,false);
|
|
|
+ aPaddingBottom:=El.GetRenderedCSSLength(fcaPaddingBottom,false);
|
|
|
|
|
|
aBorderBox.Left:=aLeft+aMarginLeft;
|
|
|
aBorderBox.Top:=aTop+aMarginTop;
|
|
@@ -95,7 +99,7 @@ begin
|
|
|
|
|
|
//debugln(['TFresnelRenderer.DrawElement ',El.Name,' Border=',dbgs(aBorderBox),' Content=',dbgs(aContentBox)]);
|
|
|
|
|
|
- aBackgroundColor:=El.CSSComputedAttribute[fcaBackgroundColor];
|
|
|
+ aBackgroundColor:=El.CSSRenderedAttribute[fcaBackgroundColor];
|
|
|
if not TryHtmlToFPColor(aBackgroundColor,aBackgroundColorFP) then
|
|
|
aBackgroundColorFP:=colTransparent;
|
|
|
if aBackgroundColorFP.Alpha<>alphaTransparent then
|
|
@@ -103,7 +107,7 @@ begin
|
|
|
FillRect(aBackgroundColorFP,aBorderBox);
|
|
|
end;
|
|
|
|
|
|
- aBorderColor:=El.CSSComputedAttribute[fcaBorderColor];
|
|
|
+ aBorderColor:=El.CSSRenderedAttribute[fcaBorderColor];
|
|
|
if not TryHtmlToFPColor(aBorderColor,aBorderColorFP) then
|
|
|
aBorderColorFP:=colTransparent;
|
|
|
if aBorderColorFP.Alpha<>alphaTransparent then
|
|
@@ -125,7 +129,7 @@ begin
|
|
|
|
|
|
if El is TFresnelLabel then
|
|
|
begin
|
|
|
- aCaption:=TFresnelLabel(El).Caption;
|
|
|
+ aCaption:=TFresnelLabel(El).RenderedCaption;
|
|
|
if aCaption<>'' then
|
|
|
begin
|
|
|
TextOut(aContentBox.Left,aContentBox.Top,El.Font,colBlack,aCaption);
|
|
@@ -139,8 +143,22 @@ begin
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
+procedure TFresnelRenderer.UpdateRenderedAttributes(El: TFresnelElement);
|
|
|
+var
|
|
|
+ LNode: TSimpleFresnelLayoutNode;
|
|
|
+ i: Integer;
|
|
|
+begin
|
|
|
+ LNode:=TSimpleFresnelLayoutNode(El.LayoutNode);
|
|
|
+ if LNode.SkipRendering then exit;
|
|
|
+
|
|
|
+ El.UpdateRenderedAttributes;
|
|
|
+ for i:=0 to LNode.NodeCount-1 do
|
|
|
+ UpdateRenderedAttributes(TSimpleFresnelLayoutNode(LNode.Nodes[i]).Element);
|
|
|
+end;
|
|
|
+
|
|
|
procedure TFresnelRenderer.Draw(Viewport: TFresnelViewport);
|
|
|
begin
|
|
|
+ UpdateRenderedAttributes(Viewport);
|
|
|
DrawElement(Viewport,0,0);
|
|
|
end;
|
|
|
|