From 4c032af54faa7d6657d8eb886e6c8918b4db17a2 Mon Sep 17 00:00:00 2001 From: wp Date: Sat, 8 Sep 2018 15:55:42 +0000 Subject: [PATCH] TurboPower_ipro: Some more improvements in line spacings. git-svn-id: trunk@58909 - --- components/turbopower_ipro/iphtml.pas | 36 +++++++++---------- .../turbopower_ipro/iphtmlblocklayout.pas | 2 +- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/components/turbopower_ipro/iphtml.pas b/components/turbopower_ipro/iphtml.pas index bef7c26714..556173e5e3 100644 --- a/components/turbopower_ipro/iphtml.pas +++ b/components/turbopower_ipro/iphtml.pas @@ -245,8 +245,8 @@ type FCurProps : TIpHtmlProps; FBlockMin, FBlockMax : Integer; function GetProps: TIpHtmlProps; + procedure ProcessDuplicateLFs; procedure RemoveLeadingLFs; - procedure RemoveDuplicateLFs; public FPageRect : TRect; constructor Create(AOwner: TIpHtmlNodeCore); virtual; @@ -4021,16 +4021,9 @@ begin end; end; -procedure TIpHtmlBaseLayouter.RemoveLeadingLFs; -begin - while (FElementQueue.Count>0) - and (PIpHtmlElement(FElementQueue[0])^.ElementType in [etSoftLF, etHardLF]) do - FElementQueue.Delete(0); -end; - -procedure TIpHtmlBaseLayouter.RemoveDuplicateLFs; +procedure TIpHtmlBaseLayouter.ProcessDuplicateLFs; var - i: Integer; + i, ilast: Integer; elem: PIpHtmlElement; prevelem: PIpHtmlElement; begin @@ -4048,16 +4041,21 @@ begin if (prevelem.ElementType = etSoftLF) then begin prevelem.LFHeight := MaxI2(prevelem.LFHeight, elem.LFHeight); FElementQueue.Delete(i-1); - end else - if (prevelem.ElementType = etHardLF) then begin - //prevelem.LFHeight := prevelem.LFHeight + elem.LFHeight; - //FElementQueue.Delete(i); end; + // nothing to do for etHardLF end; dec(i); end; end; +procedure TIpHtmlBaseLayouter.RemoveLeadingLFs; +begin + while (FElementQueue.Count>0) + and (PIpHtmlElement(FElementQueue[0])^.ElementType in [etSoftLF, etHardLF]) do + FElementQueue.Delete(0); +end; + + { TIpHtmlBaseTableLayouter } constructor TIpHtmlBaseTableLayouter.Create(AOwner: TIpHtmlNodeCore); @@ -10010,17 +10008,18 @@ begin hf := Props.FontSize; if FChildren.Count > 0 then begin h := GetMargin(Props.ElemMarginTop, hf div 2); - elem := Owner.BuildLinefeedEntry(etHardLF, h); + elem := Owner.BuildLinefeedEntry(etSoftLF, h); EnqueueElement(elem); end; inherited Enqueue; if FChildren.Count > 0 then begin h := GetMargin(Props.ElemMarginBottom, hf div 4); - elem := Owner.BuildLinefeedEntry(etHardLF, h); + elem := Owner.BuildLinefeedEntry(etSoftLF, h); EnqueueElement(elem); end; end; + { TIpHtmlNodeLI } procedure TIpHtmlNodeLI.CalcMinMaxWidth(var Min, Max: Integer); @@ -10137,9 +10136,10 @@ var elem: PIpHtmlElement; begin if (ParentNode is TIpHtmlNodeP) or + (ParentNode is TIpHtmlNodeDIV) or (ParentNode is TIpHtmlNodeLI) or - (ParentNode is TIpHtmlNodePRE) or - (ParentNode is TIpHtmlNodeDIV) +// (ParentNode is TIpHtmlNodePRE) or + (ParentNode is TIpHtmlNodeHeader) then h := 0 else diff --git a/components/turbopower_ipro/iphtmlblocklayout.pas b/components/turbopower_ipro/iphtmlblocklayout.pas index b8a599515e..42e79219fa 100644 --- a/components/turbopower_ipro/iphtmlblocklayout.pas +++ b/components/turbopower_ipro/iphtmlblocklayout.pas @@ -188,7 +188,7 @@ begin if FBlockOwner is TIpHtmlNodeBody then RemoveLeadingLFs; - RemoveDuplicateLFs; + ProcessDuplicateLFs; if not RenderProps.IsEqualTo(Props) then begin