[.net] .Net HTML rendering engine

Started by
8 comments, last by guyver23 15 years, 5 months ago
Hello there. I somehow got into the situation where I need to build a HTML rendering engine in C#. So does anyone know of an existing one or the steps you'd take to make one?
Wise men don't need advice. Fools don't take it. Lavinski - EXtremeSolutions
Advertisement
There is a browser control (System.Windows.Forms.WebBrowser)
----------------------------------------MagosX.com
Hey again, I'm fully aware of the browser control but for this I'm not allowed to use it. So how do you make one?
Wise men don't need advice. Fools don't take it. Lavinski - EXtremeSolutions
Quote:Original post by Lavinski
Hey again, I'm fully aware of the browser control but for this I'm not allowed to use it. So how do you make one?


What do you mean, "not allowed to use it"? Why not?

As for writing your own from scratch, it's a pretty daunting task... how fully-featured does it need to be? Does it need to just support some basic formatting (e.g. <b>, <a href="..."> etc) or does it need full support for things like inline images, CSS, the box model, etc?
Maybe use WebKit? Google's Chrome does. I don't think they have a C# port yet, so you might have something to contribute to the community.

Other than that, I second Codeka in that writing up your own rendering engine will take you some years to do on your own; if you manage to do it at all. [wink]

hth,
CipherCraft
You could use a Java browser and run a Java-to-C# converter on it. Still a fair bit of work, but hopefully less than just rolling one from scratch.

Java Language Conversion Assistant

Lobo Java browser

Good luck!
Hey Codeka, It will not be anywhere near fully featured but it will need to implement a the most common tags and the box model, but will not contain anything like &#106avascript or the full HTML or CSS implementations.
Wise men don't need advice. Fools don't take it. Lavinski - EXtremeSolutions
hm...
This is a very very simple process of rendering html.

Phase 1-
Create a text parser that reads your html file (from src or from http)

Phase 2-
The parser must break down the html text file into a collection of objects
So when you read <tag> text <tag2>text2</tag2></tag> you should be able to create object "tag" parent of object "text" and object "tag2" which is parent of "text2".

Phase 3-
Render objects into screen
An object would be something like

Type -> DIV
Child of -> its parent
Position -> absolute | relative | static -> translates into X,Y
Size -> W,H
Collection of children ->
styles ->

When rendering recursively through the screen you should be able to handle position and basic styles.

Thats about the best I can come up with in short.

Yours Truly
K
Pain is Inevitable, Suffering is Optional.Unknown
Take a look at this: http://www.codeplex.com/htmlagilitypack
This sounds like homework.

This topic is closed to new replies.

Advertisement