Recent

Author Topic: Another two bugs in TIpHtmlPanel one new introduced.  (Read 526 times)

Soner

  • Sr. Member
  • ****
  • Posts: 280
Another two bugs in TIpHtmlPanel one new introduced.
« on: May 19, 2022, 12:56:17 pm »
I found two bugs in TIpHtmlPanel, one bug is new introduced. Can anyone look and confirm it, before I report it.
Look at the screenshot.

wp

  • Hero Member
  • *****
  • Posts: 9728
Re: Another two bugs in TIpHtmlPanel one new introduced.
« Reply #1 on: May 19, 2022, 05:19:46 pm »
I looked at the <br> bug first and found that it can be fixed by changing the TIpHtmlNodeTABLE.Enqueue in IpHtml.pas in the following way:
Code: Pascal  [Select][+][-]
  1. procedure TIpHtmlNodeTABLE.Enqueue;
  2. begin
  3. //The commented code bellow prevent a blank line before the table
  4. {
  5.   case Align of
  6.   hiaTop,
  7.   hiaMiddle,
  8.   hiaBottom,
  9.   hiaCenter :
  10.     EnqueueElement(Owner.SoftLF);
  11.   end;
  12. }
  13.   EnqueueElement(Owner.SoftLF);
  14.  
  15.   EnqueueElement(Element);
  16.  
  17.   EnqueueElement(Owner.SoftLF);
  18.   EnqueueElement(Owner.HardLF);  // LFs needed otherwise next element is too close  // wp: uncomment this line
  19. {
  20.   case Align of
  21.   hiaTop,
  22.   hiaMiddle,
  23.   hiaBottom,
  24.   hiaCenter :
  25.     EnqueueElement(Owner.SoftLF);
  26.   end;
  27. }
  28. end;
The commented code is from earlier versions indicating that there has been several experiments with that routine. I must say that I never understood what IPro's SoftLFs and HardLFs are good for.

So please carefully check out this corrected version and report back if there are any side-effect (which I am expecting...)
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

Soner

  • Sr. Member
  • ****
  • Posts: 280
Re: Another two bugs in TIpHtmlPanel one new introduced.
« Reply #2 on: May 20, 2022, 09:14:49 am »
wp, I tried it, it looks okay.
...
I must say that I never understood what IPro's SoftLFs and HardLFs are good for.
...
I think softbreaks are linebreaks after some tags like <table>, <p> and hardbreaks are after <br> tag.


I found another new bug introduced in newer lazarus versions look at the screenshot, the text "Free Pascal" should be transparent like in lazarus 1.8.

I changed the html file, don't use html file from my first post, it has error.

Edit: New bug is also in 2.0.11

Edit2: I had on my usb stick one lazarus version Revision 61029 maybe lazarus 2.0.2 from year 2019/2020. Iphtml.pas file the last change date 2019-04-22. This version has not the new color bug.
« Last Edit: May 20, 2022, 09:28:52 am by Soner »

wp

  • Hero Member
  • *****
  • Posts: 9728
Re: Another two bugs in TIpHtmlPanel one new introduced.
« Reply #3 on: May 20, 2022, 10:29:21 pm »
wp, I tried it, it looks okay.
Committed it. Did a few more tests, no apparent issues. Still, the entire SoftLF/HardLF thing is a mess and should be reworked from ground up. (For example, the same issue that you report exists for list tags).

I found another new bug introduced in newer lazarus versions look at the screenshot, the text "Free Pascal" should be transparent like in lazarus 1.8.
This must have come in when somebody asked for rendering text with background color. I'll have a look, maybe I find it in the commit notes (but I don't make promises - IpHtmlPanel is a pain to work in...).

[EDIT]
Found the culprit and posted a bug report: https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/39756

Fixed in main (60731529).
« Last Edit: May 21, 2022, 07:24:17 pm by wp »
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

wp

  • Hero Member
  • *****
  • Posts: 9728
Re: Another two bugs in TIpHtmlPanel one new introduced.
« Reply #4 on: May 21, 2022, 08:20:17 pm »
As for the alignment error, I found that it works correctly when I remove the style section, or more precisely, when I remove the "body" style. Parsing the css seems to override the alignment props somewhere...
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

Soner

  • Sr. Member
  • ****
  • Posts: 280
Re: Another two bugs in TIpHtmlPanel one new introduced.
« Reply #5 on: May 24, 2022, 12:38:49 pm »
I knew it with css-part but not with body-tag, good investigation. I see you created a bug reports.
I am using currently workaround, this version with lazarus 2.2.0.:
Edit2: I had on my usb stick one lazarus version Revision 61029 maybe lazarus 2.0.2 from year 2019/2020. Iphtml.pas file the last change date 2019-04-22. This version has not the new color bug.

And I am using for the right aligment this:
"<td style="text-align:right">"

 

TinyPortal © 2005-2018