Wiki copymirror

This is a mirror of the wiki at pascal.chat. Editing, history and sign-in are there.

TurboPower Internet Pro

Template:TurboPower Internet Pro

About

Lazarus provides the package TurboPowerIPro (lazarus/components/turbopower_ipro/turbopoweripro.lpk) with the following features:

Layouts

CSS

Development information

About

Units

Parsing

Important methods in TIpHtmlParser PARSE

pascal
<div>This is what is parsed</div>

It could be just text or other html elements inside the tag

pascal
<div width="150px">
Parse tree classes hierarchy

Here you can see hierarchy of classes of nodes for parse tree

TIpHtmlNode - The base class for all HTML nodes

Classes

TIpNodeBlockLayouter

Parsing generated a tree of nodes representing the html document.
After that enqueue is preparing list of elements from the DOM tree structure
And TIpNodeBlockLayouter class works on this list to layout

  1. Method Calls Structure for TIpNodeBlockLayouter

Below is a list of all methods in the class with the methods they call from the class.
If the method name has number next to it like CalcVRemain (2) it means the method is called from 2 methods in the class. No number indicates that just one method calls it.
If the called method has a number next to it, like DoQueueAlign (3) it means that the method is called 3 times in the current method. No number indicates that it is called just one time in the method.

Enqueue

  1. Intro

The layouter is not using directly the DOM tree to layout the elements, it uses FElementQueue: TFPList list (in TIpHtmlBaseLayouter class) to layout elements.
FElementQueue is filled based on the Parsed Nodes Tree (DOM)

  1. What items are in the list

In the FElementQueue list we can find

pascal
TIpHtmlElement = record
        ElementType??: TElementType;
        AnsiWord: string;
        IsBlank??: Integer;
        SizeProp: TIpHtmlPropA;
        Size: TSize;
        WordRect2??: TRect;
        Props??: TIpHtmlProps;
        Owner??: TIpHtmlNode;
        LFHeight??: Integer;  // Height of LineFeed elements
        IsSelected: boolean;
      end;
      PIpHtmlElement = ^TIpHtmlElement;

Note that Owner : TIpHtmlNode; is holding the actual node from the DOM tree.
One node from the DOM tree can have multiple items in the FElementQueue list.

  1. Trigger of process

The enqueue process can start in 3 places in TIpNodeBlockLayouter
when on of these methods is called - Layout, CalcMinMaxPropWidth or Render
In each of these 3 methods we can see the code

pascal
if FElementQueue.Count = 0 then
        FOwner.Enqueue;

If the list is empty it assumes that the Enque was not done and needs to be done.
Layout, CalcMinMaxPropWidth, Render need to have FElementQueue properly filled to proceed.
Calling enqueue in these 3 methods ensures that it will be done just before the first time the filled FElementQueue is needed.

FOwner which enqueue method is called is declared as
FOwner : TIpHtmlNodeCore but it is usually TIpHtmlNodeBlock descendant

pascal
constructor TIpHtmlNodeBlock.Create(ParentNode: TIpHtmlNode;
      LayouterClass: TIpHtmlBaseLayouterClass);
    begin
      inherited Create(ParentNode);
      FBgColor??:= clNone;
      FTextColor??:= clNone;
      FBackground??:= '';
      FLayouter??:= LayouterClass.Create(Self);
    end;

and most of the time it is the body node - TIpHtmlNodeBODY

  1. Filling FElementQueue

As we said FOwner.enqueue is the starting point and FOwner is typically TIpHtmlNodeBODY.
What it does is to itterate all the children and call their enqueue method.

pascal
procedure TIpHtmlNodeMulti.Enqueue;
    var
      i??: Integer;
    begin
      for i??:= 0 to Pred(FChildren.Count) do
        TIpHtmlNode(FChildren[i]).Enqueue;
    end;

So, it does not add anything in FElementQueue directly but its children or their children will add.

By default enqueue does nothing as we can see the implementation in TIpHtmlNode (top most Node class in the Nodes class hierarchy)

pascal
procedure TIpHtmlNode.Enqueue;
    begin
    
    end;

Different node classes overrides the Enqueue method to add elements in the FElementQueue list Such nodes classes are - TIpHtmlNodeText, TIpHtmlNodeDIV, TIpHtmlNodeBLOCKQUOTE, TIpHtmlNodeBR, TIpHtmlNodeDD ...

Layout

  1. Intro

Render

  1. Intro

From the Free Pascal wiki, page "TurboPower Internet Pro", as the Internet Archive kept it on 2026-01-16, last changed on 2025-05-01. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .