|
|
@@ -993,14 +993,10 @@ var
|
|
|
s: String;
|
|
|
aFont: IFresnelFont;
|
|
|
aComp: TCSSResCompValue;
|
|
|
+ i: Integer;
|
|
|
+ l: SizeInt;
|
|
|
begin
|
|
|
LNode:=TUsedLayoutNode(El.LayoutNode);
|
|
|
- with Params.BoundingBox.Box do
|
|
|
- begin
|
|
|
- aLeft:=Left+LNode.BorderLeft+LNode.PaddingLeft;
|
|
|
- aRight:=Right-LNode.BorderRight-LNode.PaddingRight;
|
|
|
- aTop:=Top+LNode.BorderTop+LNode.PaddingTop;
|
|
|
- end;
|
|
|
|
|
|
aFont:=El.Font;
|
|
|
|
|
|
@@ -1046,18 +1042,65 @@ begin
|
|
|
end;
|
|
|
end;
|
|
|
if aThickness<0.1 then exit;
|
|
|
-
|
|
|
- DrawTextDecorationH(aLeft,aTop,aRight,aFont,LineKW,StyleKW,aColorFP,aThickness);
|
|
|
end;
|
|
|
CSSRegistry.kwGrammarError:
|
|
|
begin
|
|
|
- DrawTextDecorationH(aLeft,aTop,aRight,aFont,CSSRegistry.kwUnderline,CSSRegistry.kwWavy,colDkGreen,1);
|
|
|
+ LineKW:=CSSRegistry.kwUnderline;
|
|
|
+ StyleKW:=CSSRegistry.kwWavy;
|
|
|
+ aColorFP:=colDkGreen;
|
|
|
+ aThickness:=1;
|
|
|
end;
|
|
|
CSSRegistry.kwSpellingError:
|
|
|
begin
|
|
|
- DrawTextDecorationH(aLeft,aTop,aRight,aFont,CSSRegistry.kwUnderline,CSSRegistry.kwWavy,colRed,1);
|
|
|
+ LineKW:=CSSRegistry.kwUnderline;
|
|
|
+ StyleKW:=CSSRegistry.kwWavy;
|
|
|
+ aColorFP:=colRed;
|
|
|
+ aThickness:=1;
|
|
|
end;
|
|
|
end;
|
|
|
+
|
|
|
+ if Params.Fragments<>nil then
|
|
|
+ begin
|
|
|
+ // fragments
|
|
|
+ l:=length(Params.Fragments);
|
|
|
+ with Params.Fragments[0] do
|
|
|
+ begin
|
|
|
+ aLeft:=Left+LNode.BorderLeft+LNode.PaddingLeft;
|
|
|
+ aRight:=Right-LNode.BorderRight-LNode.PaddingRight;
|
|
|
+ aTop:=Top+LNode.BorderTop+LNode.PaddingTop;
|
|
|
+ end;
|
|
|
+ DrawTextDecorationH(aLeft,aTop,aRight,aFont,LineKW,StyleKW,aColorFP,aThickness);
|
|
|
+
|
|
|
+ for i:=1 to l-2 do
|
|
|
+ begin
|
|
|
+ with Params.Fragments[i] do
|
|
|
+ begin
|
|
|
+ aLeft:=Left;
|
|
|
+ aRight:=Right;
|
|
|
+ aTop:=Top+LNode.BorderTop+LNode.PaddingTop;
|
|
|
+ end;
|
|
|
+ DrawTextDecorationH(aLeft,aTop,aRight,aFont,LineKW,StyleKW,aColorFP,aThickness);
|
|
|
+ end;
|
|
|
+
|
|
|
+ with Params.Fragments[l-1] do
|
|
|
+ begin
|
|
|
+ aLeft:=Left;
|
|
|
+ aRight:=Right-LNode.BorderRight-LNode.PaddingRight;
|
|
|
+ aTop:=Top+LNode.BorderTop+LNode.PaddingTop;
|
|
|
+ end;
|
|
|
+ DrawTextDecorationH(aLeft,aTop,aRight,aFont,LineKW,StyleKW,aColorFP,aThickness);
|
|
|
+
|
|
|
+ end else begin
|
|
|
+ // simple box
|
|
|
+ with Params.BoundingBox.Box do
|
|
|
+ begin
|
|
|
+ aLeft:=Left+LNode.BorderLeft+LNode.PaddingLeft;
|
|
|
+ aRight:=Right-LNode.BorderRight-LNode.PaddingRight;
|
|
|
+ aTop:=Top+LNode.BorderTop+LNode.PaddingTop;
|
|
|
+ end;
|
|
|
+
|
|
|
+ DrawTextDecorationH(aLeft,aTop,aRight,aFont,LineKW,StyleKW,aColorFP,aThickness);
|
|
|
+ end;
|
|
|
end;
|
|
|
|
|
|
function TFresnelRenderer.CreateScrollBar(El: TFresnelElement; Horizontal: boolean
|
|
|
@@ -1225,12 +1268,12 @@ begin
|
|
|
aBorderBox:=El.UsedBorderBox;
|
|
|
|
|
|
//writeln('TFresnelRenderer.DrawElement ',El.Name,' BorderBox=',El.UsedBorderBox.ToString,' ContentBox=',El.UsedContentBox.ToString,' Origin=',Origin.ToString);
|
|
|
-
|
|
|
- if El<>El.Viewport then
|
|
|
- begin
|
|
|
- // background and border
|
|
|
- BorderParams:=CreateBorderAndBackground;
|
|
|
- try
|
|
|
+ BorderParams:=nil;
|
|
|
+ try
|
|
|
+ if El<>El.Viewport then
|
|
|
+ begin
|
|
|
+ // background and border
|
|
|
+ BorderParams:=CreateBorderAndBackground;
|
|
|
// border-width
|
|
|
BorderParams.Width[ffsLeft]:=LNode.BorderLeft;
|
|
|
BorderParams.Width[ffsTop]:=LNode.BorderTop;
|
|
|
@@ -1284,55 +1327,57 @@ begin
|
|
|
if BorderParams.HasBorder then
|
|
|
DrawElBorder(El,BorderParams);
|
|
|
end;
|
|
|
- finally
|
|
|
- BorderParams.Free;
|
|
|
end;
|
|
|
- end;
|
|
|
|
|
|
- NeedRestore:=false;
|
|
|
- ClipHorizontal:=flfClipHorizontal in LNode.Flags;
|
|
|
- ClipVertical:=flfClipVertical in LNode.Flags;
|
|
|
- if ClipHorizontal or ClipVertical then
|
|
|
- begin
|
|
|
- //writeln('TFresnelRenderer.DrawElement ',El.Name,' ',ClipHorizontal,' ',ClipVertical);
|
|
|
- r:=El.GetUsedPaddingBox;
|
|
|
- if not ClipHorizontal then
|
|
|
- begin
|
|
|
- r.Left:=-Origin.X;
|
|
|
- r.Right:=El.Viewport.Width-Origin.X;
|
|
|
- end else if not ClipVertical then
|
|
|
+ NeedRestore:=false;
|
|
|
+ ClipHorizontal:=flfClipHorizontal in LNode.Flags;
|
|
|
+ ClipVertical:=flfClipVertical in LNode.Flags;
|
|
|
+ if ClipHorizontal or ClipVertical then
|
|
|
begin
|
|
|
- r.Top:=-Origin.Y;
|
|
|
- r.Bottom:=El.Viewport.Height-Origin.Y;
|
|
|
- end;
|
|
|
+ //writeln('TFresnelRenderer.DrawElement ',El.Name,' ',ClipHorizontal,' ',ClipVertical);
|
|
|
+ r:=El.GetUsedPaddingBox;
|
|
|
+ if not ClipHorizontal then
|
|
|
+ begin
|
|
|
+ r.Left:=-Origin.X;
|
|
|
+ r.Right:=El.Viewport.Width-Origin.X;
|
|
|
+ end else if not ClipVertical then
|
|
|
+ begin
|
|
|
+ r.Top:=-Origin.Y;
|
|
|
+ r.Bottom:=El.Viewport.Height-Origin.Y;
|
|
|
+ end;
|
|
|
|
|
|
- Save;
|
|
|
- NeedRestore:=true;
|
|
|
- ClipRect(r);
|
|
|
- end;
|
|
|
- try
|
|
|
- // underlying text-decoration
|
|
|
- TextDecorationLineKW:=El.GetComputedKeyword(fcaTextDecorationLine,CSSRegistry.Chk_TextDecorationLine_KeywordIDs);
|
|
|
- if TextDecorationLineKW in [CSSRegistry.kwUnderline,CSSRegistry.kwOverline,
|
|
|
- CSSRegistry.kwGrammarError,CSSRegistry.kwSpellingError] then
|
|
|
- DrawElTextDecoration(El,TextDecorationLineKW,BorderParams);
|
|
|
+ Save;
|
|
|
+ NeedRestore:=true;
|
|
|
+ ClipRect(r);
|
|
|
+ end;
|
|
|
+ try
|
|
|
+ // underlying text-decoration
|
|
|
+ TextDecorationLineKW:=El.GetComputedKeyword(fcaTextDecorationLine,CSSRegistry.Chk_TextDecorationLine_KeywordIDs);
|
|
|
+ if (TextDecorationLineKW in [CSSRegistry.kwUnderline,CSSRegistry.kwOverline,
|
|
|
+ CSSRegistry.kwGrammarError,CSSRegistry.kwSpellingError])
|
|
|
+ and (BorderParams<>nil) then
|
|
|
+ DrawElTextDecoration(El,TextDecorationLineKW,BorderParams);
|
|
|
|
|
|
- // Give element a chance to draw itself (on top of background and border)
|
|
|
- aRenderable.Render(FIntfRenderer);
|
|
|
+ // Give element a chance to draw itself (on top of background and border)
|
|
|
+ aRenderable.Render(FIntfRenderer);
|
|
|
|
|
|
- DrawChildren(El);
|
|
|
+ DrawChildren(El);
|
|
|
|
|
|
- // overlying text-decoration
|
|
|
- if TextDecorationLineKW=CSSRegistry.kwLineThrough then
|
|
|
- DrawElTextDecoration(El,TextDecorationLineKW,BorderParams);
|
|
|
+ // overlying text-decoration
|
|
|
+ if (TextDecorationLineKW=CSSRegistry.kwLineThrough)
|
|
|
+ and (BorderParams<>nil) then
|
|
|
+ DrawElTextDecoration(El,TextDecorationLineKW,BorderParams);
|
|
|
|
|
|
- // draw scrollbars
|
|
|
- DrawScrollBars(El);
|
|
|
+ // draw scrollbars
|
|
|
+ DrawScrollBars(El);
|
|
|
+ finally
|
|
|
+ if NeedRestore then
|
|
|
+ Restore;
|
|
|
+ end;
|
|
|
+ aRenderable.AfterRender;
|
|
|
finally
|
|
|
- if NeedRestore then
|
|
|
- Restore;
|
|
|
+ BorderParams.Free;
|
|
|
end;
|
|
|
- aRenderable.AfterRender;
|
|
|
end;
|
|
|
|
|
|
procedure TFresnelRenderer.DrawChildren(El: TFresnelElement);
|
|
|
@@ -1345,9 +1390,12 @@ begin
|
|
|
LNode:=TUsedLayoutNode(El.LayoutNode);
|
|
|
|
|
|
OldOrigin:=Origin;
|
|
|
- NewOrigin.X:=OldOrigin.X+El.UsedClientBox.Left-El.ScrollLeft;
|
|
|
- NewOrigin.Y:=OldOrigin.Y+El.UsedClientBox.Top-El.ScrollTop;
|
|
|
- Origin:=NewOrigin;
|
|
|
+ if LNode.Layouter<>nil then
|
|
|
+ begin
|
|
|
+ NewOrigin.X:=OldOrigin.X+El.UsedClientBox.Left-El.ScrollLeft;
|
|
|
+ NewOrigin.Y:=OldOrigin.Y+El.UsedClientBox.Top-El.ScrollTop;
|
|
|
+ Origin:=NewOrigin;
|
|
|
+ end;
|
|
|
//writeln('TFresnelRenderer.DrawChildren ',El.GetPath,' Old=',OldOrigin.ToString,' Origin=',Origin.ToString);
|
|
|
for i:=0 to LNode.NodeCount-1 do
|
|
|
begin
|