[fpc-pascal] Is there a CSS parser in FPC?

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Tue Mar 3 18:55:07 CET 2015


On 2015-03-03 16:13, dev.dliw at gmail.com wrote:
> 
> you might also want to take a look at https://code.google.com/p/thtmlviewer

Thanks for the info. I see it is a descendant of PBear.com code. I
remember using that back in 1998. :)


> It's still actively developed, so the CSS parser should be more advanced than 
> the one of TurboPower IP.

I took a quick look at the code in general and was truly disappointed.
Quick examples:

===========[HtmlImages.pas]====================
uses
{$ifdef LCL}
  LclIntf, IntfGraphics, FpImage, LclType, LResources, LMessages, HtmlMisc,
{$else}
  Windows, Jpeg,
{$endif}
  SysUtils, Classes, Graphics, Forms,
  Controls,
===============================

...or...

===========[HTMLSubs.pas]====================
uses
 {$ifdef UseInline}
 HtmlCaches,
 {$endif}
{$ifdef VCL}
  Windows,
  {$ifndef Compiler28_Plus}
  EncdDecd,
  {$endif}
{$endif}
  Messages, Graphics, Controls, ExtCtrls, Classes, SysUtils, Variants,
Forms, Math, Contnrs, ComCtrls,
{$ifdef LCL}
  LclIntf, LclType, HtmlMisc, types,
{$endif}
  HtmlGlobals,
===============================

...or...

===========[ReadHTML.pas]====================
uses
{$ifdef LCL}
  LclIntf, LclType, HtmlMisc,
{$else}
  Windows,
{$endif}
  SysUtils, Math, Variants, Classes, Graphics, Controls, Contnrs,
  HtmlGlobals,
===============================


Those dependencies are crazy! LCLIntf, Forms, Graphics, Controls,
Windows (???) all in a unit that just reads and parses HTML. Wow.

Sadly TurboPower IP doesn't look any better - at least the version
included with Lazarus.

My plan is to develop a 100% non-GUI-toolkit-dependent browser engine,
which is 100% doable. The only (optional) GUI toolkit dependency would
be the rasterizer integration for LCL or fpGUI - the last step in the
engine pipeline. But if you render to an image file for example (via
FPImage or AggPas), their would be no GUI toolkit dependency.


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/



More information about the fpc-pascal mailing list